高效四元数角速度 [英] Efficient quaternion angular velocity

查看:44
本文介绍了高效四元数角速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用四元数表示的方向和一个用四元数或数字表示的角速度(围绕原始方向的每秒弧度).我了解如何使用转换为轴角来做到这一点,但该方法在计算上相当昂贵,并且不是一个现实的选择.在给定时间间隔(以秒为单位)的情况下,我将如何修改方向四元数?我需要针对这两种情况(四元数和数字)的解决方案.但是,将一种情况转换为另一种情况是可以接受的,并且可能更可取,具体取决于转换所需的各种算法/公式的计算复杂性.

I have an orientation expressed with a quaternion and an angular velocity expressed as either a quaternion or a number (radians per second around the original orientation). I understand how to do this using conversion to axis-angle but that method is rather computationally expensive and is not a realistic option. How would I go about modifying the orientation quaternion given a time interval (in seconds)? I need a solution for both cases (the quaternion and the number). However, converting one case into the other is acceptable and may be preferable depending on the computational complexity of the various algorithms/formulae required for conversions.

推荐答案

为了更新方向,您需要将当前方向乘以增量旋转.这是与轴角转换相当昂贵的操作.

For update of orientation , you require to multiply current orientation by delta rotation. This is comparable expensive operation with axis angle conversion.

表示角速度的常用方法是指数映射",即平行于旋转轴的 3d 矢量和旋转速度的大小(每秒弧度).转换为 delta 旋转四元数看起来像

Common way to represent angular velocity is "exponential map", the 3d vector parallel with rotation axis and magnitude of rotation velocity (radians per second). The conversion to delta rotation quaternion looks like

Quaternion deltaRotation(const Vector3& em, double deltaTime)
{
   Vector3 ha = em * deltaTime * 0.5; // vector of half angle
   double l = ha.norm(); // magnitude
   if (l > 0) {
      ha *= sin(l) / l;
      return Quaternion(cos(l), ha.x(), ha.y(), ha.z());
   } else {
      return Quaternion(1.0, ha.x(), ha.y(), ha.z());
   }
}

如果您的 deltaTime 小且旋转速度小,您可以使用 1st Taylor series multiplier 的近似值.但是您应该更频繁地对结果四元数进行归一化以避免数值不稳定.

If your deltaTime is small and rotation speed is small, you can use approximation by 1st Taylor series multiplier. But you should normalize result quaternion to avoid numerical instability more often.

Quaternion deltaRotationAppx1(const Vector3& em, double deltaTime)
{
   Vector3 ha = em * deltaTime * 0.5; // vector of half angle
   return Quaternion(1.0, ha.x(), ha.y(), ha.z());
}

这篇关于高效四元数角速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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