Execute

The Clipper Library

Clipper.Execute

Del.» function Execute(clipType: TClipType;
  out solution: TPolygons;
  subjFillType: TPolyFillType = pftEvenOdd;
  clipFillType: TPolyFillType = pftEvenOdd): boolean; overload;

function Execute(clipType: TClipType;
  out solution: TPolyTree;
  subjFillType: TPolyFillType = pftEvenOdd;
  clipFillType: TPolyFillType = pftEvenOdd): boolean; overload;

C++ »
bool Execute(ClipType clipType,
  Polygons &solution,
  PolyFillType subjFillType = pftEvenOdd,
  PolyFillType clipFillType = pftEvenOdd);

bool Execute(ClipType clipType,
  PolyTree &solution,
  PolyFillType subjFillType = pftEvenOdd,
  PolyFillType clipFillType = pftEvenOdd);

C#  »
public bool Execute(ClipType clipType,
  Polygons solution,
  PolyFillType subjFillType,
  PolyFillType clipFillType);

public bool Execute(ClipType clipType,
  PolyTree solution,
  PolyFillType subjFillType,
  PolyFillType clipFillType);


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 (default: Even-Odd). Also, subject and clip polygons don't have to use the same fill type.

This method is overloaded since the solution parameter can be either a Polygons or PolyTree structure. When the solution parameter is a Polygons structure, the solution will contain a collection of polygons containing both outer and inner polygon contours (where inner contours have an orientation opposite outer contours). On the other hand, the PolyTree structure explicitly associates inner 'hole' polygons with their container 'outer' polygons.

The order that polygons are listed in the solution structure is undefined. The solution will never contain overlapping polygons, nor will it contain polygons with self-intersecting edges. 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: The Orientation of polygons returned in the 'solution' parameter will always be 'true' for outer polygons and 'false' for inner 'hole' polygons (unless the ReverseSolution property has been enabled).

It's important to note that the fill rules apply solely within subject and clip polygons to define their respective regions. These rules aren't applied when merging these polygons into a single solution during the clip operation. If you wish for a fill rule to apply to the merging of subject and clip polygons as well - typically during a UNION operation, then you should UNION all the polygons as subjects without assigning clip polygons.

See Also

Example, ReverseSolution, PolyTree, Orientation, ClipType, PolyFillType, Polygons