Skip to content
This repository was archived by the owner on Nov 17, 2021. It is now read-only.

Small quaternion from vector improvements #78

Merged
merged 2 commits into from
Dec 16, 2018

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Dec 16, 2018

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

@MaEtUgR MaEtUgR self-assigned this Dec 16, 2018
@MaEtUgR MaEtUgR requested a review from dagar December 16, 2018 18:02
@coveralls
Copy link

coveralls commented Dec 16, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling b11f091 on pr-quaternion-from-vector-improvements into 9c0acfb on master.

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();
Copy link
Member

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?

Copy link
Member Author

@MaEtUgR MaEtUgR Dec 16, 2018

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.

Copy link
Member

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.

@MaEtUgR MaEtUgR force-pushed the pr-quaternion-from-vector-improvements branch from 745ee1e to b11f091 Compare December 16, 2018 19:09
@MaEtUgR MaEtUgR merged commit 18fba82 into master Dec 16, 2018
@MaEtUgR MaEtUgR deleted the pr-quaternion-from-vector-improvements branch December 16, 2018 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants