ReferenceFrameRotations.jl
ReferenceFrameRotations.jl copied to clipboard
Add ClockwiseAngle for 2D applications
I know the package only implements 3D rotations, but it would be nice to add this tiny struct for convenience and have conversion methods with DCM. Something as simple as
struct ClockwiseAngle{T}
a::T
end
function Base.convert(::Type{<:DCM}, cw::ClockwiseAngle)
s, c = sincos(cw.a)
@SMatrix [c s; -s c]
end
I can submit a PR for that if you feel that it is useful.
This is where I am placing temporary definitions while we sort out what to do:
https://github.com/JuliaGeometry/Meshes.jl/blob/master/src/rotations.jl
The same think can be accomplished by:
@view angle_to_dcm(0.5, :Z)[1:2, 1:2]
Isn't it enough?
Yes, but now we are forcing users to handle the dimension of the problem explicitly. The vision I have for these rotations in geometric processing is dimension-agnostic. The fact that DCM{2} is a view of DCM{3} is an implementation detail. We should still be able to work with rotations in a N-dimensional space without manual handling of the number of coordinates.
We should still be able to work with rotations in a N-dimensional space without manual handling of the number of coordinates.
Hum, I see. It makes sense. We just need to be sure to select a name to this 2D rotation so that the user are 100% sure it will return a 2x2 matrix. We also have clockwise rotations in 3D spaces, for example.