Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top