Rotations
3D rotations made easy in Julia
The documentation is still work in progress. For more information, see also
(TBW) comments are left in areas that have not yet been documented. Feel free to open pull requests and improve this document!
Installation
pkg> add RotationsFirst example
julia> using Rotations # 3D Rotation by Euler Anglesjulia> R_euler = RotXYZ(1,2,3) # Get an angle and an axis of the rotation3×3 RotXYZ{Float64} with indices SOneTo(3)×SOneTo(3)(1.0, 2.0, 3.0): 0.411982 0.0587266 0.909297 -0.681243 -0.642873 0.350175 0.605127 -0.763718 -0.224845julia> rotation_angle(R_euler), rotation_axis(R_euler) # Convert the rotation to unit quaternion(2.386003742640557, [-0.8122105149361277, 0.22178973672199065, -0.5395585159294407])julia> R_quat = QuatRotation(R_euler) # Get quaternion parameters of the rotation3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(0.368871, -0.754934, 0.206149, -0.501509)): 0.411982 0.0587266 0.909297 -0.681243 -0.642873 0.350175 0.605127 -0.763718 -0.224845julia> Rotations.params(R_quat) # Convert the rotation to MRP (Modified Rodrigues Parameters)4-element StaticArraysCore.SVector{4, Float64} with indices SOneTo(4): 0.36887135771328977 -0.7549338012644524 0.20614922602687769 -0.5015090964037221julia> R_mrp = MRP(R_euler)3×3 MRP{Float64} with indices SOneTo(3)×SOneTo(3)(-0.551501, 0.150598, -0.366367): 0.411982 0.0587266 0.909297 -0.681243 -0.642873 0.350175 0.605127 -0.763718 -0.224845julia> Rotations.params(R_mrp) # Get parameters of the MRP3-element StaticArraysCore.SVector{3, Float64} with indices SOneTo(3): -0.551500911324184 0.1505979541943602 -0.3663668565916208julia> Rotations.params(R_mrp) # Also supports 2D rotation3-element StaticArraysCore.SVector{3, Float64} with indices SOneTo(3): -0.551500911324184 0.1505979541943602 -0.3663668565916208julia> R_2d = Angle2d(π/6) # Also supports some differentiation2×2 Angle2d{Float64} with indices SOneTo(2)×SOneTo(2)(0.523599): 0.866025 -0.5 0.5 0.866025julia> Rotations.jacobian(RotMatrix, R_quat)9×4 StaticArraysCore.SMatrix{9, 4, Float64, 36} with indices SOneTo(9)×SOneTo(4): 0.433806 -0.887829 -0.582158 1.41624 -0.500436 -0.616288 -1.22899 0.0544439 -0.858727 -0.0893562 -0.987236 -0.902914 0.959693 0.500968 -1.53408 -0.678839 1.21202 0.539215 0.677354 0.358205 -0.94644 -0.415371 -0.688138 -0.353725 -0.258529 0.369901 0.362841 -0.597826 1.25153 -0.209024 -1.1474 0.763531 0.903621 1.17038 -0.319595 -1.22854