Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


a simple q about rotating vector

This topic is 5960 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

in red book, it said:
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?

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!