I have been given a system (A) in which X is right, Y is up, and Z is near.

I must convert it to a system (B) in which X is forward, Y is left, and Z is up.

In system B, I am interested in a quaternion given in system A. I would like to convert the rotation represented by the quaternion in system A into the equivalent rotation in system B.

When I simply observe the system A quaternion in system B without changing any axes, yaw is yaw, pitch is roll, and roll is pitch. However, when I switch the Y and X axes, I get strange behavior. When facing north, the system becomes inconsistent. Pitch is pitch when facing north, but pitch is yaw when facing west, pitch is negative pitch when facing south.

I need to switch pitch and roll with each other, but it seems that accomplishing this in quaternion representation is not as simple as switching the x and y axes.

How can I convert from this left-handed coordinate system to my right-handed coordinate system and set my quaternion appropriately?

Please comment if my question is confusing. I'll do my best to clarify.

  • $\begingroup$ I am confused by your description. I am interpreting "near" as "coming out of the paper towards me" and "forward" as "going into the paper". With that description, these are both right-hand systems. (and up/down/left/right as directions on the paper.) $\endgroup$ – rschwieb Apr 28 '17 at 16:57
  • $\begingroup$ You're right! I got confused. Both systems are right handed, I suppose I just need to rotate between them. $\endgroup$ – Nate Gardner Apr 28 '17 at 21:20

What you need is a reflection and luckily those are still easy with quaternions.

For any unit length quaternion $n$ with real part zero, $n^2=-1$, and the transformation $q\mapsto nqn$ is a reflection in the plane normal to $n$.

If you really do have one coordinate system of one type, and need to convert to the other, you can just use $n=i$ and then find a rotation that aligns the axes.

This does exactly what you think: it reverses the sign of the $x$-axis. Perhaps the thing that you were missing is that they way to reflect vectors with quaternions is different from the way to rotate them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.