Slicing polygons and curves using arbitrary curves? #493
Replies: 1 comment 1 reply
-
As far as I know, you cannot cut with open geometry - it has to be closed - the subject can be open or closed, but the cutter always has to be closed geometry. All may not be lost, though. If you have a certain floating point tolerance in your incoming geometry, you could consider scaling up the geometry to be cut, and then offset your user's cutting curve. Then you can cut with that cutting curve and scale it all back down again. That should make your injected cut of negligible width in the output geometry because you've crushed down below your floating point tolerance and the values will be essentially comparable. For example, if you have a tolerance of 2 decimal places, for the sake of argument, in your incoming geometry, scale it up by 100x and then offset the cutting curve to make it a closed shape. Cut the scaled closed geometry and then scale it all back down again to have your negligible cut in place. I do something similar in my projects to allow rectangular decomposition and keyhole insertions into arbitrary geometry that does not change the perceived nature of the geometry. |
Beta Was this translation helpful? Give feedback.
-
I have list of curves and polygons (not triangles) for my representation of an object in the system I am building
I’d like to create a 2D “slice tool” that the user can draw across the object to split all the curves and polygons into separate shapes. The user’s curve could have recursive self intersections, which is tricky, and the thickness of the user’s curve is 0 (it’s a cutting curve, not an expanded curve).
Can CliiperLib help here? e.g. take the user’s curve and my curve/polygon lists and return a list of modified shapes? (not the traingles, just the points and whether they’re curves or polygons).
I’m still learning clipperlib, but I get the sense it could help here with some modifications.
Could someone help make a C++ example if this is possoble?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions