mercurys 0.0.1

Mercury celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
#[derive(Debug, Clone)]
pub struct NamedRegion {
    pub name: &'static str,
    pub center_lat: f64,
    pub center_lon: f64,
    pub diameter_km: f64,
    pub kind: RegionKind,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RegionKind {
    Basin,
    Planitia,
    Crater,
    Rupes,
    Quadrangle,
}

pub const MAJOR_REGIONS: &[NamedRegion] = &[
    NamedRegion {
        name: "Caloris Basin",
        center_lat: 30.5,
        center_lon: 170.2,
        diameter_km: 1550.0,
        kind: RegionKind::Basin,
    },
    NamedRegion {
        name: "Rembrandt Basin",
        center_lat: -33.0,
        center_lon: 88.0,
        diameter_km: 716.0,
        kind: RegionKind::Basin,
    },
    NamedRegion {
        name: "Beethoven Basin",
        center_lat: -20.0,
        center_lon: -124.0,
        diameter_km: 643.0,
        kind: RegionKind::Basin,
    },
    NamedRegion {
        name: "Tolstoj Basin",
        center_lat: -16.3,
        center_lon: -164.5,
        diameter_km: 510.0,
        kind: RegionKind::Basin,
    },
    NamedRegion {
        name: "Rachmaninoff Basin",
        center_lat: 27.6,
        center_lon: 57.6,
        diameter_km: 306.0,
        kind: RegionKind::Basin,
    },
    NamedRegion {
        name: "Borealis Planitia",
        center_lat: 73.0,
        center_lon: 80.0,
        diameter_km: 1500.0,
        kind: RegionKind::Planitia,
    },
    NamedRegion {
        name: "Suisei Planitia",
        center_lat: 59.0,
        center_lon: 151.0,
        diameter_km: 800.0,
        kind: RegionKind::Planitia,
    },
    NamedRegion {
        name: "Sobkou Planitia",
        center_lat: 40.0,
        center_lon: -130.0,
        diameter_km: 700.0,
        kind: RegionKind::Planitia,
    },
    NamedRegion {
        name: "Discovery Rupes",
        center_lat: -56.3,
        center_lon: -37.3,
        diameter_km: 650.0,
        kind: RegionKind::Rupes,
    },
    NamedRegion {
        name: "Enterprise Rupes",
        center_lat: -37.0,
        center_lon: 75.0,
        diameter_km: 820.0,
        kind: RegionKind::Rupes,
    },
    NamedRegion {
        name: "Carnegie Rupes",
        center_lat: 58.5,
        center_lon: -54.0,
        diameter_km: 570.0,
        kind: RegionKind::Rupes,
    },
    NamedRegion {
        name: "Kuiper Crater",
        center_lat: -11.0,
        center_lon: -31.5,
        diameter_km: 62.0,
        kind: RegionKind::Crater,
    },
    NamedRegion {
        name: "Degas Crater",
        center_lat: 37.1,
        center_lon: -127.0,
        diameter_km: 54.0,
        kind: RegionKind::Crater,
    },
    NamedRegion {
        name: "Debussy Crater",
        center_lat: -33.0,
        center_lon: -10.0,
        diameter_km: 80.0,
        kind: RegionKind::Crater,
    },
    NamedRegion {
        name: "Hokusai Crater",
        center_lat: 57.8,
        center_lon: 16.9,
        diameter_km: 114.0,
        kind: RegionKind::Crater,
    },
];

pub fn regions() -> &'static [&'static str] {
    &[
        "Caloris Basin",
        "Rembrandt Basin",
        "Beethoven Basin",
        "Tolstoj Basin",
        "Rachmaninoff Basin",
        "Borealis Planitia",
        "Suisei Planitia",
        "Sobkou Planitia",
        "Discovery Rupes",
        "Enterprise Rupes",
        "Carnegie Rupes",
        "Kuiper Crater",
        "Degas Crater",
        "Debussy Crater",
        "Hokusai Crater",
    ]
}

pub fn find_region(name: &str) -> Option<&'static NamedRegion> {
    MAJOR_REGIONS.iter().find(|r| r.name == name)
}

pub const QUADRANGLE_COUNT: usize = 15;

pub fn quadrangle_name(index: usize) -> &'static str {
    const NAMES: [&str; 15] = [
        "H-1 Borealis",
        "H-2 Victoria",
        "H-3 Shakespeare",
        "H-4 Raditladi",
        "H-5 Hokusai",
        "H-6 Kuiper",
        "H-7 Beethoven",
        "H-8 Tolstoj",
        "H-9 Eminescu",
        "H-10 Derain",
        "H-11 Discovery",
        "H-12 Michelangelo",
        "H-13 Neruda",
        "H-14 Bach",
        "H-15 Caloris",
    ];
    if index < 15 { NAMES[index] } else { "Unknown" }
}