function Execute(clipType: TClipType; out solution: TArrayOfArrayOfFloatPoint; subjFillType: TPolyFillType = pftEvenOdd; clipFillType: TPolyFillType = pftEvenOdd): Boolean; overload;
function Execute(clipType: TClipType; out solution: TArrayOfArrayOfFixedPoint; subjFillType: TPolyFillType = pftEvenOdd; clipFillType: TPolyFillType = pftEvenOdd): Boolean; overload;
The Execute() method performs the specified clipping task (intersection, union, difference or xor) on the previously assigned subject and clip polygons. This method can be called multiple times without reassigning subject and clip polygons (ie when different clipping operations are required on the same polygon sets). The polygon fill methods can be Even-Odd, Non-Zero, Positive and Negative. Subject and clip polygons can use different fill types.
The order that polygons are listed in the solution structure is undefined, though polygons lower down (when rendered in an image) are generally listed before those higher up. The solution will never contain overlapping polygons, nor will it contain polygons with self-intersections. Also, the filling mode for solution polygons is undefined since it can be either EvenOdd or NonZero. (This is because the winding depth of solution polygons will always be in the range of -1 to 1.)
Solution orientation: Polygons returned in the 'solution' will always have a positive (true) orientation for outer 'container' polygons, and the opposite orientation for inner 'hole' polygons.
uses GR32, GR32_Clipper; ... var i: integer; subj, clip, solution: TArrayOfArrayOfFloatPoint; begin setlength(subj, 2); setlength(subj, 4); subj := FloatPoint(180,200); subj := FloatPoint(260,200); subj := FloatPoint(260,150); subj := FloatPoint(180,150); setlength(subj, 3); subj := FloatPoint(215,160); subj := FloatPoint(230,190); subj := FloatPoint(200,190); setlength(clip, 1); setlength(clip, 4); clip := FloatPoint(190,210); clip := FloatPoint(240,210); clip := FloatPoint(240,130); clip := FloatPoint(190,130); with TClipper.Create do try Add(subj, ptSubject); Add(clip, ptClip); Execute(ctIntersection, solution, pftNonZero, pftNonZero); finally free; end; //nb: DrawPolygons is a stub for your own polygon rendering code. DrawPolygons(subj, $160000FF, $600000FF); DrawPolygons(clip, $20FFFF00, $30FF0000); DrawPolygons(solution, $3000FF00, $FF006600);
Copyright ©2000-2016 Alex Denisov and the Graphics32 Team - Graphics32 v2.0 - Built on 25-April-2017