Closed mikmoore closed 2 years ago
Merging #53 (d361d81) into master (88d7057) will increase coverage by
1.95%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #53 +/- ##
==========================================
+ Coverage 43.62% 45.58% +1.95%
==========================================
Files 3 3
Lines 353 351 -2
==========================================
+ Hits 154 160 +6
+ Misses 199 191 -8
Impacted Files | Coverage Δ | |
---|---|---|
src/Quaternion.jl | 85.05% <100.00%> (+4.37%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 88d7057...d361d81. Read the comment docs.
This PR is intended to remove the piracy of
LinearAlgebra.normalize(::Vector)
that was previously being committed by Quaternions. This piracy would makenormalize(zeros(3))
return a vector of0.0
when it would normally return a vector ofNaN
.The guilty method was only used in
qrotation(::Vector,::Any)
so it was easy enough to remove it and provide the matching calculation in its place. I also noticed thatqrotation([0,0,0],1.0) == Quaternion(0.8775825618903728, 0.0, 0.0, 0.0, true)
, which is wrong in multiple capacities.I have made it an error to use this method with a zero vector in the first argument. A potential alternative would be to force the rotation angle to zero in this case, but I opted for the error since a zero axis seemed more likely to be used in error than deliberately (given thatEDIT: An all-zero rotation axis will force the rotation to zero, yieldingqrotation(::Vector)
is available for the latter case).Quaternion(1.0)
.Along the way, I noticed that the related method
qrotation(::Vector)
was type-unstable for zero inputs and that input vectors withNaN
entries failed to propagate theirNaN
s. Both of these issues are resolved by making it mirror the changes already made to the 2-arg method.