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

Fix intersection for parallel lines #34

Merged

Conversation

michaelkirk
Copy link
Member

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

@frewsxcv
Copy link
Member

frewsxcv commented Jun 3, 2016

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
Copy link
Member Author

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

Copy link
Member

@frewsxcv frewsxcv Jun 5, 2016

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.

Copy link
Contributor

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

@frewsxcv
Copy link
Member

frewsxcv commented Jun 5, 2016

This is great, thank you so much for your contribution! ✨

@frewsxcv frewsxcv merged commit 91f3e7e into georust:master Jun 5, 2016
nyurik pushed a commit to nyurik/geo that referenced this pull request Mar 19, 2022
34: used last version of geo-types r=frewsxcv a=datanel



Co-authored-by: David Quintanel <david.quintanel@canaltp.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants