Jump to content
  • Advertisement


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


Matrix Question

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

Hey, it''s me again. Finally understand what needs to be done to get texture projection working, and one of the most important steps is getting the reverse of the modelview matrix..... I''ve tried reversing the transformations I perform on the modelview matrix (and putting them in the texture matrix, of course), and it looks alright, but whenever the camera rotates, the spotlight sort of moves a little.... I''ve also tried using the transpose of the modelview matrix, but it must not be completely orthogonal, so it gives the same sort of wonky effect on the spot light..... I guess I need to take the true inverse of the modelview matrix, but I''m yet to find some decent code to find the inverse of a matrix... can anyone help? Or does anyone have any cool tricks to quickly finding the inverse of the modelview matrix? -Mr.Oreo

Share this post

Link to post
Share on other sites
Matrix A is a 3x3 Matrix, it's composed of the followind elements: A[3][3]{{a, b, c}, {d, e, f}, {g, h, i}};

The inverse of Matrix A or A^-1 is as follows:

A^-1 = (1\|A|) * {{e*i-f*h, -(b*1-c*h), b*f-c*e},
{d*h-e*g, -(a*h-b*g), a*e-b*d}} /*this is a 3x3 matrix */

When |A| is the determinant of A or:

det(A)= a(e*i-f*h) - b(d*i-f*g) + c(d*h-e*g)
finding the determinant that way is called expansion by minors (2x2 matrices within the 3x3).

Sorry I couldn't show you in chalkboard matrix notation.

remember that (1\|A|) is a scalar.

[edited by - Californium on January 20, 2003 1:59:38 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
good lord, what happened to their gaussian elimination?? i once wrote a rout that was 4 times as small.. the stuff for cramer''s rule seems okay, tho.


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!