a simple q about rotating vector

Started by
1 comment, last by ed9er 22 years, 2 months ago
in red book, it said:
quote: To transform any arbitrary vector so that it''s coincident with another arbitrary vector (for instance, the negative z-axis), you need to do a little mathematics. The axis about which you want to rotate is given by the cross product of the two normalized vectors. To find the angle of rotation, normalize the initial two vectors. The cosine of the desired angle between the vectors is equal to the dot product of the normalized vectors. The angle of rotation around the axis given by the cross product is always between 0 and 180 degrees. (See Appendix E for definitions of cross and dot products.)
it needs lots caculation: cross product and dot product, and an inverse cosine, i think the rotating can also be accomplished by define the rotate axis as the sum of the two vector, and then the angle of rotation as 180, it will be more efficient. am i got anything wrong? or what''s the disadvantage?
------------------------------------------------------CCP is fascistic, they even banned www.sourceforge.net
Advertisement
Example: You have an object whose upvector is pointing somewhere. You want that up vector to point slightly in a different way, but want to keep the object facing in the same direction (front vector is unchanged). Doing it the way the Red Book described, it will work.

Now, doing it the way you described, the up vector will indeed point in the right direction, but the object is now facing in the opposite direction (the front vector is inverted). You can think of it this way. What if the new up vector and the old up vector is parallel. You will rotate the object 180 degrees about the up vector.
so true ... thx!

------------------------------------------------------CCP is fascistic, they even banned www.sourceforge.net

This topic is closed to new replies.

Advertisement