# 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

http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/euleranglestoquaternions.shtml

This shows the angles being divided by 2.

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

https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm

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.

HTH

Mark

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

Martin

----- 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
> https://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQua
> 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 -
> http://www.rust.net/~kgeoinfo/quaternion.txt). 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
> http://mathworld.wolfram.com/EulerParameters.html
>
> I get wrong answers interestingly enough.
>
> Best Regards,
>
> Mark
>