mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 07:03:34 +08:00
AxisAngle: call q.imag().norm() for conversion
This is important depending on the platform because norm() calls matrix::squrt() which dispatches correctly to the implementation for the used type. Otherwise float squrt()s can get calculated as double.
This commit is contained in:
committed by
Mathieu Bresciani
parent
4873dc1c1e
commit
2cca35c8fe
@@ -69,7 +69,7 @@ public:
|
|||||||
AxisAngle(const Quaternion<Type> &q)
|
AxisAngle(const Quaternion<Type> &q)
|
||||||
{
|
{
|
||||||
AxisAngle &v = *this;
|
AxisAngle &v = *this;
|
||||||
Type mag = Type(sqrt(q(1) * q(1) + q(2) * q(2) + q(3) * q(3)));
|
Type mag = q.imag().norm();
|
||||||
if (fabs(mag) >= Type(1e-10)) {
|
if (fabs(mag) >= Type(1e-10)) {
|
||||||
v = q.imag() * Type(Type(2) * atan2(mag, q(0)) / mag);
|
v = q.imag() * Type(Type(2) * atan2(mag, q(0)) / mag);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user