Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rotations.params methods for RotationGenerator #216

Merged
merged 2 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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