Maths - Conversion Matrix to Euler

Definition of terms:

This conversion is better avoided, since it is non-linier and has singularities at + & - 90 degrees, so if already working in terms of matricies its better to continue using matrices if possible.

This depends on what conventions are used for the Euler Angles. The following assumes NASA Standard Airplane

So it we look at the Euler to Matrix conversion we can see that:


m01/m00 = s1 / c1 = tan(heading)
m12/m22 = s3 / c3 = tan(bank)
m02 = -s2 = -sin(attitude)

so this gives:

heading = atan(m01/m00)
bank = atan(m12/m22)
attitude = asin(-m02)

Note this only applies to a martix which represents a pure rotation. The equations for heading and bank should be independent of uniform scaling as it will cancel out in the division. It would be better to find an expression for attitude which is also independent of scaling.

Since there are several ways to produce the same rotation using heading, bank and attitude then the solution is not unique. tan(0) is 0, tan(90 degrees) is infinity, tan(-90 degrees) is -infinity. So the results will depend on whether arctan processes a result between -90 and 90 or 0 and 180.

Issues

Example

we take the 90 degree rotation from this: rightUp to this: rightForward

As shown here the matrix for this rotation is:

[R] =
1 0 0
0 0 -1
0 1 0

So using the above result:

heading = atan(m01/m00) = atan(0) = 0
bank = atan(m12/m22) = atan(infinity) = 90 degrees
attitude = asin(-m02) = asin(0) = 0

As you can see here, this gives the result that we are looking for.

We have to be very careful about the following issues:


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

 

cover Game Programming Gems - Lots of concepts + code - Includes design techniques, Maths, Improving speed, AI, Polygonal techniques, Pixel effects (4 pages on quaternions, nothing on collision detection and response)

cover Game Programming Gems 2 - More on the topics above, includes audio, still nothing on collision)

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.