satkit/
solarsystem.rs

1/// Solar system bodies
2///
3/// Coordinate origin is the solar system barycenter
4///
5/// # Notes:
6///  * For native JPL Ephemerides function calls:
7///    positions for all bodies are natively relative to
8///    solar system barycenter, with exception of moon,
9///    which is computed in Geocentric system
10///  * EMB (2) is the Earth-Moon barycenter
11///  * The sun position is relative to the solar system barycenter
12///    (it will be close to origin)
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum SolarSystem {
15    /// Mercury
16    Mercury = 0,
17    /// Venus
18    Venus = 1,
19    /// Earth-Moon Barycenter
20    EMB = 2,
21    /// Mars
22    Mars = 3,
23    /// Jupiter
24    Jupiter = 4,
25    /// Saturn
26    Saturn = 5,
27    /// Uranus
28    Uranus = 6,
29    /// Neptune
30    Neptune = 7,
31    /// Pluto
32    Pluto = 8,
33    /// Moon (Geocentric)
34    Moon = 9,
35    /// Sun
36    Sun = 10,
37}
38
39impl std::fmt::Display for SolarSystem {
40    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
41        let name = match self {
42            Self::Mercury => "Mercury",
43            Self::Venus => "Venus",
44            Self::EMB => "Earth-Moon Barycenter",
45            Self::Mars => "Mars",
46            Self::Jupiter => "Jupiter",
47            Self::Saturn => "Saturn",
48            Self::Uranus => "Uranus",
49            Self::Neptune => "Neptune",
50            Self::Pluto => "Pluto",
51            Self::Moon => "Moon",
52            Self::Sun => "Sun",
53        };
54        write!(f, "{}", name)
55    }
56}