Is it possible to separate rotation and scale in a matrix?
After they have already been combined, is it possible to separate them into two separate matrices? If so, links or descriptions on how would be appreciated.
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.
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
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
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement