Archived

This topic is now archived and is closed to further replies.

Coordinate axis factoring of a rotation matrix

This topic is 5496 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Assuming there there is just rotations specfied in a transformation how does one factor it into the product of three coordinate axis rotation Rx*Ry*Rz. I have an algorithm which i believe works but its not quit giving me correct results :
inline    void getFactoredCoordinateAxisRotationDegreesIntoArray(double* theta) {
        //Factor as RxRyRz, assumes that axiss are orthanormal
    
        double thetaY = asin(m31);
        theta[1] = thetaY;
        if (thetaY < PI/2.0f) {
            if (thetaY > -PI/2.0f) {
                theta[0] = atan2(-m32, m33);
                theta[2] = atan2(-m21, m11);
            }
            else {
                theta[0] = -atan2(m12, m22);
                theta[2] = 0.0f; 
            }
        }
        else {
            theta[0] = atan2(m12, m22);
            theta[2] = 0.0f;
        }
    }
thanks

Share this post


Link to post
Share on other sites
the Factored rotations for matrix
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
1.000000 0.000000 0.000000 0.000000
0.000000 0.000000 0.000000 1.000000

are 0.000000 89.999995 0.000000 about the x y z axis repectively, but as we can see this is not true. I''m not sure why this case is not working for my algorithm. Any ideas as to why this specfic matrix breaks the algorithm

Share this post


Link to post
Share on other sites
Dave Eberly''s reference should help:

http://www.magic-software.com/Documentation/EulerAngles.pdf

See Section 2 "Factoring Rotation Matrices". Better yet, download his code, MgcMatrix.*, and use his implemented methods ToEulerAnglesXYZ(...), etc.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites