~starkingdoms/starkingdoms

ref: cb5394d426ad0a74d83cc6e63e1d5300ce9f6e3b starkingdoms/server/src/orbit/kepler.rs -rw-r--r-- 482 bytes
cb5394d4 — c0repwn3r jenkins CI pt.11 (fix the custom build image) 2 years ago
                                                                                
1
2
3
4
5
6
7
/// Kepler's equation: M = E - e * sin(E)
/// M is the Mean Anomaly (angle to where body would be if its orbit was actually circular)
/// E is the Eccentric Anomaly (angle to where the body is on the ellipse)
/// e is the eccentricity of the orbit (0 = perfect circle, and up to 1 is increasingly elliptical)
pub fn kepler_equation(eccentric_anomaly: f64, mean_anomaly: f64, eccentricity: f64) -> f64 {
    mean_anomaly - eccentric_anomaly + eccentricity * eccentric_anomaly.sin()
}