Wednesday, September 19, 2012

Short memo for angle calculation using atan2


Angle and arc-tangent function (in C/C++)




θ = atan2(x,y)
θ' = -(360 - θ)

#1: Bearing and an arc-tangent function

b = atan2(E, N)
Angle between 'N' axis and a vector.
CW is positive.




#2: Rotation angle about an axis and an arc-tangent function

ω = -atan2(x, y)
Angle between 'Y' axis and a vector.
CCW is positive.



No comments: