-
Notifications
You must be signed in to change notification settings - Fork 44
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
Angle2d seems superfluous #275
Comments
After looking at this some more, I understand why it is done this way. ( |
Yeah, that's right. Here's a draft comment that I was trying to send.
For more performance on 2D rotations. (See #14, #89 and docs) julia> using Rotations, StaticArrays, BenchmarkTools
julia> subtypes(Rotation{2})
2-element Vector{Any}:
Angle2d
RotMatrix{2}
julia> r1 = Angle2d(3.0)
2×2 Angle2d{Float64} with indices SOneTo(2)×SOneTo(2)(3.0):
-0.989992 -0.14112
0.14112 -0.989992
julia> r2 = RotMatrix{2}(3.0)
2×2 RotMatrix2{Float64} with indices SOneTo(2)×SOneTo(2):
-0.989992 -0.14112
0.14112 -0.989992
julia> @btime r1^3
16.464 ns (1 allocation: 16 bytes)
2×2 Angle2d{Float64} with indices SOneTo(2)×SOneTo(2)(9.0):
-0.91113 -0.412118
0.412118 -0.91113
julia> @btime r2^3
68.839 ns (1 allocation: 48 bytes)
2×2 RotMatrix2{Float64} with indices SOneTo(2)×SOneTo(2):
-0.91113 -0.412118
0.412118 -0.91113
You can also use julia> g = Angle2dGenerator(3.0)
2×2 Angle2dGenerator{Float64} with indices SOneTo(2)×SOneTo(2)(3.0):
0.0 -3.0
3.0 0.0
julia> exp(g)
2×2 Angle2d{Float64} with indices SOneTo(2)×SOneTo(2)(3.0):
-0.989992 -0.14112
0.14112 -0.989992
There are many ways to represent a rotations: Euler angles, rotation around an axis, quaternions, etc. Rotations.jl has types for each rotation representation. julia> subtypes(Rotation{3})
27-element Vector{Any}:
AngleAxis
MRP
QuatRotation
RodriguesParam
RotMatrix{3}
RotX
RotXY
RotXYX
RotXYZ
RotXZ
RotXZX
RotXZY
RotY
RotYX
RotYXY
RotYXZ
RotYZ
RotYZX
RotYZY
RotZ
RotZX
RotZXY
RotZXZ
RotZY
RotZYX
RotZYZ
RotationVec |
Thanks for elaborating on this! |
It seems that
Angle2d
represents a 2D rotation by an angle.This seems confusing to me: This representation is basically the same as the Lie algebra representation by a 2x2 skew-symmetric matrix.
So if I want to represent a 2D rotation "lazily" by an angle, I would use the proper Lie algebra type
RotationGenerator{2,T}
.What is the point of having
Angle2d
?When I exponentiate the
RotationGenerator{2,T}
I would expect to receive the actual rotation matrix.Having to apply an additional
RotMatrix
is not nice when writing generic code that works for multiple dimensions.Edit: It seems that 3D rotations also behave in the same way with first producing a
RotationVec
when exponentiating an element from the Lie algebra.It just seems a bit opaque to me that the actual work is delayed to the
RotMatrix
constructor and does not happen in theexp
.The text was updated successfully, but these errors were encountered: