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 wrapping of longitudes in HaversineDestination #1091

Merged
merged 2 commits into from
Oct 24, 2023

Conversation

apendleton
Copy link
Contributor

  • 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.

Currently HaversineDestination sometimes produces output points with longitudes that aren't within [-180,180]. This PR adds logic to ensure that they're correctly wrapped.

Note: the wrapping logic is branchless so it's nice and speedy, but a drawback is that it slightly twiddles some floating-point results out like 10 places after the decimal, even for longitudes that don't need wrapping, which required adding some epsilon = whatever to some existing tests. If a branch-y version that only touches out of bounds longitudes is preferred, let me know, and I can make the swap (probably in this branch and also in #1090 , which uses the same new function).

fixes #1074

Copy link
Member

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

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

I'll leave this another day or so in case anyone else wants to review.

@urschrei urschrei added this pull request to the merge queue Oct 24, 2023
Merged via the queue into georust:main with commit a949f3f Oct 24, 2023
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.

HaversineDestination results don't wrap at the antimeridian as expected
3 participants