ofxClipper
ofxClipper copied to clipboard
Clipping open paths
Hi @bakercp - I had an issue where I needed to clip an open path. I was unable to do this with the current code - maybe there is some way to do it?
What I ended up doing was setting the "use_lines" preprocessor macro and implement the clipping with Clipper::PolyTree and finally also not closing the generated paths and the incoming subject paths.
Currently I am just making some very simple changes to the code, but it could probably be made into a proper pull request.
Would that be something you'd be interested in?
Before: (notice the closed paths arr not in the after image)
After:
Hi @CarstenHoyer I'm certainly interested, though I'm not totally sure what I'm looking at in the images.
@bakercp OK I see the example probably worked better in my head :), here is a another one:
We have two bezier curves.
We want to do a difference, where the blue curve is a mask on the green curve. Currently both curves will be closed by ofxClipper, and the result will look like this (the red is the clipping difference):
Using PolyTree and the "use_lines" macro, we can keep the subject open (http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Execute.htm). The result will look like this - the user will have to manually close and open the blue curve:
@bakercp - Let me know what you think.
@bakercp - did you have a moment to look at this?
Hey there, sorry for the delay. I just merged some API changes for of 0.10.+ Could you take a look and see how these changes fit or don't fit with this issue? If your problem is still ongoing, then we should be able to find a solution with the api rework.