mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-15 04:57:36 +08:00
Quaternion multiply inline return
This commit is contained in:
@@ -255,12 +255,11 @@ public:
|
||||
Quaternion operator*(const Quaternion &q) const
|
||||
{
|
||||
const Quaternion &p = *this;
|
||||
Quaternion r;
|
||||
r(0) = p(0) * q(0) - p(1) * q(1) - p(2) * q(2) - p(3) * q(3);
|
||||
r(1) = p(0) * q(1) + p(1) * q(0) + p(2) * q(3) - p(3) * q(2);
|
||||
r(2) = p(0) * q(2) - p(1) * q(3) + p(2) * q(0) + p(3) * q(1);
|
||||
r(3) = p(0) * q(3) + p(1) * q(2) - p(2) * q(1) + p(3) * q(0);
|
||||
return r;
|
||||
return {
|
||||
p(0) * q(0) - p(1) * q(1) - p(2) * q(2) - p(3) * q(3),
|
||||
p(0) * q(1) + p(1) * q(0) + p(2) * q(3) - p(3) * q(2),
|
||||
p(0) * q(2) - p(1) * q(3) + p(2) * q(0) + p(3) * q(1),
|
||||
p(0) * q(3) + p(1) * q(2) - p(2) * q(1) + p(3) * q(0)};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user