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

Intersection is wrongly empty #1647

Closed
ksesong opened this issue Apr 3, 2019 · 3 comments
Closed

Intersection is wrongly empty #1647

ksesong opened this issue Apr 3, 2019 · 3 comments

Comments

@ksesong
Copy link

ksesong commented Apr 3, 2019

Description/Steps to reproduce

4b3d892a-9171-4a19-a8f9-d810b84917d9

var pathA = PathItem.create("M0,0h60v60h-60z");
var pathB = PathItem.create("M60,47c-0.89493,-0.00177 -1.72254,0.47497 -2.17,1.25l-12.12,21c-0.44703,0.77427 -0.44656,1.72831 0.00123,2.50214c0.44779,0.77383 1.27472,1.24963 2.16877,1.24786h24.24c0.89405,0.00177 1.72098,-0.47403 2.16877,-1.24786c0.44779,-0.77383 0.44826,-1.72787 0.00123,-2.50214l-12.12,-21c-0.44746,-0.77503 -1.27507,-1.25177 -2.17,-1.25M64.33,47l12.12,21c0.89315,1.54699 0.89316,3.45295 0.00003,4.99995c-0.89313,1.547 -2.54373,2.50001 -4.33003,2.50005h-24.24c-1.78631,-0.00005 -3.4369,-0.95306 -4.33003,-2.50005c-0.89313,-1.547 -0.89312,-3.45296 0.00003,-4.99995l12.12,-21c0.88236,-1.55771 2.53981,-2.51466 4.33,-2.5c1.79019,-0.01466 3.44764,0.94229 4.33,2.5z");
pathA.fillColor = 'red';
pathB.fillColor = 'blue';
var interesectAB = pathA.intersect(pathB);
interesectAB.fillColor = 'green';
console.log(interesectAB.pathData)

There is no "green" path (which would identify the interesection).

Link to reproduction test-case

http://sketch.paperjs.org/#V/0.11.8/S/bVPLbtwwDPwVwZfdAJKg9yNFD0l76SFAgR67PTiOGgdx7MDr5tCi/16S8nqzQH2xSHGGwzH9pxnbl9JcN9+ey9L1DW+66QHjt3Zmr+3S37CP7Cu8vyzlRXZzaZeyPzR3iqs+qLegehHU70Nz9eEwniC3/4cExV3shJIpu2w5HJTSMTKhZTTGO66kiy5DwkgduZbGD0LD2XCjEedcVBaqYnQGqjARfOAIT1Yz4jOWG+mV0a4jQMwEsMkyIIwuGiR2OVgGzCFFauRiCr1xcOhInvL8pA7ZVU4oF9SpM0ysuK2PODXCRDKB02AxxU2ZWKWdxhLbXC5UuIcGSAyH2sGTQ2QIhXfBSWvByGFzBhVb7WEO70LOrMaBW+m8yZ66KzDOyQyPr1/AaksAIvfOxuob6GQCOyCgJnwvqjM4TgpW1y8HF0xACxto8uytCmeoWLHnZmLtVmOYvcoLmzyx6hvO3kBtMpaM9D5GDd57m5Mmeu1CYGQGRh2Iy0qTFkVXFn0NuFXZGZNrKVSuy0q7LX8+DcOnaZhmWNndXB52683t5c398Kvs1g1/Gpcyl2Pplhtc9MpDScztCY0N3tddsj3OpYxI103jcRqKHKbH/UU5knxul/YK/sd7+IGeXye4PzbX33/8/Qc=

Expected result

Strangely enough, when I move the square just a little, the intersection appears.

http://sketch.paperjs.org/#V/0.11.8/S/bVM9b9wwDP0rgpe7AJKgT0pK0SFplw4BCnTsdXAcNQ7i2IHPzdCi/72kZN/lgHqxRPE9Pj5Rf5qxfcnNdfPtOS9d3/Cmmx5o/9bO7LVd+hv2kX3F/5clv8huzu2S94fmTklFn+bbogf1BqoXoH4fmqsPh3EjuP0/ASjuQieUjMklywXx6BCY0DIY4x0Su+ASBozUgWtp/CA0rg03mnDOBWUxKwRnMIsC4IETPFrNCp+x3EivjHZdAYRUADZahoTBBUPELoFlyAwxlEIuROiNw0VX5CnPN3XErlIkuahOnWFixZ3qiK0QBaIBXhoLMZyUiVXa1pY49eWgwj0WIGJc1Aq+OFQMKds7cNJaNHI4OUOKrfbYh3eQEqt74FY6b5Jn9b4QIxN+vt6A1bYACrl3NlTfUCcTVIEANeB7UZ2hdiJYXW8OD5jAEhZK58lbBWeoWLHnYmKtVvfYe5UHJ3li1TecvcHcaGwx0vsQNHrvbYq60GsHwIoZtOtQXFK6aFHlyJKvQFOVnDGppmLmOqxl0uXPp2H4NA3TjCO7m/PDbj25vTy5H37l3TrhT+OS53zM3XJDg155SpBi+4KmAu/zLtke55xHouum8TgNWQ7T4/4inUg+t0t7ha/zHh/Q8+uE58fm+vuPv/8A

Similarly, same issue in this situation (you can move the rectangle a little bit, and the intersections become correct):

http://sketch.paperjs.org/#V/0.11.8/S/bVHRTsIwFP2VpS9gUpZ2q2WB+ND45IOJiW9YH8q4OEK3YikYNf67vVsBNeYud9s55562p5+kMy2QGXncQqgbQkntVvivO6yj8dnrwfgAPrvJHkxo7gK0ee3BBBhrcs8oayQ7StZMJPvQ5Go+DO2iVP0/Ihktq1yogueS9o1RHgtBGsmfODJJj3NTobig8UGcUSGRPCFYvaZlk7JShaDFSVgNxglJwlIu2tivc6k4rsYvW5niJ1rHN0/9vBkkF8NJ+1Pm6421t846jGi0tAcYzTG7lNsvWpMXD9BpkmLadFGxhzpgVoPbGRonA1zoovtj9w7WurfeL97dMoa83bmo3pPZ0/PXNw==

@lehni
Copy link
Member

lehni commented Jun 22, 2019

This can be reduced to this sketch. It looks like one intersection isn't found!

@lehni
Copy link
Member

lehni commented Jun 22, 2019

Possibly related is this scenario, where two intersections are found, but one is falsely assumed to not be a crossing.

@lehni lehni closed this as completed in 14ce1dc Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants