Maths - RE: Conversion Quaternion to Euler

From: "Mark Elson"
To: "'Martin.Baker'"
Subject: RE: Euler to Quaternion
Date: 19 December 2002 14:11

Hi Martin,

Turns out a reference is on the Mathworks site at

This shows the angles being divided by 2.

On another point with regard to the quaternion to euler conversion on

I have found, in C++ and Excel, anyway that the atan2(x,y) works better
than atan(x/y) when attitude is greater than 90.

With atan if you put an attitude of 100deg in you get an attitude of
80deg (correct) but will heading and bank at zero (wrong).
Atan2 switches the heading and bank to 180 deg when attitude > 90deg
which is correct.



-----Original Message-----
From: Martin.Baker
Sent: 18 December 2002 18:56
To: Mark Elson
Subject: Re: Euler to Quaternion

Hi Mark,

Yes, I think you are right, looking at William's proof he has used
lower case (c1) to denote the cosine of angle/2 and upper case (C1) to
denote cosine of angle without dividing by 2.

Therefore I have changed the web page to show that in the formulae at
the top then the angles are divided by 2. In the code snippet the angles
are not divided by two. William's proof shows these are equivalent.

Please could I include your message on the site to warn others that
there is an issue. Please do let me know what you find, if you do work
it out yourself from first principles I would very much like to include
that on the site.

I haven't checked Wolframs page yet, I suspect they may be using a
different set of euler angles. It is a real nightmare not having a
standard definition for euler angles.

Thanks for letting me know about this,


----- Original Message -----
From: "Mark Elson"
Sent: Wednesday, December 18, 2002 4:11 PM
Subject: Euler to Quaternion

> Hi Martin,
> Great web-site.
> I'm not sure that one set of formulae is correct for the Euler to
> Quaternion conversion though
> On
> te
> rnion/index.htm
> You have
> w = e0 = c1c2c3 + s1s2s3
> x = e1 = c1c2s3 - s1s2c3
> y = e2 = c1s2c3 + s1c2s3
> z = e3 = s1c2c3 - c1s2s3
> Where c1 = cos(heading) etc.
> I believe this should be c1 = cos(0.5*heading) and so on for the rest.
> I haven't been through William's proof yet and I'm struggling to find
> a definitive reference without working it out myself (I had a ref from

> a web-site but the link has expired -
> If I do find something
> I'll let you know though.
> When I implement code as per your web-page I get double the rotation I

> expect. This is correct using half-angles in place of the Euler angles
> BTW, when I implemented code exactly as per Wolframs page
> I get wrong answers interestingly enough.
> Best Regards,
> Mark

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-2017 Martin John Baker - All rights reserved - privacy policy.