我是一个物理学家,正在学习一些编程,遇到过很多人用四元数进行旋转,而不是用矩阵/向量的形式写东西。
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.
然而,限于刚性旋转和描述,不使用任何分析结构,三维旋转可以等价地描述任何一种方式(或其他一些方式)。
一般来说,我们只需要一个点 X = (x,y,z)到一个新点 X’= (x’,y’,z’)的映射,这个映射受到 X2 = X’ABC 0的约束。有很多东西可以做到这一点。
最简单的方法就是画出这个定义的三角形,然后使用三角法,或者使用点(x,y,z)和向量(x,y,z)与函数 f (X) = X’和矩阵 MX = X’之间的同构,或者使用四元数,或者使用其他方法(x,y,z) T将旧向量的分量投影到新向量上。(a,b,c)(x’,y’,z’)等。
从数学的角度来看,这些描述在这个设置中都是等价的(作为一个定理)。它们都有相同数量的自由度,相同数量的约束,等等。
那么为什么四元数似乎比向量更受青睐呢?
我看到的通常原因是没有万向节锁或数字问题。
没有万向节锁参数似乎很奇怪,因为这只是一个欧拉角的问题。它也只是一个坐标问题(就像极坐标系中 r = 0的奇异点(雅可比松散秩)) ,这意味着它只是一个局部问题,可以通过切换坐标、从简并中旋转出来或者使用两个重叠的坐标系来解决。
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).
那么,为什么要在向量或其他选择上使用四元数呢?