dwarfplanetsfactory 0.0.1

Dwarf planet factory — classify, build and catalogue dwarf planets of any type: Kuiper belt, scattered disk, plutino, cold classical, detached, binary, Ceres-type, and sednoid.
Documentation
pub mod binary_dwarf;
pub mod ceres_type;
pub mod cold_classical;
pub mod detached;
pub mod kuiper_belt;
pub mod plutino;
pub mod scattered_disk;
pub mod sednoid;

pub use binary_dwarf::BinaryDwarf;
pub use ceres_type::CeresType;
pub use cold_classical::ColdClassical;
pub use detached::Detached;
pub use kuiper_belt::KuiperBelt;
pub use plutino::Plutino;
pub use scattered_disk::ScatteredDisk;
pub use sednoid::Sednoid;

/// Unified enum wrapping all dwarf planet types produced by the factory.
#[derive(Debug)]
pub enum GeneratedDwarfPlanet {
    KuiperBelt(KuiperBelt),
    ScatteredDisk(ScatteredDisk),
    Plutino(Plutino),
    ColdClassical(ColdClassical),
    Detached(Detached),
    BinaryDwarf(BinaryDwarf),
    CeresType(CeresType),
    Sednoid(Sednoid),
}

impl GeneratedDwarfPlanet {
    pub fn radius(&self) -> f64 {
        match self {
            Self::KuiperBelt(d) => d.radius,
            Self::ScatteredDisk(d) => d.radius,
            Self::Plutino(d) => d.radius,
            Self::ColdClassical(d) => d.radius,
            Self::Detached(d) => d.radius,
            Self::BinaryDwarf(d) => d.primary_radius,
            Self::CeresType(d) => d.radius,
            Self::Sednoid(d) => d.radius,
        }
    }

    pub fn semi_major_axis(&self) -> f64 {
        match self {
            Self::KuiperBelt(d) => d.semi_major_axis,
            Self::ScatteredDisk(d) => d.semi_major_axis,
            Self::Plutino(d) => d.semi_major_axis,
            Self::ColdClassical(d) => d.semi_major_axis,
            Self::Detached(d) => d.semi_major_axis,
            Self::BinaryDwarf(d) => d.semi_major_axis,
            Self::CeresType(d) => d.semi_major_axis,
            Self::Sednoid(d) => d.semi_major_axis,
        }
    }

    pub fn eccentricity(&self) -> f64 {
        match self {
            Self::KuiperBelt(d) => d.eccentricity,
            Self::ScatteredDisk(d) => d.eccentricity,
            Self::Plutino(d) => d.eccentricity,
            Self::ColdClassical(d) => d.eccentricity,
            Self::Detached(d) => d.eccentricity,
            Self::BinaryDwarf(d) => d.eccentricity,
            Self::CeresType(d) => d.eccentricity,
            Self::Sednoid(d) => d.eccentricity,
        }
    }
}