I need to separate the x,y and z rotation components out of a matrix which contains no scaling factor. Therefore I found this website:

www.robertblum.com/articles/category/math/

I tried to implement it that way, but when I use the three results to create the same matrix again, I don’t get the original matrix back - some values are (more than slightly) different or with inverted sign.

Probably I just did a mistake. If anyone can fix it out of this code:

```
rotVals.x = atan2( m_fMVMatrix[9], m_fMVMatrix[10]);
rotVals.y = asin( -m_fMVMatrix[8] );
rotVals.z = atan2( m_fMVMatrix[4], m_fMVMatrix[0]);
GLdouble mat[16] =
{ cos(rotVals.y)*cos(rotVals.z),
(cos(rotVals.z)*sin(rotVals.x)*sin(rotVals.y)) - (sin(rotVals.z)*cos(rotVals.x)),
(cos(rotVals.x)*cos(rotVals.z)*sin(rotVals.y)) + (sin(rotVals.x)*sin(rotVals.z)),
0,
cos(rotVals.y)*sin(rotVals.z),
(sin(rotVals.x)*sin(rotVals.y)*sin(rotVals.z)) + (cos(rotVals.x)*cos(rotVals.z)),
(cos(rotVals.x)*sin(rotVals.y)*cos(rotVals.z)) - (sin(rotVals.x)*cos(rotVals.z)),
0,
-sin(rotVals.y),
-sin(rotVals.x)*cos(rotVals.y),
cos(rotVals.x)*cos(rotVals.y),
0,
pos.x,
pos.y,
pos.z,
1.0
};
```

it would be great!