pg_orrery/src/l12.h
Ryan Malloy 3915d1784f Rename pg_orbit to pg_orrery
An existing product called PG Orbit (a mobile PostgreSQL client)
creates a naming conflict. pg_orrery — a database orrery built from
Keplerian parameters and SQL instead of brass gears.

Build system: control file, Makefile, Dockerfile, docker init script.
C source: GUC prefix, PG_FUNCTION_INFO_V1 symbol, header guards,
ereport prefixes, comments across ~30 files including vendored SGP4.
SQL: all 5 install/migration scripts, function name pg_orrery_ephemeris_info.
Tests: 9 SQL suites, 8 expected outputs, standalone DE reader test.
Documentation: CLAUDE.md, README.md, DESIGN.md, Starlight site infra,
36 MDX pages, OG renderer, logo SVG, docker-compose, agent threads.

All 13 regression suites pass. Docs site builds (37 pages).
2026-02-17 13:36:22 -07:00

74 lines
2.6 KiB
C

/************************************************************************
L1.2 Galilean satellite theory -- Lainey, Duriez & Vienne
Clean-room implementation for pg_orrery.
The L1.2 theory provides positions and velocities of Jupiter's four
Galilean moons (Io, Europa, Ganymede, Callisto) relative to Jupiter's
center, in the VSOP87 ecliptic J2000 reference frame.
Reference:
Lainey V., Duriez L., Vienne A.
"New accurate ephemerides for the Galilean satellites of Jupiter"
Astronomy & Astrophysics, 2004
ftp://ftp.imcce.fr/pub/ephem/satel/galilean/L1/L1.2/
The theory coefficients are astronomical constants derived from
fitting observations of the Galilean system. They represent
physical measurements and are not copyrightable.
Copyright (c) 2026 Ryan Malloy <ryan@supported.systems>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Thread-safe: all functions are reentrant with no static mutable state.
****************************************************************/
#ifndef L12_H
#define L12_H
#ifdef __cplusplus
extern "C" {
#endif
#define L12_IO 0
#define L12_EUROPA 1
#define L12_GANYMEDE 2
#define L12_CALLISTO 3
/*
* Compute the position (and optionally velocity) of a Galilean moon
* using the L1.2 semi-analytic theory.
*
* jd: Julian date in Terrestrial Time (TT).
* body: Moon index: 0=Io, 1=Europa, 2=Ganymede, 3=Callisto.
* xyz: Output position in AU, VSOP87 ecliptic J2000 frame,
* relative to Jupiter's center. Must point to double[3].
* xyzdot: Output velocity in AU/day, same frame. May be NULL
* to skip velocity computation.
*/
void GetL12Coor(double jd, int body, double *xyz, double *xyzdot);
#ifdef __cplusplus
}
#endif
#endif /* L12_H */