Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Wrapped LatLng should be inclusive of min and max longitude. #10784

Closed
wants to merge 1 commit into from

Conversation

asheemmamoowala
Copy link
Contributor

@asheemmamoowala asheemmamoowala commented Dec 21, 2017

Core equivalent of #10769.

mbgl::util::wrap(value, min, max) wraps value, inclusive of min, but exclusive of max. For LatLng, latitudes that are positive multiples of +180.0 should not be wrapped to -180.0.

//cc @osana

@ansis
Copy link
Contributor

ansis commented Dec 22, 2017

Why should 180 wrap to 180 instead of -180? Would this mean that coordinates representing the same point ([0, -180], [0, 180]) could get wrapped to different values?

@asheemmamoowala
Copy link
Contributor Author

asheemmamoowala commented Dec 22, 2017

The wrap-around of max longitude is problematic when used with LatLngBounds. A bounds that has its western extent at 180.0 gets wrapped to -180.0 and flips the eastern and western extents. But this approach also then would fail for bounds from 180.0 to 240.0, so it doesn't really solve anything :(

You make a good point though @ansis, that this would be problematic when comparing just points for equality.

@asheemmamoowala asheemmamoowala deleted the latlng-wrap-inclusive branch April 4, 2018 21:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants