earths 0.0.4

High-fidelity Earth simulation engine — orbit, atmosphere, geology, hydrology, biosphere, terrain, lighting, rendering, satellites, and temporal systems with full scientific coupling
Documentation
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Biome {
    Ocean,
    Beach,
    Desert,
    Grassland,
    Forest,
    Taiga,
    Tundra,
    Snow,
    Mountain,
    Volcanic,
}
pub struct SplatWeights {
    pub weights: [(Biome, f32); 4],
}
pub struct BiomeClassifier {
    pub sealevel: f64,
}
impl Default for BiomeClassifier {
    fn default() -> Self {
        Self { sealevel: 0.0 }
    }
}
impl BiomeClassifier {
    pub fn classify(&self, elevationm: f64, latitudedeg: f64, moisture: f64) -> Biome {
        if elevationm < self.sealevel {
            return Biome::Ocean;
        }
        if elevationm < self.sealevel + 10.0 {
            return Biome::Beach;
        }
        if elevationm > 4000.0 {
            return Biome::Snow;
        }
        if elevationm > 2500.0 {
            return Biome::Mountain;
        }
        let abslat = latitudedeg.abs();
        if abslat > 70.0 {
            return Biome::Tundra;
        }
        if abslat > 55.0 {
            return Biome::Taiga;
        }
        if moisture < 0.2 {
            return Biome::Desert;
        }
        if moisture > 0.6 {
            return Biome::Forest;
        }
        Biome::Grassland
    }
    pub fn splat(&self, elevationm: f64, latitudedeg: f64, moisture: f64) -> SplatWeights {
        let primary = self.classify(elevationm, latitudedeg, moisture);
        SplatWeights {
            weights: [
                (primary, 1.0),
                (Biome::Ocean, 0.0),
                (Biome::Ocean, 0.0),
                (Biome::Ocean, 0.0),
            ],
        }
    }
}