TPAInTPARel

From SCAR Divi Manual
Revision as of 00:21, 21 October 2011 by Freddy (talk | contribs) (Description)
Jump to: navigation, search

Definition

function TPAInTPARel(const TPA1, TPA2: 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 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: TPointArray;

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

  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(TPAInTPARel(TPA1, TPA2));

  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(TPAInTPARel(TPA1, TPA2));
end.

Output:

1
1
0

See Also