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

Simple intersection fails #97

Open
shehzan10 opened this issue Jan 23, 2019 · 2 comments · May be fixed by #115
Open

Simple intersection fails #97

shehzan10 opened this issue Jan 23, 2019 · 2 comments · May be fixed by #115
Assignees

Comments

@shehzan10
Copy link

The following code fails intersection and returns an empty array:

const poly1 = [[
    [0, 0],
    [1, 0],
    [1, 1],
    [0, 1],
    [0, 0]
]];

const poly2 = [[
    [0.5, 0.0],
    [0.6, 0.5],
    [0.7, 0.5],
    [0.5, 0.0]
]];
const intersectionPolygon = martinezPolygonClipping.intersection(poly1, poly2);

In the above case, the poly2 can be interpreted as "leaning right", with exactly 1 vertex at the southern edge.

However, when running with poly2 "leaning left", this passes.

const poly2 = [[
    [0.5, 0.0],
    [0.4, 0.5],
    [0.3, 0.5],
    [0.5, 0.0]
]];

It also passes when the vertex is not on the southern edge.

const poly2 = [[
    [0.5, 0.00001], // Both +0.00001 and -0.0001 pass
    [0.6, 0.5],
    [0.7, 0.5],
    [0.5, 0.00001]
]];
@w8r
Copy link
Owner

w8r commented Jan 23, 2019

Thanks for a good test case!

@w8r w8r self-assigned this Jan 23, 2019
@w8r w8r added the bug label Jan 23, 2019
@shehzan10
Copy link
Author

@w8r Any chance we can see a fix for this soon?

@bluenote10 bluenote10 linked a pull request Jan 11, 2020 that will close this issue
@rowanwins rowanwins linked a pull request Apr 4, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants