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

Wrong intersection depending on minor difference in coordinates #102

Open
purplecomet1 opened this issue Jun 24, 2019 · 6 comments
Open

Comments

@purplecomet1
Copy link

You can view the issue here: https://codepen.io/purplecomet1/pen/WqOZRB

The polygons are defined on lines 9-12 and 21-25 respectively.

If you select 'Intersection' and run it, only a portion of it is highlighted instead of the whole shape.

If you edit certain coordinates slightly, however, it will produce the correct intersection. For example, adding '.0001' to either the x or y coordinate on line 10 will produce the correct intersection. The same is true for removing the last 3 decimal places of the y-coordinate on line 23.

@purplecomet1
Copy link
Author

You can get even more bizarre intersections if you delete the decimal places from lines 21 and 25 (so that the coordinates become [27, 74]).

This intersection selects a portion of the polygon that is outside of the bounding polygon and a random line from across the polygon.

@bluenote10
Copy link
Collaborator

Another check against polybooljs. It also seems to avoid the problem:

Input:
bug_102_input

Output:
bug_102_output

I'll stop making these comparisons now. What I wanted to find out is whether looking into polybooljs may help to fix some of the open issues -- which seems to be the case. After all, there might be even a single cause of all the issues, e.g., just a missing edge case check.

@w8r
Copy link
Owner

w8r commented Jan 6, 2020

It's the precision model, I suspect.

@rowanwins
Copy link
Collaborator

Resolved in v0.6.0 by #111

@rowanwins rowanwins reopened this Jan 13, 2020
@rowanwins
Copy link
Collaborator

Turns out the demo site I used to check the ouput was doing some funky things and this isn't resolved :(

@rowanwins
Copy link
Collaborator

The intersection operation appears to be working 0.7.3, although the difference operations seem to be generating a few stray segments

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

4 participants