有效四元数角速度 [英] Efficient quaternion angular velocity
问题描述
要更新方向,您需要将当前方向乘以增量旋转。与轴角度转换相比,这是可比的昂贵操作。
表示角速度的常用方法是与旋转轴和旋转速度(弧度/秒)平行的3d向量中的指数图。转换为增量旋转四元数看起来像是
四元数deltaRotation(const Vector3& em,double deltaTime)
{
四元数q;
Vector3 ha = em * deltaTime * 0.5; //半角矢量
double l = ha.norm(); //幅度
if(l> 0)
{
double ss = sin(l)/ l;
q =四元数(cos(l),ha.x()* ss,ha.y()* ss,ha.z()* ss);
} else {
q =四元数(1.0,ha.x(),ha.y(),ha.z());
}
返回q;
}
如果您的deltaTime小而旋转速度小,则可以使用第一泰勒级数乘数。但是您应该对结果四元数进行规范化处理,以避免更多的数值不稳定。 $ b {
Vector3 ha = em * deltaTime * 0.5; //半角矢量
return Quaternion(1.0,ha.x(),ha.y(),ha.z());
}
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.
Common way to represent angular velocity is "exponential map"m 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)
{
Quaternion q;
Vector3 ha = em * deltaTime *0.5; // vector of half angle
double l = ha.norm(); // magnitude
if( l > 0 )
{
double ss = sin(l)/l;
q = Quaternion(cos(l), ha.x()*ss, ha.y()*ss, ha.z()*ss);
}else{
q = Quaternion(1.0, ha.x(), ha.y(), ha.z());
}
return q;
}
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屋!