为什么用于旋转四元数? [英] Why are quaternions used for rotations?

查看:203
本文介绍了为什么用于旋转四元数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名物理学家,并已学习了一些编程以及所遇到的很多使用四元数的旋转,而不是写东西,矩阵/矢量形式的人。

I'm a physicist, and have been learning some programming, and have come across a lot of people using quaternions for rotations instead of writing things in matrix/vector form.

在物理学中,也有我们不使用四元数(尽管离奇的故事,真实偶尔讲述了哈密尔顿/吉布斯/等)很好的理由。物理要求我们的描述具有良好的分析问题(这有一个precisely定义的含义,但在一些远远超出什么教在正常的介绍类,而技术的方式,所以我不会进入任何细节)。事实证明,四元数没有这个漂亮的行为,所以他们是没有用的,和向量/矩阵做的,所以我们使用他们。

In physics, there are very good reasons we don't use quaternions (despite the bizarre story that's occasionally told about Hamilton/Gibbs/etc). Physics requires that our descriptions have good analytic behavior (this has a precisely defined meaning, but in some rather technical ways that go far beyond what's taught in normal intro classes, so I won't go into any detail). It turns out that quaternions don't have this nice behavior, and so they aren't useful, and vectors/matrices do, so we use them.

但是,限制在刚性的旋转和说明不使用任何分析结构,三维旋转可以被等效任何一项所记载的方式(或一些其他方法)。

However, restricted to rigid rotations and descriptions that do not use any analytic structures, 3D rotations can be equivalently described either way (or a few other ways).

通常情况下,我们只想要一个点X =(X,Y,Z)的映射到一个新的点X'=(X',Y',Z')受约束X ^ 2 = X' ^ 2。而且有很多事情做。

Generally, we just want a mapping of a point X=(x,y,z) to a new point X'=(x',y',z') subject to the constraint that X^2 = X'^2. And there are lots of things that do this.

的幼稚的方法是只画出此定义了三角形和使用触发,或使用点之间的同构(X,Y,Z)和一个向量(x,Y,Z)和函数f(x)= X'和一个矩阵MX = X',或用四元,或伸出使用其他一些方法(X,Y,Z)^ T老载体沿着新的一个的组件。(A,B,C)(X' ,Y',Z'),等等等等。

The naive way is to just draw the triangles this defines and use trig, or use the isomorphism between a point (x,y,z) and a vector (x,y,z) and the function f(X) = X' and a matrix MX=X', or using quaternions, or projecting out components of the old vector along the new one using some other method (x, y, z)^T.(a,b,c) (x',y',z'), etc, etc.

从一个数学问题,这些描述都在此设置(作为定理)等价。它们都具有相同数目的自由度,约束相同数量的等

From a math point of view, these descriptions are all equivalent in this setting (as a theorem). They all have the same number of degrees of freedom, the same number of constraints, etc.

那么,为什么四元数似乎pferred超过载体$ P $?

So why do quaternions seem to preferred over vectors?

我看到的通常的原因是没有万向锁,或数字的问题。

The usual reasons I see are no gimbal lock, or numerical issues.

在无万向节锁定的说法似乎很奇怪,因为这是欧拉角只有一个问题。它也只有一个坐标问题(就像在极坐标的奇异性在r = 0(雅可比失去等级)),这意味着它是唯一的一个局部问题,并且可以通过切换坐标,旋转出的简并性来解决,或者使用两个重叠的坐标系。

The no gimbal lock argument seems odd, since this is only a problem of euler angles. It is also only a coordinate problem (just like the singularity at r=0 in polar coordinates (the Jacobian looses rank)), which means it is only a local problem, and can be resolved by switching coordinates, rotating out of the degeneracy, or using two overlapping coordinate systems.

我更确定的数值问题,因为我不知道具体怎么这两个(及任何选项)将实施。我读过,重新归一四元数比这样做的一个旋转矩阵更容易,但是这是唯一真正的通用矩阵;旋转具有轻视此附加约束(其内置有四元数的定义)(实际上,这有因为它们具有的自由度相同数目的是真实的)。

I'm less sure about numerical issues, since I don't know in detail how both of these (and any alternatives) would be implemented. I've read that re-normalizing a quaternion is easier than doing that for a rotation matrix, but this is only true for a general matrix; a rotation has additional constraints that trivializes this (which are built into the definition of quaternions) (In fact, this has to be true since they have the same number of degrees of freedom).

那么,什么是超过载体或其他替代品使用四元数的原因是什么?

So what is the reason for the use of quaternions over vectors or other alternatives?

推荐答案

万向锁是一个原因,但正如你说,这只是一个问题,欧拉角,是很容易解决的。欧拉角仍在使用,当内存是一个问题,因为你只需要存储3个数字。

Gimbal lock is one reason, although as you say it is only a problem with Euler angles and is easily solvable. Euler angles are still used when memory is a concern as you only need to store 3 numbers.

有关四元数与一个3x3旋转矩阵,四元数具有的优点在尺寸(4标量与9)和速度(四元数乘法比3×3矩阵乘法快得多)。

For quaternions versus a 3x3 rotation matrix, the quaternion has the advantage in size (4 scalars vs. 9) and speed (quaternion multiplication is much faster than 3x3 matrix multiplication).

注意的这些重$ P $旋转psentations所有的是在实践中使用。欧拉角用最少的内存;矩阵使用更多的内存,但不从万向锁受苦,有很好的分析性能;和四元数罢工两者很好的平衡,是重量轻,但无万向锁。

Note that all of these representations of rotations are used in practice. Euler angles use the least memory; matrices use more memory but don't suffer from Gimbal lock and have nice analytical properties; and quaternions strike a nice balance of both, being lightweight, but free from Gimbal lock.

这篇关于为什么用于旋转四元数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆