/** * apparent.ts — Geometric ephemeris state → apparent place. * * Turns raw DE440 barycentric vectors into the direction an observer actually * sees, applying, in the order the corrections physically occur: * * 1. Light-time — the body is seen where it *was* when the light left it. * Solved iteratively; the observer stays at epoch t. * 2. Deflection — solar gravity bends the ray (≤1.75″ at the solar limb, * ~0.004″ at 90° elongation). * 3. Aberration — the observer's barycentric velocity tilts the apparent * direction by up to 20.5″. * * The previous implementation had none of these working: light-time was * computed in *days* and then subtracted from an epoch expressed in *seconds*, * so the correction was ~86400× too small and effectively absent, and neither * aberration nor deflection existed at all. Together those accounted for most * of the 7–41″ error measured against JPL Horizons. * * Output is an ICRF equatorial unit vector plus true geometric distance; the * caller rotates it into whichever ecliptic frame it needs. */ import type { Vec3 } from './chebyshev.js'; import type { Vec } from './precession.js'; /** Astronomical unit, km (IAU 2012). */ export declare const AU_KM = 149597870.7; /** Minimal slice of SpkFile that this module needs. */ export interface BarycentricSource { getBarycentric(naifBody: number, et: number): Vec3; } export interface ApparentPlace { /** Apparent direction as an ICRF equatorial unit vector. */ direction: Vec; /** Geometric distance observer → body at emission, in AU. */ distanceAU: number; /** Light-time in seconds. */ lightTimeSec: number; } export interface ObserverState { /** Barycentric position, km (ICRF equatorial). */ position: Vec; /** Barycentric velocity, km/s (ICRF equatorial). */ velocity: Vec; } /** * Which of the three corrections to apply. * * Astronomy defaults to all three ("apparent place" — where a telescope points). * Jyotish software conventionally does not: JHora publishes **geometric** places, * with all three off. Measured against JHora's 1998 reference chart, the gap * between the two conventions is 44″ for Venus, 21″ for the Sun and 7″ for * Saturn — small, but far above the arcsecond level this engine works at, so it * has to be an explicit choice rather than an assumption. */ export interface PlaceCorrections { lightTime?: boolean; deflection?: boolean; aberration?: boolean; } /** Geometric place: where the body *is*, ignoring how its light reaches us. */ export declare const GEOMETRIC: Required; /** Apparent place: where the body is *seen*. Matches JPL Horizons. */ export declare const APPARENT: Required; /** * Barycentric state of the observer. * * @param geocentreOffset Optional observer offset from the geocentre in km * (ICRF equatorial) for topocentric places, plus its * velocity in km/s from Earth rotation. */ export declare function observerState(spk: BarycentricSource, earthNaifId: number, et: number, geocentreOffset?: { position: Vec; velocity: Vec; }): ObserverState; /** * Geocentric (or topocentric) place of a solar-system body. * * @param spk Barycentric state source (the loaded SPK file) * @param naifBody NAIF id of the target * @param sunNaifId NAIF id of the Sun (for the deflection geometry) * @param et Ephemeris time, seconds past J2000.0 TDB * @param observer Observer barycentric state at `et` * @param corrections Which corrections to apply; see {@link PlaceCorrections} */ export declare function computePlace(spk: BarycentricSource, naifBody: number, sunNaifId: number, et: number, observer: ObserverState, corrections?: Required): ApparentPlace;