extern crate rkepler;
use rkepler::frame::coord;
use rkepler::math::angle;
use rkepler::math::sphe::sph;
use rkepler::math::sphe::sph::Sph;
#[test]
fn t_eqv_hor() {
let hd = Sph { lon: 1.1, lat: 1.2 };
let phi = 0.3;
let out = coord::eqv_hor(&hd, phi);
assert!((out.lon - 5.916889243730066194).abs() < 1e-13);
assert!((out.lat - 0.4472186304990486228).abs() < 1e-14);
}
#[test]
fn t_hor_eqv() {
let ae = Sph { lon: 5.5, lat: 1.1 };
let phi = 0.7;
let out = coord::hor_eqv(&ae, phi);
assert!((out.lon - 0.5933291115507309663).abs() < 1e-14);
assert!((out.lat - 0.9613934761647817620).abs() < 1e-14);
}
#[test]
fn t_parallactic() {
let hd = Sph { lon: 1.1, lat: 1.2 };
let phi = 0.3;
let out = coord::parallactic(&hd, phi);
assert!((out - 1.906227428001995580).abs() < 1e-13);
}
#[test]
fn t_icrs_gal() {
let icrs = Sph {
lon: 5.9338074302227188048671087,
lat: -1.1784870613579944551540570,
};
let out = sph::from_cart(&coord::icrs_gal(&icrs.to_cart()));
assert!((angle::norm_dblpi(out.lon) - 5.5850536063818546461558).abs() < 1e-14);
assert!((out.lat - -0.7853981633974483096157).abs() < 1e-14);
}
#[test]
fn t_gal_icrs() {
let gal = Sph {
lon: 5.5850536063818546461558105,
lat: -0.7853981633974483096156608,
};
let out = sph::from_cart(&coord::gal_icrs(&gal.to_cart()));
assert!((angle::norm_dblpi(out.lon) - 5.9338074302227188048671).abs() < 1e-14);
assert!((out.lat - -1.1784870613579944551541).abs() < 1e-14);
}