CopyTPA

From SCAR Divi Manual
Jump to: navigation, search

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)

See Also