use kalast::{
    EnvironmentSystem, Properties, SingleBody, Time, World, ASTRONAUMICAL_UNIT, DAY, HOUR, MINUTE,
    TAU, V3,
};

fn main() {
    // Define the crater
    // 30° Sun inclination
    let mut crater = SingleBody::new(
        "Crater",
        "rsc/obj/crater.obj",
        V3::new(1.0, 0.0, -(30.0 * TAU / 360.0).tan()) * ASTRONAUMICAL_UNIT * 1.664,
        Properties::new(
            11.92 * HOUR, // rotation period
            11.92 * HOUR, // revolution period
            0.0,          // obliquity
            500.0,        // thermal inertia
            2146.0,       // density
            600.0,        // heat capacity
            0.07,         // albedo
            0.9,          // emissivity
        ),
    );
    crater.body_mut().object.invert_normals();
    crater.complete_model(true);
    crater.body_mut().fixed(true);

    // Time
    let time = Time::new(10.0 * DAY, 30.0 * MINUTE);

    // World
    let mut world = World::new(time, crater);
    world.start();
    world.save("rsc/data/tmp.txt");

    println!(
        "min: {:.2}, max: {:.2}",
        world.environment_system.body().surface_temperatures().min(),
        world.environment_system.body().surface_temperatures().max()
    );
}
