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 matrix4×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.308625 0.895201 0.975162 0.983584 0.222395 0.231256 0.0879502 0.330056 0.169486 0.825429 0.663839 0.735344 0.371062 0.715111 0.565011 0.564244
julia> r2 = nearest_rotation(m) # nearest rotation matrix from given matrix4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): -0.306502 0.122098 0.331115 0.884032 0.86999 -0.311353 -0.0787503 0.374132 0.287234 0.2587 0.882828 -0.266807 0.258206 0.906215 -0.323693 0.0856
julia> r3 = rand(RotMatrix{4}) # random rotation in SO(4)4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): -0.297558 0.549115 -0.0245667 0.780595 0.718069 -0.155441 -0.571783 0.365075 -0.554747 -0.713356 -0.32387 0.280156 0.296803 -0.406736 0.753372 0.422971
julia> r1*r2/r3 # multiplication and division4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): 0.840184 -0.105656 0.223361 0.48274 -0.135862 0.854724 -0.130199 0.483773 -0.173369 -0.436149 -0.704557 0.532275 0.495556 0.260878 -0.660877 -0.499608
julia> s = log(r2) # logarithm of RotMatrix is a RotMatrixGenerator4×4 RotMatrixGenerator{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): 0.0 -1.67553 0.263972 1.31238 1.67553 0.0 -0.570308 -1.21815 -0.263972 0.570308 0.0 -0.102625 -1.31238 1.21815 0.102625 0.0
julia> exp(s) # exponential of RotMatrixGenerator is a RotMatrix4×4 RotMatrix{4, Float64, 16} with indices SOneTo(4)×SOneTo(4): -0.306502 0.122098 0.331115 0.884032 0.86999 -0.311353 -0.0787503 0.374132 0.287234 0.2587 0.882828 -0.266807 0.258206 0.906215 -0.323693 0.0856