Home | ClipperLib | ClipperBase |
ClipperBase.AddPolygon
Del.» function AddPolygon(const polygon: TPolygon; polyType: TPolyType): boolean;
C++ » bool AddPolygon(const Polygon &pg, PolyType polyType);
C# » public virtual bool AddPolygon(Polygon pg, PolyType polyType);
Any number of subject and clip polygons can be added to the clipping task, either individually via the AddPolygon() method, or as groups via the AddPolygons() method, or even using both methods.
Adjacent vertices with identical coordinates will be treated as a single vertex. Whereever 3 adjacent vertices form a single colinear edge, the middle vertex will be ignored.
Polygon Orientation:
Outer polygons can be either clockwise or counter-clockwise as long as any inner 'hole' polygons have the reverse orientation.
Polygon Coordinate range:
Polygon coordinates must be between ± 0x3FFFFFFFFFFFFFFF (± 4.6e+18), otherwise a range error will be thrown when attempting to add the polygon to the Clipper object. If coordinates can be kept between ± 0x3FFFFFFF (± 1.0e+9), a modest increase in performance (approx. 15-20%) over the larger range can be achieved by avoiding large integer math.
The function will return false if:
- there are less than 3 coordinates defining the polygon (once duplicates have been excluded).
- all polygon coordinates are co-linear.
See Also
Example, AddPolygons, Polygon, PolyType
Copyright ©2010-2012 Angus Johnson - Clipper version 5.1.0 - Help file built on 17-February-2013