Jump to content
  • Advertisement
Sign in to follow this  
rfterdarc

affine decomp

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

This has prob been asked before... If i have: M = ScaleMatrix * RotationMatrix * TranslationMatrix (Left Handed) How can i extract the scale vector, rotation quat? (translation vector is obvious)

Share this post


Link to post
Share on other sites
Advertisement
The scaling factors are the sizes of the heterogeneous vectors constituting the top-left 3x3 block. Dividing these vectors so that each is unitary, you're left with a rotation matrix. For (a column-vector) example:

The rotation-scaling-translation matrix:
a11 a12 a13 a14
a21 a22 a23 a24
a31 a32 a33 a34
0 0 0 1
Translation vector = (a14, a24, a34)

The rotation-scaling matrix:
a11 a12 a13 0
a21 a22 a23 0
a31 a32 a33 0
0 0 0 1
XScale = sqrt(a11² + a12² + a13²)
YScale = sqrt(a21² + a22² + a23²)
ZScale = sqrt(a31² + a32² + a33²)

The rotation matrix:
a11/XScale a12/XScale a13/XScale 0
a21/YScale a22/YScale a23/YScale 0
a31/ZScale a32/ZScale a33/ZScale 0
0 0 0 1
Now, calculating the rotation quaternion is a little more involved, so I'll link you to this FAQ.

Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!