#### Archived

This topic is now archived and is closed to further replies.

# Rebuilding matrices

## Recommended Posts

Lightrocker    148
I have given a 4x4 matrix for vertex and normal transformation and want to receive a possible set of the scaling, rotation and translation matrices. The multiplication of those matrices should result in the given matrix. Are there code samples, tutorials or similar, that show an optimized way of rebuilding the matrices with the computer? M(Transformation) = M(Scaling) * M(Rotation) * M(Translation) M(Transformation) is given. I want to get ONE possible set of M(Scaling), M(Rotation) and M(Translation).

#### Share this post

##### Share on other sites
Timkin    864
quote:
Original post by Lightrocker
I want to get ONE possible set of M(Scaling), M(Rotation) and M(Translation).

There are an infinite number of possible scaling, rotation and translation operations that equate to a given transformation. How do you choose one from an infinite set? You need to offer some constraints and then the problem is one of constraint satisfaction.

Cheers,

Timkin

#### Share this post

##### Share on other sites
Lightrocker    148
To get one of the possible sets, some good constant values should be used. Only the resulting set has to be always the same, if the given matrix is.

Is there still a problem?

[edited by - Lightrocker on October 8, 2002 5:22:47 AM]

#### Share this post

##### Share on other sites
Zipster    2365
Well, "good constant values" is quite subjective I like 0 or 1 because things tend to either disappear or stay the same, but that's just me

You need a system of equations to solve this. Let's write it like this:
Transformation  Scaling       Rotation      Translation      |             |            |              |[ A B C 0 ]   [ J 0 0 0 ]   [ M N O 0 ]   [ 1 0 0 0 ][ D E F 0 ] = [ 0 K 0 0 ] * [ P Q R 0 ] * [ 0 1 0 0 ][ G H I 0 ]   [ 0 0 L 0 ]   [ S T U 0 ]   [ 0 0 1 0 ][ 0 0 0 1 ]   [ 0 0 0 1 ]   [ 0 0 0 1 ]   [ V W X 0 ]

You have the values for A - I, so you can create a system of equations However, you will soon realize that you less equations than unknowns. Thus, you need more constants. K.I.S.S, so chose something like the identity matrix for the scaling, etc.

[edited by - Zipster on October 8, 2002 12:46:52 PM]