Jump to content
  • Advertisement

Archived

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

_walrus

Coordinate axis factoring of a rotation matrix

This topic is 5840 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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!