什么时候需要使用四元数?
我多年来一直在进行 2D 和 3D 操作,包括图形,并且从未使用过四元数,所以我对它们没有感觉。我知道它们可以用于欧拉角中困难的某些操作,并且它们可以用于找到最适合一组坐标(X1,X2...XN,X=(xyz))所需的旋转到另一个(X1',X2'...XN')。
有哪些地方需要四元数?他们是否在某些地方使解决方案变得更优雅或更高效?
I have been carrying out 2D and 3D operations, including graphics, for many years and have never used quaternions so I don't have a feel for them. I know that they can be used for certain operations that are difficult in Euler angles and also that they can be used to find the rotation required to best fit one set of coordinates (X1, X2...XN, X=(xyz)) onto another (X1', X2'... XN').
Are there places where quaternions are essential? And are there places where they make solutions more elegant or more efficient?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
它们比旋转矩阵具有更小的内存占用,并且比矩阵和角度/轴表示更有效。
另外:
They have a smaller memory footprint than rotation matrices and they are more efficient than both matrix and angle/axis representations.
Also:
与欧拉角相比,四元数具有许多优点,并且通常更适合 3D 旋转:
缺点:
Quaternions have many advantages over Euler angles and are often preferable for 3D rotations:
Disadvantages:
使用四元数还可以解决万向节锁的问题。当您想要执行任意旋转时,它们更容易使用。
With quaternions you also handle the problem of the gimbal lock. And they are easier to work with when you want to perform arbitrary rotations.
四元数的优点
分解
Pros of quaternions
Cons.
四元数相对于矩阵的优点不仅在于计算速度更快,而且主要是因为围绕任意角度连续旋转的矩阵表示最终会产生可怕的浮点舍入误差,并且不再表示正确的仿射旋转。 “恢复”旋转矩阵在计算上比归一化四元数更昂贵。因此,应选择四元数而不是纯旋转矩阵。
The advantage of quaternions over matrices is not only faster computation, but mostly because a matrix representation of successive rotations around arbitrary angles eventually give in to dreadful floating-point round-off errors and no longer represent proper, affine rotations. "Restoring" a rotation matrix is computationally more expensive than normalizing a quaternion. Therefore, quaternions should be chosen over pure rotation matrices.
与欧拉角相比,它们的构成更简单,并且避免了万向节锁问题。
与旋转矩阵相比,它们在数值上更稳定,并且表示形式(4 个数字)更紧凑。
Compared to Euler angles they are simpler to compose and avoid the problem of gimbal lock.
Compared to rotation matrices they are more numerically stable and the representation (4 numbers) is more compact.