Difference between revisions of "CopyTPA"
From SCAR Divi Manual
(Created page with "==Definition== <source lang="scar" lines="false"> function CopyTPA(const TPA: TPointArray): TPointArray; </source> ==Availability== SCAR Divi 3.28 > Current *Contained a bug 3....") |
|||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
==Availability== | ==Availability== | ||
SCAR Divi 3.28 > Current | SCAR Divi 3.28 > Current | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==Description== | ==Description== | ||
Line 23: | Line 18: | ||
TPA := [Point(5, 6), Point(0, 0), Point(1, 1)]; | TPA := [Point(5, 6), Point(0, 0), Point(1, 1)]; | ||
TPA2 := TPA; | TPA2 := TPA; | ||
− | + | SortTPA(TPA2); | |
WriteLn('TPA passed by reference to TPA2:'); | WriteLn('TPA passed by reference to TPA2:'); | ||
WriteLn('TPA: ' + TPAToStr(TPA)); | WriteLn('TPA: ' + TPAToStr(TPA)); | ||
Line 30: | Line 25: | ||
TPA := [Point(5, 6), Point(0, 0), Point(1, 1)]; | TPA := [Point(5, 6), Point(0, 0), Point(1, 1)]; | ||
TPA2 := CopyTPA(TPA); | TPA2 := CopyTPA(TPA); | ||
− | + | SortTPA(TPA2); | |
WriteLn('TPA passed by value to TPA2:'); | WriteLn('TPA passed by value to TPA2:'); | ||
WriteLn('TPA: ' + TPAToStr(TPA)); | WriteLn('TPA: ' + TPAToStr(TPA)); |
Latest revision as of 16:55, 12 December 2012
Definition
function CopyTPA(const TPA: TPointArray): TPointArray;
Availability
SCAR Divi 3.28 > Current
Description
Creates a new TPointArray with a copy of every element in the given array TPA. An extended function with additional functionality is available as CopyTPAEx.
Example
var TPA, TPA2: TPointArray; begin TPA := [Point(5, 6), Point(0, 0), Point(1, 1)]; TPA2 := TPA; SortTPA(TPA2); WriteLn('TPA passed by reference to TPA2:'); WriteLn('TPA: ' + TPAToStr(TPA)); WriteLn('TPA2: ' + TPAToStr(TPA2)); TPA := [Point(5, 6), Point(0, 0), Point(1, 1)]; TPA2 := CopyTPA(TPA); SortTPA(TPA2); WriteLn('TPA passed by value to TPA2:'); WriteLn('TPA: ' + TPAToStr(TPA)); WriteLn('TPA2: ' + TPAToStr(TPA2)); end.
Output:
TPA passed by reference to TPA2: TPA: (0,0);(1,1);(5,6) TPA2: (0,0);(1,1);(5,6) TPA passed by value to TPA2: TPA: (5,6);(0,0);(1,1) TPA2: (0,0);(1,1);(5,6)