TPAExtractTriangle

From SCAR Divi Manual
Revision as of 13:01, 21 November 2012 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer); </source> ==Availability== SCAR D...")
(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

  • Before 3.37.01 the function didn't resize the filtered 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