Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Decompose a matrix in 5 matrices (rotation, scaling and translation)

20 views
Skip to first unread message

tirengarfio

unread,
Sep 5, 2006, 7:59:18 AM9/5/06
to
Decompose a matrix in 5 matrix
Hi,

I have a 4x4 matrix that i would like to decompose in 5 matrices.

The four matrices that compose it are these:

Translation matrix:

tx, ty and tz represent our translation values.
Code:

[ 1, 0, 0, 0]
[ 0, 1, 0, 0]
[ 0, 0, 1, 0]
[tx, ty, tz, 1]


The Rotation Matrix:

Rotation on X Axis.


Code:
[ 1, 0, 0, 0]
[ 0, cos(xrot), -sin(xrot), 0]
[ 0, sin(xrot), cos(xrot), 0]
[ 0, 0, 0, 1]


Rotation on Y Axis.


Code:
[ cos(yrot), 0, sin(yrot), 0]
[ 0, 1, 0, 0]
[-sin(yrot), 0, cos(yrot), 0]
[ 0, 0, 0, 1]

Rotation on Z Axis.

Code:

[ cos(zrot), -sin(zrot), 0, 0]
[ sin(zrot), cos(zrot), 0, 0]
[ 0, 0, 1, 0]
[ 0, 0, 0, 1]

The Scale Matrix:

sx, sy and sz represent our scale values.


Code:
[ sx, 0, 0, 0]
[ 0, sy, 0, 0]
[ 0, 0, sz, 0]
[ 0, 0, 0, 1]


As some told me in this thread, there is no problem to get the Translation matrix, just multiplying the original matrix by
Code:

[0]
[0]
[0]
[1]

But how can i get the other 4 matrices??

Sylvain Croussette

unread,
Sep 5, 2006, 12:49:23 PM9/5/06
to
tirengarfio wrote:
> Decompose a matrix in 5 matrix
> Hi,
>
> I have a 4x4 matrix that i would like to decompose in 5 matrices.
>
> The four matrices that compose it are these:
>
>

etc...

The book Graphics Gems 2 has an algorithm to do this, in section VII.1
Decomposing a matrix into simple transformations. There is code here
that is supposed to implement it (I haven't checked it personally):

http://www.acm.org/pubs/tog/GraphicsGems/gemsii/

The files you'll need are unmatrix.c, unmatrix.h and GraphicsGems.h

0 new messages