@interstellar-tools/types 0.60.1 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,12 @@ import { CartesianCoordinatesInterface } from './planets.js';
11
11
  * @group Celestial Bodies
12
12
  */
13
13
  export interface AsteroidBeltInterface {
14
+ /** Stable identifier. Never translated. */
15
+ id: string;
14
16
  /** Name of the asteroid belt. */
15
17
  name: string;
18
+ /** Id of the star the belt orbits (e.g., `'sun'`). */
19
+ parent: string;
16
20
  /** Inner radius of the belt in Astronomical Units (AU). */
17
21
  innerRadius: number;
18
22
  /** Outer radius of the belt in Astronomical Units (AU). */
@@ -32,8 +36,10 @@ export interface AsteroidBeltInterface {
32
36
  * @typedef {AsteroidBeltInterface[]} AsteroidBeltsType
33
37
  * @example
34
38
  * ```ts
35
- * const asteroidBelt: AsteroidBeltInterface = [{
39
+ * const asteroidBelts: AsteroidBeltsType = [{
40
+ * id: 'main-asteroid-belt',
36
41
  * name: 'Main Belt',
42
+ * parent: 'sun',
37
43
  * innerRadius: 2.1,
38
44
  * outerRadius: 3.3,
39
45
  * color: '#888888',
@@ -1 +1 @@
1
- {"version":3,"file":"asteroid-belts.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroid-belts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"asteroid-belts.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroid-belts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC"}
@@ -1,6 +1,5 @@
1
- import { DistanceInterface, MeasureInterface } from '../distance.js';
2
- import type { Radians } from '../numeric.js';
3
- import { TemporalInterface } from '../temporal.js';
1
+ import { DistanceInterface } from '../distance.js';
2
+ import type { OrbitInterface } from '../orbits.js';
4
3
  import { CartesianCoordinatesInterface } from './planets.js';
5
4
  /**
6
5
  * High-level **orbital class** of an asteroid (by dynamical region).
@@ -58,9 +57,9 @@ export type AsteroidSpectralType = 'c-type' | 's-type' | 'v-type' | 'm-type' | '
58
57
  *
59
58
  * ::: info
60
59
  *
61
- * **Orbital elements (angles & distances):**
60
+ * **Orbital elements (angles & distances)**, all in `orbit`:
62
61
  *
63
- * - Semi-major axis `a` should be in **astronomical units (au)** via {@link MeasureInterface}.
62
+ * - Semi-major axis `a` should be in **astronomical units (au)**.
64
63
  * - Eccentricity `e` for bound ellipses typically satisfies \(0 \le e < 1\).
65
64
  * - Inclination `i`, argument of perihelion `w` (ω), and longitude of ascending node `om` (Ω)
66
65
  * are given in **degrees**.
@@ -71,7 +70,7 @@ export type AsteroidSpectralType = 'c-type' | 's-type' | 'v-type' | 'm-type' | '
71
70
  * q \;=\; a\,(1 - e)
72
71
  * $$
73
72
  *
74
- * **Period convention:** `period` is a duration (e.g., in **days**) using {@link TemporalInterface}.
73
+ * **Period convention:** `period` is a duration (e.g., in **days**).
75
74
  * If you encode direction, a **negative value** indicates **counter-clockwise** in your display
76
75
  * convention (visualization-specific; not a physical requirement).
77
76
  *
@@ -83,6 +82,8 @@ export type AsteroidSpectralType = 'c-type' | 's-type' | 'v-type' | 'm-type' | '
83
82
  * @group Celestial Bodies
84
83
  */
85
84
  export interface AsteroidInterface {
85
+ /** Stable identifier, used by `parent` references. Never translated. */
86
+ id: string;
86
87
  /** Name of the asteroid (e.g., `"Ceres"`, `"Vesta"`). */
87
88
  name: string;
88
89
  /** General dynamical region (e.g., main-belt, NEO, Trojan). */
@@ -91,49 +92,10 @@ export interface AsteroidInterface {
91
92
  category: AsteroidCategory;
92
93
  /** Spectral/taxonomic class (composition & albedo proxy). */
93
94
  spectralType: AsteroidSpectralType;
94
- /** Star system identifier (e.g., `"Solar System"`). */
95
- system: string;
96
- /**
97
- * **Semi-major axis** (typically in **au**).
98
- *
99
- * @example
100
- * ```ts
101
- * a: { value: 2.77, unit: 'au' }
102
- * ```
103
- */
104
- a: MeasureInterface;
105
- /**
106
- * **Eccentricity** of the orbit.
107
- * ::: info
108
- *
109
- * Elliptical orbits: \(0 \le e < 1\). Parabolic: \(e=1\). Hyperbolic: \(e>1\).
110
- *
111
- * :::
112
- */
113
- e: number;
114
- /** **Inclination** \(i\) in **degrees**. */
115
- i: number;
116
- /** **Argument of perihelion** \( \omega \) in **degrees**. */
117
- w: number;
118
- /** **Longitude of ascending node** \( \Omega \) in **degrees**. */
119
- om: number;
120
- /** **True anomaly** \( \nu \) (current orbital position) in **radians**. */
121
- angle: Radians;
122
- /**
123
- * **Orbital period** as a duration (e.g., in **days**).
124
- * ::: info
125
- *
126
- * A **negative** value may be used to flag **counter-clockwise** drawing direction in UIs.
127
- *
128
- * :::
129
- */
130
- period: TemporalInterface;
131
- /**
132
- * **Perihelion distance** \( q = a(1-e) \) (typically in **au**).
133
- * @see a
134
- * @see e
135
- */
136
- q: number;
95
+ /** Id of the star the asteroid orbits (e.g., `'sun'`). */
96
+ parent: string;
97
+ /** Orbit around the parent, with all elements including `i`, `w`, `om` and `q`. */
98
+ orbit: Required<OrbitInterface>;
137
99
  /**
138
100
  * Optional **Cartesian coordinates** (distance values) in a specified frame.
139
101
  * ::: info
@@ -1 +1 @@
1
- {"version":3,"file":"asteroids.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,qBAAqB,GACrB,iBAAiB,GACjB,SAAS,GACT,wBAAwB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,aAAa,GACb,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,SAAS,GACT,UAAU,GACV,uBAAuB,CAAC;AAE5B;;;;;;;;;;;;;;GAcG;AACH,MAA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7D,YAAY,EAAE,oBAAoB,CAAC;IAEnC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IAEf,mFAAmF;IACnF,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEhC;;;;;;;OAOG;IACH,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,qBAAqB;IACrB,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,qBAAqB;IACrB,CAAC,CAAC,EAAE,iBAAiB,CAAC;IAEtB;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,4EAA4E;IAC5E,MAAM,EAAE,iBAAiB,CAAC;IAE1B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;IAE5C,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IAEd,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC"}
@@ -1,17 +1,17 @@
1
- import { DistanceInterface, MeasureInterface } from '../distance.js';
2
- import type { Radians } from '../numeric.js';
3
- import { TemporalInterface } from '../temporal.js';
1
+ import { DistanceInterface } from '../distance.js';
2
+ import type { OrbitInterface } from '../orbits.js';
4
3
  import { CartesianCoordinatesInterface } from './planets.js';
5
4
  /**
6
5
  * Represents a **comet** in the solar system simulation.
7
6
  *
8
- * **Cometary Orbital Parameters:**
7
+ * **Cometary Orbital Parameters**, all in `orbit`:
9
8
  * - **Semi-major axis (`a`)**: Defines the **size** of the comet’s orbit in **Astronomical Units (AU)**.
10
9
  * - **Orbital eccentricity (`e`)**: Determines how **elliptical** the orbit is ($0 = $ circular, closer to $1$ = highly elliptical).
11
10
  * - **Inclination (`i`)**: The tilt of the orbit relative to the **ecliptic plane**, measured in **degrees**.
12
11
  * - **Argument of perihelion (`w`)**: The angle from the **ascending node** to the **perihelion**.
13
12
  * - **Longitude of the ascending node (`om`)**: Defines where the orbit crosses the ecliptic.
14
13
  * - **Perihelion distance (`q`)**: The closest approach to the Sun in **AU**.
14
+ * - **Angle (`angle`)**: For comets this is the **mean anomaly** at J2000, as in the source data.
15
15
  *
16
16
  * **Visualization Parameters:**
17
17
  * - **Orbit Path (`orbitPath`)**: Precomputed trajectory for rendering.
@@ -21,30 +21,18 @@ import { CartesianCoordinatesInterface } from './planets.js';
21
21
  * @group Celestial Bodies
22
22
  */
23
23
  export interface CometInterface {
24
+ /** Stable identifier, used by `parent` references. Never translated. */
25
+ id: string;
24
26
  /** Name of the comet (e.g., "Halley", "Hale-Bopp"). */
25
27
  name: string;
26
28
  /** Type of comet based on its orbital characteristics. */
27
29
  type: 'periodic comet' | 'oort cloud comet' | 'short-period comet';
28
30
  /** Category classification of the comet. */
29
31
  category: 'halley-type comet' | 'long-period comet' | 'jupiter-family comet';
30
- /** The star system where the comet is located. */
31
- system: string;
32
- /** Semi-major axis of the orbit in AU. */
33
- a: MeasureInterface;
34
- /** Orbital eccentricity (0 = circular, closer to 1 = highly elliptical). */
35
- e: number;
36
- /** Orbital inclination in degrees. */
37
- i: number;
38
- /** Argument of perihelion in degrees. */
39
- w: number;
40
- /** Longitude of the ascending node in degrees. */
41
- om: number;
42
- /** Mean anomaly at epoch in radians. */
43
- angle: Radians;
44
- /** Orbital period in Earth days. Negative values indicate counter clockwise orbit */
45
- period: TemporalInterface;
46
- /** Perihelion distance in AU. */
47
- q: number;
32
+ /** Id of the star the comet orbits (e.g., `'sun'`). */
33
+ parent: string;
34
+ /** Orbit around the parent, with all elements including `i`, `w`, `om` and `q`. */
35
+ orbit: Required<OrbitInterface>;
48
36
  /** X-coordinate in a distance-based system (optional). */
49
37
  x?: DistanceInterface;
50
38
  /** Y-coordinate in a distance-based system (optional). */
@@ -70,19 +58,22 @@ export interface CometInterface {
70
58
  * @typedef {CometInterface[]} CometsType
71
59
  * @example
72
60
  * ```ts
73
- * const halley: CometInterface = [{
61
+ * const halley: CometsType = [{
62
+ * id: '1p-halley',
74
63
  * name: 'Halley',
75
64
  * type: 'periodic comet',
76
65
  * category: 'halley-type comet',
77
- * system: 'Sun,
78
- * a: { value: 17.8, unit: 'au' },
79
- * e: 0.967,
80
- * i: 162.26,
81
- * w: 111.33,
82
- * om: 58.42,
83
- * angle: 0,
84
- * period: { value: 76, unit: 'years' },
85
- * q: 0.586,
66
+ * parent: 'sun',
67
+ * orbit: {
68
+ * a: { value: 17.834, unit: 'au' },
69
+ * e: 0.96714,
70
+ * i: 162.26,
71
+ * w: 111.33,
72
+ * om: 58.42,
73
+ * angle: 0.669857 as Radians,
74
+ * period: { value: 27576, unit: 'd' },
75
+ * q: 0.586
76
+ * },
86
77
  * radius: { value: 11, unit: 'km' },
87
78
  * color: '#ffffff',
88
79
  * size: 1.2
@@ -1 +1 @@
1
- {"version":3,"file":"comets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/comets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;IACnE,4CAA4C;IAC5C,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;IAC7E,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,CAAC,EAAE,gBAAgB,CAAC;IACpB,4EAA4E;IAC5E,CA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0D;IAC1D,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;IACnE,4CAA4C;IAC5C,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;IAC7E,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAChC,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,oEAAoE;IACpE,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;IAC5C,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC"}
@@ -44,6 +44,7 @@ export interface BlackHoleInterface {
44
44
  * @example
45
45
  * ```ts
46
46
  * const milkyWay: GalaxyInterface = {
47
+ * id: 'milky-way',
47
48
  * name: 'Milky Way',
48
49
  * type: 'Spiral',
49
50
  * diameter: { value: 105700, unit: 'lightyears' },
@@ -54,6 +55,8 @@ export interface BlackHoleInterface {
54
55
  * @group Celestial Bodies
55
56
  */
56
57
  export interface GalaxyInterface {
58
+ /** Stable identifier, used by `parent` references. Never translated. */
59
+ id: string;
57
60
  /** Name of the galaxy. */
58
61
  name: string;
59
62
  /** Morphological classification of the galaxy. */
@@ -1 +1 @@
1
- {"version":3,"file":"galaxies.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/galaxies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,wDAAwD;IACxD,CAAC,EAAE,iBAAiB,CAAC;IACrB,wDAAwD;IACxD,CAAC,EAAE,iBAAiB,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,wCAAwC;IACxC,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"galaxies.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/galaxies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,wDAAwD;IACxD,CAAC,EAAE,iBAAiB,CAAC;IACrB,wDAAwD;IACxD,CAAC,EAAE,iBAAiB,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,wCAAwC;IACxC,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC"}
@@ -1,15 +1,11 @@
1
- import { DistanceInterface, MeasureInterface } from '../distance.js';
2
- import type { Radians } from '../numeric.js';
3
- import { TemporalInterface } from '../temporal.js';
1
+ import { DistanceInterface } from '../distance.js';
2
+ import type { OrbitInterface } from '../orbits.js';
4
3
  import { CartesianCoordinatesInterface } from './planets.js';
5
4
  /**
6
5
  * Represents a **moon** (natural satellite) orbiting a planet.
7
6
  *
8
- * **Orbital Properties:**
9
- * - **Semi-major axis (`a`)**: Defines the moon’s orbit size in **Astronomical Units (AU)**.
10
- * - **Orbital eccentricity (`e`)**: Determines how elliptical the orbit is ($0 =$ circular, closer to $1 =$ highly elliptical).
11
- * - **Orbital period (`period`)**: Time taken for one full orbit in **Earth days**. Negative values indicate counter clockwise direction.
12
- * - **True anomaly (`angle`)**: The moon’s current position in its orbit (in **radians**).
7
+ * A moon always has a `parent` (its planet) and an `orbit` around it; see
8
+ * {@link OrbitInterface}.
13
9
  *
14
10
  * **Visualization Properties:**
15
11
  * - **Orbit Path (`orbitPath`)**: Precomputed trajectory for rendering.
@@ -19,43 +15,42 @@ import { CartesianCoordinatesInterface } from './planets.js';
19
15
  * @example
20
16
  * ```ts
21
17
  * const europa: MoonInterface = {
18
+ * id: 'europa',
22
19
  * name: 'Europa',
23
20
  * category: 'natural satellite',
24
- * system: 'Jupiter',
25
- * a: { value: 0.00448, unit: 'au' },
26
- * e: 0.009,
27
- * period: { value: 3.55, unit: 'd' },
21
+ * parent: 'jupiter',
22
+ * orbit: {
23
+ * a: { value: 0.00448, unit: 'au' },
24
+ * e: 0.009,
25
+ * period: { value: -3.551, unit: 'd' },
26
+ * angle: 0 as Radians
27
+ * },
28
28
  * radius: { value: 1560.8, unit: 'km' },
29
- * color: '#a6a6a6',
30
- * angle: 0,
29
+ * color: '#a6a6a6'
31
30
  * };
32
31
  * ```
33
32
  * @group Celestial Bodies
34
33
  */
35
34
  export interface MoonInterface {
35
+ /** Stable identifier, used by `parent` references. Never translated. */
36
+ id: string;
36
37
  /** Name of the moon (e.g., "Io", "Europa", "Titan"). */
37
38
  name: string;
38
39
  type?: undefined;
39
40
  /** Classification of the moon. */
40
41
  category: 'natural satellite' | 'irregular satellite' | 'retrograde satellite';
41
- /** The planetary system where the moon is located (e.g., "Jupiter"). */
42
- system: string;
43
- /** Semi-major axis of the orbit in AU. */
44
- a: MeasureInterface;
45
- /** Orbital eccentricity (0 = circular, closer to 1 = highly elliptical). */
46
- e: number;
42
+ /** Id of the planet the moon orbits (e.g., `'jupiter'`). */
43
+ parent: string;
44
+ /** Orbit around the parent planet. */
45
+ orbit: OrbitInterface;
47
46
  /** Semi-minor axis converted to pixels (calculated from `a` and `e`). */
48
47
  miA?: number;
49
48
  /** X-offset for the ellipse focus (accounts for eccentricity). */
50
49
  focus_x?: number;
51
- /** Orbital period in Earth days. Negative values indicate counter clockwise orbit */
52
- period: TemporalInterface;
53
50
  /** Physical radius of the moon in kilometres. */
54
51
  radius: DistanceInterface;
55
52
  /** Visual representation color. */
56
53
  color: string;
57
- /** Current orbital position in radians (True Anomaly). */
58
- angle: Radians;
59
54
  /** X-coordinate in a distance-based system (optional). */
60
55
  x?: DistanceInterface;
61
56
  /** Y-coordinate in a distance-based system (optional). */
@@ -1 +1 @@
1
- {"version":3,"file":"moons.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/moons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EACN,mBAAmB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;IACvE,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,CAAC,EAAE,gBAAgB,CAAC;IACpB,4EAA4E;IAC5E,CAAC,EAAE,MAAM,CAAC;IACV,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,MAAM,EAAE,iBAAiB,CAAC;IAC1B,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,oEAAoE;IACpE,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"moons.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/moons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EACN,mBAAmB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;IACvE,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,oEAAoE;IACpE,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
@@ -1,6 +1,5 @@
1
- import { DistanceInterface, MeasureInterface } from '../distance.js';
2
- import type { Radians } from '../numeric.js';
3
- import { TemporalInterface } from '../temporal.js';
1
+ import { DistanceInterface } from '../distance.js';
2
+ import type { OrbitInterface } from '../orbits.js';
4
3
  /**
5
4
  * Represents **2D coordinates** for planetary positioning.
6
5
  *
@@ -18,13 +17,11 @@ export interface CartesianCoordinatesInterface {
18
17
  y: number;
19
18
  }
20
19
  /**
21
- * Represents a **planet** in the solar system simulation.
20
+ * Represents a **planet** or **planetoid**.
22
21
  *
23
- * **Orbital Properties:**
24
- * - **Semi-major axis (`a`)**: Defines the planet’s orbit size in **Astronomical Units (AU)**.
25
- * - **Orbital eccentricity (`e`)**: Determines how elliptical the orbit is ($0 =$ circular, closer to $1 =$ highly elliptical).
26
- * - **Orbital period (`period`)**: Time taken for one full orbit in **Earth days**.
27
- * - **True anomaly (`angle`)**: The planet’s current position in its orbit (in **radians**).
22
+ * A planet is bound to one `parent`: usually a star, a binary system for a
23
+ * circumbinary planet, or the galaxy for a rogue planet. Its `orbit` describes
24
+ * the motion around that parent; see {@link OrbitInterface}.
28
25
  *
29
26
  * **Classification & Visualization:**
30
27
  * - **Type (`type`)**: Scientific classification of the planet (e.g., **terrestrial, gas giant, ice planet**).
@@ -35,16 +32,19 @@ export interface CartesianCoordinatesInterface {
35
32
  * @example
36
33
  * ```ts
37
34
  * const earth: PlanetInterface = {
35
+ * id: 'earth',
38
36
  * name: 'Earth',
39
37
  * type: 'terrestrial planet',
40
38
  * category: 'planet',
41
39
  * color: '#4287f5',
42
- * system: 'Sun',
40
+ * parent: 'sun',
41
+ * orbit: {
42
+ * a: { value: 1.0, unit: 'au' },
43
+ * e: 0.0167,
44
+ * period: { value: -365.256, unit: 'd' },
45
+ * angle: 1.753 as Radians
46
+ * },
43
47
  * radius: { value: 6371, unit: 'km' },
44
- * a: { value: 1.0, unit: 'au' },
45
- * e: 0.0167,
46
- * period: { value: 365.25, unit: 'd' },
47
- * angle: 0,
48
48
  * x: { value: 0, unit: 'au' },
49
49
  * y: { value: 1, unit: 'au' },
50
50
  * z: { value: 0, unit: 'au' }
@@ -53,6 +53,8 @@ export interface CartesianCoordinatesInterface {
53
53
  * @group Celestial Bodies
54
54
  */
55
55
  export interface PlanetInterface {
56
+ /** Stable identifier, used by `parent` references. Never translated. */
57
+ id: string;
56
58
  /** Name of the planet (e.g., "Earth", "Mars"). */
57
59
  name: string;
58
60
  /** Type classification of the planet. */
@@ -61,28 +63,22 @@ export interface PlanetInterface {
61
63
  category: 'planet' | 'planetoid';
62
64
  /** Visual representation color. */
63
65
  color: string;
64
- /** The planetary system in which the planet exists. */
65
- system: string;
66
+ /** Id of the star, system or galaxy the planet is bound to. */
67
+ parent?: string;
68
+ /** Orbit around the parent. */
69
+ orbit?: OrbitInterface;
66
70
  /** Physical radius of the planet in kilometres. */
67
71
  radius: DistanceInterface;
68
- /** Semi-major axis of the orbit in AU. */
69
- a: MeasureInterface;
70
- /** Orbital eccentricity (0 = circular, closer to 1 = highly elliptical). */
71
- e: number;
72
72
  /** Semi-minor axis of the orbit (calculated from `a` and `e`). */
73
73
  miA?: number;
74
74
  /** X-offset for the ellipse focus (accounts for eccentricity). */
75
75
  focus_x?: number;
76
- /** Current orbital position in radians (True Anomaly). */
77
- angle: Radians;
78
- /** X-coordinate in a distance-based system. */
76
+ /** X-coordinate in the parent's frame. */
79
77
  x: DistanceInterface;
80
- /** Y-coordinate in a distance-based system. */
78
+ /** Y-coordinate in the parent's frame. */
81
79
  y: DistanceInterface;
82
- /** Z-coordinate in a distance-based system. */
80
+ /** Z-coordinate in the parent's frame. */
83
81
  z: DistanceInterface;
84
- /** Orbital period in Earth days. Negative values indicate counter clockwise orbit */
85
- period: TemporalInterface;
86
82
  /** Precomputed orbital path points for visualization (optional). */
87
83
  orbitPath?: CartesianCoordinatesInterface[];
88
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"planets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/planets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAA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,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"planets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/planets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,6BAA6B;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EACA,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,eAAe,GACf,WAAW,GACX,WAAW,GACX,eAAe,GACf,eAAe,GACf,WAAW,GACX,YAAY,GACZ,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,cAAc,GACd,YAAY,GACZ,iBAAiB,GACjB,oBAAoB,CAAC;IACzB,6DAA6D;IAC7D,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,mDAAmD;IACnD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,CAAC,EAAE,iBAAiB,CAAC;IACrB,0CAA0C;IAC1C,CAAC,EAAE,iBAAiB,CAAC;IACrB,0CAA0C;IAC1C,CAAC,EAAE,iBAAiB,CAAC;IACrB,oEAAoE;IACpE,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
@@ -1,92 +1,68 @@
1
- import { DistanceInterface, MeasureInterface } from '../distance.js';
2
- import type { Radians } from '../numeric.js';
3
- import { TemporalInterface } from '../temporal.js';
1
+ import { DistanceInterface } from '../distance.js';
2
+ import type { OrbitInterface } from '../orbits.js';
4
3
  import { CartesianCoordinatesInterface } from './planets.js';
5
4
  /**
6
- * Represents a **star system**, which can be a planetary system or a stellar system.
5
+ * Represents a **star**.
7
6
  *
8
- * @property {string} name - Name of the star system.
9
- * @property {'planetary system' | 'stellar system'} type - Specifies if it is a **planetary system** or a **stellar system**.
10
- *
11
- * @example
12
- * ```ts
13
- * const solarSystem: StarSystemInterface = {
14
- * name: 'Solar System',
15
- * type: 'planetary system'
16
- * };
17
- * ```
18
- * @group Celestial Bodies
19
- */
20
- export interface StarSystemInterface {
21
- name: string;
22
- type: 'planetary system' | 'stellar system';
23
- }
24
- /**
25
- * Represents a **star** in a planetary or stellar system.
26
- *
27
- * **Orbital & Physical Properties:**
28
- * - **Semi-major axis (`a`)**: Defines the star’s orbit size (AU or light-years).
29
- * - **Orbital eccentricity (`e`)**: Determines how elliptical the orbit is.
30
- * - **Orbital period (`period`)**: Time taken for one full orbit. Negative values indicates counter clockwise direction.
31
- * - **True anomaly (`angle`)**: The star’s current position in its orbit (in **radians**).
32
- * - **Radius (`radius`)**: Physical size of the star.
7
+ * A star is bound to one `parent`: a galaxy for a single star like Vega, or a
8
+ * system barycenter for a star in a planetary, binary or multiple system. Its
9
+ * `orbit` describes the motion around that parent. A star without a `parent`
10
+ * is unbound, like a hypervelocity star leaving its galaxy.
33
11
  *
34
12
  * **Classification & Visualization:**
35
- * - **Type (`type`)**: Classification of the star (e.g., **main-sequence star, white dwarf**).
13
+ * - **Type (`type`)**: Spectral classification of the star (e.g., `'G2V'`).
36
14
  * - **Category (`category`)**: Defined as `'star'`.
37
15
  * - **Color (`color`)**: Used for visual representation.
38
16
  *
39
17
  * @example
40
18
  * ```ts
41
- * const sun: StarInterface = {
42
- * name: 'Sun',
43
- * type: 'G-type main-sequence',
19
+ * const vega: StarInterface = {
20
+ * id: 'vega',
21
+ * name: 'Vega',
22
+ * type: 'A0V',
44
23
  * category: 'star',
45
- * system: solarSystem,
46
- * radius: { value: 695700, unit: 'km' },
47
- * color: '#ffcc00',
48
- * a: { value: 0, unit: 'au' },
49
- * e: 0,
50
- * period: { value: 0, unit: 'years' },
51
- * angle: 0,
52
- * x: { value: 0, unit: 'au' },
53
- * y: { value: 0, unit: 'au' },
54
- * z: { value: 0, unit: 'au' }
24
+ * parent: 'milky-way',
25
+ * orbit: {
26
+ * a: { value: 27230, unit: 'ly' },
27
+ * e: 0.005,
28
+ * period: { value: -480, unit: 'Myr' },
29
+ * angle: 1.5699 as Radians
30
+ * },
31
+ * radius: { value: 2600000, unit: 'km' },
32
+ * color: 'blue'
55
33
  * };
56
34
  * ```
57
35
  * @group Celestial Bodies
58
36
  */
59
37
  export interface StarInterface {
38
+ /** Stable identifier, used by `parent` references. Never translated. */
39
+ id: string;
60
40
  /** Name of the star. */
61
41
  name: string;
62
- /** Classification of the star (e.g., main-sequence, red giant, white dwarf). */
42
+ /** Spectral classification of the star (e.g., `'G2V'`). */
63
43
  type: string;
64
44
  /** Defines the category as a star. */
65
45
  category: 'star';
66
- /** The system in which the star exists. */
67
- system: StarSystemInterface;
46
+ /** Id of the galaxy or system the star is bound to. */
47
+ parent?: string;
48
+ /** Orbit around the parent. */
49
+ orbit?: OrbitInterface;
50
+ /** Mass in solar masses ($M_\odot$). */
51
+ mass?: number;
68
52
  /** Physical radius of the star. */
69
53
  radius: DistanceInterface;
70
54
  /** Visual representation color. */
71
55
  color: string;
72
- /** Semi-major axis of the orbit (AU or light-years). */
73
- a: MeasureInterface;
74
- /** Orbital eccentricity (0 = circular, closer to 1 = highly elliptical). */
75
- e: number;
76
56
  /** Semi-minor axis of the orbit (calculated from `a` and `e`). */
77
57
  miA?: number;
78
58
  /** X-offset for the ellipse focus (accounts for eccentricity). */
79
59
  focus_x?: number;
80
- /** Current orbital position in radians (True Anomaly). */
81
- angle: Radians;
82
- /** X-coordinate in a distance-based system. */
83
- x: DistanceInterface;
84
- /** Y-coordinate in a distance-based system. */
85
- y: DistanceInterface;
86
- /** Z-coordinate in a distance-based system. */
87
- z: DistanceInterface;
88
- /** Orbital period of the star. Negative values indicate counter clockwise direction. */
89
- period: TemporalInterface;
60
+ /** X-coordinate in the parent's frame. */
61
+ x?: DistanceInterface;
62
+ /** Y-coordinate in the parent's frame. */
63
+ y?: DistanceInterface;
64
+ /** Z-coordinate in the parent's frame. */
65
+ z?: DistanceInterface;
90
66
  /** Precomputed orbital path points for visualization (optional). */
91
67
  orbitPath?: CartesianCoordinatesInterface[];
92
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stars.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/stars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,aAAa;IAC5B,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF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C,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,oEAAoE;IACpE,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
@@ -1,17 +1,68 @@
1
+ import { DistanceInterface } from '../distance.js';
2
+ import type { OrbitInterface } from '../orbits.js';
1
3
  /**
2
- * Represents a star system within the space visualization.
4
+ * Kind of system a barycenter holds together.
5
+ *
6
+ * - `'planetary'`: one star with planets, like the Solar System.
7
+ * - `'binary'`: two stars orbiting a shared barycenter.
8
+ * - `'multiple'`: three or more stars, nested as pairs (Alpha Centauri).
9
+ * - `'cluster'`: a loosely bound group whose members have a parent but no orbit.
10
+ *
11
+ * @group Celestial Bodies
12
+ */
13
+ export type SystemKindType = 'planetary' | 'binary' | 'multiple' | 'cluster';
14
+ /**
15
+ * Represents a **system**: the barycenter (centre of mass) that its members
16
+ * orbit.
17
+ *
18
+ * A system does not list its members. Each member names the system as its
19
+ * `parent`, so the member list is derived and there is one source of truth.
20
+ * Systems nest: the Alpha Centauri AB pair is a system whose parent is the
21
+ * Alpha Centauri system.
22
+ *
23
+ * - `parent` and `orbit` set: the system orbits its parent as one body.
24
+ * - `parent` without `orbit`: bound to the parent, but not on a Kepler orbit.
25
+ * - Neither: unbound.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const alphaCentauriAB: SystemInterface = {
30
+ * id: 'alpha-centauri-ab',
31
+ * name: 'Alpha Centauri AB',
32
+ * kind: 'binary',
33
+ * parent: 'alpha-centauri',
34
+ * orbit: {
35
+ * a: { value: 503, unit: 'au' },
36
+ * e: 0.5,
37
+ * period: { value: -547, unit: 'kyr' },
38
+ * angle: Math.PI as Radians
39
+ * }
40
+ * };
41
+ * ```
3
42
  * @group Celestial Bodies
4
43
  */
5
44
  export interface SystemInterface {
6
- /** Name of the star system. */
45
+ /** Stable identifier, used by `parent` references. Never translated. */
46
+ id: string;
47
+ /** Display name of the system. */
7
48
  name: string;
8
- /** List of star names in the system. */
9
- stars: string[];
10
- /** Distance from the Sun in light-years. */
11
- distance: number;
49
+ /** What kind of system the barycenter holds together. */
50
+ kind: SystemKindType;
51
+ /** Id of the galaxy or system this system is bound to. */
52
+ parent?: string;
53
+ /** Orbit of the system's barycenter around its parent. */
54
+ orbit?: OrbitInterface;
55
+ /** Distance from the Sun. */
56
+ distance?: DistanceInterface;
57
+ /** X-coordinate of the barycenter in the parent's frame. */
58
+ x?: DistanceInterface;
59
+ /** Y-coordinate of the barycenter in the parent's frame. */
60
+ y?: DistanceInterface;
61
+ /** Z-coordinate of the barycenter in the parent's frame. */
62
+ z?: DistanceInterface;
12
63
  }
13
64
  /**
14
- * Type alias for a collection of star systems.
65
+ * Type alias for a collection of systems.
15
66
  * @group Celestial Bodies
16
67
  */
17
68
  export type SystemsType = SystemInterface[];
@@ -1 +1 @@
1
- {"version":3,"file":"systems.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/systems.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"systems.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/systems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,cAAc,CAAC;IACrB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,4DAA4D;IAC5D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,4DAA4D;IAC5D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,4DAA4D;IAC5D,CAAC,CAAC,EAAE,iBAAiB,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
package/dist/orbits.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import type { MeasureInterface } from './distance.js';
2
+ import type { Radians } from './numeric.js';
3
+ import type { TemporalInterface } from './temporal.js';
1
4
  /**
2
5
  * Clohessy–Wiltshire / Hill relative-motion **state vector** in the LVLH frame.
3
6
  *
@@ -85,4 +88,53 @@ export type CwStateDerivative = readonly [
85
88
  /** Time derivative of `zDot` (cross-track relative acceleration). */
86
89
  zDDot: number
87
90
  ];
91
+ /**
92
+ * Kepler **orbital elements** of one body around its parent.
93
+ *
94
+ * The parent is whatever the body is gravitationally bound to: a star, a
95
+ * planet, a barycenter or a galaxy. It is named by the `parent` id on the body
96
+ * or system that carries this orbit, and the elements always describe the
97
+ * motion **around that parent**, never around anything further up.
98
+ *
99
+ * ::: info
100
+ *
101
+ * - **Pairs**: when two bodies orbit a shared barycenter (Alpha Centauri A and
102
+ * B), each carries its own orbit. Both share `e`, `period` and `angle`, their
103
+ * periapses point in opposite directions, and their semi-major axes split by
104
+ * mass ratio: $a_1 = a \, m_2 / (m_1 + m_2)$, where $a$ is their separation.
105
+ * - **Direction**: a negative `period` indicates a counter-clockwise orbit.
106
+ * - `i`, `w`, `om` and `q` are only given where the dataset has them (comets and
107
+ * asteroids).
108
+ *
109
+ * :::
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const earthOrbit: OrbitInterface = {
114
+ * a: { value: 1.0, unit: 'au' },
115
+ * e: 0.0167,
116
+ * period: { value: -365.256, unit: 'd' },
117
+ * angle: 1.753 as Radians
118
+ * };
119
+ * ```
120
+ * @group Orbits
121
+ */
122
+ export interface OrbitInterface {
123
+ /** Semi-major axis of this body's orbit around the parent's centre of mass. */
124
+ a: MeasureInterface;
125
+ /** Orbital eccentricity (0 = circular, closer to 1 = highly elliptical). */
126
+ e: number;
127
+ /** Orbital period. Negative values indicate counter clockwise direction. */
128
+ period: TemporalInterface;
129
+ /** Current orbital position at J2000 in radians (true anomaly). */
130
+ angle: Radians;
131
+ /** Orbital inclination in degrees. */
132
+ i?: number;
133
+ /** Argument of periapsis in degrees. */
134
+ w?: number;
135
+ /** Longitude of the ascending node in degrees. */
136
+ om?: number;
137
+ /** Periapsis distance $q = a(1 - e)$ in the unit of `a`. */
138
+ q?: number;
139
+ }
88
140
  //# sourceMappingURL=orbits.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"orbits.d.ts","sourceRoot":"","sources":["../src/orbits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS;IAC7B,0CAA0C;IAC1C,CAAC,EAAE,MAAM;IACT,kDAAkD;IAClD,CAAC,EAAE,MAAM;IACT,oDAAoD;IACpD,CAAC,EAAE,MAAM;IACT,yDAAyD;IACzD,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS;IACvC,yDAAyD;IACzD,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,gEAAgE;IAChE,KAAK,EAAE,MAAM;IACb,qEAAqE;IACrE,KAAK,EAAE,MAAM;IACb,qEAAqE;IACrE,KAAK,EAAE,MAAM;CACd,CAAC"}
1
+ {"version":3,"file":"orbits.d.ts","sourceRoot":"","sources":["../src/orbits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS;IAC7B,0CAA0C;IAC1C,CAAC,EAAE,MAAM;IACT,kDAAkD;IAClD,CAAC,EAAE,MAAM;IACT,oDAAoD;IACpD,CAAC,EAAE,MAAM;IACT,yDAAyD;IACzD,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS;IACvC,yDAAyD;IACzD,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,gEAAgE;IAChE,KAAK,EAAE,MAAM;IACb,qEAAqE;IACrE,KAAK,EAAE,MAAM;IACb,qEAAqE;IACrE,KAAK,EAAE,MAAM;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,CAAC,EAAE,gBAAgB,CAAC;IACpB,4EAA4E;IAC5E,CAAC,EAAE,MAAM,CAAC;IACV,4EAA4E;IAC5E,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mEAAmE;IACnE,KAAK,EAAE,OAAO,CAAC;IACf,sCAAsC;IACtC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interstellar-tools/types",
3
- "version": "0.60.1",
3
+ "version": "0.61.0",
4
4
  "description": "Shared TypeScript types (e.g., 3D tuples, equation result interfaces) used across the monorepo to keep APIs predictable and safe.",
5
5
  "keywords": [
6
6
  "types",