TPAExtractTriangle

From SCAR Divi Manual
Revision as of 17:50, 25 November 2012 by Freddy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);

Availability

SCAR Divi 3.35 > Current

Notes

  • Before 3.37.01 the function didn't resize the extracted array.

Description

Extracts points from a given TPointArray TPA by removing all points that are not inside of the given triangle area. (X1, Y1), (X2, Y2) and (X3, Y3) define the corner points of the triangle.

Example

var
  TPA: TPointArray;

begin
  TPA := [Point(0, 0), Point(2, 2), Point(2, 3), Point(5, 10)];
  WriteLn(TPAToStr(TPA));
  TPAExtractTriangle(TPA, 1, 1, 1, 4, 3, 4);
  WriteLn('Extracted: ' + TPAToStr(TPA));
end.

Output:

(0,0);(2,2);(2,3);(5,10)
Extracted: (2,3)

See Also