You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
* Return a new LatLng object with a wrapped Longitude. This allows original data object
Two issues with this method:
Method comments say that new LatLng will be created. Current implementation returns this
wrap() from telemetry.MathUtils is used which relies on an implementation of wrap from core.
* Constrains value to the given range (including min, excluding max) via modular arithmetic.
* <p>
* Same formula as used in Core GL (wrap.hpp)
* std::fmod((std::fmod((value - min), d) + d), d) + min;
*
* @param value Value to wrap
* @param min Minimum value
* @param max Maximum value
* @return Wrapped value
*/
public static double wrap(double value, double min, double max) {
double delta = max - min;
double firstMod = (value - min) % delta;
double secondMod = (firstMod + delta) % delta;
return secondMod + min;
excluding max is what is important here.
For longitude 180 -> that will wrap to -180 even though max value is 180.
To fix this:
LatLng.wrap() should return a new LatLng
double delta = max - min;
double firstMod = (value - min) % delta;
double secondMod = (firstMod + delta) % delta;
if (value > min && second == 0) {
return max;
}
return secondMod + min;
mapbox-gl-native/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java
Line 201 in fccdd7d
Two issues with this method:
this
excluding max is what is important here.
For longitude 180 -> that will wrap to -180 even though max value is 180.
To fix this:
cc @asheemmamoowala @tobrun @cammace
The text was updated successfully, but these errors were encountered: