use crate::physics::orbit::TitanOrbit;

pub fn libration_factor(true_anomaly_rad: f64) -> f64 {
    1.0 + 0.08 * true_anomaly_rad.sin()
}

pub fn orbital_energy_j_per_kg(orbit: TitanOrbit, distance_m: f64) -> f64 {
    let speed = orbit.orbital_speed_m_s(distance_m);
    0.5 * speed.powi(2) - crate::physics::orbit::PLANET_GRAVITATIONAL_PARAMETER / distance_m
}

pub fn resonance_offset_deg(orbit: TitanOrbit, spin_period_s: f64) -> f64 {
    let orbital_period = orbit.orbital_period_s();
    360.0 * (spin_period_s - orbital_period) / orbital_period
}
