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

Improve separating shapes by path - Polygon #4

Open
TobyKLight opened this issue Oct 3, 2022 · 1 comment
Open

Improve separating shapes by path - Polygon #4

TobyKLight opened this issue Oct 3, 2022 · 1 comment

Comments

@TobyKLight
Copy link
Owner

Goal

The goal of the end user is to split a shape into parts with only an open path. Like the knife tool in Adobe Illustrator.
Currently shapes can only be clipped by other shapes with fill.
The workaround (As used by the PolyPath.Compartments operation) is to clip the shape with a very thin filled shape representing a line. However this means the resulting points do not exactly match the original points and can create artifacts. You can see this in the helpatch "Extract Compartments from a Polypath" by changing the 'divider width' value.

Polygons

Polygons use the Clipper1 library.
The Clipper1 library does support clipping an open path but as the subject only. I.E the path is clipped by the fill shape. You can see this the Helppatch "HowTo Find Intersection of Line and Polygons". It does not work the other way.

Potential solutions are:
-Clipper2 library may support this, but will not bring this in until vvvv gamma stable version supports net5. See #1
-Clip using the 'small filled paths' workaround > Then have an operation that searches along the clipping path for an original point in the radius of all new points and shifts new points back to their original position. I can already see some edge cases that wouldn't work with this solution but maybe worthwhile.
-Find another clipping algorithm for this case? If anyone has ideas put em below. (Or even better if you'd like to contribute a patch more than welcome)

@TobyKLight
Copy link
Owner Author

TobyKLight commented Oct 3, 2022

Currently unclear if Clipper2 will improve this
From the Clipper2 documentation

"The library supports open path clipping, though only subject paths may be open."

My understanding of this is it means the open path itself can be clipped but the open path won't clip a filled area.

http://www.angusj.com/clipper2/Docs/Overview.htm#:~:text=Clipping%20open%20paths,solutions%20remains%20undefined.

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

1 participant