   uncombining transformation matrix
  Hi,This is probably a real stupid question, but I'm really really confused! I have the usual setup, a simple scenegraph with each node containing a float for uniform scale, a 3X3 matrix for rotation a 3X1 vector for translation, and finally a 4X4 matrix which holds the world transformation. As I traverse my scenegraph I calculate each nodes world transform by combining it's local transform data with the world transform of it's parent node.How do I reverse the process? I can easily get the translation vector back but how do I turn the rotational/scale part of the world transformation matrix into a single 3X3 rotation matrix and a single float for my uniform scale?Sorry if this question gets asked all the time, I have looked around but just don't understand how to do this.Thanks in advance.   
  You can extract the scale as the magnitude of the three columns in the upper 3x3 submatrix, then multiply by the inverse of that to get the rotation. But why would you want to do this? It's rarely a useful thing to do.   ;  wow that was a quick reply, thanks :)It's easier to think of transformations as three separate operations, well for me anyway. But it's easier to combine transformations when they are stored in one 4X4 matrix. It seems more elegant to use two 4X4 matrices (one for local transform and one for world transform) instead of splitting the local transform into a float, a 3X3 matrix and a vector and storing the world transform as a 4X4 matrix. I just wanted to know how I can extract all the info I would normally have separately from a 4X4 transform matrix.I read something about having to use polar decomposition to obtain the rotation and scaling info, which scared and confused me! But I guess that's only if you have non-uniform scaling???Thanks again for the quick reply ;)   ;Quote:Original post by sock_monsterwow that was a quick reply, thanks :)It seems more elegant to use two 4X4 matrices (one for local transform and one for world transform) instead of splitting the local transform into a float, a 3X3 matrix and a vector and storing the world transform as a 4X4 matrix.More elegant as viewed from the header file, I suppose. Less elegant in that you'd be perpetually tearing apart your transform, tweaking it a bit, and putting it back together. A 4x4 matrix is not a suitable representation for updating transformations.Quote:I read something about having to use polar decomposition to obtain the rotation and scaling info, which scared and confused me!What I described IS the polar decomposition, for the special case of orthogonal real matrices. And it'll work fine with non-uniform scaling.   ;  I'm finding that out first hand right now! It's way easier to keep them separate and combine later :)Thanks again;  What I've found is that matrix decomposition is useful when you need to output a particular transform to a human, such as in a debugging tool, or a game design tool.  For this reason alone, having a good decomposition procedure is handy.  Other than interfacing with humans, keep the transform in a more compact form, such as a 4x4 matrix, or as {scale vec, rotation quat, translate vec} which simplifies a lot of blending operations. If you aren't going to be doing a lot of blending, you should really just use matrices.   