四元数和三轴

发布于 2024-09-15 12:14:31 字数 133 浏览 3 评论 0原文

给定一个四元数 q 和三个 3D 向量 (vx, vy, vz),它们形成坐标轴,可以沿任意方向定向,但都彼此垂直,从而形成 3d 空间。

如何检查四元数 q 是否旋转到与某些 3D 向量(vx、vy、vz)相同的方向(或相反的方向)?

Given a quaternion q, and three 3D vectors (vx, vy, vz) which form coordinate axes, which can be oriented in arbitrary direction, but are all perpendicular to each other, thus forming a 3d space.

How can I check if the quaternion q is rotated to the same direction (or opposite direction) as some of the 3D vectors (vx, vy, vz)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦境 2024-09-22 12:14:31

如果 q = (w,x,y,z),其中 w 是“标量部分”,qv=(x,y,z) 是“向量部分”,
然后你可以计算 qv 和每个基向量 vx、vy、vz 之间的角度
使用点积。

cos(theta) = (qv dot vx) / ( |qv| * |vx|)

如果 cos(theta) 为 +1,则 q 的旋转轴平行于该基向量。

cos(theta) = -1 意味着它们是反平行的。

If q = (w,x,y,z), where w is the "scalar part", and qv=(x,y,z) is the "vector part",
then you can calculate the angle between qv and each of the basis vectors vx, vy, vz
using the dot product.

cos(theta) = (qv dot vx) / ( |qv| * |vx|)

If cos(theta) is +1, the rotation axis of q is parallel to that basis vector.

cos(theta) = -1 implies that they are anti-parallel.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文