Hi guys!
This is not directly related to Astro/Space, but I did not find a more appropriate local to post this.
I have just tagged the v0.5.0 do ReferenceFrameRotations.jl. Now, we have full support for the four different rotation representations supported by the package: Direction Cosine Matrices (DCM), Euler Angle and Axis, Euler Angles, and Quaternions.
Hence, for example, we can compose rotations using Euler Angles:
julia> Θ₁ = EulerAngles(pi/3,pi/4,pi/5,:XYZ)
EulerAngles{Float64}:
R(X): 1.0472 rad ( 60.0000 deg)
R(Y): 0.7854 rad ( 45.0000 deg)
R(Z): 0.6283 rad ( 36.0000 deg)
julia> Θ₂ = EulerAngles(pi,pi/2,pi/2,:YXY)
EulerAngles{Float64}:
R(Y): 3.1416 rad ( 180.0000 deg)
R(X): 1.5708 rad ( 90.0000 deg)
R(Y): 1.5708 rad ( 90.0000 deg)
julia> Θ₂*Θ₁
EulerAngles{Float64}:
R(Y): -2.0344 rad (-116.5651 deg)
R(X): 0.9117 rad ( 52.2388 deg)
R(Y): 0.0564 rad ( 3.2315 deg)
The same applies for Euler Angle and Axis:
julia> ea1 = EulerAngleAxis(1, [0;1;0])
EulerAngleAxis{Int64}:
Euler angle: 1.0000 rad ( 57.2958 deg)
Euler axis: [ 0.0000, 1.0000, 0.0000]
julia> ea2 = EulerAngleAxis(1, [0;0;1])
EulerAngleAxis{Int64}:
Euler angle: 1.0000 rad ( 57.2958 deg)
Euler axis: [ 0.0000, 0.0000, 1.0000]
julia> ea2*ea1
EulerAngleAxis{Float64}:
Euler angle: 1.3834 rad ( 79.2651 deg)
Euler axis: [ 0.3603, 0.6596, 0.6596]
We can also convert between any two rotation descriptions using the function <representation 1>_to_<representation 2>
like:
julia> Θ₁ = EulerAngles(pi/3,pi/4,pi/5,:XYZ)
EulerAngles{Float64}:
R(X): 1.0472 rad ( 60.0000 deg)
R(Y): 0.7854 rad ( 45.0000 deg)
R(Z): 0.6283 rad ( 36.0000 deg)
julia> angle_to_dcm(Θ₁)
3×3 StaticArrays.SArray{Tuple{3,3},Float64,2,9}:
0.572061 0.789312 0.223006
-0.415627 0.044565 0.908443
0.707107 -0.612372 0.353553
julia> angle_to_quat(Θ₁)
Quaternion{Float64}:
+ 0.7018154679091262 + 0.5417432513768273.i + 0.17244580102463125.j + 0.4292222551314542.k
julia> angle_to_angleaxis(Θ₁)
EulerAngleAxis{Float64}:
Euler angle: 1.5857 rad ( 90.8543 deg)
Euler axis: [ 0.7605, 0.2421, 0.6025]
The documentation of the package can be found here Home · Reference Frame Rotations