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

This topic is 4270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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.

##### Share on other sites
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 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 on other sites
thanks to both of you, I'll be looking at it more today and hopefully solve my problem.

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

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]

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 19
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631761
• Total Posts
3002177
×