dwarfplanetsfactory 0.0.2

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
use crate::config::parameters;

/// Degrees to radians
pub fn deg_to_rad(deg: f64) -> f64 {
    deg * parameters::PI / 180.0
}

/// Radians to degrees
pub fn rad_to_deg(rad: f64) -> f64 {
    rad * 180.0 / parameters::PI
}

/// Arcseconds to radians
pub fn arcsec_to_rad(arcsec: f64) -> f64 {
    arcsec / 206265.0
}

/// Radians to arcseconds
pub fn rad_to_arcsec(rad: f64) -> f64 {
    rad * 206265.0
}

/// AU to metres
pub fn au_to_m(au: f64) -> f64 {
    au * parameters::AU
}

/// Metres to AU
pub fn m_to_au(m: f64) -> f64 {
    m / parameters::AU
}

/// Years to seconds
pub fn years_to_s(years: f64) -> f64 {
    years * parameters::YEAR
}

/// Seconds to years
pub fn s_to_years(s: f64) -> f64 {
    s / parameters::YEAR
}

/// Clamp a value and return it
pub fn clamp_f64(val: f64, lo: f64, hi: f64) -> f64 {
    val.clamp(lo, hi)
}