mapbox-java
mapbox-java copied to clipboard
TurfMeasurements should have a function for determining bearing deltas
TurfMeasurement.bearing(Point point1, Point point2
This function can return -180.0, 180.0.
In order to calculate the difference between two bearings. Downstream needs to create a normalizing function which can determine that the difference between -179.0 and 179.0, is 2 degrees.
double TurfMeasurements.shortestBearingDiff(double bearing1, double bearing2) {
...
}
This function should be proven with unit tests.
other name ideas for the function. i like extending the bearing function with bearingShortest*. am not preferring "rotationDiff" because rotation is a difference.
bearingDifference
bearingShortestDiff
bearingShortestDelta
shortestRotationDiff