Skip to content

Commit

Permalink
Merge pull request #2 from Affie/hotfix/convertconstructors
Browse files Browse the repository at this point in the history
Fixes constructor fall back warnings in 0.7
  • Loading branch information
Affie committed Nov 9, 2018
2 parents 0b4ce42 + 72a8c4f commit 3f5ef2f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/TransformUtils.jl
Expand Up @@ -141,6 +141,22 @@ mutable struct Euler
Euler(v::VectorFloatInt, q::Quaternion) = new(v[1],v[2],v[3], q)
end

#explicit convertion constructors
SO3(ss::so3) = convert(SO3, ss)
SO3(A::AngleAxis) = convert(SO3, A)
SO3(q::Quaternion) = convert(SO3, q)
SO3(E::Euler) = convert(SO3, E)

Quaternion(ss::so3) = convert(Quaternion, ss)
Quaternion(R::SO3) = convert(Quaternion, R)
Quaternion(A::AngleAxis) = convert(Quaternion, A)
Quaternion(E::Euler) = convert(Quaternion, E)

AngleAxis(R::SO3) = convert(AngleAxis, R)
AngleAxis(q::Quaternion) = convert(AngleAxis, q)

Euler(SO3::SO3) = convert(Euler, SO3)
Euler(q::Quaternion) = convert(Euler, q)

mutable struct SE3
R::SO3
Expand Down
22 changes: 22 additions & 0 deletions test/runtests.jl
Expand Up @@ -11,6 +11,28 @@ using Test
SE3(T.t, q)
SE3(T.t, R)
SE3(T.t, A)
E = Euler(0)

RfromE = SO3(E)
RfromQ = SO3(q)
RfromA = SO3(A)
Rfromss = SO3(ss)

QfromE = Quaternion(E)
QfromR = Quaternion(R)
QfromA = Quaternion(A)
Qfromss = Quaternion(ss)

# AfromE = AngleAxis(E) # Convert not implemented yet
AfromR = AngleAxis(R)
AfromQ = AngleAxis(q)
# Afromss = AngleAxis(ss) # Convert not implemented yet

EfromR = Euler(R)
EfromQ = Euler(q)
# EfromA = Euler(A) # Convert not implemented yet
# Efromss = Euler(ss) # Convert not implemented yet

end

@testset "Ensure basic quaternion operations hold" begin
Expand Down

0 comments on commit 3f5ef2f

Please sign in to comment.