View Full Version : Angle between two vectors [0..2PI]

10-14-2002, 07:31 AM
Hello. I took a look to the FAQs, but I haven't found the whole solution. I know how to find the angle between two vectors, but not in this range [0..360] or [0..2PI]. I implement a camera engine...
So, if I well understand :

Angle = RadianToDegres( acos( |v1 v2| ) )

Where v1 is the Right vector of the camera.
Where v2 is the Right vector of the world (1.0, 0.0, 0.0)

My camera preserve the Right, Up and Forward vector. I want to extract the proper angle of it.

So, pretend the camera rotate 90 around the X axis. Now his UP vector will point forward... So in world coordinate, the camera has an angle of 90 in X axis...

If I add 180 in X axis, the camera has an angle of 270....

Hope you understand.
Many thanks
Martin Beaudet

10-14-2002, 11:02 AM
I think you need to use matrices.
I have a good matrix class if you want one?

10-15-2002, 09:38 AM
Yes, I'm interested.