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 ​

npm
shell
npm i --save @interstellar-tools/constants

Variables ​

VariableDescription
G_SIGravitational constant G in SI units.

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.
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.
TIME_SCALE_TT-
TIME_SCALE_UTCTime-scale tags used in this package.
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⁻¹).

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.

Objects ​

VariableDescription
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_KMLimb–inflection minus photospheric offset (~0.333 Mm). / export const SOLAR_RADIUS_LIMB_INFLECTION_MINUS_PHOTOSPHERIC_KM = 333;
SOLAR_RADIUS_SOHO_MDI_MERCURY_TRANSIT_UNC_KM1σ uncertainty for SOHO/MDI Mercury-transit radius.

Temporal ​

VariableDescription
JULIAN_YEAR_DAYSLength of the Julian year in SI days (exactly 365.25).
JULIAN_YEAR_SECONDSLength of the Julian year in seconds.
MILLISECONDS_PER_DAYMilliseconds in one SI day.
MILLISECONDS_PER_SECONDMilliseconds in one second (exact).
SECONDS_PER_DAYLength of the SI day in seconds (exact).