scaling + rotation matrix

Started by
1 comment, last by jtech 21 years, 9 months ago
I have a matrix with scaling and rotation elements multiplied together. How would I remove the scaling components and extract the rotation matrix?
Advertisement
Well, I can think of a solution if you have equal scalings along every axis... actually, I''m not actually sure if this will work because I''ve never tried it, but this is my idea:

you know that a rotation matrix always has a determinant of 1, and you know that a scaling matrix always multiplies the determinant of the matrix it was applied to, by the product of all the scaling factors. So if your scaling factors were sx,sy,sz, then it would multiply the determinant by sx*sy*sz.

So, if you take the determinant of your matrix and you know that the matrix is only a product of a scaling and rotation, you can take the determinant of that, which will be equal to sx*sy*sz. Then if the scalings are equal, you simply divide every number in the rotation matrix by the cube root of the determinant.

If scaling factors are unequal but you know their ratios, then you can algebraically solve for sx,sy, and sz. Then you put those numbers in the matrix:

[[ 1/sx, 0, 0, 0]
[ 0, 1/sy, 0, 0]
[ 0, 0, 1/sz, 0]
[ 0, 0, 0, 1]

and multiply it by the original matrix to yield the rotation matrix.


Hope that helps =)
quote:
you know that a rotation matrix always has a determinant of 1


Interesting, I did not know it had that property.

That''s sounds like the key.

Thanks.

This topic is closed to new replies.

Advertisement