General dimensional Rotation
Our main goal is to efficiently represent rotations in lower dimensions, such as 2D and 3D, but some operations on rotations in general dimensions are also supported.
example
julia> r1 = one(RotMatrix{4}) # generate identity rotation matrix
4×4 RotMatrix{4, Bool, 16} with indices SOneTo(4)×SOneTo(4): 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
julia> m = @SMatrix rand(4,4)
4×4 StaticArraysCore.SMatrix{4, 4, Float64, 16} with indices SOneTo(4)×SOneTo(4): 0.115476 0.615245 0.556732 0.99422 0.931452 0.308629 0.567579 0.951829 0.357777 0.0961021 0.173829 0.36057 0.118372 0.0616595 0.389747 0.326205
julia> r2 = nearest_rotation(m) # nearest rotation matrix from given matrix
4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): -0.361536 0.636965 0.188476 0.654251 0.905047 0.260542 0.294813 0.161536 0.147057 -0.563165 -0.35468 0.731725 -0.168989 -0.457426 0.867043 0.10218
julia> r3 = rand(RotMatrix{4}) # random rotation in SO(4)
4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): 0.141799 -0.929335 -0.323753 -0.106834 0.372013 -0.244372 0.667382 0.597068 0.669741 0.0863514 0.271728 -0.685678 -0.626855 -0.262988 0.613147 -0.402419
julia> r1*r2/r3 # multiplication and division
4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): -0.774135 0.226266 -0.584524 -0.0886031 -0.226501 0.566221 0.597992 -0.520093 0.580877 0.392511 -0.548245 -0.456009 0.109515 0.688573 0.0128591 0.716734
julia> s = log(r2) # logarithm of RotMatrix is a RotMatrixGenerator
4×4 RotMatrixGenerator{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): 0.0 -0.175841 -1.62367 1.68145 0.175841 0.0 1.56937 -0.506933 1.62367 -1.56937 0.0 -0.604178 -1.68145 0.506933 0.604178 0.0
julia> exp(s) # exponential of RotMatrixGenerator is a RotMatrix
4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): -0.361536 0.636965 0.188476 0.654251 0.905047 0.260542 0.294813 0.161536 0.147057 -0.563165 -0.35468 0.731725 -0.168989 -0.457426 0.867043 0.10218