问题描述
在我的 3d 程序中,对象的旋转由四元数表示,如 [0.130526, 0.0, 0.0, 0.991445]
.该程序使用 Z 轴朝上的右手坐标系(如在 3ds max 中):
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):
另一方面,我的应用程序使用左手坐标系Y轴向上:
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?
推荐答案
角度 x 绕轴 (u,v,w) 的旋转可以用实部为 cos(x/2) 和虚部为 sin(x/2)*(u,v,w).
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).
如果轴坐标在原始三面体中是 (u,v,w),那么它们在你的三面体中将是 (u,w,v).
If axis coordinates are (u,v,w) in original trihedron, they will be (u,w,v) in your trihedron.
因此,如果原始四元数是 (a,b,c,d) - a+ib+jc+kd - 在您的三面体中,四元数必须转换为 (a,b,d,c).
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.
编辑
但是因为你的三面体是左旋的,角度也必须反过来,所以同样的旋转最终可以用你的三面体中的四元数 (a,-b,-d,-c) 表示.
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.
这篇关于将四元数从右手坐标系转换为左手坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!