Sign in to follow this  

uncombining transformation matrix

This topic is 2790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by sock_monster
wow 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this