use crate::SOLAR_DAY_S;
const MERCURY_YEAR_S: f64 = 7_600_521.6;
const MERCURY_YEAR_EARTH_DAYS: f64 = 87.969;
pub struct MercuryCalendar {
pub elapsed_s: f64,
}
impl MercuryCalendar {
pub fn new(elapsed_s: f64) -> Self {
Self { elapsed_s }
}
pub fn mercury_years(&self) -> f64 {
self.elapsed_s / MERCURY_YEAR_S
}
pub fn mercury_solar_days(&self) -> f64 {
self.elapsed_s / SOLAR_DAY_S
}
pub fn earth_days(&self) -> f64 {
self.elapsed_s / 86400.0
}
pub fn year_fraction(&self) -> f64 {
(self.elapsed_s % MERCURY_YEAR_S) / MERCURY_YEAR_S
}
pub fn mean_anomaly_rad(&self) -> f64 {
self.year_fraction() * 2.0 * std::f64::consts::PI
}
}
pub fn orbital_period_days() -> f64 {
MERCURY_YEAR_EARTH_DAYS
}
pub fn solar_day_earth_days() -> f64 {
SOLAR_DAY_S / 86400.0
}