Archived

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

bgbg

rotation matrix

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
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