“距离"是指四元数之间的距离(或角度大小)? [英] "Distance" (or angular magnitude) between two quaternions?
问题描述
我想找到两个四元数之间的距离".距离"是指单个浮点数或整数,而不是另一个四元数(这就是区别,即 inverse(q1)* q2
).我猜你可以称呼我想要的角度大小".
I want to find the "distance" between two quaternions. By "distance" I mean a single float or int, not another quaternion (that would be the difference, i.e. inverse(q1)*q2
). I guess you could call what I want "angular magnitude".
我需要从物理角度进一步旋转物理对象,然后再施加更大的扭矩.
I need to apply more torque to a physics object the further it's rotated from its original angle.
我不了解四元数中涉及的数学,因此基于代码的示例将非常有帮助.我已经看过其他几个问题,但我不相信有任何答案,或者至少不会以我理解的方式回答.
I don't understand the maths involved in quaternions, so a code-based example would be most helpful. I've looked at several other questions but I don't believe any answer my question, or at least not in a way I understand it.
推荐答案
找出差分四元数qd = inverse(q1)* q2).
Find the difference quaternion qd = inverse(q1)*q2).
通过角度= 2 *找到q1和q2之间的角度* atan2(qd.vec().length(),qd.w())//注意:带符号
Than find the angle between q1 and q2 by angle = 2 * atan2(qd.vec().length(), qd.w()) // NOTE: signed
这里的角度"是从q1到q2的最短弧线旋转角度.
The "angle" here, is the angle of rotation from q1 to q2 by shortest arc.
这篇关于“距离"是指四元数之间的距离(或角度大小)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!