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

lib/Vlib: Return all intersection points from Vect_line_get_intersections #2358

Merged
merged 8 commits into from
May 20, 2022

Conversation

marisn
Copy link
Contributor

@marisn marisn commented May 6, 2022

Initial implementation (by me in 2008 https://trac.osgeo.org/grass/changeset/34306) of Vect_line_get_intersections and Vect_line_get_intersections2 returns just one of intersection points between two lines. This is wrong as per bug #2344 users do expect to get back all intersection points. This PR fixes both functions and adds tests to Vlib, v.profile.

Might be a candidate for a backport.

marisn added 5 commits May 6, 2022 12:32
Current implementation of function Vect_line_get_intersections() reports
a single intersection even if lines cross multiple times
(a buggy implementation introduced by me in 2008 with
https://trac.osgeo.org/grass/changeset/34306)

Added tests should cover most of line intersection cases.
A fix for Vect_line_get_intersections2() still needs to be done.
Old implementation of Vect_line_get_intersections2 returns only one line
crossing point. After this commit all intersections are returned.
…nge the outcome

In the code was an early bailout if an intersection was found. This shortcut is still
taken if only a check of intersection needs to be done.
@marisn marisn requested review from neteler and metzm May 6, 2022 09:39
@marisn marisn added the vector Related to vector data processing label May 6, 2022
@marisn marisn added this to the 8.4.0 milestone May 6, 2022
@marisn marisn linked an issue May 6, 2022 that may be closed by this pull request
Copy link
Contributor

@metzm metzm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Do you mind including the changes of PR #2359 here? This might avoid conflicts between these two PRs and I would delete PR #2359.

@marisn
Copy link
Contributor Author

marisn commented May 12, 2022

Do you mind including the changes of PR #2359 here? This might avoid conflicts between these two PRs and I would delete PR #2359.

Yes, a good idea. Done :-) Thanks for your work on #2359

@marisn marisn merged commit 20331ef into OSGeo:main May 20, 2022
@marisn marisn modified the milestones: 8.4.0, 8.2.1 May 20, 2022
neteler pushed a commit that referenced this pull request May 20, 2022
…#2358)

* Vlib: report all line intersections in Vect_line_get_intersections|2()

Current implementation of function Vect_line_get_intersections() reports
a single intersection even if lines cross multiple times
(a buggy implementation introduced by me in 2008 with
https://trac.osgeo.org/grass/changeset/34306)

Added tests should cover most of line intersection cases.

Also fixes bug #2344 (+ a test case)

Contains an update to documentation (from PR #2359 by metzm; fixes #2345)
@neteler neteler modified the milestones: 8.2.1, 8.2.0 May 20, 2022
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
…OSGeo#2358)

* Vlib: report all line intersections in Vect_line_get_intersections|2()

Current implementation of function Vect_line_get_intersections() reports
a single intersection even if lines cross multiple times
(a buggy implementation introduced by me in 2008 with
https://trac.osgeo.org/grass/changeset/34306)

Added tests should cover most of line intersection cases.

Also fixes bug OSGeo#2344 (+ a test case)

Contains an update to documentation (from PR OSGeo#2359 by metzm; fixes OSGeo#2345)
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
…OSGeo#2358)

* Vlib: report all line intersections in Vect_line_get_intersections|2()

Current implementation of function Vect_line_get_intersections() reports
a single intersection even if lines cross multiple times
(a buggy implementation introduced by me in 2008 with
https://trac.osgeo.org/grass/changeset/34306)

Added tests should cover most of line intersection cases.

Also fixes bug OSGeo#2344 (+ a test case)

Contains an update to documentation (from PR OSGeo#2359 by metzm; fixes OSGeo#2345)
@neteler neteler changed the title Vlib: Return all intersection points from Vect_line_get_intersections lib/Vlib: Return all intersection points from Vect_line_get_intersections Jun 6, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
…OSGeo#2358)

* Vlib: report all line intersections in Vect_line_get_intersections|2()

Current implementation of function Vect_line_get_intersections() reports
a single intersection even if lines cross multiple times
(a buggy implementation introduced by me in 2008 with
https://trac.osgeo.org/grass/changeset/34306)

Added tests should cover most of line intersection cases.

Also fixes bug OSGeo#2344 (+ a test case)

Contains an update to documentation (from PR OSGeo#2359 by metzm; fixes OSGeo#2345)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] v.profile does not report all crossings of a single line
3 participants