-
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
Fix intersection for parallel lines #34
Fix intersection for parallel lines #34
Conversation
audit. Also, x/y should be prefered to lng/lat as it's more general.
Using https://github.com/brandonxiang/geojson-python-utils/blob/33b4c00c6cf27921fb296052d0c0341bd6ca1af2/geojson_utils.py#L5 as a reference, there were several typos in our transcription of the algorithm. Fixing these typos fixes the parallel line test. WIP: Several polygon/linestring tests are now failing.
cc @azime |
for (a1, a2) in vect0.iter().zip(vect0[1..].iter()) { | ||
for (b1, b2) in vect1.iter().zip(vect1[1..].iter()) { | ||
let u_b = (b2.y() - b1.y()) * (a2.x() - a1.x()) - | ||
(b2.x() - b1.x()) * (a2.y() - a1.y()); | ||
if u_b == 0. { | ||
// The point is on boundary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment correct? TBH I don't really understand the code. @azime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't ignore miss this comment. I figure if either of you found out more about what this conditional is doing, one of you can address it in a follow-up PR; not reason to hold this one up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.@michaelkirk Unnecessary comment, I just delete it in PR : #36
.thank you for the correction
This is great, thank you so much for your contribution! ✨ |
34: used last version of geo-types r=frewsxcv a=datanel Co-authored-by: David Quintanel <david.quintanel@canaltp.fr>
I was just backfilling a test for testing that parallel line strings don't intersect. This lead me to find a bug in the line segment intersection test.
Fixing that, uncovered another bug in the poly.intersect(line_string) implementation.
I renamed the variables in the line segment algorithm to correspond to the transcribed algorithm for easier auditing. You can see just the linestring intersection bug fix here:
093bb9a