Jump to content
  • Advertisement


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


Matrix error correction

This topic is 6826 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 everybody Does anybody know what the mathematical process or how to correct for matrix drift or errors. I am using a 4x4 linear matrix such as mat[16]. I read diffrent articles on this subject from diffrent websites. The methods mentioned are dot products and normalization, cross products then normalization and finally matrix to quaternion and the quaternion back to matrix. Even though they mention these methods they never seem to show you the steps of correcting a matrix drift or error. Any examples would be greatly appreaciated. Thanks Doug

Share this post

Link to post
Share on other sites
I'm assuming you're only using rotation and translation. For this setup you only need to error correction to the first 3x3 part of the matrix. This is where the rotation information is stored. I'll tell you one way of error correcting this part:

MATRIX M; // The matrix to be corrected
VECTOR E1,E2,E3; // Three temporary vectors

// Extract the rotation information
E1 = VECTOR(M[0][0], M[0][1], M[0][2]);
E2 = VECTOR(M[1][0], M[1][1], M[1][2]);
E3 = VECTOR(M[2][0], M[2][1], M[2][2]);

// Make sure the vectors are orthogonal and normalized
E3 = Normalize(Cross(E1, E2)); // Make E3 orthogonal to E1 and E2
E2 = Normalize(Cross(E3, E1)); // Make E2 orthogonal to E3 and E1
E1 = Normalize(E1);

// Reinsert the information into the matrix
M[0][0] = E1.x; M[0][1] = E1.y; M[0][2] = E1.z;
M[1][0] = E2.x; M[1][1] = E2.y; M[1][2] = E2.z;
M[2][0] = E3.x; M[2][1] = E3.y; M[2][2] = E3.z;

I hope that clears things up. Remember that CrossProduct isn't commutative so you must make you compute these in the correct order otherwise you'll introduce mirroring in the transformation.

Edited by - Spellbound on 3/14/00 10:26:49 AM

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!