Split a polygon by a polygon #988
Replies: 3 comments 1 reply
|
I have a similar requirement to you, have you solved it? |
|
I think you should get the desired result if you declare the bottom left polygon in your example to be an open path - that ought to give you just the section of the path within the top right polygon following an intersection (AND) query. If you need both parts, I would suggest exploring the use of the Z value (needs Clipper built with the preprocessor directive). With this, you can use the Z coordinate to 'tag' the points on each polygon with the polygon index (allowing you to track which points came from which polygon in the output. You can set a callback to assign a different index (usually -1) to the intersection points. You can then use the Z value to clean up the solution by removing points that came from the polygon other than the one you are interested in. |
|
This is a method I came up with recently. It can clip closed paths and maintain the original order of the paths. Clipper2Lib::Paths64 clipContourPath(const Clipper2Lib::Rect64& clipRect, } std::vectorClipper2Lib::Point64 segmentRectIntersections(const Clipper2Lib::Rect64& rect, } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Is there a way to split a polygon into a sub-parts?
This method can do boolean intersection:
Clipper2Lib::PathsD solution = Clipper2Lib::Intersect(subject, boundary, Clipper2Lib::FillRule::NonZero, 8);But what I need is this:
All reactions