Difference between revisions of "CopyTPA"

From SCAR Divi Manual
Jump to: navigation, search
(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....")
 
Line 6: Line 6:
 
==Availability==
 
==Availability==
 
SCAR Divi 3.28 > Current
 
SCAR Divi 3.28 > Current
 
*Contained a bug 3.26-3.27 that caused the initial element in every subarray of the result to be duplicated inside of that subarray.
 
 
===Aliases===
 
*TPAGroup (SCAR Divi 3.26 > Current)
 
  
 
==Description==
 
==Description==

Revision as of 20:15, 20 October 2011

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;
  TPASort(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);
  TPASort(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)

See Also