# Rigid 3D matrix to Euler angles problem

• Feb 7th 2013, 05:31 AM
Markiki
Rigid 3D matrix to Euler angles problem
Hello all,

I'm working with 3D objects and I need to transform one into another space.
To do so, I have the rigid 3D transformation matrix but I need the corresponding Euler angles because the software I use (and I must use this soft) only takes Euler angles as input.
I did it successfully several times, however, I am now stuck with one matrix I do not manage to convert correctly to Euler angles.
I tried several methods which return different angles but when I convert these obtained angles back to rigid 3D matrix it is almost as the input but not exactly: some value are inverted or moved to another position.
I don't think my matrix is a case of Gimbal lock...

I would really appreciate some help to solve this mystery!

Here is the input rotation matrix:

0.8903889 0.0212530 0.4547048
0.0601415 -0.9956453 -0.0712306
-0.4512115 -0.0907696 0.8877891
-71.127601 67.851913 786.39953

Thanks,

Mark
• Feb 7th 2013, 03:16 PM
chiro
Re: Rigid 3D matrix to Euler angles problem
Hey Markiki.

For this you will need to use a numeric solver routine to get the Euler angles. Are you familiar with these routines?
• Feb 7th 2013, 10:47 PM
Markiki
Re: Rigid 3D matrix to Euler angles problem

I'm affraid I'm not familiar at all with these routines.
Are they necessary because I'm facing a special case? Because for other matrices I had in the past I didn't need them...
Would you briefly explain the method?

Thanks again!
• Feb 7th 2013, 11:38 PM
chiro
Re: Rigid 3D matrix to Euler angles problem
Basically if your matrix is a rotation matrix, it will involve three angles that correspond to the Euler angles, and you will have three sets of equations in three variables that involve sines and cosines.

What you do is use a numerical root finding algorithm to get the three angles and then you have your answer.

Basically a root finding algorithm is a general algorithm for solving f(x) = 0 for a general f(x). You will have three of these: one for each Euler angle and then you solve them all and get an approximate value for the angles which you can use elsewhere.

So in short you will after arranging, obtain f(x) = 0, g(y) = 0 and h(z) = 0 for Euler angles x,y,z and then using something like the Bisection Method or Newton Rhapson, you get an approximate x', y', z' where f(x') ~ 0, g(y') ~ 0 and h(z') ~ 0 (~ means approximate).