Difference between revisions of "TPAChain"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function TPAChain(const TPA: TPointArray; const Dist: Integer): T2DPointArray; </source> ==Availability== SCAR Divi 3.26 > Curr...")
 
(Description)
Line 8: Line 8:
  
 
==Description==
 
==Description==
This function chains all [[TPoint|TPoints]] that are within a certain distance from each other together into individual [[TPointArray|TPointArrays]].
+
This function splits a given [[TPointArray]] '''TPA''' into separated TPointArrays by grouping together the points that are within a given distance from each other. The function returns a [[T2DPointArray]] containing all the resulting TPointArrays.
  
 
==Example==
 
==Example==

Revision as of 14:59, 9 September 2011

Definition

function TPAChain(const TPA: TPointArray; const Dist: Integer): T2DPointArray;

Availability

SCAR Divi 3.26 > Current

Description

This function splits a given TPointArray TPA into separated TPointArrays by grouping together the points that are within a given distance from each other. The function returns a T2DPointArray containing all the resulting TPointArrays.

Example

var
  i: Integer;
  TPA: TPointArray;
  ATPA: T2DPointArray;

begin
  TPA := [Point(0, 0), Point(2, 6), Point(1, 2), Point(1, 1)];
  ATPA := TPAChain(TPA, 2);
  for i := Low(ATPA) to High(ATPA) do
    WriteLn(TPAToStr(ATPA[i]));
end.

Output:

(0,0);(1,1);(1,2)
(2,6)

See Also