我有一个四元数,来自具有以下内容的系统:
Right handed.
Forward direction: Y axis
Right direction: X axis
Up direction: Z axis
我需要将其转换为以下坐标系:
left-handed.
Forward direction: X axis
Right direction: Y axis
Up direction: Z axis
我试过否定轴和角度,我试过切换值,我不能让它工作。所有帮助非常感谢!我在C#工作,
Microsoft.Xna.Quaternion.
答案 0 :(得分:3)
A quaternion is a structure of four values (w, x, y, z)
. If it represents a rotation, then w = cos(phi/2)
(phi
being the rotation angle) and (x, y, z) = sin(phi/2) * (ax, ay, az)
((ax, ay, az)
being the rotation axis).
In order to convert the quaternion to another system, it is sufficient to transform the rotation axis. For your example, the transform is:
/ 0 1 0 \
T = | 1 0 0 |
\ 0 0 1 /
Finally, since you are changing handedness, you must invert the quaternion or it will rotate in the wrong direction. Summarizing, the transformed quaternion is:
(w*, x*, y*, z*) = (w, -y, -x, -z)
In general:
(x*, y*, z*) = det(T) T (x, y, z) //Assuming column vectors