Skip to content

Path intersection leads to incorrect results in one direction, not the other #2096

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

Open
kritzikratzi opened this issue Apr 30, 2025 · 0 comments

Comments

@kritzikratzi
Copy link

kritzikratzi commented Apr 30, 2025

Hi!

I found an edge case of path intersection, where I get wrong results in one direction but not the other
.

This may or may not play together with these bugs:

The example itself is quite minimal: Two shapes composed of bezier paths and lines, then look at p3=p2.intersect(p1) and p4=p1.intersect(p2).

Image

var p1 = new Path("M 120 70 A 50 50 0 0 1 170 20 L 270 20 A 50 50 0 0 1 320 70 L 320 170 A 50 50 0 0 1 270 220 A 50 50 0 0 0 220 270 A 50 50 0 0 1 170 320 A 50 50 0 0 1 120 270 L 120 170 Z");
p1.fillColor = "rgba(255,0,0,0.5)";

var p2 = new Path("M 70 120 A 50 50 0 0 1 20 70 A 50 50 0 0 1 70 20 L 170 20 A 50 50 0 0 1 220 70 A 50 50 0 0 0 270 120 A 50 50 0 0 1 320 170 A 50 50 0 0 1 270 220 A 50 50 0 0 0 220 270 A 50 50 0 0 1 170 320 A 50 50 0 0 1 120 270 L 120 170 A 50 50 0 0 0 70 120 Z");
p2.fillColor = "rgba(0,255,0,0.5)";

var p3 = p2.intersect(p1);
p3.fillColor = "rgba(0,0,255,0.5)";
p3.position.x = 450;

var p4 = p1.intersect(p2);
p4.fillColor = "rgba(0,0,255,0.5)";
p4.position.x = 700;

//alert(project.exportSVG().outerHTML);
p2.position.y = 480;

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