-
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
Weird interactions with Unitful #55
Comments
I guess we are assuming Actually this bug is more widespread than just julia> r = RotX(1)
3×3 RotX{Int64}(1):
1.0 0.0 0.0
0.0 0.540302 -0.841471
0.0 0.841471 0.540302
julia> eltype(r)
Int64
julia> r * [1,1,1]
ERROR: InexactError()
Stacktrace:
[1] convert(::Type{Int64}, ::Float64) at ./float.jl:679
[2] macro expansion at /home/ferris/.julia/v0.6/StaticArrays/src/util.jl:11 [inlined]
[3] convert_ntuple at /home/ferris/.julia/v0.6/StaticArrays/src/util.jl:8 [inlined]
[4] Type at /home/ferris/.julia/v0.6/StaticArrays/src/SArray.jl:28 [inlined]
[5] macro expansion at /home/ferris/.julia/v0.6/StaticArrays/src/matrix_multiply.jl:69 [inlined]
[6] _mul at /home/ferris/.julia/v0.6/StaticArrays/src/matrix_multiply.jl:57 [inlined]
[7] *(::Rotations.RotX{Int64}, ::Array{Int64,1}) at /home/ferris/.julia/v0.6/StaticArrays/src/matrix_multiply.jl:38 This is lying about an |
I'm finding that it works as expected for 3D rotations julia> rx = RotX(38°)
3×3 RotX{Float64} with indices SOneTo(3)×SOneTo(3)(0.663225):
1.0 0.0 0.0
0.0 0.788011 -0.615661
0.0 0.615661 0.788011
julia> rx * [1.0, 2.0, 3.0]
3-element StaticArrays.SVector{3, Float64} with indices SOneTo(3):
1.0
-0.27096291876353107
3.595355211471482
julia> rz = RotZ(38°)
3×3 RotZ{Float64} with indices SOneTo(3)×SOneTo(3)(0.663225):
0.788011 -0.615661 0.0
0.615661 0.788011 0.0
0.0 0.0 1.0
julia> rz * [1.0, 2.0, 3.0]
3-element StaticArrays.SVector{3, Float64} with indices SOneTo(3):
-0.4433121970445947
2.191682982539102
3.0 But appends an extraneous unit in 2D julia> r2 = Angle2d(38°)
2×2 Angle2d{Quantity{Int64, NoDims, FreeUnits{(°,), NoDims, nothing}}} with indices SOneTo(2)×SOneTo(2)(38°):
0.788011 -0.615661
0.615661 0.788011
julia> r2 * [1.0, 2.0]
2-element StaticArrays.SVector{2, Quantity{Float64, NoDims, Unitful.FreeUnits{(°,), NoDims, nothing}}} with indices SOneTo(2):
-25.399917897327196°
125.57418493013506° This is with:
|
I have been trying to use Rotations and Unitful together. At first, it seems like it works well:
But then I found that the units propagate incorrectly:
The text was updated successfully, but these errors were encountered: