Jump to content
  • Advertisement

Archived

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

bgbg

rotation matrix

This topic is 5374 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

hi, let''s say I have 2 UNIT vectors v1=[a,b,c] and v2=[d,e,f] . Is there a simple way of calculating the rotation matrix for a rotation from v1 to v2? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Check out quaternions. They are fast and easy

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. They who understand binary and those who do not"

Share this post


Link to post
Share on other sites
quote:
Original post by bgbg
hi, let''s say I have 2 UNIT vectors v1=[a,b,c] and v2=[d,e,f] .
Is there a simple way of calculating the rotation matrix for a rotation from v1 to v2?
Thanks in advance

There are an infinite number of such rotations, since a vector is insufficient to express roll. Consider the case of a rolling aircraft; both the "before" and "after" vectors are the same.

If you don''t have to worry about roll, and can define a third "up" vector (or, if you prefer, another cardinal-direction vector), you can use a Gramm-Schmidt orthonormalization (google is your friend) and use the resultant bases as rows of your matrix. gluLookAt does this.


How appropriate. You fight like a cow.

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!