[connect.audit] Errors in rotations

peterl@ibmpcug.co.uk (Peter Leaback) (01/03/90)

[this message has been re-posted because it did not reach some sites]

At the moment,I define my rotations as a 3x3 matrix containing 16 bit
fixed point numbers from 1 to -1. The problem I face is that after a few
thousand rotations,the errors that occur in combining rotations has
malformed the matrix. In fact, the matrix then becomes a scaling matrix
and reduces the size of the rotated object.

What I require is some method of keeping the errors from amplifying. I
have been told there are methods of reconstructing rotation matrices. But
I have also been told that reconstructing a rotation matrix is costly in
processor time,so microcomputer flight simulators that use this method
can only afford to reconstruct the rotation matrix every 500 or 1000
rotations. This method is undesirable because at the point where
reconstruction of the matrix occurs, the object visibly jolts back into
shape.

What I would prefer (and some flight simulators use) is a method that
after every rotation the matrix is nudged back into shape.

I did think of using a method where the rotation is defined as x,y,z
degrees from the axes. This would mean that any errors that occur would
only affect the angles through which to rotate and NOT malform into any
other geometrical transformation. The problem with this data structure is
that combining two rotations defined as x,y,z degrees is very costly on
processor power and requires 2 divisions.

*ANY* comments on how to solve my problem would be greatly appreciated.

Regards,Pete Leaback.
-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.

wrf@mab.ecse.rpi.edu (Wm Randolph Franklin) (01/04/90)

In article <1990Jan2.163405.24094@ibmpcug.co.uk> peterl@ibmpcug.co.uk (Peter Leaback) writes:
>
>At the moment,I define my rotations as a 3x3 matrix containing 16 bit
>fixed point numbers from 1 to -1. The problem I face is that after a few
>thousand rotations,the errors that occur in combining rotations has
>malformed the matrix. In fact, the matrix then becomes a scaling matrix
>and reduces the size of the rotated object.

One of the graphics texts (either F&vD or N&S) mentions in 2D perturbing
the matrix so that its determinant is exactly  1 before applying it.  At
this point it's not exactly a rotation matrix but apparently that's less
important than a non one det, since that is a scaling.

My idea would be to have a sequence of  rotation matrices for bigger and
bigger angles, that  is  a  matrix for  t,  5t,  9t, etc.    Then  after
compounding the t  matrix 4 times, apply  the 5t matrix to the  original
data, then apply the t matrix to  that result several  times, etc.  This
shouldn't be too expensive and if done right, there  would be no visible
jumps.

Another method would be to rotate in a different coordinate system, such
as one  with the axis of rotation   the Z axis.   Here the  errors would
accumulate  more slowly.  After  compounding the rotations  transform to
the desired coordinate system.  This means you  would apply two matrices
for each rotation.

-- 
						   Wm. Randolph Franklin
Internet: wrf@ecse.rpi.edu (or @cs.rpi.edu)    Bitnet: Wrfrankl@Rpitsmts
Telephone: (518) 276-6077;  Telex: 6716050 RPI TROU; Fax: (518) 276-6261
Paper: ECSE Dept., 6026 JEC, Rensselaer Polytechnic Inst, Troy NY, 12180

peterl@ibmpcug.co.uk (Peter Leaback) (01/06/90)

[this message has been resent because of CONTUNUEING problems at my end]

Many thanks to everyone who has replied by mail and here.

I think the most promising method i will follow up is a mixture of
Quaternions and normal rotations.

If i define my rotations as a Qaternion this poses another problem for
me, that of movement.I would need to extract something approaching a
direction vector from the Quaternion. This was simple with a rotation
matrix because i would just pick up the Z vector of the matrix and
multiply this with the speed to get the velocity. The Z vector of the
matrix can be found from a Quaternion but this requires 6 multiplications
which invalidates the speed advantage of Quaternions.

Would it be possible to use the vector part of the Quaterion as the
direction vector of the object ?

Peter Leaback.

-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.