-
Notifications
You must be signed in to change notification settings - Fork 200
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
geo::algorithm::intersects does not work properly for coordinate to line. #640
Comments
Hi @TiBehr. I think what you're seeing here is an artifact of binary floating point math. For what it's worth, I see similar results from the popular JTS and PostGIS projects:
You get a more intuitive result if you are inspecting points that are not truncated by their floating point representation:
As for what to do about floating point errors, I think the solution depends on the context. One approach might be for you to determine what your error tolerance is and use some kind of distance calculation instead. In this particular example you would get the, admittedly unintuitive, result:
Similarly, another way to make the intersection a bit "sloppier", would be to add some buffer to the geometries - making the line a rather thin rectangle, and intersecting with that. However, |
Good to know, thanks. That actually helps a lot. |
I don't think there's anything specific to do, so closing this issue. |
I stumbled onto a bug where a coordinate that lays on a line is not considered to intersect that line.
Reproduction:
The text was updated successfully, but these errors were encountered: