Skip to content

Commit

Permalink
🎨 Apply the new comment style
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisbr committed May 24, 2024
1 parent 3962743 commit eadeb28
Show file tree
Hide file tree
Showing 25 changed files with 229 additions and 383 deletions.
6 changes: 3 additions & 3 deletions src/SatelliteToolboxBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ using StaticArrays
import Base: convert, iterate, length, eltype, show

############################################################################################
# Types
# Types #
############################################################################################

include("./types/ellipsoid.jl")
include("./types/orbit.jl")

############################################################################################
# Constants
# Constants #
############################################################################################

# Colors.
Expand All @@ -27,7 +27,7 @@ const _CRAYON_BOLD = crayon"bold"
include("./constants.jl")

############################################################################################
# Includes
# Includes #
############################################################################################

include("interfaces.jl")
Expand Down
19 changes: 8 additions & 11 deletions src/constants.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## Description #############################################################################
#
# Description
# ==========================================================================================
# Constants for the SatelliteToolbox.jl ecosystem.
#
# Constants for the SatelliteToolbox.jl ecosystem.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################

export ASTRONOMICAL_UNIT, GM_EARTH, EARTH_ANGULAR_SPEED, EARTH_EQUATORIAL_RADIUS
export EARTH_ORBIT_MEAN_MOTION, EARTH_POLAR_RADIUS
Expand All @@ -16,7 +13,7 @@ export SUN_RADIUS
export JD_J2000

############################################################################################
# General Parameters Related to the Earth
# General Parameters Related to the Earth #
############################################################################################

"""
Expand Down Expand Up @@ -62,7 +59,7 @@ Earth's polar radius [m] (WGS-84).
const EARTH_POLAR_RADIUS = 6356752.3142

############################################################################################
# Ellipsoids
# Ellipsoids #
############################################################################################

"""
Expand All @@ -80,7 +77,7 @@ WGS84 ellipsoid represented using `Float32`.
const WGS84_ELLIPSOID_F32 = Ellipsoid(6378137.0f0, 1 / 298.257223563f0)

############################################################################################
# Perturbation Terms
# Perturbation Terms #
############################################################################################

"""
Expand Down Expand Up @@ -126,7 +123,7 @@ J₄ perturbation term obtained from EGM-08 model (`J₄ = -C₄ * √9`) [1].
const EGM_2008_J4 = -1.6198975999169731e-6

############################################################################################
# General Parameters Related to the Sun
# General Parameters Related to the Sun #
############################################################################################

"""
Expand All @@ -143,7 +140,7 @@ Sun radius [m] as obtained by **[1]** using measurements from the SOHO spacecraf
const SUN_RADIUS = 6.96342e8

############################################################################################
# Time
# Time #
############################################################################################

"""
Expand Down
11 changes: 4 additions & 7 deletions src/interfaces.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## Description #############################################################################
#
# Description
# ==========================================================================================
# Interfaces with Julia APIs.
#
# Interfaces with Julia APIs.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################

############################################################################################
# Iterator Interface
# Iterator Interface #
############################################################################################

# There functions allow broadcast when using the orbit propagators.
Expand Down
61 changes: 32 additions & 29 deletions src/orbit/anomalies.jl
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## Description #############################################################################
#
# Description
# ==========================================================================================
# Functions to convert anomalies related to the orbit.
#
# Functions to convert anomalies related to the orbit.
## References ##############################################################################
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# [1] Vallado, D. A (2013). Fundamentals of Astrodynamics and Applications. Microcosm Press,
# Hawthorn, CA, USA.
#
# References
# ==========================================================================================
#
# [1] Vallado, D. A (2013). Fundamentals of Astrodynamics and Applications. Microcosm
# Press, Hawthorn, CA, USA.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################

export mean_to_eccentric_anomaly, mean_to_true_anomaly
export eccentric_to_true_anomaly, eccentric_to_mean_anomaly
export true_to_eccentric_anomaly, true_to_mean_anomaly

################################################################################
# From Mean Anomaly
################################################################################
############################################################################################
# From Mean Anomaly #
############################################################################################

"""
mean_to_eccentric_anomaly(e::T1, M::T2; max_iterations::Integer = 10, tol::Union{Nothing, Number} = nothing) where {T1, T2} -> T
Expand All @@ -31,15 +25,18 @@ anomaly `M` [rad].
This function uses the Newton-Raphson algorithm to solve the Kepler's equation.
!!! Note
!!! note
The output type `T` is obtained by promoting `T1` and `T2` to float.
# Keywords
- `tol::Union{Nothing, Number}`: Tolerance to accept the solution from Newton-Raphson
algorithm. If `tol` is `nothing`, it will be `eps(T)`. (**Default** = `nothing`)
algorithm. If `tol` is `nothing`, it will be `eps(T)`.
(**Default** = `nothing`)
- `max_iterations::Number`: Maximum number of iterations allowed for the Newton-Raphson
algorithm. If it is lower than 1, then it is set to 10. (**Default** = 10)
algorithm. If it is lower than 1, then it is set to 10.
(**Default** = 10)
"""
function mean_to_eccentric_anomaly(
e::T1,
Expand All @@ -49,8 +46,7 @@ function mean_to_eccentric_anomaly(
) where {T1, T2}
T = float(promote_type(T1, T2))

# Compute the eccentric anomaly using the Newton-Raphson method.
# ======================================================================================
# == Compute the Eccentric Anomaly Using the Newton-Raphson method =====================

# Make sure that M is in the interval [0,2π].
M = mod(M, T(2π))
Expand Down Expand Up @@ -89,15 +85,18 @@ Compute the true anomaly (0, 2π) [rad] given the orbit eccentricity `e` and the
This function uses the Newton-Raphson algorithm to solve the Kepler's equation.
!!! Note
!!! note
The output type `T` is obtained by promoting `T1` and `T2` to float.
# Keywords
- `tol::Union{Nothing, Number}`: Tolerance to accept the solution from Newton-Raphson
algorithm. If `tol` is `nothing`, it will be `eps(T)`. (**Default** = `nothing`)
algorithm. If `tol` is `nothing`, it will be `eps(T)`.
(**Default** = `nothing`)
- `max_iterations::Number`: Maximum number of iterations allowed for the Newton-Raphson
algorithm. If it is lower than 1, then it is set to 10. (**Default** = 10)
algorithm. If it is lower than 1, then it is set to 10.
(**Default** = 10)
"""
function mean_to_true_anomaly(e::T1, M::T2; kwargs...) where {T1, T2}
# Compute the eccentric anomaly.
Expand All @@ -108,7 +107,7 @@ function mean_to_true_anomaly(e::T1, M::T2; kwargs...) where {T1, T2}
end

############################################################################################
# From Eccentric Anomaly
# From Eccentric Anomaly #
############################################################################################

"""
Expand All @@ -117,7 +116,8 @@ end
Compute the true anomaly (0, 2π) [rad] given the orbit eccentricity `e` and the eccentric
anomaly `E` [rad].
!!! Note
!!! note
The output type `T` is obtained by promoting `T1` and `T2` to float.
"""
function eccentric_to_true_anomaly(e::T1, E::T2) where {T1, T2}
Expand All @@ -134,7 +134,8 @@ end
Compute the mean anomaly (0, 2π) [rad] given the orbit eccentricity `e` and the eccentric
anomaly `E` [rad].
!!! Note
!!! note
The output type `T` is obtained by promoting `T1` and `T2` to float.
"""
function eccentric_to_mean_anomaly(e::T1, E::T2) where {T1, T2}
Expand All @@ -143,7 +144,7 @@ function eccentric_to_mean_anomaly(e::T1, E::T2) where {T1, T2}
end

############################################################################################
# From True Anomaly
# From True Anomaly #
############################################################################################

"""
Expand All @@ -152,7 +153,8 @@ end
Compute the eccentric anomaly (0, 2π) [rad] given the orbit eccentricity `e` and the true
anomaly `f` [rad].
!!! Note
!!! note
The output type `T` is obtained by promoting `T1` and `T2` to float.
"""
function true_to_eccentric_anomaly(e::T1, f::T2) where {T1, T2}
Expand All @@ -168,7 +170,8 @@ end
Compute the mean anomaly (0, 2π) [rad] given the orbit eccentricity `e` and the true anomaly
`f` [rad].
!!! Note
!!! note
The output type `T` is obtained by promoting `T1` and `T2` to float.
"""
function true_to_mean_anomaly(e::T1, f::T2) where {T1, T2}
Expand Down
9 changes: 3 additions & 6 deletions src/orbit/conversions.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## Description #############################################################################
#
# Description
# ==========================================================================================
# Conversion between the orbit representations using Julia built-in system.
#
# Conversion between the orbit representations using Julia built-in system.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################

function Base.convert(
::Type{KeplerianElements{Tepoch, T}},
Expand Down
27 changes: 11 additions & 16 deletions src/orbit/kepler_to_rv.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## Description #############################################################################
#
# Description
# ==========================================================================================
# Conversion from the Keplerian elements to position and velocity state vector.
#
# Conversion from the Keplerian elements to position and velocity state vector.
## References ##############################################################################
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# [1] Schwarz, R (2014). Memorandum No. 2: Cartesian State Vectors to Keplerian Orbit
# Elements. Available at www.rene-schwarz.com.
#
# References
# ==========================================================================================
#
# [1] Schwarz, R (2014). Memorandum No. 2: Cartesian State Vectors to Keplerian Orbit
# Elements. Available at www.rene-schwarz.com.
# https://downloads.rene-schwarz.com/dc/category/18
# (Accessed on 2017-08-09).
#
# https://downloads.rene-schwarz.com/dc/category/18
# (Accessed on 2017-08-09).
# [2] Kuga, H. K., Carrara, V., Rao, K. R (2005). Introdução à Mecânica Orbital. 2ª ed.
# Instituto Nacional de Pesquisas Espaciais.
#
# [2] Kuga, H. K., Carrara, V., Rao, K. R (2005). Introdução à Mecânica Orbital. 2ª ed.
# Instituto Nacional de Pesquisas Espaciais.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################

export kepler_to_rv

Expand All @@ -30,6 +24,7 @@ Convert the Keplerian elements `ke` to a Cartesian representation (position vect
and velocity vector `v` [m / s]).
!!! note
The returned vectors are represented in the same reference frame as the Keplerian
elements.
Expand Down
10 changes: 4 additions & 6 deletions src/orbit/kepler_to_sv.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## Description #############################################################################
#
# Description
# ==========================================================================================
# Conversion from orbit state vector to Keplerian elements.
#
# Conversion from orbit state vector to Keplerian elements.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################

export kepler_to_sv

Expand All @@ -15,6 +12,7 @@ export kepler_to_sv
Convert the Keplerian elements `ke` to the orbit state vector.
!!! note
The acceleration in the orbit state vector will be set to 0.
"""
function kepler_to_sv(ke::KeplerianElements)
Expand Down
Loading

0 comments on commit eadeb28

Please sign in to comment.