1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*!
* Unit constants and enumerations for consistent unit handling across the library.
*
* This module provides type-safe representations of unit formats used throughout
* the Brahe library, particularly for angle representations.
*/
use ;
/// Enumeration of angle formats for consistent angle representation across the library.
///
/// This enum is used throughout the library to specify whether angular quantities
/// should be interpreted or returned in radians or degrees. It replaces the legacy
/// `as_degrees: bool` pattern with a more explicit and type-safe approach.
///
/// For trajectory and propagator metadata where "no angles" (Cartesian) needs to be
/// represented, use `Option<AngleFormat>` where `None` indicates Cartesian representation.
///
/// # Examples
///
/// ```
/// use brahe::constants::AngleFormat;
///
/// let format = AngleFormat::Degrees;
/// let angle = match format {
/// AngleFormat::Radians => 3.14159,
/// AngleFormat::Degrees => 180.0,
/// };
/// ```
/// Constant for specifying angles in degrees.
///
/// This constant provides a convenient shorthand for `AngleFormat::Degrees`
/// and should be used for better code readability.
///
/// # Examples
///
/// ```
/// use brahe::constants::DEGREES;
/// use brahe::orbits::mean_motion;
///
/// let n = mean_motion(7000e3, DEGREES);
/// ```
pub const DEGREES: AngleFormat = Degrees;
/// Constant for specifying angles in radians.
///
/// This constant provides a convenient shorthand for `AngleFormat::Radians`
/// and should be used for better code readability.
///
/// # Examples
///
/// ```
/// use brahe::constants::RADIANS;
/// use brahe::orbits::mean_motion;
///
/// let n = mean_motion(7000e3, RADIANS);
/// ```
pub const RADIANS: AngleFormat = Radians;