Convert quaternion from right-handed to left-handed coordinate system

3d, graphics, math

Solution

A rotation of angle x around axis (u,v,w) can be represented by quaternion with real part cos(x/2) and unreal part sin(x/2)*(u,v,w).

If axis coordinates are (u,v,w) in original trihedron, they will be (u,w,v) in your trihedron.

Thus if original quaternion was (a,b,c,d) - a+ib+jc+kd - the quaternion must be transformed to (a,b,d,c) in your trihedron.

EDIT

But because your trihedron is left handed, the angle also has to be reversed, so the same rotation can finally be expressed by the quaternion (a,-b,-d,-c) in your trihedron.

Problem

I my 3d program, the rotation of object is represented by the quaternion like `[0.130526, 0.0, 0.0, 0.991445]`. The program works with right-handed coordinate system with the Z axis pointing up (like in 3ds max): On the other hand, my application use left-handed coordinate system and the Y axis is up: How can I transform my quaternion from one coordinate system to another, with the respect for which axis is up?

Original source

Related problems