11-16-2022, 03:49 AM
You can put this function around any angle in radians, and it will simplify it to be at least zero, and less than 2pi.
function simplify_angle(a)
threesixty = 8 * atn(1)
x = -a / threesixty
if x <> int(x) then x = x + 1
simplify_angle = a + (int(x) * threesixty)
end function
function simplify_angle(a)
threesixty = 8 * atn(1)
x = -a / threesixty
if x <> int(x) then x = x + 1
simplify_angle = a + (int(x) * threesixty)
end function