From f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead Mon Sep 17 00:00:00 2001
From: jaseg Del.» function Area(const pts: TPath): double; C++ » double Area(const Path &poly); C# » public static double Area(Path poly); This function returns the area of the supplied polygon. It's assumed that the path is closed and does not self-intersect. Depending on orientation, this value may be positive or negative. If Orientation is true, then the area will be positive and conversely, if Orientation is false, then the area will be negative. Del.» function CleanPolygon(const Poly: TPath; Distance: double = 1.415): TPath; C++ » void CleanPolygon(const Path &in_poly, Path &out_poly, double distance = 1.415); C++ » void CleanPolygon(Path &poly, double distance = 1.415); C# » public static Path CleanPolygon(Path poly, double distance = 1.415); Removes vertices:
+
+
+
+
+
+ Home
+
+ ClipperLib
+
+
+
Area
+
+
+
+
+
+ See Also
+
+
+
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
+ Home
+
+ ClipperLib
+
+
+
CleanPolygon
+
+
+
+
+
+
+
+
Vertices are semi-adjacent when they are separated by a single (out-lying) vertex.
The distance parameter's default value is approximately √2 so that a vertex will be removed when adjacent or semi-adjacent vertices having their corresponding X and Y coordinates differing by no more than 1 unit. (If the egdes are semi-adjacent the out-lying vertex will be removed too.)
C++ only: This function is overloaded. In the first definition, the in_poly and out_poly parameters can reference the same Path object though in that case the calling code might be clearer if the second definition (accepting a single Paths parameter) is used.
CleanPolygons, SimplifyPolygon, Path
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function CleanPolygons(const Polys: TPaths; Distance: double = 1.415): TPaths;
+ +C++ » void CleanPolygons(const Paths &in_polys, Paths &out_polys, double distance = 1.415);
+ +C++ » void CleanPolygons(Paths &polys, double distance = 1.415);
+ +C# » public static Paths CleanPolygons(Paths polys, double distance = 1.415);
+Removes vertices: +
Vertices are semi-adjacent when they are separated by a single (out-lying) vertex.
The distance parameter's default value is approximately √2 so that a vertex will be removed when adjacent or semi-adjacent vertices having their corresponding X and Y coordinates differing by no more than 1 unit. (If the egdes are semi-adjacent the out-lying vertex will be removed too.)
C++ only: This function is overloaded. In the first definition, the in_polys and out_polys parameters can reference the same Paths object though in that case the calling code might be clearer if the second definition (accepting a single Paths parameter) is used.
CleanPolygon, SimplifyPolygons
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function ClosedPathsFromPolyTree(PolyTree: TPolyTree): TPaths;
+ +C++ » void ClosedPathsFromPolyTree(PolyTree& polytree, Paths& paths);
+ +C# » public static void ClosedPathsFromPolyTree(PolyTree polytree, Paths paths);
+This function filters out open paths from the PolyTree structure and returns only closed paths in a Paths structure.
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function MinkowskiDiff(const Poly1: TPath; const Poly2: TPath): TPaths;
+ +C++ » void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
+ +C# » public static Paths MinkowskiDiff(Path poly1, Path poly2);
+ Minkowski Difference is performed by subtracting each point in a polygon from the set of points in an open or closed path. A key feature of Minkowski Difference is that when it's applied to two polygons, the resulting polygon will contain the coordinate space origin whenever the two polygons touch or overlap. (This function is often used to determine when polygons collide.)
In the image on the left the blue polygon is the 'minkowski difference' of the two red boxes. The black dot represents the coordinate space origin.
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function MinkowskiSum(const Pattern: TPath; const Path: TPath; PathIsClosed: Boolean): TPaths; overload;
+ +Del.» function MinkowskiSum(const Pattern: TPath; const Paths: TPaths; PathFillType: TPolyFillType; PathIsClosed: Boolean): TPaths; overload;
+ +C++ » void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
+ +C++ » void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, PolyFillType pathFillType, bool pathIsClosed);
+ +C# » public static Paths MinkowskiSum(Path pattern, Path path, bool pathIsClosed);
+ +C# » public static Paths MinkowskiSum(Path pattern, Paths paths, PolyFillType pathFillType, bool pathIsClosed);
+Minkowski Addition is performed by adding each point in a polygon 'pattern' to the set of points in an open or closed path. The resulting polygon (or polygons) defines the region that the 'pattern' would pass over in moving from the beginning to the end of the 'path'.
+ + +
+
+ Path path = new Path(); + Path pattern = new Path(); + Paths solution = new Paths(); + + //Greek capital sigma (sum sign) ... + Int64[] ints1 = new Int64[] { 300, 400, 100, 400, 200, 300, 100, 200, 300, 200 }; + path = IntsToPolygon(ints1); + + //diagonal brush pattern ... + Int64[] ints2 = new Int64[] { 4, -6, 6, -6, -4, 6, -6, 6 }; + pattern = IntsToPolygon(ints2); + + solution = Clipper.MinkowskiSum(pattern, path, false); + //move 'pattern' to the end of 'path' ... + pattern = TranslatePath(pattern, 300, 200); + + //Display solution ± pattern ... ++ + + +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function OffsetPaths(const polys: Paths; const delta: double; JoinType: TJoinType = jtSquare; EndType: TEndType = etClosed; Limit: double = 0.0): TPaths;
+ +C++ » void OffsetPaths(const Paths &in_polys, Paths &out_polys, double delta, JoinType jointype = jtSquare, EndType endtype = etClosed, double limit = 0.0);
+ +C# » public static Paths OffsetPaths(Paths polys, double delta, JoinType jointype = JoinType.jtSquare, EndType endtype = EndType.etClosed, double limit = 0.0);
+ Deprecated. (See ClipperOffset.)
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function OpenPathsFromPolyTree(PolyTree: TPolyTree): TPaths;
+ +C++ » void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
+ +C# » public static void OpenPathsFromPolyTree(PolyTree polytree, Paths paths);
+This function filters out closed paths from the PolyTree structure and returns only open paths in a Paths structure.
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function Orientation(const poly: TPath): boolean;
+ +C++ » bool Orientation(const Path &poly); // Function in the ClipperLib namespace.
+ +C# » public static bool Orientation(Path poly); // Static method of the Clipper class in the ClipperLib namespace.
+ + +Orientation is only important to closed paths. Given that vertices are declared in a specific order, orientation refers to the direction (clockwise or counter-clockwise) that these vertices progress around a closed path.
Orientation is also dependent on axis direction:
+
Notes:
+
Overview, Clipper.ReverseSolution, Path
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function PointInPolygon(const Pt: TIntPoint; const poly: TPath): Integer;
+ +C++ » int PointInPolygon(const IntPoint pt, const Path &poly); // Function in the ClipperLib namespace.
+ +C# » public static int PointInPolygon(IntPoint pt, Path poly); // Static method of the Clipper class.
+ + +Returns 0 when false, -1 when pt is on poly and +1 when pt is in poly.
It's assumed that 'poly' is closed and does not self-intersect.
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function PolyTreeToPaths(PolyTree: TPolyTree): TPaths;
+ +C++ » void PolyTreeToPaths(PolyTree& polytree, Paths& paths);
+ +C# » public static Paths PolyTreeToPaths(PolyTree polytree);
+This function converts a PolyTree structure into a Paths structure.
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function ReversePath(const polys: TPath): TPath;
+ +C++ » void ReversePath(const Path &p);
+ +C# » //Call Path.Reverse().
+Reverses the vertex order (and hence orientation) in the specified path.
+ + +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function ReversePaths(const p: TPaths): TPaths;
+ +C++ » void ReversePaths(const Paths &p);
+ +C# » void ReversePaths( Paths p );
+Reverses the vertex order (and hence orientation) in each contained path.
+ + + +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function SimplifyPolygon(const Poly: TPath; FillType: TPolyFillType = pftEvenOdd): TPaths;
+ + C++ » void SimplifyPolygon(const Path &in_poly, Paths &out_polys,
PolyFillType fillType = pftEvenOdd);
C# » public static Paths SimplifyPolygon(Path poly,
PolyFillType fillType = PolyFillType.pftEvenOdd);
Removes self-intersections from the supplied polygon (by performing a boolean union operation using the nominated PolyFillType).
Polygons with non-contiguous duplicate vertices (ie 'touching') will be split into two polygons.
Note: There's currently no guarantee that polygons will be strictly simple since 'simplifying' is still a work in progress.
Clipper.StrictlySimple, CleanPolygon, Path, PolyFillType
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
![]() |
+ ![]() |
+ ![]() |
+
Del.» function SimplifyPolygons(const polys: TPaths;
FillType: TPolyFillType = pftEvenOdd): TPaths;
C++ » void SimplifyPolygons(const Paths &in_polys, Paths &out_polys,
PolyFillType fillType = pftEvenOdd);
C++ » void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
+ +C# » public static Polygons SimplifyPolygons(Paths polys,
PolyFillType fillType = PolyFillType.pftEvenOdd);
Removes self-intersections from the supplied polygons (by performing a boolean union operation using the nominated PolyFillType).
Polygons with non-contiguous duplicate vertices (ie 'vertices are touching') will be split into two polygons.
C++ only: This function is overloaded. In the first definition, the in_polys and out_polys parameters can reference the same Paths object though in that case the calling code might be clearer if the second definition (accepting a single Paths parameter) is used.
Note: There's currently no guarantee that polygons will be strictly simple since 'simplifying' is still a work in progress.
Clipper.StrictlySimple, CleanPolygons, PolyFillType
+ +
Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014