I have been trying to build a piece of code that computes the heading change between two points. My approach is to take the 'getBearing()' value that android returns for each of them, and subtract the first with the last.
But a problem arises in extreme cases: android returns a value ranged ]0;360], which means that some subtractions will return huge heading changes, even though the change may have been smaller.
For example, if walking slightly angle towards north, with a bearing of 355º and then changing to 5º degrees, the heading change value should read 10º, but with my method it will read -350º.
Any idea on how to find a way to compute heading changes using these values, but returning the appropriate change accoordingly?
NOTE: The heading change must also denote the direction of the change.