winnie

10-15-2005, 06:42 AM

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 () ;

glLoadIdentity () ;

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.

Thank you in advance.

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 () ;

glLoadIdentity () ;

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.

Thank you in advance.