|
1 | | -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| 1 | +## Description ############################################################################# |
2 | 2 | # |
3 | | -# Description |
4 | | -# ============================================================================== |
| 3 | +# Functions related to the conversion from Euler angles to DCM. |
5 | 4 | # |
6 | | -# Functions related to the conversion from Euler angles to DCM. |
7 | | -# |
8 | | -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| 5 | +############################################################################################ |
9 | 6 |
|
10 | 7 | export angle_to_dcm |
11 | 8 |
|
12 | 9 | """ |
13 | | - angle_to_dcm(θ₁::Number[, θ₂::Number[, θ₃::Number]], rot_seq::Symbol = :ZYX) |
14 | | - angle_to_dcm(Θ::EulerAngles) |
| 10 | + angle_to_dcm(θ₁::Number[, θ₂::Number[, θ₃::Number]], rot_seq::Symbol = :ZYX) -> DCM |
| 11 | + angle_to_dcm(Θ::EulerAngles) -> DCM |
15 | 12 |
|
16 | | -Create a direction cosine matrix that perform a set of rotations (`θ₁`, `θ₂`, |
17 | | -`θ₃`) about the coordinate axes specified in `rot_seq`. |
| 13 | +Create a direction cosine matrix that perform a set of rotations (`θ₁`, `θ₂`, `θ₃`) about |
| 14 | +the coordinate axes specified in `rot_seq`. |
18 | 15 |
|
19 | | -The input values of the origin Euler angles can also be passed inside the |
20 | | -structure `Θ` (see [`EulerAngles`](@ref)). |
| 16 | +The input values of the origin Euler angles can also be passed inside the structure `Θ` (see |
| 17 | +[`EulerAngles`](@ref)). |
21 | 18 |
|
22 | | -The rotation sequence is defined by a `Symbol` specifing the rotation axes. The |
23 | | -possible values depends on the number of rotations as follows: |
| 19 | +The rotation sequence is defined by a `Symbol` specifing the rotation axes. The possible |
| 20 | +values depends on the number of rotations as follows: |
24 | 21 |
|
25 | 22 | - **1 rotation** (`θ₁`): `:X`, `:Y`, or `:Z`. |
26 | 23 | - **2 rotations** (`θ₁`, `θ₂`): `:XY`, `:XZ`, `:YX`, `:YZ`, `:ZX`, or `:ZY`. |
27 | | -- **3 rotations** (`θ₁`, `θ₂`, `θ₃`): `:XYX`, `XYZ`, `:XZX`, `:XZY`, `:YXY`, |
28 | | - `:YXZ`, `:YZX`, `:YZY`, `:ZXY`, `:ZXZ`, `:ZYX`, or `:ZYZ` |
| 24 | +- **3 rotations** (`θ₁`, `θ₂`, `θ₃`): `:XYX`, `XYZ`, `:XZX`, `:XZY`, `:YXY`, `:YXZ`, `:YZX`, |
| 25 | + `:YZY`, `:ZXY`, `:ZXZ`, `:ZYX`, or `:ZYZ` |
29 | 26 |
|
30 | 27 | # Remarks |
31 | 28 |
|
32 | | -This function assigns `dcm = A3 * A2 * A1` in which `Ai` is the DCM related with |
33 | | -the *i*-th rotation, `i Є [1,2,3]`. If the *i*-th rotation is not specified, |
34 | | -then `Ai = I`. |
| 29 | +This function assigns `dcm = A3 * A2 * A1` in which `Ai` is the DCM related with the _i_-th |
| 30 | +rotation, `i ∈ [1,2,3]`. If the _i_-th rotation is not specified, then `Ai = I`. |
35 | 31 |
|
36 | 32 | # Example |
37 | 33 |
|
@@ -87,11 +83,7 @@ function angle_to_dcm(θ::Number, rot_seq::Symbol) |
87 | 83 | end |
88 | 84 | end |
89 | 85 |
|
90 | | -function angle_to_dcm( |
91 | | - θ₁::T1, |
92 | | - θ₂::T2, |
93 | | - rot_seq::Symbol |
94 | | -) where {T1<:Number, T2<:Number} |
| 86 | +function angle_to_dcm(θ₁::T1, θ₂::T2, rot_seq::Symbol) where {T1<:Number, T2<:Number} |
95 | 87 | T = promote_type(T1, T2) |
96 | 88 |
|
97 | 89 | # Compute the sines and cosines. |
|
0 commit comments