View Full Version : How to decompose a matrix?

LangFox

03-02-2004, 08:30 PM

Hi everyone,

if given a matrix multiplied by three matrix: scale, rotation and translation, how to decompose it to get the three original matrix? Thank you in advance.

LangFox

03-02-2004, 09:57 PM

It may be like this:

matScale =

| S 0 |

| 0 1 |

matRotattion =

| R 0 |

| 0 1 |

matTranslation =

| A 0 |

| T 1 |

A is the identified matrix.

matScale x matRotattion x matTranslation =

| SxR 0 |

| T 1 |

Now I can get the matTranslation, but how to get matScale and matRotattion from SxR ?

Phil Atkin

03-03-2004, 01:01 AM

OK, strip out the translation from your composite result matrix.

If the scale is uniform I think this will work - pass a unit vector [1,0,0] for example into your composite result matrix matrix, and normalize it to find the incoming scale. Then scale the composite matrix by 1/scale. I *think* you'll be left with the original rotation matrix.

If the scale isn't uniform this is highly unlikely to work!

LangFox

03-03-2004, 02:45 PM

Thank you! I will try it.

Phil Atkin

03-04-2004, 02:28 AM

Note, when I said 'normalize', I *actually* meant determine the radius - if your vector [1,0,0] comes out as [0.5, -0.8, 0.9 ] the implication is a scale of 1.3038, so multiply the matrix by 0.767 to get the original rotation.

Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.