# Thread: concatenation of two rotations

1. ## concatenation of two rotations

What is the resulting rotation of the concatenation of two rotations ?

A rotation R is given by its rotation axis (x,y,z) and its rotation angle alpha.

Mathematically a rotation R can be realized by a rotation matrix M.
(x,y,z) and alpha are coded into this matrix.

Now: Given are two rotations
R0 with (x0,y0,z0) and alpha0 and
R1 with (x1,y1,z1) and alpha1.
The concatenation of two rotations R0 and R1 is represented
by the matrix product M of the corresponding rotation matrices M0 and M1,
ie. M = M1*M0 .

Question 1: Is the concatenation of two arbitrary rotations always a rotation ?
(I think so.)

Question 2: How can I compute exactly
the rotation axis (x,y,z) and the rotation angle of M ?

My solution: First step: Use OpenGL to compute M:
double M [16] ;
glMatrixMode ( GL_MODELVIEW) ;
glPushMatrix () ;
glRotated ( alpha1 , x1 , y1 , z1 ) ;
glRotated ( alpha0 , x0 , y0 , z0 ) ;
glGetDoublev ( GL_MODELVIEWMATRIX , M ) ;
glPopMatrix () ;
// second step: use M to compute (x,y,z) and alpha.

In the second step I analysed M several ways.
But numerical problems and special cases give unsatisfactory results.

2. ## Re: concatenation of two rotations

Yes, the concatenation of rotations is always a rotation. The only thing to note here is that you may accumulate numeric errors when multiplying matrices too often, so the result degenerates.

I think you should look into quaternions.

The axis/angle representation and the quaternion representation is nearly the same. A quaternion that represents a rotation is (cos(a), x*sin(a), y*sin(a), z*sin(a)) for a normalized rotation axis.

You can then concatinate the rotations directly in quaternion representation and extract the new axis/angle without converting to a matrix. Also it should not be hard to find matrix<->quaternion conversion code in the web...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•