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 ClockwiseAngle for 2D applications #22

Open
juliohm opened this issue Nov 12, 2021 · 4 comments
Open

Add ClockwiseAngle for 2D applications #22

juliohm opened this issue Nov 12, 2021 · 4 comments

Comments

@juliohm
Copy link
Contributor

juliohm commented Nov 12, 2021

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.

@juliohm
Copy link
Contributor Author

juliohm commented Nov 12, 2021

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

@ronisbr
Copy link
Member

ronisbr commented Nov 17, 2021

The same think can be accomplished by:

@view angle_to_dcm(0.5, :Z)[1:2, 1:2]

Isn't it enough?

@juliohm
Copy link
Contributor Author

juliohm commented Nov 18, 2021

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.

@ronisbr
Copy link
Member

ronisbr commented Nov 19, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants