0

I have a coordinate system of XYZ, where I rotate by euler angles, starting with X, then Y, then Z. I need to convert this rotation, to it's equivalent X Y Z rotations, but relative to another coordinate system, as specified by a quaternion orientation. Unfortunately, I am stuck.

Coordinate Axes

Mary Ellen Bench
  • 589
  • 1
  • 8
  • 28

1 Answers1

0

There is no easy way to do this since the Euler angles are only in their infinitesimal version compatibel with the product of the rotation matrices.

The easiest way under the given conditions is to transform the existing angles into the quaternion of the rotation, multiply the two quaternions and extract the new Euler angles from the product.


A useful link collecting many if not all axis-rotation to quaternion and back transformations: http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm


Denote with a,b,c the half angles for the rotations around the X,Y,Z axes, and with (ca,sa) etc. the corresponding cosine-sine pairs. Then the rotation around the X axis with angle 2a corresponds to the quaternion

ca+sa*i

where i,j,k are the basis quaternions in the x,y,z directions. The rotation Rz(2c)*Ry(2b)*Rx(2a) corresponds to the quaternion

r=(cc+sc*k)*(cb+sb*j)*(ca+sa*i)

If q is another unit quaternion, then the rotated basis for the rotation corresponding to q is qiq', qiq', qkq', where q' is the conjugate of q. The aim is to represent r with axis rotations in this new basis. If the new half angles are u,v,w, then one has to solve

r=(cw+sw*qkq')*(cv+sv*qjq')*(cu+su*qiq')

for these half-angles, which simplifies because of qq'=1=q'q to

q'rq=(cw+sw*k)*(cv+sv*j)*(cu+su*i)

Now you can again use the formulas on the web site.

Lutz Lehmann
  • 25,219
  • 2
  • 22
  • 51
  • Heh yeah, it is challenging me, I have been stuck for a while. Unfortunately that link didn't seem to help, seems to be missing the second half? That was euler to quaternion, but how do you go from resulting multiplied quaternion, to euler X then Y then Z angles relative to the quaternion orientation? – Mary Ellen Bench May 06 '14 at 03:18
  • Perhaps the chart at the top is too confusing: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm. Also take a look at the related topics to the right. – Lutz Lehmann May 07 '14 at 15:41
  • Or use the [search facility](http://stackoverflow.com/search?q=conver*+quaternion+euler). – Lutz Lehmann May 07 '14 at 15:47
  • I don't believe pure quaternion to euler will work? Since my eulers need to be relative around original quaternion. Seems like needs to be different than the normal formulas. – Mary Ellen Bench May 07 '14 at 23:18
  • Added comment on how to avoid using rotation matrices. – Lutz Lehmann May 07 '14 at 23:41
  • When you say quaternion cosine/sine pair, how does that translate to XYZW of quaternion? I'm trying to figure out how your formula turns into actual quaternions for that sites formulas. – Mary Ellen Bench May 08 '14 at 23:25
  • i,j,k are the complex unit quaternions, i.e., unit imaginary, anti-commuting and with i*j*k=-1. I did such a computation in http://stackoverflow.com/a/23121093/3088138 – Lutz Lehmann May 08 '14 at 23:30
  • Is there a similar computation using typical quaternions? The math seems to escape me and I don't see any resources on that site about it. – Mary Ellen Bench May 09 '14 at 18:11