I am using atan2() to find the angle between x,y values. I understand atan2 method returns a numeric value between –pi and pi. How do I map that value to [-pi/4, pi/4]. The question is related to this Limiting atan2 to specific angle ranges but I couldn't understand it well.
if (a > pi/4):
a -= 2 * pi/4
return a
elif(a <= -pi/4):
a += 2 * pi/4
return a