Find the shortest path from angle1 to angle2.
This will never take the long way around the circle or make multiple loops around the circle.
More precisely find difference where positiveModulo(angle1 + difference, FULL_CIRCLE) == positiveModulo(angle2, FULL_CIRCLE).
Then select the difference where Math.abs(difference) is smallest.
Return the difference.
Parameters
angle1: number
radians
angle2: number
radians
Returns number
A value to add to angle1 to get another angle that is equivalent to angle2.
A value between -π and π.
Find the shortest path from
angle1
toangle2
. This will never take the long way around the circle or make multiple loops around the circle.More precisely find
difference
wherepositiveModulo(angle1 + difference, FULL_CIRCLE) == positiveModulo(angle2, FULL_CIRCLE)
. Then select thedifference
whereMath.abs(difference)
is smallest. Return thedifference
.