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.9.0 or higher
shell
npm i --save @interstellar-tools/constantsVariables
| Variable | Description |
|---|---|
| G_SI | Gravitational constant G in SI units. |
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. |
| 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. |
| TIME_SCALE_TT | - |
| TIME_SCALE_UTC | Time-scale tags used in this package. |
| 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⁻¹). |
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. |
Objects
| Variable | Description |
|---|---|
| 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 | Limb–inflection minus photospheric offset (~0.333 Mm). / export const SOLAR_RADIUS_LIMB_INFLECTION_MINUS_PHOTOSPHERIC_KM = 333; |
| SOLAR_RADIUS_SOHO_MDI_MERCURY_TRANSIT_UNC_KM | 1σ uncertainty for SOHO/MDI Mercury-transit radius. |
Temporal
| Variable | Description |
|---|---|
| JULIAN_YEAR_DAYS | Length of the Julian year in SI days (exactly 365.25). |
| JULIAN_YEAR_SECONDS | Length of the Julian year in seconds. |
| 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). |