UNPKG

@observerly/astrometry

Version:

observerly's lightweight, zero-dependency, type safe astrometry library written in Typescript for calculating the position of celestial objects in the sky.

220 lines (219 loc) 8.13 kB
/*****************************************************************************************************************/ import type { EclipticCoordinate, EquatorialCoordinate, GeographicCoordinate, HorizontalCoordinate } from './common'; /*****************************************************************************************************************/ export type Planet = { /** * * * Some unique identifier for the planet. * */ uid: string; /** * * * The common, wsternised name of the planet. * */ name: 'Mercury' | 'Venus' | 'Earth' | 'Mars' | 'Jupiter' | 'Saturn' | 'Uranus' | 'Neptune'; /** * * * The "astrological" symbol for the planet. * */ symbol: '☿' | '♀' | '♁' | '♂' | '♃' | '♄' | '♅' | '♆'; /** * * * The planet's orbital period in tropical years. * */ T: number; /** * * * The planet's mass relative to Earth. * */ m: number; /** * * * The planet's radius relative to Earth. * */ r: number; /** * * * The planet's eccentricity. * */ e: number; /** * * * The planet's semi-major axis in AU. * */ a: number; /** * * * The planet's inclination in degrees. * */ i: number; /** * * * The planet's ecliptical longitude at epoch in degrees. * */ ε: number; /** * * * The planet's ecliptical longitude at perihelion in degrees. * */ ϖ: number; /** * * * The planet's ecliptical longitude of ascending node at epoch in degrees. * */ Ω: number | null; /** * * * Whether the planet is inferior. * */ isInferior?: boolean; }; /*****************************************************************************************************************/ export declare const mercury: Planet; /*****************************************************************************************************************/ export declare const venus: Planet; /*****************************************************************************************************************/ export declare const mars: Planet; /*****************************************************************************************************************/ export declare const jupiter: Planet; /*****************************************************************************************************************/ export declare const saturn: Planet; /*****************************************************************************************************************/ export declare const uranus: Planet; /*****************************************************************************************************************/ export declare const neptune: Planet; /*****************************************************************************************************************/ /** * * * This snapshot of orbital data is taken from the The Astronomical Almanac 2000 and various NASA sources. * * All quoted values are for the epoch J2000.0. * */ export declare const planets: Planet[]; /*****************************************************************************************************************/ type PlanetOrbitalParameters = Omit<Planet, 'uid' | 'name' | 'symbol'>; /*****************************************************************************************************************/ /** * * getPlanetaryMeanAnomaly() * * A planet's mean anomaly is the angle between perigee and the Sun's current position. * * @param date - The date to calculate the Planet's mean anomaly for. * @param planet - The planet to calculate the mean anomaly for. * @returns a planet's mean anomaly at a given datetime */ export declare const getPlanetaryMeanAnomaly: (datetime: Date, planet: PlanetOrbitalParameters) => number; /*****************************************************************************************************************/ /** * * getPlanetaryEquationOfCenter() * * @param date - The date to calculate the Planet's equation of center for. * @param planet - The planet to calculate the equation of center for. * @returns a planet's equation of center at a given datetime * */ export declare const getPlanetaryEquationOfCenter: (datetime: Date, planet: PlanetOrbitalParameters) => number; /*****************************************************************************************************************/ /** * * getPlanetaryTrueAnomaly() * * A planet's true anomaly is the angle between perigee and the planet's * current position, corrected for the planet's eccentricity. * * @param date - The date to calculate the Planet's true anomaly for. * @param planet - The planet to calculate the true anomaly for. * @returns a planet's true anomaly at a given datetime * */ export declare const getPlanetaryTrueAnomaly: (datetime: Date, planet: PlanetOrbitalParameters) => number; /*****************************************************************************************************************/ /** * * getPlanetaryHeliocentricEclipticLongitude() * * @param date - The date to calculate the Planet's heliocentric ecliptic longitude for. * @param planet - The planet to calculate the heliocentric ecliptic longitude for. * @returns a planet's heliocentric ecliptic longitude at a given datetime * */ export declare const getPlanetaryHeliocentricEclipticLongitude: (datetime: Date, planet: PlanetOrbitalParameters) => number; /*****************************************************************************************************************/ /** * * getPlanetaryHeliocentricEclipticLatitude() * * @param date - The date to calculate the Planet's heliocentric ecliptic latitude for. * @param planet - The planet to calculate the heliocentric ecliptic latitude for. * @returns a planet's heliocentric ecliptic latitude at a given datetime * */ export declare const getPlanetaryHeliocentricEclipticLatitude: (datetime: Date, planet: PlanetOrbitalParameters) => number; /*****************************************************************************************************************/ /** * * getPlanetaryHeliocentricDistance() * * @param date - The date to calculate the Planet's heliocentric distance for. * @param planet - The planet to calculate the heliocentric distance for. * @returns a planet's heliocentric distance at a given datetime (in AUs) * */ export declare const getPlanetaryHeliocentricDistance: (datetime: Date, planet: PlanetOrbitalParameters) => number; /*****************************************************************************************************************/ /** * * getPlanetaryGeocentricEclipticCoordinate() * * @param datetime - The date to calculate the Planet's geocentric ecliptic coordinates for. * @param planet - The planet to calculate the geocentric ecliptic coordinates for. * @returns a planet's geocentric ecliptic coordinates at a given datetime * */ export declare const getPlanetaryGeocentricEclipticCoordinate: (datetime: Date, planet: PlanetOrbitalParameters) => EclipticCoordinate; /*****************************************************************************************************************/ /** * getPlanetaryPositions * * Gets the ecliptical, equatorial, horizontal positions of all planets other than the Earth * for a given datetime and observer location. * * @param datetime - The date and time of the observation. * @param observer - The geographic coordinate of the observer. * @param planets - The array of planets to get positions for. * @returns An array of horizontal coordinates for all planets. * */ export declare const getPlanetaryPositions: (datetime: Date, observer: GeographicCoordinate) => (Planet & EclipticCoordinate & EquatorialCoordinate & HorizontalCoordinate)[]; export {}; /*****************************************************************************************************************/