Jump to content
  • Advertisement
Sign in to follow this  
leoptimus

Fast Inverse

This topic is 4768 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!