Page 1 of 1

How to calculate this angle

Posted: Sat Mar 10, 2007 10:47 am
by Magnet
I have rotation angle and vector.
How to calculate angle between them ("? - required angle")
Image

Posted: Sat Mar 10, 2007 11:59 am
by Warchief
Calculate angle from the vector X to the normal (vector with angle 0, which should be 1,0 for 2D or 1,0,0 or 0,0,1 for 3D with Y upwards, depending the anle you need).

You may use acos( X dot Normal ) to get the angle (without sign) or atan2( X.y, X.x ) [for 2D. 3D-> z,x or x,z] to get it signed. Then substract the alpha angle.