Documentation / @interstellar-tools/types / DistanceUnitType
Type Alias: DistanceUnitType
ts
type DistanceUnitType =
| 'm'
| 'km'
| 'au'
| 'ly'
| 'kly'
| 'Mly'
| 'Gly'
| 'pc'
| 'kpc'
| 'Mpc'
| 'Gpc';Defined in: distance.ts:43
Canonical distance unit symbols for astronomy/space visualization.
Design principles
- Canonical symbols only (no plurals / long names) for stable math & serialization.
- Uses meters as the SI base; larger units have conventional scientific definitions.
Conventions
au- Astronomical Unit (IAU 2012 B2): 149 597 870 700 m (lowercaseauis the IAU symbol).lyfamily - Light-year based on the Julian year:1 ly = c × 365.25 d = 9 460 730 472 580 800 m(withkly = 10³ ly,Mly = 10⁶ ly,Gly = 10⁹ ly).pcfamily - Parsec defined from the arcsecond parallax:1 pc = au × (648000 / π) ≈ 3.085677581×10¹⁶ m(kpc/Mpc/Gpcare ×10³/×10⁶/×10⁹).
Members
- SI base & common multiple:
m,km - Astronomical:
au - Light-year family:
ly,kly,Mly,Gly - Parsec family:
pc,kpc,Mpc,Gpc
Example
ts
// Example shape often used alongside this type:
type Distance = { value: number; unit: DistanceUnitType };
const d1: Distance = { value: 1, unit: 'au' };
const d2: Distance = { value: 3.26, unit: 'ly' };
const d3: Distance = { value: 8, unit: 'kpc' };See
- https://www.iau.org/static/resolutions/IAU2012_English.pdf (IAU 2012 B2 - definition of the astronomical unit)
- https://en.wikipedia.org/wiki/Light-year (Light-year based on Julian year)
- https://en.wikipedia.org/wiki/Parsec (Parsec definition & meter equivalence)