Jump to content
• Advertisement

#### Archived

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

# 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

##### 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

##### 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

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633416
• Total Posts
3011780
• ### Who's Online (See full list)

There are no registered users currently online

×

## 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!