Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!aipdc From: aipdc@castle.ed.ac.uk (Paul D. Crowley) Newsgroups: comp.graphics Subject: Cumulative error in rotation matrices Summary: How do I correct cumulative errors in matrices? Keywords: matrices, errors, aipdc@castle started this thread Message-ID: <7386@castle.ed.ac.uk> Date: 29 Nov 90 20:39:43 GMT Distribution: comp Organization: Edinburgh University Computer Services Lines: 37 I'm writing a program that uses interactive graphics. It has a matrix M that represents the way you're facing, and applies it to every point in the scene before dividing by the depth and plotting the point on the screen. When I want to do a new rotation, I generate a matrix for that rotation which looks something like ( cos x sin x 0) A = (-sin x cos x 0) ( 0 0 1) I then do the matrix multiplication AM and place the result in M. My problem is that M is gradually getting further and further from being a rotation. Since the value for cos(x) is not exact, the matrix A is not exactly a rotation but a rotation followed by some other (small) transformation. But since M is multiplied by one of these very often, these small transformations build up, and the image becomes skewed in lots of nasty ways. What I'd like to do is apply some sort of process to M every so often that brings it back into line, ie that finds the rotation which M is closest to and changes it into that. But I have no idea what form what rotations will take. Incidentally, if it makes a difference, I lied a little bit up there: M is actually 4x4 since I'm operating on four-dimensional scenes. Solutions for three dimensions would also be appreciated, though. If anyone else is interested in this, mail me a "me too!" message. I'll forward everything I get to you, unless I get enough of them, in which case I'll summarise (and summarise properly, I promise) to the net. advaTHANKSnce -- \/ o\ Paul Crowley aipdc@uk.ac.ed.castle /\__/ "Trust me, I know what I'm doing" - Sledge Hammer Brought to you by Super Global Mega Corp .com