-
Notifications
You must be signed in to change notification settings - Fork 208
Small quaternion from vector improvements #78
Conversation
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to reuse cr here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because in this corner case cr
the cross product was a zero vector which is useless to determine the rotation direction. So we infer the adequate direction by a fused method, more details in the original description: #55 (comment) For that cr
needs to contain something different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's incredibly minor, but I was only suggesting not reusing variables (cr) for different purposes.
If I didn't miss anything (on a tiny screen) cr is being used as a temp to hold the source absolute values, then a unit vector, then finally the cross product of source with that unit vector.
745ee1e
to
b11f091
Compare
Functional change: do not recalculate the dot product in the normal case
Comments: a bit more clear and synced up with the prototyping script: Auterion/Flight_Control_Prototyping_Scripts#1