-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
getCrossings() returns touching paths which do not cross each other #1409
Comments
Yes there are a ton of edge cases where this doesn't work as it should. Unfortunately I have very little time available to further improve anything on paper.js : / |
I can completely understand. It's a very complex area of the library too. In case it helps you or anyone else who has this issue, I'll detail my fix. In order to find out if a path overlapped another path (but without returning as an overlap if it happened to be touching), I ended up using something like this: const intersectingPath = PathItem.intersect(secondPath); Thanks for your speedy feedback! |
I'm not sure if this should be logged as a separate issue. But if you take two identical simple paths, and run getCrossings, should this return empty? Today it does not. For example, see this sketch |
@renschler yeah this is a a bit of a workaround that was included for the boolean operations to work correctly, but it shouldn't affect the public API like this. See the TODO here: Lines 354 to 360 in b51a4be
You can work around this for now by doing this instead: const crossings = path1.getIntersections(path2, inter => inter.isCrossing()); |
In the documentation, Path.getCrossings() says
However, with the following code, these non-intersecting but touching paths are reported as crossing:
Loving paper.js! It's absolutely amazing and I am very thankful for such a great library! Thank you!!
The text was updated successfully, but these errors were encountered: