Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Extracts all points from a given TPointArray TPA
- by removing all points that fall outside extractPoints.
- [==============================================================================}
- procedure TPAExtractPoints(var TPA: TPointArray; extractPoints: TPointArray);
- var
- tmp: TPointArray;
- begin
- if (Length(TPA) > 0) then
- if (Length(extractPoints) > 0) then
- begin
- tmp := CopyTPA(TPA);
- TPAFilterPoints(tmp, extractPoints);
- if (Length(tmp) > 0) then
- begin
- TPAFilterPoints(TPA, tmp);
- SetLength(tmp, 0);
- end;
- end else
- SetLength(TPA, 0);
- end;
- var
- tmp, TPA: TPointArray;
- begin
- TPA := [Point(1, 1), Point(1, 2), Point(2, 1), Point(2, 2)];
- TPAExtractPoints(TPA, tmp);
- WriteLn(TPAToStr(TPA));
- SetLength(TPA, 0);
- end.
Advertisement
Add Comment
Please, Sign In to add comment