use super::*;
macro_rules! impl_planet_center_shift_vsop {
($center:ty) => {
impl<F> CenterShiftProvider<$center, Barycentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
rotate_shift_from_ecliptic::<_, F, Eph, Eop, Nut>(<$center>::vsop87e(jd), jd, ctx)
}
}
impl_reverse_center_shifts!($center);
};
}
impl_planet_center_shift_vsop!(Mercurycentric);
impl_planet_center_shift_vsop!(Venuscentric);
impl_planet_center_shift_vsop!(Marscentric);
impl_planet_center_shift_vsop!(Jovicentric);
impl_planet_center_shift_vsop!(Saturnocentric);
impl_planet_center_shift_vsop!(Uranocentric);
impl_planet_center_shift_vsop!(Neptunocentric);
impl<F> CenterShiftProvider<Plutocentric, Barycentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
use crate::bodies::solar_system;
let helio_pos = solar_system::PLUTO.orbit.kepler_position(jd);
let sun_bary = Eph::sun_barycentric(jd);
let bary_pos = Position::<Barycentric, EclipticMeanJ2000, qtty::AstronomicalUnit>::new(
helio_pos.x() + sun_bary.x(),
helio_pos.y() + sun_bary.y(),
helio_pos.z() + sun_bary.z(),
);
rotate_shift_from_ecliptic::<_, F, Eph, Eop, Nut>(bary_pos, jd, ctx)
}
}
impl_reverse_center_shifts!(Plutocentric);
impl<F> CenterShiftProvider<Selenocentric, Barycentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
let moon_geo_au = Eph::moon_geocentric(jd).to_unit::<qtty::AstronomicalUnit>();
let earth_bary = Eph::earth_barycentric(jd);
let seleno_bary = Position::<Barycentric, EclipticMeanJ2000, qtty::AstronomicalUnit>::new(
moon_geo_au.x() + earth_bary.x(),
moon_geo_au.y() + earth_bary.y(),
moon_geo_au.z() + earth_bary.z(),
);
rotate_shift_from_ecliptic::<_, F, Eph, Eop, Nut>(seleno_bary, jd, ctx)
}
}
impl<F> CenterShiftProvider<Geocentric, Selenocentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
let moon_geo_au = Eph::moon_geocentric(jd).to_unit::<qtty::AstronomicalUnit>();
let geo_to_seleno = Position::<Geocentric, EclipticMeanJ2000, qtty::AstronomicalUnit>::new(
-moon_geo_au.x(),
-moon_geo_au.y(),
-moon_geo_au.z(),
);
rotate_shift_from_ecliptic::<_, F, Eph, Eop, Nut>(geo_to_seleno, jd, ctx)
}
}
impl<F> CenterShiftProvider<Barycentric, Selenocentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
inverse_shift::<Barycentric, Selenocentric, F, Eph, Eop, Nut>(jd, ctx)
}
}
impl<F> CenterShiftProvider<Heliocentric, Selenocentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
compose_shift::<Heliocentric, Barycentric, Selenocentric, F, Eph, Eop, Nut>(jd, ctx)
}
}
impl<F> CenterShiftProvider<Selenocentric, Heliocentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
inverse_shift::<Selenocentric, Heliocentric, F, Eph, Eop, Nut>(jd, ctx)
}
}
impl<F> CenterShiftProvider<Selenocentric, Geocentric, F> for ()
where
F: affn::ReferenceFrame,
(): FrameRotationProvider<EclipticMeanJ2000, F>,
{
#[inline]
fn shift<Eph: Ephemeris, Eop: EopProvider, Nut>(
jd: JulianDate,
ctx: &AstroContext<Eph, Eop, Nut>,
) -> AuShift {
inverse_shift::<Selenocentric, Geocentric, F, Eph, Eop, Nut>(jd, ctx)
}
}