Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Muzzafarath

Use of identity matrix?

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

Can anyone please tell me what the use of the identity matrix is? Multiplying a matrix with the identity matrix just gives the first matrix... Then why would you want to multiply with the identity matrix at all...? It will just take up precious clock cycles It would be like writing int x = 5; x = x; x will be equal to x... I see no point in the identity matrix. /. Muzzafarath Mad House Software

Share this post


Link to post
Share on other sites
Advertisement
You''re quite right in pointing out that there''s no point in multiplying by the identity matrix.

In scalar arithmetic, there''s no point in multiplying by 1 - but no one ever questions the wisdom of having a value of 1 because we intuitively understand why it is useful.

Uniary values can be particularly useful in simplifying mathematical equations, which in turn can make for more efficient and robust code. A trivial scalar example:

x + ax + bx = x(1 + a + b)

So instead of performing two multiplies and one addition, we can perform one multiply and two additions. And the more complex the equation, the more potential for benefit. Now a similar matrix example (N and M have the same dimensions ;->):

A + NA + MA = A(I + N + M)

Trust me - matrix additions are much faster than matrix multiplications. So now you know why the identity matrix is a Good Thing. Similar things can be said about the zero matrix - where would scalar arithmetic be without a zero?

Share this post


Link to post
Share on other sites
Asking "what''s the use for the Identity matrix" is just like asking "what is the use for the number 1.".
Mathematically, they amount to exactly the same thing.
Multiplying by it yields no difference, adding does.

And by the way, most OpenGL implementations are smart enough to bypass matrices if you set them to the Identity matrix, so for instance, if you Identity the projection matrix, it will skip the entire projection stage.
Just an example to show you why it''s useful.


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites
quote:
Original post by MadKeithV

Asking "what's the use for the Identity matrix" is just like asking "what is the use for the number 1.".
Mathematically, they amount to exactly the same thing.
Multiplying by it yields no difference, adding does.

And by the way, most OpenGL implementations are smart enough to bypass matrices if you set them to the Identity matrix, so for instance, if you Identity the projection matrix, it will skip the entire projection stage.
Just an example to show you why it's useful.

Give me one more medicated peaceful moment..
~ (V)^/) /<é!t/-/ ~


I read in some tutorial that "multiplying with the identity matrix is useful because every matrix multiplied with the identity matrix comes out the same". I just can't see why that's useful, but I do see when the identity matrix is useful in your projection example.

I re-phrase my question: why is it useful to multiply a matrix with the identity matrix?

/. Muzzafarath
Mad House Software

Edited by - Muzzafarath on June 22, 2000 7:19:01 AM

Share this post


Link to post
Share on other sites
quote:
Original post by Muzzafarath
why is it useful to multiply a matrix with the identity matrix?




Multiplying with the identity matrix isn''t usefull (tutorials don''t say always the truth), but it''s useful for other things, Osc explained it.


Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites
Just pointing out a small error in Osc equations :

A + NA + MA = A(I + N + M) // Wrong

A + NA + MA = (I + N + M)A // Right

It doesn''t look like there is a difference, but believe me there is. With matrices you have to be careful in what order you multiply them.

Another use for the identity matrix is when you want to invert a matrix. When inverting you are in fact solving the following equation:

A-1A = AA-1 = I





- WitchLord

Share this post


Link to post
Share on other sites
Cheers, WitchLord! That really was a silly error...

Still, that''s the price for taking a 5 minute helldesk call in the middle of writing an equation. (no, that''s not a typo ;->)

I remember doing some work on using the identity matrix to find the inverse of a given matrix a while ago. The details are now a haze, but I recall that this is a very efficient process and helps to solve numerous problems the require a matrix inverse, such as some common problems in 3D graphics.

Share this post


Link to post
Share on other sites
quote:
Original post by Muzzafarath
It would be like writing

int x = 5;
x = x;

x will be equal to x... I see no point in the identity matrix.




I''m not so sure about x will be equal to x.. I read in the C Faq that the results are undefined if the variable is being referenced and dereferenced.

Share this post


Link to post
Share on other sites
Eh eh, try this one, an error I had in my engine just the other day:
float x = 1.0f;
int y = x/0.1f;
y = .... 9!!!!!!!!!


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites

  • 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!