Documentation / @interstellar-tools/constants
@interstellar-tools/constants
Authoritative physical and astronomical constants in SI units, plus curated datasets of planets, moons, stars, comets, asteroids and galaxies, so every calculation in your stack draws on the same source of truth.
Documentation
The full documentation lives at phun-ky.net/interstellar-tools:
- Getting started: installation, unit conventions and recommended practices
- API reference for
@interstellar-tools/constants: every export, with formulas, parameters and examples
Installation
- Node.js version 22.12.0 or higher
- ES modules;
require()needs Node 22.12 or later
shell
npm i --save @interstellar-tools/constantsVariables
| Variable | Description |
|---|---|
| EGM2008 | Earth's gravity field from EGM2008, the Earth Gravitational Model of the US National Geospatial-Intelligence Agency, to the sixth zonal harmonic: what a numerical propagator needs beyond a point mass. |
| G_SI | Gravitational constant G in SI units. |
| WGS84 | The WGS 84 reference ellipsoid: Earth's shape as GPS uses it. |
Datasets
| Variable | Description |
|---|---|
| ASTEROID_BELTS | Predefined asteroid belts in the solar system visualization. |
| ASTEROIDS | Represents a collection of well-known asteroids within the solar system simulation. |
| COMETS | Represents a collection of well-known comets within the solar system simulation. |
| GALAXIES | Represents a collection of galaxies within the space visualization. |
| INTERSTELLAR_OBJECTS | Represents the interstellar objects seen so far: bodies from other stars' systems, passing the Sun once on open orbits. |
| MOONS | Represents a dataset of natural satellites (moons) in the solar system. |
| PLANETS | Represents a dataset of planets and planetoids in the solar system. |
| STARS | Represents a dataset of well-known stars within the Milky Way. |
| SYSTEMS | Predefined systems: the barycenters that stars and planets orbit. |
Date
| Variable | Description |
|---|---|
| EPOCH_2000_UTC_MIDNIGHT | UTC midnight at the start of 2000-01-01 (convenient calendar anchor). |
| EPOCH_2000_UTC_MIDNIGHT_TIME_SCALE | Time scale associated with EPOCH_2000_UTC_MIDNIGHT. |
| J2000_EPOCH_TIME_SCALE | The defining time scale for the J2000 epoch. J2000 is conventionally specified in Terrestrial Time (TT). |
| J2000_TT | J2000 epoch as a Julian Date in the TT time scale. |
| J2000_UTC | J2000 epoch as a UTC timestamp for JavaScript usage. |
| J2000_UTC_TIME_SCALE | Time scale associated with J2000_UTC. |
| JULIAN_DATE_UNIX_EPOCH | The Julian date of the Unix epoch, 1970-01-01T00:00:00Z: 2440587.5. A Julian date counts days from noon on 1 January 4713 BC, so whole days start at noon. |
| LEAP_SECONDS | The leap second table: TAI − UTC, in s, from each date on, since UTC took whole-second steps on 1972-01-01. |
| MODIFIED_JULIAN_DATE_OFFSET | The offset of the modified Julian date: MJD = JD − 2400000.5, so MJD 0 is 1858-11-17T00:00:00, and days start at midnight. |
| TIME_SCALE_TAI | - |
| TIME_SCALE_TT | - |
| TIME_SCALE_UT1 | - |
| TIME_SCALE_UTC | Time-scale tags used in this package. |
| TT_MINUS_TAI_SECONDS | TT − TAI: Terrestrial Time runs a fixed 32.184 s ahead of International Atomic Time, by definition. |
| TT_MINUS_UTC_AT_J2000_MS | - |
| TT_MINUS_UTC_AT_J2000_SECONDS | Useful offset at the J2000 epoch (for UTC↔TT conversions near that instant). |
Distance
| Variable | Description |
|---|---|
| AU_METERS | Astronomical unit in meters, exact (IAU 2012 B2). |
| AU_PER_LY | Astronomical units per light-year. |
| KM_PER_AU | Kilometers in one astronomical unit. |
| LY_PER_AU | Light-years per astronomical unit (reciprocal of AU_PER_LY). |
| LY_PER_PC | Light-years per parsec. |
| METERS_PER_LY | Meters in one light-year, defined as c × (Julian year). |
| METERS_PER_PC | Meters in one parsec, using the exact IAU 2015 Resolution B2 definition: pc = (648000 / π) au. |
| PC_PER_LY | Parsecs per light-year (reciprocal of LY_PER_PC). |
| RADIANS_PER_ARCSECOND | Radians in one arcsecond: π / 648 000. |
| SPEED_OF_LIGHT_M_PER_S | Speed of light in vacuum, exact per SI (m·s⁻¹). |
Galactic
| Variable | Description |
|---|---|
| SUN_GALACTOCENTRIC_DISTANCE | The Sun's distance from the Milky Way's centre, |
| SUN_GALACTOCENTRIC_VELOCITY | The Sun's velocity around the Milky Way's centre, in km/s, in the 'galactocentric' frame: |
| SUN_HEIGHT_ABOVE_GALACTIC_PLANE | The Sun's height above the Milky Way's plane, |
Math
| Variable | Description |
|---|---|
| TWO_PI | The circle constant τ (tau), equal to 2π (≈ 6.283185307179586). Useful for full rotations, radians-per-turn calculations, angular velocity, and other periodic math where factors of 2 arise naturally. |
Nominal
| Variable | Description |
|---|---|
| EARTH_EQUATORIAL_RADIUS_NOMINAL_KM | Nominal equatorial radius of Earth, |
| EARTH_GM_NOMINAL_M3_PER_S2 | Nominal mass parameter of Earth, |
| EARTH_POLAR_RADIUS_NOMINAL_KM | Nominal polar radius of Earth, |
| JUPITER_EQUATORIAL_RADIUS_NOMINAL_KM | Nominal equatorial radius of Jupiter, |
| JUPITER_GM_NOMINAL_M3_PER_S2 | Nominal mass parameter of Jupiter, |
| JUPITER_POLAR_RADIUS_NOMINAL_KM | Nominal polar radius of Jupiter, |
| SOLAR_EFFECTIVE_TEMPERATURE_NOMINAL_K | Nominal solar effective temperature, |
| SOLAR_GM_NOMINAL_M3_PER_S2 | Nominal solar mass parameter, |
| SOLAR_IRRADIANCE_NOMINAL_W_PER_M2 | Nominal total solar irradiance, |
| SOLAR_LUMINOSITY_NOMINAL_W | Nominal solar luminosity, |
Objects
| Variable | Description |
|---|---|
| SOLAR_RADIUS_LIMB_INFLECTION_MINUS_PHOTOSPHERIC_KM | Limb–inflection minus photospheric offset (~0.333 Mm), in km (HSK 2008). |
| SOLAR_RADIUS_NOMINAL_KM | Nominal solar radius (IAU 2015 B3), exact. |
| SOLAR_RADIUS_PHOTOSPHERIC_KM | Photospheric / "standard" solar radius suggested for models (HSK 2008). Reconciles seismic and photospheric definitions. |
| SOLAR_RADIUS_PICARD_SODISM_535_7_NM_KM | PICARD/SODISM radius at 535.7 nm. |
| SOLAR_RADIUS_PICARD_SODISM_535_7_NM_UNC_KM | 1σ uncertainty at 535.7 nm. |
| SOLAR_RADIUS_PICARD_SODISM_607_1_NM_KM | PICARD/SODISM radius at 607.1 nm. |
| SOLAR_RADIUS_PICARD_SODISM_607_1_NM_UNC_KM | 1σ uncertainty at 607.1 nm. |
| SOLAR_RADIUS_PICARD_SODISM_782_2_NM_KM | PICARD/SODISM radius at 782.2 nm. |
| SOLAR_RADIUS_PICARD_SODISM_782_2_NM_UNC_KM | 1σ uncertainty at 782.2 nm. |
| SOLAR_RADIUS_SOHO_MDI_MERCURY_TRANSIT_KM | Radius from SOHO/MDI Mercury transits (2003 & 2006). |
| SOLAR_RADIUS_SOHO_MDI_MERCURY_TRANSIT_UNC_KM | 1σ uncertainty for SOHO/MDI Mercury-transit radius. |
Observations
| Name | Description |
|---|---|
| DISCOVERIES | How and when bodies were discovered, keyed by body id: the date, the people credited and the observatory, from the Minor Planet Center's circulars. For the interstellar objects so far. |
| HELIOSPHERE | The Sun's heliosphere, the bubble the solar wind blows into the interstellar medium: the heliopause's distance towards the nose, on the flanks and down the tail, the interstellar wind's direction and speed, and the Voyagers' crossings of its boundaries. |
| HELIOSPHERE_DISPLAY | How to draw the heliosphere: hidden until a renderer offers to show it, as it has no colour of its own. withDisplay puts it on the Sun as its display.astrosphere. |
| INTERSTELLAR_OBJECT_OBSERVATIONS | What is measured about the interstellar objects, keyed by id: their catalogue identifiers, JPL's orbit solutions with the fitted non-gravitational accelerations, the radiants they came from, their magnitudes and, for ʻOumuamua, its push in m/s². |
| MOON_RING_ROLES | The moons whose dust feeds a ring, keyed by moon id: Metis, Amalthea and Thebe for Jupiter's (Burns et al. 1999), Enceladus for Saturn's E ring and Phoebe for its Phoebe ring. |
| PLANET_RINGS | The rings of Jupiter, Saturn, Uranus and Neptune, keyed by planet id: each ring's edges and optical depth, and Saturn's named gaps, from the PDS Ring-Moon Systems Node and NASA NSSDCA. |
| RING_DISPLAY | How to draw the giant planets' rings, keyed by planet id: each as opaque as its densest ring, with Saturn's colour measured from Cassini's images and the others' assumed. derivation says which. |
| STAR_ASTROMETRY | Where each star is on the sky, keyed by star id: its catalogue identifiers, its ICRS position at J2000, parallax, proper motion and radial velocity, its V magnitude, and its letter within its system. Given for every star but the Sun and the S-stars, from SIMBAD, Hipparcos and Gaia DR3. |
| STAR_PARAMETERS | What each star's light tells about it, keyed by star id: its spectral class, effective temperature, luminosity, surface gravity and metallicity, and for Vega and Altair, the temperatures at their poles and equators. |
| withDisplay | The bodies, with drawing groups kept apart put on them: each body's entry in each group is merged into its display, beside its colour. |
| withObservations | The bodies, with observations kept apart put on them: each body's entry in each group is merged into its observations. |
Temporal
| Variable | Description |
|---|---|
| EARTH_SIDEREAL_DAY_SECONDS | Earth's sidereal day in seconds: one turn against the vernal equinox, 23 h 56 m 4.0905 s. Sidereal time runs at this rate. |
| JULIAN_YEAR_DAYS | Length of the Julian year in SI days (exactly 365.25). |
| JULIAN_YEAR_SECONDS | Length of the Julian year in seconds. |
| MARS_SIDEREAL_DAY_SECONDS | Mars's sidereal day in seconds: one turn against the stars, 24 h 37 m 22.663 s, the rotation of Mars in PLANETS. |
| MARS_SOL_DAYS | The Martian sol in Earth days: the ratio of a sol to a day, 1.0274912517. |
| MARS_SOL_SECONDS | The Martian sol in seconds: the mean solar day on Mars, sunrise to sunrise, 24 h 39 m 35.244 s. |
| MILLISECONDS_PER_DAY | Milliseconds in one SI day. |
| MILLISECONDS_PER_SECOND | Milliseconds in one second (exact). |
| SECONDS_PER_DAY | Length of the SI day in seconds (exact). |