View Full Version : Finding rotation vector and angle
12-05-2003, 02:28 AM
I'm using spherical coordinates to move an object that looks like an arrow around the origo. I want to rotate the arrow so that it always points to the origo.
How do I find the vector to rotate the arrow-object about and how do I calculate the angle of rotation?
Thanks in advance!
here is the calcul for the angle between this two vector :
axz= acos( ( x1*x2 + y1*y2 + z1*z2) )
( ------------------------ )
( norm(v1) * norm(v2) )
where norm(v1)=sqrt(x1^2 + y1^2 + z1^2 )
where norm(v2)=sqrt(x2^2 + y2^2 + z2^2 )
You can get the angle in the xz plane by delete all references to the y component.
I hope it will help you.....
12-06-2003, 02:25 AM
Now I can calculate the angle, but i still need to know the axis to rotate about... Any suggestions?
If i were you, i would calculate the angle in the xz and yz and plane and then launch these opengl command:
2 plane rotation are enought to rotae in space.
After these rotate the model to his position.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.