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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
use super::{CelestialBody, NAIF};

/// Planet Mercury as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
/// **Warning**: Keplerian dynamics are _not_ a correct representation of the orbit of Mercury
/// (cf. [this discussion](https://physics.stackexchange.com/questions/26408/what-did-general-relativity-clarify-about-mercury))
/// so one should take into account that general relativity is required for high fidelity dynamics in the vicinity of this planet.
pub struct MERCURY;

impl CelestialBody for MERCURY {
    fn gm() -> f64 {
        22_032.080_486_418
    }
    fn eq_radius() -> f64 {
        2439.7
    }
    fn flattening() -> f64 {
        0.0
    }
}

impl NAIF for MERCURY {
    fn id() -> i32 {
        199
    }
}

/// Planet Venus as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct VENUS;

impl CelestialBody for VENUS {
    fn gm() -> f64 {
        324_858.598_826_46
    }
    fn eq_radius() -> f64 {
        6_051.9
    }
    fn flattening() -> f64 {
        0.0
    }
}

impl NAIF for VENUS {
    fn id() -> i32 {
        299
    }
}

/// Planet Earth as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct EARTH;

impl EARTH {
    /// Defines the semi major radius of the ellipsoid of Earth, as per WGS84, in km.
    pub fn semi_major_radius() -> f64 {
        6378.1370
    }

    /// The rotation rate of Earth, in radians per seconds; [source](http://hpiers.obspm.fr/eop-pc/models/constants.html).
    pub fn rotation_rate() -> f64 {
        7.292_115_146_706_4e-5
    }
}

impl CelestialBody for EARTH {
    fn gm() -> f64 {
        398_600.441_5
    }
    fn eq_radius() -> f64 {
        6_378.136_3
    }
    fn flattening() -> f64 {
        // From [EMG2008](http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/egm08_wgs84.html)
        0.003_352_810_664_747_480_5
    }
}

impl NAIF for EARTH {
    fn id() -> i32 {
        399
    }
}

/// Planet Mars as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct MARS;

impl CelestialBody for MARS {
    fn gm() -> f64 {
        42_828.314_258_067
    }
    fn eq_radius() -> f64 {
        3.397e3
    }
    fn flattening() -> f64 {
        0.006_476_30
    }
}

impl NAIF for MARS {
    fn id() -> i32 {
        499
    }
}

/// Planet Jupiter as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct JUPITER;

impl CelestialBody for JUPITER {
    fn gm() -> f64 {
        126_712_767.857_80
    }
    fn eq_radius() -> f64 {
        7.1492e4
    }
    fn flattening() -> f64 {
        0.064_874_39
    }
}

impl NAIF for JUPITER {
    fn id() -> i32 {
        599
    }
}

/// Planet Saturn as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct SATURN;

impl CelestialBody for SATURN {
    fn gm() -> f64 {
        37_940_626.061_137
    }
    fn eq_radius() -> f64 {
        6.0268e4
    }
    fn flattening() -> f64 {
        0.097_962_43
    }
}

impl NAIF for SATURN {
    fn id() -> i32 {
        699
    }
}

/// Planet Uranus as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct URANUS;

impl CelestialBody for URANUS {
    fn gm() -> f64 {
        5_794_549.007_071_9
    }
    fn eq_radius() -> f64 {
        2.5559e4
    }
    fn flattening() -> f64 {
        0.022_927_34
    }
}

impl NAIF for URANUS {
    fn id() -> i32 {
        799
    }
}

/// Planet Neptune as defined in [GMAT 2016a](https://github.com/ChristopherRabotin/GMAT/blob/37201a6290e7f7b941bc98ee973a527a5857104b/src/base/util/GmatDefaults.hpp).
pub struct NEPTUNE;

impl CelestialBody for NEPTUNE {
    fn gm() -> f64 {
        6_836_534.063_879_3
    }
    fn eq_radius() -> f64 {
        2.5269e4
    }
    fn flattening() -> f64 {
        0.018_560_29
    }
}

impl NAIF for NEPTUNE {
    fn id() -> i32 {
        899
    }
}