Inverting rotations
A rotation represented by DCM, Euler angle and axis, Euler angles, quaternion, CRP, or MRP can be inverted using the function:
inv_rotation(R)in which R must be one of the supported rotation types.
If R is a DCM, then the transpose matrix will be returned. Hence, the user must ensure that the input matrix is ortho-normalized. Otherwise, the result will not be the inverse matrix of the input.
If R is a Quaternion, then the conjugate quaternion will be returned. Hence, the user must ensure that the input quaternion is normalized (have unit norm). Otherwise, the result will not be the inverse quaternion of the input.
For Euler angle and axis, Euler angles, CRP, and MRP, the type-specific inv method is used.
These behaviors were selected to alleviate the computational burden.
julia> D1 = angle_to_dcm(0.5, 0.5, 0.5, :XYZ)DCM{Float64}: 0.770151 0.622447 -0.139381 -0.420735 0.659956 0.622447 0.479426 -0.420735 0.770151julia> D2 = inv_rotation(D1)DCM{Float64}: 0.770151 -0.420735 0.479426 0.622447 0.659956 -0.420735 -0.139381 0.622447 0.770151julia> D2 * D1DCM{Float64}: 1.0 3.41413e-17 -1.73278e-17 3.41413e-17 1.0 7.52438e-17 -1.73278e-17 7.52438e-17 1.0julia> q1 = angle_to_quat(0.5, 0.5, 0.5, :XYZ)Quaternion{Float64}: + 0.894463 + 0.291567⋅i + 0.172955⋅j + 0.291567⋅kjulia> q2 = inv_rotation(q1)Quaternion{Float64}: + 0.894463 - 0.291567⋅i - 0.172955⋅j - 0.291567⋅kjulia> q2 * q1Quaternion{Float64}: + 1.0 + 0.0⋅i - 1.38778e-17⋅j + 0.0⋅kjulia> c1 = angle_to_crp(0.5, 0.2, -0.1, :XYZ)CRP{Float64}: X : + 0.25 Y : + 0.112968 Z : - 0.0243908julia> c2 = inv_rotation(c1)CRP{Float64}: X : - 0.25 Y : - 0.112968 Z : + 0.0243908julia> c2 * c1CRP{Float64}: X : + 0.0 Y : + 0.0 Z : + 0.0julia> m1 = angle_to_mrp(0.5, 0.2, -0.1, :XYZ)MRP{Float64}: X : + 0.122716 Y : + 0.0554514 Z : - 0.0119725julia> m2 = inv_rotation(m1)MRP{Float64}: X : - 0.122716 Y : - 0.0554514 Z : + 0.0119725julia> m2 * m1MRP{Float64}: X : + 0.0 Y : + 0.0 Z : + 0.0