use kalast::{Body, Properties, Time, World, ASTRONAUMICAL_UNIT, DAY, HOUR, TAU, V3, YEAR};
use std::path::Path;

fn main() {
    // Bodies
    let mut primary = Body::new(
        "Didymos",
        V3::new(0., 1., 0.) * ASTRONAUMICAL_UNIT * 1.664,
        Path::new("rsc/obj/didymos.obj"),
        Properties::new(
            1. * YEAR,    // rotation period
            11.92 * HOUR, // revolution period
            0.,           // obliquity
            100.,         // thermal inertia
            2146.,        // density
            600.,         // heat capacity
            0.1,          // albedo
            0.9,          // emissivity
        ),
    );
    let mut moon = Body::new(
        "Dimorphos",
        primary.position - V3::new(1., 0., 0.) * 1e3,
        Path::new("rsc/obj/dimorphos.obj"),
        Properties::new(
            11.92 * HOUR, // rotation period
            11.92 * HOUR, // revolution period
            0.,           //162. * TAU / 360., // obliquity
            500.,         // thermal inertia
            2146.,        // density
            600.,         // heat capacity
            0.07,         // albedo
            0.9,          // emissivity
        ),
    );
    // moon.set_faces_mask_equator();
    primary.object.apply_factor(1e3);

    // Time
    let time = Time::new(moon.properties.revolution_period() * 50.75, 30.);

    // World
    let mut world = World::new(time, moon, Some(primary));
    // world.start();
    // world.save(Path::new("rsc/temperatures/dimorphos_wo_obl_test.txt"));

    world.view_factor();

    /*
    let centers = world.body_environment.object.centers();
    let normals = world.body_environment.object.normals();
    println!("{}", centers.column(0));
    println!("{}", normals.column(0));
    */

    // println!("{}", world.body_target.temperatures());
}
