Sign in to follow this  
SweetToothKane

Is it possible to separate rotation and scale in a matrix?

Recommended Posts

It's pretty easy for a matrix that you know was originally constructed from a rotation and uniform scale - just take the columns / rows of the matrix and treat them as 3-vectors and find their length. If the matrix is constructed from a rotation and uniform scale all the lengths should be the same to within a small tolerance. The length is the scale and if you divide through by the scale you get back the original rotation matrix. The same principle applies for non-uniform scale but you have a different scale on each axis and you also then have to know whether the scale or the rotation was applied first.

Share this post


Link to post
Share on other sites
I think this will be better discussed in 'Maths & Physics' - moved. [smile]

For a DirectX-oriented 'answer' you might want to look at the various D3DX maths functions; I don't have my docs to hand, but I'm pretty sure there are some decomposition functions that can break down an arbitrary matrix into the component SRT parts...

hth
Jack

Share this post


Link to post
Share on other sites
Ok, an update. I found a DirectX function (D3DXMatrixDecompose) which just takes the matrix and outputs three matrices (S, R, T). So I am pretty sure this will work and again want to thank both of you guys.


ADDITION EDIT:
http://www.robertblum.com/articles/category/math/

I found that link after I discovered the D3DXMatrixDecompose didn't work properly with my matrices. After testing the methods presented in this article (tested Scaling and Z-Axis rotation) it appears to work great, with one exception. The angle returned was negative as opposed to positive like it was applied in.

[Edited by - SweetToothKane on November 10, 2006 6:34:58 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this