Can i switch X Y Z in a quaternion?

Captain GouLash picture Captain GouLash · Apr 19, 2013 · Viewed 8.8k times · Source

i have a coordinate system where the Y axis is UP. I need to convert it to a coordinate system where Z is UP. I have the rotations stored in quaternions, so my question is : if i have a quaternion X,Y,Z can i switch the Y with the Z and get the result that Z is actually UP?

Answer

datenwolf picture datenwolf · Apr 19, 2013

Just swpping two axes in a quaternions? No this doesn't work because this flips the chirality. However if you flip the chirality and negate the quaternion's real part then you're back in the original chirality. In general form you can write this as

Q'(Q, i'j'k') = εi'j'k' Qw_w + Qi_i + Qj_j + Qk_k

where

Levi-Cevita Symbol Definition

is the totally antisymmetric tensor, known as the Levi-Cevita symbol.

This shouldn't be a surprise, as the i², j², k² rules of quaternions are defined also by the same totally antisymmetric tensor.