Skip to content

Commit

Permalink
Add Rotations.params methods for RotationGenerator (#216)
Browse files Browse the repository at this point in the history
* add tests for Rotations.params(::RotationGenerator)

* add Rotations.params methods for RotationVecGenerator and Angle2dGenerator
  • Loading branch information
hyrodium authored Jan 23, 2022
1 parent 62e4afd commit 5319b35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rotation_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ end
end
end

@inline params(r::Angle2dGenerator) = SVector{1}(r.v)

"""
struct RotationVecGenerator{T} <: RotationGenerator{2,T}
Expand Down Expand Up @@ -216,6 +217,7 @@ end
end
end

@inline params(r::RotationVecGenerator) = SVector{3}(r.x,r.y,r.z)

################################################################################
################################################################################
Expand Down
5 changes: 5 additions & 0 deletions test/rotation_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@
@test_throws DimensionMismatch Angle2dGenerator(1) + RotationVecGenerator(2,3,4)
end

@testset "params" begin
@test Rotations.params(Angle2dGenerator(1)) == [1]
@test Rotations.params(RotationVecGenerator(2,3,4)) == [2,3,4]
end

@testset "type promotion" begin
for (T, N) in ((Angle2dGenerator, 2), (RotationVecGenerator, 3))
R = RotMatrixGenerator
Expand Down

0 comments on commit 5319b35

Please sign in to comment.