JuliaGeometry / Rotations.jl

Julia implementations for different rotation parameterizations
https://juliageometry.github.io/Rotations.jl
MIT License
176 stars 44 forks source link

Fix the argument type of `perpendicular_vector` #268

Closed hyrodium closed 11 months ago

hyrodium commented 11 months ago

This PR fixes #265.

Before this PR

julia> using Rotations, StaticArrays

julia> u = MVector(1,0,0)
3-element MVector{3, Int64} with indices SOneTo(3):
 1
 0
 0

julia> v = MVector(-1,0,0)
3-element MVector{3, Int64} with indices SOneTo(3):
 -1
  0
  0

julia> rotation_between(u,v)
ERROR: MethodError: no method matching perpendicular_vector(::MVector{3, Int64})

Closest candidates are:
  perpendicular_vector(::SVector{3})
   @ Rotations ~/.julia/dev/Rotations/src/util.jl:8

Stacktrace:
 [1] rotation_between(u::MVector{3, Int64}, v::MVector{3, Int64})
   @ Rotations ~/.julia/dev/Rotations/src/rotation_between.jl:23
 [2] top-level scope
   @ REPL[4]:1

After this PR

julia> using Rotations, StaticArrays

julia> u = MVector(1,0,0)
3-element MVector{3, Int64} with indices SOneTo(3):
 1
 0
 0

julia> v = MVector(-1,0,0)
3-element MVector{3, Int64} with indices SOneTo(3):
 -1
  0
  0

julia> rotation_between(u,v)
3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(0.0, 0.0, 1.0, 0.0)):
 -1.0  0.0   0.0
  0.0  1.0   0.0
  0.0  0.0  -1.0
codecov[bot] commented 11 months ago

Codecov Report

Merging #268 (d8845ef) into master (4240829) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #268   +/-   ##
=======================================
  Coverage   89.93%   89.93%           
=======================================
  Files          17       17           
  Lines        1619     1619           
=======================================
  Hits         1456     1456           
  Misses        163      163           
Files Changed Coverage Δ
src/util.jl 89.47% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more