Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ IEnumerator PollLocationRoutine()
// atan2 increases angle CCW, flip sign of latDiff to get CW
double latDiff = -(_lastPositions[i].x - _lastPositions[i - 1].x);
double lngDiff = _lastPositions[i].y - _lastPositions[i - 1].y;
// +90.0 to make top (north) 0
// +90.0 to make top (north) 0°
double heading = (Math.Atan2(latDiff, lngDiff) * 180.0 / Math.PI) + 90.0f;
// stay within [0..360] range
// stay within [0..360]° range
if (heading < 0) { heading += 360; }
if (heading >= 360) { heading -= 360; }
lastHeadings[i - 1] = (float)heading;
Expand All @@ -327,7 +327,7 @@ IEnumerator PollLocationRoutine()
_userHeadingSmoothing.Add(lastHeadings[0]);
float finalHeading = (float)_userHeadingSmoothing.Calculate();

//fix heading to have 0 for north, 90 for east, 180 for south and 270 for west
//fix heading to have 0° for north, 90° for east, 180° for south and 270° for west
finalHeading = finalHeading >= 180.0f ? finalHeading - 180.0f : finalHeading + 180.0f;


Expand Down