mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
quaternion: improve comments
This commit is contained in:
@@ -195,9 +195,10 @@ public:
|
||||
Quaternion &q = *this;
|
||||
Vector3<Type> cr = src.cross(dst);
|
||||
const float dt = src.dot(dst);
|
||||
/* If the two vectors are parallel, cross product is zero
|
||||
* If they point opposite, the dot product is negative */
|
||||
if (cr.norm() < eps && dt < 0) {
|
||||
// handle corner cases with 180 degree rotations
|
||||
// if the two vectors are parallel, cross product is zero
|
||||
// if they point opposite, the dot product is negative
|
||||
cr = src.abs();
|
||||
if (cr(0) < cr(1)) {
|
||||
if (cr(0) < cr(2)) {
|
||||
@@ -215,7 +216,7 @@ public:
|
||||
q(0) = Type(0);
|
||||
cr = src.cross(cr);
|
||||
} else {
|
||||
/* Half-Way Quaternion Solution */
|
||||
// normal case, do half-way quaternion solution
|
||||
q(0) = dt + sqrt(src.norm_squared() * dst.norm_squared());
|
||||
}
|
||||
q(1) = cr(0);
|
||||
|
||||
Reference in New Issue
Block a user