Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipping open paths #17

Open
CarstenHoyer opened this issue Jan 22, 2019 · 5 comments
Open

Clipping open paths #17

CarstenHoyer opened this issue Jan 22, 2019 · 5 comments

Comments

@CarstenHoyer
Copy link

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)
screenshot 2019-01-22 at 22 04 03

After:
screenshot 2019-01-22 at 22 03 28

@bakercp
Copy link
Owner

bakercp commented Jan 22, 2019

Hi @CarstenHoyer I'm certainly interested, though I'm not totally sure what I'm looking at in the images.

@CarstenHoyer
Copy link
Author

@bakercp OK I see the example probably worked better in my head :), here is a another one:

We have two bezier curves.
screenshot 2019-01-23 at 08 54 41

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):
screenshot 2019-01-23 at 08 56 13

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:
screenshot 2019-01-23 at 08 55 48

@CarstenHoyer
Copy link
Author

@bakercp - Let me know what you think.

@CarstenHoyer
Copy link
Author

@bakercp - did you have a moment to look at this?

@bakercp
Copy link
Owner

bakercp commented Mar 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants