Skip to content

Commit

Permalink
Attempt to fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
bzinberg committed Nov 12, 2021
1 parent 4706396 commit 6ce1ae4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/PoseComposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,14 @@ interp(a::Pose, b::Pose, t::Real) = a * interp(a ⦸ b, t)

function quatPow(q::UnitQuaternion, t::Real)
# TODO: Once https://github.com/JuliaGeometry/Rotations.jl/issues/126 is
# fixed, this special case won't be necessary
if t == 0 || q == one(UnitQuaternion) || q == -one(UnitQuaternion)
# fixed, this special case won't be necessary.
#
# For an example showing why we need an approximately-equal check rather than an exact equality check, see
# https://github.com/probcomp/PoseComposition.jl/issues/5
ε = 1e-30
if (isapprox(t, 0; atol=ε)
|| isapprox(q, one(UnitQuaternion); atol=ε)
|| isapprox(q, -one(UnitQuaternion); atol=ε))
return one(UnitQuaternion)
end
return exp(t * log(q))
Expand Down

0 comments on commit 6ce1ae4

Please sign in to comment.