pg_orrery/src/sidereal_time.h
Ryan Malloy 0544a78276 pg_orbit 0.2.0: Full solar system computation at the SQL layer
Phase 1 — Stars, comets, Keplerian propagation:
- star_observe() / star_observe_safe(): fixed star alt/az via IAU 1976
  precession, equatorial-to-horizontal transform
- kepler_propagate(): two-body Keplerian orbit propagation for
  elliptic, parabolic, and hyperbolic orbits
- comet_observe(): observe comets/asteroids from orbital elements
- heliocentric type: ecliptic J2000 position (x, y, z in AU)

Phase 2 — VSOP87 planets, ELP82B Moon, Sun:
- planet_heliocentric(): VSOP87 heliocentric ecliptic J2000 positions
  for Mercury through Neptune (Bretagnon & Francou, MIT)
- planet_observe(): full observation pipeline for any planet
- sun_observe(): Sun position from negated Earth VSOP87
- moon_observe(): ELP2000-82B lunar position (Chapront-Touzé, MIT)
- Clean-room precession (IAU 2006) and sidereal time (IERS 2010)
- elliptic_to_rectangular utility (Stellarium, MIT)

All Stellarium extractions are MIT-licensed, thread-safe (static
caching removed for PARALLEL SAFE), zero external data files.

All 9 regression tests pass (90ms total).
2026-02-16 01:36:27 -07:00

48 lines
1.5 KiB
C

/*
* sidereal_time.h -- Greenwich sidereal time (mean and apparent)
*
* Clean-room implementation from published standards:
* IERS Conventions (2010), IERS Technical Note 36, Ch. 5.
* Capitaine, Guinot & McCarthy (2000), "Definition of the
* Celestial Ephemeris Origin and of UT1 in the International
* Celestial Reference Frame", A&A 355, 398-405.
*
* No PostgreSQL dependencies -- pure math, suitable for standalone use.
*/
#ifndef PG_ORBIT_SIDEREAL_TIME_H
#define PG_ORBIT_SIDEREAL_TIME_H
/*
* get_mean_sidereal_time -- Greenwich Mean Sidereal Time
*
* Computes GMST using the classical polynomial in UT1,
* consistent with IAU 2006 precession.
*
* JD = Julian Date (UT1 timescale)
* JDE = Julian Ephemeris Date (TDB/TT timescale)
*
* For pg_orbit Phase 2, JD and JDE are treated as identical
* (delta-T correction not yet applied; the difference is <1s
* for recent epochs).
*
* Returns GMST in radians, normalized to [0, 2*pi).
*/
double get_mean_sidereal_time(double JD, double JDE);
/*
* get_apparent_sidereal_time -- Greenwich Apparent Sidereal Time
*
* GAST = GMST + equation of the equinoxes.
*
* The equation of the equinoxes accounts for nutation:
* EqEq = delta_psi * cos(epsilon_A)
* where delta_psi is nutation in longitude and epsilon_A is
* the mean obliquity, both from precession.h.
*
* Returns GAST in radians, normalized to [0, 2*pi).
*/
double get_apparent_sidereal_time(double JD, double JDE);
#endif /* PG_ORBIT_SIDEREAL_TIME_H */