TPAInTPARelEx

From SCAR Divi Manual
Jump to: navigation, search

Definition

function TPAInTPARelEx(const TPA1, TPA2: TPointArray; var TPAFound: TPointArray): Boolean;

Availability

SCAR Divi 3.28 > Current

Description

Returns true if a series of points are found in TPA2 that are all at the same relative position towards eachother as the points in TPA1. The points from TPA2 that are equivalent to the first point in TPA1 are returned in TPAFound. The function does not take into account duplicate points. If your arrays contain a lot of duplicate points, the overall execution time will be shorter is you remove the duplicate points first with TPARemoveDupl.

Example

var
  TPA1, TPA2, TPA: TPointArray;

begin
  TPA1 := [Point(2, 5), Point(6, 1), Point(1, 1)];
  TPA2 := [Point(4, 7), Point(8, 3), Point(3, 3)];
  WriteLn(TPAInTPARelEx(TPA1, TPA2, TPA));
  WriteLn(TPAToStr(TPA));

  TPA1 := [Point(2, 5), Point(6, 1), Point(1, 1)];
  TPA2 := [Point(0, 0), Point(4, 7), Point(1, 1), Point(8, 3), Point(3, 3)];
  WriteLn(TPAInTPARelEx(TPA1, TPA2, TPA));
  WriteLn(TPAToStr(TPA));

  TPA1 := [Point(1, 5), Point(6, 1), Point(1, 1)];
  TPA2 := [Point(0, 0), Point(4, 7), Point(1, 1), Point(8, 3), Point(3, 3)];
  WriteLn(TPAInTPARelEx(TPA1, TPA2, TPA));
  WriteLn(TPAToStr(TPA));
end.

Output:

1
(4,7)
1
(4,7)
0

See Also