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

Add PointLocation.isOnSegment function #1083

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

dr-jts
Copy link
Contributor

@dr-jts dr-jts commented Apr 23, 2024

Add PointLocation.isOnSegment function, and use it instead of LineIntersector.hasIntersection.

Also remove unused LineIntersector.computeIntersection(p, p1, p2).

Port of locationtech/jts#1048

@dr-jts dr-jts added the Enhancement New feature or feature improvement. label Apr 23, 2024
@@ -42,7 +58,7 @@ PointLocation::isOnLine(const geom::CoordinateXY& p, const geom::CoordinateSeque
const geom::CoordinateXY* pp = &(pt->getAt<geom::CoordinateXY>(0));
Copy link
Member

Choose a reason for hiding this comment

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

Maybe change this to a reference so you dispense with the * further down,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that but was getting compile errors. Does it need to be a pointer because it gets revalued at the end of the loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another option is to simply define references for both points each time through the loop.

Copy link
Member

Choose a reason for hiding this comment

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

Oh yeah, const references hate being redefined. 🤷 Nm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to d4b654a

@dr-jts dr-jts merged commit 11fae13 into libgeos:main Apr 23, 2024
30 checks passed
@dr-jts dr-jts deleted the add-pointlocation-isonsegment branch April 23, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or feature improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants