问题描述
在我的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.
这篇关于将四元数从右手坐标系转换为左手坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!