Jump to content
  • Advertisement
Sign in to follow this  
snooty

Transformation matrix that has no inverse

This topic is 4368 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, How can I overcome the problem of matrices that have no inverses (determinant = 0)? Even very simple transformations may fall victim to it, like: [ 1 0.5 0 ] [ 2 1 0 ] [ 0 0 1 ] which is just a simple 2D skewing. Please help.

Share this post


Link to post
Share on other sites
Advertisement
When you say this is a problem, why is it a problem? I think the bottom line is that you either have to keep or know the original point.

I think if it in terms of loss of information. For example, if you had this matrix M, which is singular (determinant = 0):

M = [ 1 0 0 ]
[ 0 0 0 ]
[ 0 0 0 ]

M throws away Y and Z but keeps X. Once you transform a point using the above matrix, you have "lost" information. You can only go back to the original point in order to get that information back.

It's not so obvious just by looking at your matrix that it is singular, but since the determinant is 0, it means that you can't find the original point given the transformed point.

Share this post


Link to post
Share on other sites
Row1 = [1 0.5 0]
Row2 = [2 1 0]
Row3 = [0 0 1]

What you have here is a sticky situation. The main problem I see is that your transformation is linearly dependent. Specifically Row2 = 2 * Row1. When a situation like this arises, you will not be able to invert the matrix since the matrix will then be singular and you lose information just as Tweduk pointed out.

The only way I can think of to solve this problem is to make sure each row in your matrix is linearly independent if you want to invert the matrix. So you could require any transformations to have this property, then when you go to invert the matrix return an error when you get a singular matrix and handle it gracefully.

Anyhow, any transformation you do will work just fine as long as you don't need to invert and untransform (i guess). Do you really need to get the inverse of any transformation you do?

-Dagbud

Share this post


Link to post
Share on other sites
Are you sure you're going to be dealing with singular transformation matrices that need to be inverted? I instantly think projection matrices, and that's exactly what your example will do, project everything onto a line. Maybe not using the shortest perpendicular distance, but everything will end up on a line nonetheless.

You'll have to make sure that your transformation matrices are invertible before you apply them if you really want to undo them. Any standard transformation matrix should be invertible, or least if it isn't invertible -- such as clip-space to screen-space -- you can make do with a set of untransformed points (i.e. reverse transform a screen-space point into a line).

Share this post


Link to post
Share on other sites
The problem you have is that the matrix isn't a skew matrix, in 2d it maps all points onto the line y = 2x.

Presumably what you want is to do a skew using this matrix:
[ 1 0.5 ]
[ 0 1 ]

followed by this one
[ 1 0 ]
[ 2 1 ]

which results in this matrix (product of the two transform matrices):

[ 2 0.5 ]
[ 2 1 ]

or, if you do them in the opposite order,
[ 1 0.5 ]
[ 2 2 ]

and both of those are non-singular.

[EDIT: Stuck to 2d to make it simpler]

Share this post


Link to post
Share on other sites
Thank you very much for the replies.

I see my wrong concept now.
It looks like nothing should be drawn when the matrix is uninvertible.

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!