Maths - Conversion Quaternion to Euler

By: Nobody/Anonymous - nobody
file Quaternion to Euler Angles slight correction  
2006-02-24 07:14

Hello, 
 
First, congratulations on your excellent 3D maths site! It's been really useful, thanks a lot =) 
 
Now, on this page: https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm 
 
When you consider the singularity at attitude -90 degrees, you ask: 
 
" have I made an error here? in the examples it seems to require: heading = -2 * atan2(x,w) " 
 
Actually, there is a problem with the atan2 arguments. Here: 
 

w = -z = 0.7071(c(1-3)) 
-x = y = 0.7071(s(1-3)) 
 
(...) 
 
w = -z = 0.7071(cos((heading-bank)/2)) 
x = -y = 0.7071(sin((heading-bank)/2)) <-- error 
 
(...) 
 
heading-bank = 2 * atan2(x,w) <-- resulting error 

 
The marked line should read "-x = y = 0.7071(sin((heading-bank)/2))", resulting in  
 
"heading-bank = 2 * atan2(-x,w)" 
or 
"heading-bank = 2 * atan2(y,w)" <-- would be nice to change both (heading+bank) and (heading-bank) expressions to this one 
 
Should work fine then! 
 
Vitor Barata


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 If you are interested in 3D games, this looks like a good book to have on the shelf. If, like me, you want to have know the theory and how it is derived then there is a lot for you here. Including - Graphics pipeline, scenegraph, picking, collision detection, bezier curves, surfaces, key frame animation, level of detail, terrain, quadtrees & octtrees, special effects, numerical methods. Includes CDROM with code.

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

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