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

Bug in Polygon.contain method when used on segments #31

Closed
bernizt opened this issue Sep 11, 2019 · 3 comments
Closed

Bug in Polygon.contain method when used on segments #31

bernizt opened this issue Sep 11, 2019 · 3 comments
Labels

Comments

@bernizt
Copy link

bernizt commented Sep 11, 2019

  • I'm trying to use the method contain of a polygon to check if a segment is inside it.
  • The results are not always correct. Check the runkit example for a correct detection and a wrong detection.
  • Note: changing the tolerance parameter doesn't make a difference.
@alexbol99
Copy link
Owner

Hello @bernizt ,
Sorry for the late reply.
I tried your example in the latest release (1.2.1) and got expected result in both cases.
See this notebook: https://observablehq.com/d/d407b9bed460e39b
Thanks,
Alex

@karolis-k
Copy link

karolis-k commented May 6, 2020

I think there is still a bug. I updated the example, just changed the shape of polygon a little: https://observablehq.com/@karolis-k/issue-31-bug-in-polygon-contain-method
I quickly checked the code and it seems that the problem is that segment's/edge's inclusion is checked only by start, end and middle points. In previous example it just happened so by coincidence that middle point was outside polygon.

@alexbol99
Copy link
Owner

You are right, this method was incomplete. Try new release v1.2.6, problem should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants