AddPath

The Clipper Library

ClipperBase.AddPath

Del.» function AddPath(const path: TPath; polyType: TPolyType; Closed: Boolean): Boolean;

C++ » bool AddPath(const Path &pg, PolyType polyType, bool closed);

C#  » public virtual bool AddPath(Path pg, PolyType polyType, bool closed);

Any number of subject and clip paths can be added to a clipping task, either individually via the AddPath() method, or as groups via the AddPaths() method, or even using both methods.

'Subject' paths may be either open (lines) or closed (polygons) or even a mixture of both, but 'clipping' paths must always be closed. Clipper allows polygons to clip both lines and other polygons, but doesn't allow lines to clip either lines or polygons.

With closed paths, orientation should conform with the filling rule that will be passed via Clippper's Execute method.

Path Coordinate range:
Path coordinates must be between ± 0x3FFFFFFFFFFFFFFF (± 4.6e+18), otherwise a range error will be thrown when attempting to add the path 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. If the preprocessor directive use_int32 is defined (allowing a further increase in performance of 20-30%), then the maximum range is restricted to ± 32,767.

Return Value:
The function will return false if the path is invalid for clipping. A path is invalid for clipping when:

  • it has less than 2 vertices
  • it has 2 vertices but is not an open path
  • the vertices are all co-linear and it is not an open path


See Also

Example, Clipper.Execute, AddPaths, Orientation, Defines, Path, PolyFillType, PolyType