quaternion: improve comments

This commit is contained in:
Matthias Grob
2018-12-16 18:00:02 +00:00
parent a4f39c0f89
commit 18fba8221c
+4 -3
View File
@@ -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);