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

Implemented "Closest Point" from a Point on a Geometry using spherical geometry. #958

Merged
merged 13 commits into from Jun 27, 2023

Conversation

bbetov
Copy link
Contributor

@bbetov bbetov commented Jan 2, 2023

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Essentially implementing ClosestPoint trait for spherical geometry. I named the new trait HaversineClosestPoint.

There is a slight (intentional) difference in behavior in the case when a segment (arc)'s length is very close to zero, the spherical algorithm will return Closest::SinglePoint instead of Closest::Indeterminate. I think even if the segment has degenerated to a point, there is still a closest point.

geo/src/algorithm/haversine_closest_point.rs Outdated Show resolved Hide resolved
geo/src/algorithm/haversine_closest_point.rs Outdated Show resolved Hide resolved
geo/src/algorithm/haversine_closest_point.rs Outdated Show resolved Hide resolved
geo/src/algorithm/haversine_closest_point.rs Outdated Show resolved Hide resolved
geo/src/algorithm/haversine_closest_point.rs Show resolved Hide resolved
Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

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

Thank you for your patience @bbetov!

@michaelkirk
Copy link
Member

bors r=frewsxcv,michaelkirk

Can add to the documentation that non-intersecting geometries may be considered to intersect if they are very close within T::EPSILON.

I'll follow up with an update to the docs - no need to make this PR wait even longer on account of me.

@michaelkirk michaelkirk mentioned this pull request Jun 27, 2023
2 tasks
@michaelkirk
Copy link
Member

There were some clippy errors too, due to a deprecation/rename that's happened in the meanwhile. Fixed in #1026.

bors bot added a commit that referenced this pull request Jun 27, 2023
1026: haversine closest point fixups r=michaelkirk a=michaelkirk

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md).
- [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---

Addendum to #958



Co-authored-by: Branimir Betov <b_betov@yahoo.com>
Co-authored-by: Corey Farwell <coreyf@rwell.org>
Co-authored-by: Michael Kirk <michael.code@endoftheworl.de>
@bors bors bot merged commit 0242ae4 into georust:main Jun 27, 2023
12 of 13 checks passed
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.

None yet

3 participants