Matrix decomposition

Started by
7 comments, last by alvaro 9 years, 2 months ago

Hey guys!

Quite simply, I was wondering if I maintain a transformation matrix of translations, scalings and rotations and also another one with just the rotations - could I extract the correct resulting scale and possibly translation if I multiply the combined matrix by the inverse rotation matrix? I have a feeling the math might not be that simple, but I'm just not sure. Thanks in advance!

Advertisement

Please look at my post here since it handles simple decomposition as well as its requisites.

EDIT: To talk about your approach:

When using row vectors, the combined matrix written as composition looks like

S * R * T

If you multiply with the inverse rotation on the local side you get

R-1 * S * R * T

and on the global side you get

S * R * T * R-1

so none of this produces the result you are expecting.

Thanks haegarr! That is a beautifully comprehensive explanation. So I gather that in order for an inverse transformation to have a directly inverse effect, it had best be applied right next to the original transformation, on either side like R-1 * R * S * T or S * T * R * R-1?

As long as you don't want to interpret it w.r.t. extra-ordinary rotation center and/or scale axes and center, this means to have the equivalence

I am just a bit unclear about this part. Is the transformation application order important for this decomposition method to work?


[...]So I gather that in order for an inverse transformation to have a directly inverse effect, it had best be applied right next to the original transformation, on either side like R-1 * R * S * T or S * T * R * R-1?

Yes, because for any matrix M

M * M-1 = M-1 * M = I

and

M * I = I * M = M

so you have e.g.

R-1 * R * S * T = ( R-1 * R ) * S * T = I * S * T = S * T

However, notice that R * S * T is an order one usually don't want to use, because scaling appears in the rotated (if using row vectors) space, so that the axes of scaling are not what one probably expects, or else scaling appears in the translated (if column vectors are used) space, what means that the center of scaling is not where one probably expects. See below for details.


I am just a bit unclear about this part. Is the transformation application order important for this decomposition method to work?

What I meant here is that the composed matrix is defined to be (still using row vectors)

S * R * T

what means that center and axes of scaling and center of rotation is not freely available.

You can use other compositions, too. For example in X3D a transform is defined as

C-1 * A-1 * S * A * R * C * T

where C denotes the center of scaling and rotation, and A denotes the axes (in form of a rotation) of scaling. Decomposing such a matrix means to not only look for S, R, and T, but also for C and A and hence is more complex than what I have shown.

Can someone explain to me why we need non-uniform scalings at all? They are not an intrinsic class of transformations, meaning that whether something is a scaling or not depends on the choice of coordinates. That ultimately creates a lot of problems, of which this thread is an example.

Fantastic! I'm currently using SRT-transformed mesh hierarchies in a game, and this should help me extract the information needed to form matching collision volumes. You have my gratitude :)


Can someone explain to me why we need non-uniform scalings at all?

Perhaps I don't understand your point. Non-uniform scaling works nicely for objects that "grow" more in one direction than another - e.g., a circus balloon that, during inflation, grows longer at a greater rate than the diameter. EDIT: Or Pinocchio's nose wink.png

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

[... ]I'm currently using SRT-transformed mesh hierarchies in a game, and this should help me extract the information needed to form matching collision volumes. [...]

Notice that the transform definition you used originally to calculate the overall matrix plays no role here. The both compositing schemes I've shown above are to be understood as prescriptions for the de-composition, i.e. which matrices occur with what meaning. You can trouble-freely build a matrix by SRT and decompose it using the X3D scheme and vice-versa.

Can someone explain to me why we need non-uniform scalings at all?


Perhaps I don't understand your point. Non-uniform scaling works nicely for objects that "grow" more in one direction than another - e.g., a circus balloon that, during inflation, grows longer at a greater rate than the diameter. EDIT: Or Pinocchio's nose wink.png


So when you read in the model you can apply some arbitrary transformation to it, but then all the other transforms (model to world world to camera, limb to limb...) just need rotation and translation. Let's call the composition of a rotation and a translation a movement. The composition of several movements is still a movement. But if you throw in scalings, you now have to operate with the larger class of arbitrary affine transformations.

This topic is closed to new replies.

Advertisement