Skip to content

Commit ea60b1f

Browse files
ronisbrclaude
andcommitted
📚 Fix docstrings, add description headers, and remove trailing spaces
- Add description section headers to all new CRP/MRP conversion files - Fix typos in docstrings: `ReferenceFramerotation`, `anlges`, `the used` - Remove trailing whitespace from CRP/MRP source files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b53dc3d commit ea60b1f

16 files changed

Lines changed: 103 additions & 31 deletions

src/conversions/crp_to_angle.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from CRP to Euler angles.
4+
#
5+
############################################################################################
6+
17
export crp_to_angle
28

39
"""

src/conversions/crp_to_angleaxis.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from CRP to Euler angle and axis.
4+
#
5+
############################################################################################
6+
17
export crp_to_angleaxis
28

39
"""

src/conversions/crp_to_dcm.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from CRP to DCM.
4+
#
5+
############################################################################################
6+
17
export crp_to_dcm
28

39
"""

src/conversions/crp_to_quat.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from CRP to quaternion.
4+
#
5+
############################################################################################
6+
17
export crp_to_quat
28

39
"""
@@ -8,6 +14,6 @@ Convert CRP `c` to a Quaternion.
814
function crp_to_quat(c::CRP)
915
q_sq = c.q1^2 + c.q2^2 + c.q3^2
1016
β0 = 1 / sqrt(1 + q_sq)
11-
17+
1218
return Quaternion(β0, c.q1 * β0, c.q2 * β0, c.q3 * β0)
1319
end

src/conversions/dcm_to_crp.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from DCM to CRP.
4+
#
5+
############################################################################################
6+
17
export dcm_to_crp
28

39
"""

src/conversions/dcm_to_mrp.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from DCM to MRP.
4+
#
5+
############################################################################################
6+
17
export dcm_to_mrp
28

39
"""

src/conversions/mrp_to_angle.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from MRP to Euler angles.
4+
#
5+
############################################################################################
6+
17
export mrp_to_angle
28

39
"""

src/conversions/mrp_to_angleaxis.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from MRP to Euler angle and axis.
4+
#
5+
############################################################################################
6+
17
export mrp_to_angleaxis
28

39
"""

src/conversions/mrp_to_dcm.jl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from MRP to DCM.
4+
#
5+
############################################################################################
6+
17
export mrp_to_dcm
28

39
"""
@@ -8,56 +14,56 @@ Convert MRP `m` to a Direction Cosine Matrix (DCM).
814
function mrp_to_dcm(m::MRP)
915
# Direct formula from the provided image:
1016
# [C] = [I] + (8 [skew(m)]^2 - 4(1 - |m|^2)[skew(m)]) / (1 + |m|^2)^2
11-
17+
1218
s_sq = m.q1^2 + m.q2^2 + m.q3^2
1319
denom = (1 + s_sq)^2
14-
20+
1521
fac1 = 8 / denom
1622
fac2 = 4 * (1 - s_sq) / denom
17-
23+
1824
# Skew symmetric matrix components
1925
# [ 0 -q3 q2]
2026
# [ q3 0 -q1]
2127
# [-q2 q1 0 ]
22-
28+
2329
# Precompute skew terms
2430
sk_12 = -m.q3
2531
sk_13 = m.q2
2632
sk_21 = m.q3
2733
sk_23 = -m.q1
2834
sk_31 = -m.q2
2935
sk_32 = m.q1
30-
36+
3137
# Skew^2 terms
3238
# Row 1
3339
# sk2_11 = sk_12 * sk_21 + sk_13 * sk_31 = -q3*q3 + q2*(-q2) = -q3^2 - q2^2
3440
# sk2_12 = sk_13 * sk_32 = q2 * q1
3541
# sk2_13 = sk_12 * sk_23 = -q3 * -q1 = q1q3
36-
42+
3743
sk2_11 = -m.q3^2 - m.q2^2
3844
sk2_12 = m.q1 * m.q2
3945
sk2_13 = m.q1 * m.q3
40-
46+
4147
sk2_21 = sk2_12
4248
sk2_22 = -m.q3^2 - m.q1^2
4349
sk2_23 = m.q2 * m.q3
44-
50+
4551
sk2_31 = sk2_13
4652
sk2_32 = sk2_23
4753
sk2_33 = -m.q2^2 - m.q1^2
48-
54+
4955
# Combine
5056
d11 = 1 + fac1 * sk2_11
5157
d12 = fac1 * sk2_12 - fac2 * sk_12
5258
d13 = fac1 * sk2_13 - fac2 * sk_13
53-
59+
5460
d21 = fac1 * sk2_21 - fac2 * sk_21
5561
d22 = 1 + fac1 * sk2_22
5662
d23 = fac1 * sk2_23 - fac2 * sk_23
57-
63+
5864
d31 = fac1 * sk2_31 - fac2 * sk_31
5965
d32 = fac1 * sk2_32 - fac2 * sk_32
6066
d33 = 1 + fac1 * sk2_33
61-
67+
6268
return DCM(d11, d12, d13, d21, d22, d23, d31, d32, d33)'
6369
end

src/conversions/mrp_to_quat.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Description #############################################################################
2+
#
3+
# Functions related to the conversion from MRP to quaternion.
4+
#
5+
############################################################################################
6+
17
export mrp_to_quat
28

39
"""
@@ -8,9 +14,9 @@ Convert MRP `m` to a Quaternion.
814
function mrp_to_quat(m::MRP)
915
s_sq = m.q1^2 + m.q2^2 + m.q3^2
1016
denom = 1 + s_sq
11-
17+
1218
β0 = (1 - s_sq) / denom
1319
f = 2 / denom
14-
20+
1521
return Quaternion(β0, f * m.q1, f * m.q2, f * m.q3)
1622
end

0 commit comments

Comments
 (0)