From 5f1c15e614bba391e1d521c3cc637390d4ec78ba Mon Sep 17 00:00:00 2001 From: yuni Date: Thu, 28 Nov 2024 03:27:54 +0100 Subject: [PATCH] atmosphere: fix density calculations --- doc/research.md | 4 ++-- src/nature.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/research.md b/doc/research.md index 2e4393a..590d70b 100644 --- a/doc/research.md +++ b/doc/research.md @@ -122,8 +122,8 @@ Density: - 500km-1029.2km: `rho[kg/m³](x[m]) = exp(-15.98781474626208 - 0.00000816092074*x)` - 200km-500km: `rho[kg/m³](x[m]) = exp(-4.22487505187567 - 0.00003251947782*x)` - 0km-200km: `rho[kg/m³](x[m]) = exp(-1.83275074106303 - 0.00004486861245*x)` -- -62000km-0km: `rho[kg/m³](x[m]) = -0.0725781*x + 0.16` (linear regression) -- -70000km-62000km: `rho[kg/m³](x[m]) = 25000.0 / (1 + exp(0.00580528 * x + 361.44394)))` (logistic regression) +- -62000km-0km: `rho[kg/m³](x[m]) = -0.0000725781*x + 0.16` (linear regression) +- -70000km-62000km: `rho[kg/m³](x[m]) = 25000.0 / (1 + exp(0.00000580528 * x + 361.44394)))` (logistic regression) ### Designing the in-game atmosphere diff --git a/src/nature.rs b/src/nature.rs index a3560e3..57e9298 100644 --- a/src/nature.rs +++ b/src/nature.rs @@ -325,7 +325,7 @@ pub fn jupiter_altitude_to_density(altitude: f64) -> f64 { } else if x >= 0.0 { return (-1.83275074106303 - 0.00004486861245 * x).exp(); } else if x >= -62000e3 { - return -0.0725781 * x + 0.16; + return -0.0000725781 * x + 0.16; } - return 25000.0 / (1.0 + (0.00580528 * x + 361.44394)).exp(); + return 25000.0 / (1.0 + (0.00000580528 * x + 361.44394).exp()); }