use kalast::{EnvironmentSystem, Properties, SingleBody, ASTRONAUMICAL_UNIT, HOUR, TAU, V3};

fn main() {
    // Define the body.
    let mut asteroid = SingleBody::new(
        "Dimorphos",
        "rsc/obj/ellipsoid.obj",
        -V3::new(1.0, 0.0, 0.0) * ASTRONAUMICAL_UNIT * 1.074,
        Properties::new(
            11.92 * HOUR,        // rotation period
            11.92 * HOUR,        // revolution period
            162.0 * TAU / 180.0, // obliquity
            500.0,               // thermal inertia
            2146.0,              // density
            600.0,               // heat capacity
            0.07,                // albedo
            0.9,                 // emissivity
        ),
    );
    asteroid.complete_model(false);

    let mut latitudes_row = asteroid
        .body()
        .object
        .sphericals()
        .row(1)
        .abs()
        .into_owned();
    let latitudes = latitudes_row.as_mut_slice();
    latitudes.sort_by(|a, b| a.partial_cmp(b).unwrap());
    println!("{:?}", latitudes);

    // asteroid.body_mut().object.set_prime_meridian_mask(Some(0.08));
    asteroid.body_mut().object.set_equator_mask(Some(0.011));

    println!("{}", asteroid.body().object.sphericals().transpose());
    println!("{}", asteroid.body().object.faces_mask_true_indices());
}
