Sign in to follow this  

Fast Inverse

This topic is 4554 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 guys. What is the fastest way for find a 3D transform inverse? Such transform is a 4x4 matrix that manages rotations and translations. And, what about if it contains scale too?

Share this post


Link to post
Share on other sites
If you know how the transformation matrix was constructed, you can avoid a general inverse by constructing it in 'reverse'. If the original matrix is (using column vectors):

M = T*R*S

Where T = translation, R = rotation, and S = scale, the inverse is:

M-1 = S-1*R-1*T-1

Each of the inverses on the right has a trivial form (ask if you're not sure what they are). If you really want to optimize, you can write a special function to take advantage of all the zero entries.

If you just have a 4x4 transformation matrix, you can always decompose it into a translation matrix T, and a linear transform, call it L. Then:

M-1 = L-1*T-1

If you know that L only contains rotation, you can just invert it by transposition. Otherwise you'll need a general inverse, but only of the 3x3 linear transform, which is cheaper than a full 4x4 inverse.

[Edit: fixed as per b34r's post.]

[Edited by - jyk on July 1, 2005 7:51:01 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
If you know that L only contains rotation and perhaps uniform scaling, you can just invert it by transposition. Otherwise you'll need a general inverse, but only of the 3x3 linear transform, which is cheaper than a full 4x4 inverse.


Yes, although transposition will only work for a non-scaling rotation matrix.
You can get the scale vector out of the 3x3 matrix by getting the length of each row vector (if you're using row major matrice), from there it's easy to inverse scale aswel.

Share this post


Link to post
Share on other sites

This topic is 4554 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