Skip to content

Add support for higher dimensional rotation #215

Closed
@hyrodium

Description

@hyrodium

I think we don't need much supports for higher dimensional rotations, but it would be nice to have functions that can deal with them.

julia> using Rotations, StaticArrays

julia> nearest_rotation(@SMatrix randn(2,2))
2×2 RotMatrix2{Float64} with indices SOneTo(2)×SOneTo(2):
  0.81937   0.573265
 -0.573265  0.81937

julia> nearest_rotation(@SMatrix randn(3,3))
3×3 RotMatrix3{Float64} with indices SOneTo(3)×SOneTo(3):
  0.0318224  -0.981479   0.18891
 -0.244856   -0.190902  -0.95058
  0.969037   -0.016006  -0.246396

julia> nearest_rotation(@SMatrix randn(4,4))
ERROR: DimensionMismatch("No precise constructor for RotMatrix{4} found. Length of input was 16.")
Stacktrace:
 [1] (RotMatrix{4})(x::Tuple{Tuple{Tuple{NTuple{16, Float64}}}})
   @ StaticArrays ~/.julia/packages/StaticArrays/deP1N/src/convert.jl:1
 [2] (RotMatrix{4})(x::Tuple{Tuple{NTuple{16, Float64}}}) (repeats 3 times)
   @ StaticArrays ~/.julia/packages/StaticArrays/deP1N/src/convert.jl:4
 [3] StaticArray
   @ ~/.julia/packages/StaticArrays/deP1N/src/convert.jl:5 [inlined]
 [4] nearest_rotation(M::SMatrix{4, 4, Float64, 16})
   @ Rotations ~/.julia/dev/Rotations/src/core_types.jl:248
 [5] top-level scope
   @ ~/.julia/packages/StaticArrays/deP1N/src/SMatrix.jl:172

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions