Skip to content

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:

Installation ​

  • Node.js version 22.12.0 or higher
  • ES modules; require() needs Node 22.12 or later
npm
shell
npm i --save @interstellar-tools/constants

Variables ​

VariableDescription
EGM2008Earth'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_SIGravitational constant G in SI units.
WGS84The WGS 84 reference ellipsoid: Earth's shape as GPS uses it.

Datasets ​

VariableDescription
ASTEROID_BELTSPredefined asteroid belts in the solar system visualization.
ASTEROIDSRepresents a collection of well-known asteroids within the solar system simulation.
COMETSRepresents a collection of well-known comets within the solar system simulation.
GALAXIESRepresents a collection of galaxies within the space visualization.
INTERSTELLAR_OBJECTSRepresents the interstellar objects seen so far: bodies from other stars' systems, passing the Sun once on open orbits.
MOONSRepresents a dataset of natural satellites (moons) in the solar system.
PLANETSRepresents a dataset of planets and planetoids in the solar system.
STARSRepresents a dataset of well-known stars within the Milky Way.
SYSTEMSPredefined systems: the barycenters that stars and planets orbit.

Date ​

VariableDescription
EPOCH_2000_UTC_MIDNIGHTUTC midnight at the start of 2000-01-01 (convenient calendar anchor).
EPOCH_2000_UTC_MIDNIGHT_TIME_SCALETime scale associated with EPOCH_2000_UTC_MIDNIGHT.
J2000_EPOCH_TIME_SCALEThe defining time scale for the J2000 epoch. J2000 is conventionally specified in Terrestrial Time (TT).
J2000_TTJ2000 epoch as a Julian Date in the TT time scale.
J2000_UTCJ2000 epoch as a UTC timestamp for JavaScript usage.
J2000_UTC_TIME_SCALETime scale associated with J2000_UTC.
JULIAN_DATE_UNIX_EPOCHThe 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_SECONDSThe leap second table: TAI − UTC, in s, from each date on, since UTC took whole-second steps on 1972-01-01.
MODIFIED_JULIAN_DATE_OFFSETThe 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_UTCTime-scale tags used in this package.
TT_MINUS_TAI_SECONDSTT − 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_SECONDSUseful offset at the J2000 epoch (for UTC↔TT conversions near that instant).

Distance ​

VariableDescription
AU_METERSAstronomical unit in meters, exact (IAU 2012 B2).
AU_PER_LYAstronomical units per light-year.
KM_PER_AUKilometers in one astronomical unit.
LY_PER_AULight-years per astronomical unit (reciprocal of AU_PER_LY).
LY_PER_PCLight-years per parsec.
METERS_PER_LYMeters in one light-year, defined as c × (Julian year).
METERS_PER_PCMeters in one parsec, using the exact IAU 2015 Resolution B2 definition: pc = (648000 / π) au.
PC_PER_LYParsecs per light-year (reciprocal of LY_PER_PC).
RADIANS_PER_ARCSECONDRadians in one arcsecond: π / 648 000.
SPEED_OF_LIGHT_M_PER_SSpeed of light in vacuum, exact per SI (m·s⁻¹).

Galactic ​

VariableDescription
SUN_GALACTOCENTRIC_DISTANCEThe Sun's distance from the Milky Way's centre, R0: 8275.9 ± 8.6 pc.
SUN_GALACTOCENTRIC_VELOCITYThe Sun's velocity around the Milky Way's centre, in km/s, in the 'galactocentric' frame: (12.9,251.51,8.56).
SUN_HEIGHT_ABOVE_GALACTIC_PLANEThe Sun's height above the Milky Way's plane, z⊙: 20.8 ± 0.3 pc, to the galactic north.

Math ​

VariableDescription
TWO_PIThe 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 ​

VariableDescription
EARTH_EQUATORIAL_RADIUS_NOMINAL_KMNominal equatorial radius of Earth, ReEN: 6378.1 km, zero tide.
EARTH_GM_NOMINAL_M3_PER_S2Nominal mass parameter of Earth, (GM)EN: 3.986004 × 10¹⁴ m³/s².
EARTH_POLAR_RADIUS_NOMINAL_KMNominal polar radius of Earth, RpEN: 6356.8 km, zero tide.
JUPITER_EQUATORIAL_RADIUS_NOMINAL_KMNominal equatorial radius of Jupiter, ReJN: 71 492 km, at the 1-bar level.
JUPITER_GM_NOMINAL_M3_PER_S2Nominal mass parameter of Jupiter, (GM)JN: 1.2668653 × 10¹⁷ m³/s².
JUPITER_POLAR_RADIUS_NOMINAL_KMNominal polar radius of Jupiter, RpJN: 66 854 km, at the 1-bar level.
SOLAR_EFFECTIVE_TEMPERATURE_NOMINAL_KNominal solar effective temperature, Teff⊙N: 5772 K.
SOLAR_GM_NOMINAL_M3_PER_S2Nominal solar mass parameter, (GM)⊙N: 1.3271244 × 10²⁰ m³/s².
SOLAR_IRRADIANCE_NOMINAL_W_PER_M2Nominal total solar irradiance, S⊙N: 1361 W/m².
SOLAR_LUMINOSITY_NOMINAL_WNominal solar luminosity, L⊙N: 3.828 × 10²⁶ W.

Objects ​

VariableDescription
SOLAR_RADIUS_LIMB_INFLECTION_MINUS_PHOTOSPHERIC_KMLimb–inflection minus photospheric offset (~0.333 Mm), in km (HSK 2008).
SOLAR_RADIUS_NOMINAL_KMNominal solar radius (IAU 2015 B3), exact.
SOLAR_RADIUS_PHOTOSPHERIC_KMPhotospheric / "standard" solar radius suggested for models (HSK 2008). Reconciles seismic and photospheric definitions.
SOLAR_RADIUS_PICARD_SODISM_535_7_NM_KMPICARD/SODISM radius at 535.7 nm.
SOLAR_RADIUS_PICARD_SODISM_535_7_NM_UNC_KM1σ uncertainty at 535.7 nm.
SOLAR_RADIUS_PICARD_SODISM_607_1_NM_KMPICARD/SODISM radius at 607.1 nm.
SOLAR_RADIUS_PICARD_SODISM_607_1_NM_UNC_KM1σ uncertainty at 607.1 nm.
SOLAR_RADIUS_PICARD_SODISM_782_2_NM_KMPICARD/SODISM radius at 782.2 nm.
SOLAR_RADIUS_PICARD_SODISM_782_2_NM_UNC_KM1σ uncertainty at 782.2 nm.
SOLAR_RADIUS_SOHO_MDI_MERCURY_TRANSIT_KMRadius from SOHO/MDI Mercury transits (2003 & 2006).
SOLAR_RADIUS_SOHO_MDI_MERCURY_TRANSIT_UNC_KM1σ uncertainty for SOHO/MDI Mercury-transit radius.

Observations ​

NameDescription
DISCOVERIESHow 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.
HELIOSPHEREThe 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_DISPLAYHow 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_OBSERVATIONSWhat 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_ROLESThe 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_RINGSThe 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_DISPLAYHow 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_ASTROMETRYWhere 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_PARAMETERSWhat 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.
withDisplayThe bodies, with drawing groups kept apart put on them: each body's entry in each group is merged into its display, beside its colour.
withObservationsThe bodies, with observations kept apart put on them: each body's entry in each group is merged into its observations.

Temporal ​

VariableDescription
EARTH_SIDEREAL_DAY_SECONDSEarth'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_DAYSLength of the Julian year in SI days (exactly 365.25).
JULIAN_YEAR_SECONDSLength of the Julian year in seconds.
MARS_SIDEREAL_DAY_SECONDSMars'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_DAYSThe Martian sol in Earth days: the ratio of a sol to a day, 1.0274912517.
MARS_SOL_SECONDSThe Martian sol in seconds: the mean solar day on Mars, sunrise to sunrise, 24 h 39 m 35.244 s.
MILLISECONDS_PER_DAYMilliseconds in one SI day.
MILLISECONDS_PER_SECONDMilliseconds in one second (exact).
SECONDS_PER_DAYLength of the SI day in seconds (exact).