两个四元数之间的“差异" [英] 'Difference' between two quaternions

查看:773
本文介绍了两个四元数之间的“差异"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ogre工作,但这是一个普遍的四元数问题.

I'm working in Ogre, but it's a general quaternion problem.

我有一个对象,最初将旋转四元数Q1应用于该对象.稍后,我想像最初将对象旋转另一个四元数Q2一样.

I have an object, to which I apply a rotation quaternion Q1 initially. Later, I want to make it as if I initially rotated the object by a different quaternion Q2.

如何计算四元数,该四元数将采用已经旋转Q1的对象并将其对齐,就好像我所做的只是将Q2应用于初始/默认方向一样?我一直在看,但是我不确定这是否只对 orientation 有用,而不是对 rotations 有用吗?

How do I calculate the quaternion which will take the object, already rotated by Q1, and align it as if all I did was apply Q2 to the initial/default orientation? I was looking at (s)lerping, but I am not sure if this only valid on orientations rather than rotations?

推荐答案

听起来您想要Q1乘以Q2.通过Q1的逆变换将对象旋转回其原始帧(如您所说的初始方向),然后通过Q2的变换将其旋转到其新方向.

It sounds like you want the inverse of Q1 times Q2. Transforming by the inverse of Q1 will rotate the object back to its original frame (the initial orientation, as you say), and then transforming by Q2 will rotate it to its new orientation.

请注意,四元数的标准定义以从右到左的乘法顺序应用转换,因此您需要将其计算为Q = Q2 * Q1 ^ {-1}.

Note that the standard definition of a quaternion applies transformations in a right-to-left multiplication order, so you'll want to compute this as Q = Q2*Q1^{-1}.

这篇关于两个四元数之间的“差异"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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