@interstellar-tools/types 0.61.2 → 0.63.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.
- package/dist/celestial-bodies/asteroid-belts.d.ts +6 -15
- package/dist/celestial-bodies/asteroid-belts.d.ts.map +1 -1
- package/dist/celestial-bodies/asteroids.d.ts +7 -39
- package/dist/celestial-bodies/asteroids.d.ts.map +1 -1
- package/dist/celestial-bodies/comets.d.ts +16 -25
- package/dist/celestial-bodies/comets.d.ts.map +1 -1
- package/dist/celestial-bodies/display.d.ts +63 -0
- package/dist/celestial-bodies/display.d.ts.map +1 -0
- package/dist/celestial-bodies/display.js +2 -0
- package/dist/celestial-bodies/display.js.map +1 -0
- package/dist/celestial-bodies/index.d.ts +1 -0
- package/dist/celestial-bodies/index.d.ts.map +1 -1
- package/dist/celestial-bodies/index.js +1 -0
- package/dist/celestial-bodies/index.js.map +1 -1
- package/dist/celestial-bodies/moons.d.ts +7 -14
- package/dist/celestial-bodies/moons.d.ts.map +1 -1
- package/dist/celestial-bodies/planets.d.ts +10 -31
- package/dist/celestial-bodies/planets.d.ts.map +1 -1
- package/dist/celestial-bodies/stars.d.ts +6 -12
- package/dist/celestial-bodies/stars.d.ts.map +1 -1
- package/dist/celestial-bodies/systems.d.ts +1 -1
- package/dist/distance.d.ts +11 -7
- package/dist/distance.d.ts.map +1 -1
- package/dist/orbits.d.ts +32 -12
- package/dist/orbits.d.ts.map +1 -1
- package/dist/temporal.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DisplayInterface } from './display.js';
|
|
2
2
|
/**
|
|
3
3
|
* Represents an asteroid belt within the solar system simulation.
|
|
4
4
|
*
|
|
5
5
|
* **Asteroid Belt Properties:**
|
|
6
6
|
* - **Inner and Outer Radius**: Defines the spatial boundaries of the belt in **Astronomical Units (AU)**.
|
|
7
|
-
* - **
|
|
8
|
-
*
|
|
9
|
-
* - **Orbit Path (Optional)**: Stores a precomputed path for asteroid positioning.
|
|
7
|
+
* - **Drawing (`display`)**: colour, opacity, and density (how many asteroids to draw); see
|
|
8
|
+
* {@link DisplayInterface}.
|
|
10
9
|
*
|
|
11
10
|
* @group Celestial Bodies
|
|
12
11
|
*/
|
|
@@ -21,14 +20,8 @@ export interface AsteroidBeltInterface {
|
|
|
21
20
|
innerRadius: number;
|
|
22
21
|
/** Outer radius of the belt in Astronomical Units (AU). */
|
|
23
22
|
outerRadius: number;
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/** Transparency level (0 = fully transparent, 1 = solid). */
|
|
27
|
-
opacity: number;
|
|
28
|
-
/** Density factor affecting how many asteroids are simulated. */
|
|
29
|
-
density: number;
|
|
30
|
-
/** Optional: Orbit path for finer asteroid positioning. */
|
|
31
|
-
orbitPath?: CartesianCoordinatesInterface[];
|
|
23
|
+
/** How to draw the belt: colour, opacity and density, and state a renderer computes. */
|
|
24
|
+
display?: DisplayInterface;
|
|
32
25
|
}
|
|
33
26
|
/**
|
|
34
27
|
* Type alias for a collection of asteroid belts.
|
|
@@ -42,9 +35,7 @@ export interface AsteroidBeltInterface {
|
|
|
42
35
|
* parent: 'sun',
|
|
43
36
|
* innerRadius: 2.1,
|
|
44
37
|
* outerRadius: 3.3,
|
|
45
|
-
* color: '#888888',
|
|
46
|
-
* opacity: 0.5,
|
|
47
|
-
* density: 100,
|
|
38
|
+
* display: { color: '#888888', opacity: 0.5, density: 100 }
|
|
48
39
|
* }];
|
|
49
40
|
* ```
|
|
50
41
|
* @group Celestial Bodies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asteroid-belts.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroid-belts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"asteroid-belts.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroid-belts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;GASG;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,wFAAwF;IACxF,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DistanceInterface } from '../distance.js';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { FullOrbitInterface } from '../orbits.js';
|
|
3
|
+
import type { DisplayInterface } from './display.js';
|
|
4
4
|
/**
|
|
5
5
|
* High-level **orbital class** of an asteroid (by dynamical region).
|
|
6
6
|
*
|
|
@@ -70,9 +70,8 @@ export type AsteroidSpectralType = 'c-type' | 's-type' | 'v-type' | 'm-type' | '
|
|
|
70
70
|
* q \;=\; a\,(1 - e)
|
|
71
71
|
* $$
|
|
72
72
|
*
|
|
73
|
-
* **Period convention:** `period` is a duration (e.g., in **days**).
|
|
74
|
-
*
|
|
75
|
-
* convention (visualization-specific; not a physical requirement).
|
|
73
|
+
* **Period convention:** `period` is a positive duration (e.g., in **days**).
|
|
74
|
+
* A retrograde orbit (`i > 90°`) has `retrograde: true`.
|
|
76
75
|
*
|
|
77
76
|
* **Coordinates:** Optional `x,y,z` are distances in a chosen reference frame (e.g., ecliptic
|
|
78
77
|
* J2000). Always document the frame you use in calling code.
|
|
@@ -95,7 +94,7 @@ export interface AsteroidInterface {
|
|
|
95
94
|
/** Id of the star the asteroid orbits (e.g., `'sun'`). */
|
|
96
95
|
parent: string;
|
|
97
96
|
/** Orbit around the parent, with all elements including `i`, `w`, `om` and `q`. */
|
|
98
|
-
orbit:
|
|
97
|
+
orbit: FullOrbitInterface;
|
|
99
98
|
/**
|
|
100
99
|
* Optional **Cartesian coordinates** (distance values) in a specified frame.
|
|
101
100
|
* ::: info
|
|
@@ -109,41 +108,10 @@ export interface AsteroidInterface {
|
|
|
109
108
|
y?: DistanceInterface;
|
|
110
109
|
/** See {@link x}. */
|
|
111
110
|
z?: DistanceInterface;
|
|
112
|
-
/**
|
|
113
|
-
* Optional **semi-minor axis** in **pixels** (for 2D ellipse rendering).
|
|
114
|
-
*
|
|
115
|
-
* ::: info
|
|
116
|
-
*
|
|
117
|
-
* Visualization aid only; not a physical quantity.
|
|
118
|
-
*
|
|
119
|
-
* :::
|
|
120
|
-
*/
|
|
121
|
-
miA?: number;
|
|
122
|
-
/**
|
|
123
|
-
* Optional **focus offset** along X for ellipse rendering (pixels).
|
|
124
|
-
*
|
|
125
|
-
* ::: info
|
|
126
|
-
*
|
|
127
|
-
* Visualization aid only; not a physical quantity.
|
|
128
|
-
*
|
|
129
|
-
* :::
|
|
130
|
-
*/
|
|
131
|
-
focus_x?: number;
|
|
132
111
|
/** Mean/characteristic **radius** (e.g., in **km**) as a distance value. */
|
|
133
112
|
radius: DistanceInterface;
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
* ::: info
|
|
137
|
-
*
|
|
138
|
-
* Commonly a list of points in your rendering coordinate system.
|
|
139
|
-
*
|
|
140
|
-
* :::
|
|
141
|
-
*/
|
|
142
|
-
orbitPath?: CartesianCoordinatesInterface[];
|
|
143
|
-
/** Display color (hex string, e.g., `#AABBCC`). */
|
|
144
|
-
color: string;
|
|
145
|
-
/** Visual **scale factor** (UI only; not physical size). */
|
|
146
|
-
size: number;
|
|
113
|
+
/** How to draw the asteroid: its colour and drawn size, and state a renderer computes. */
|
|
114
|
+
display?: DisplayInterface;
|
|
147
115
|
}
|
|
148
116
|
/**
|
|
149
117
|
* Convenience alias for a list of asteroids.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asteroids.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"asteroids.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;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,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IAEX,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IAEb,+DAA+D;IAC/D,IAAI,EAAE,YAAY,CAAC;IAEnB,0EAA0E;IAC1E,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,6DAA6D;IAC7D,YAAY,EAAE,oBAAoB,CAAC;IAEnC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IAEf,mFAAmF;IACnF,KAAK,EAAE,kBAAkB,CAAC;IAE1B;;;;;;;OAOG;IACH,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,qBAAqB;IACrB,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,qBAAqB;IACrB,CAAC,CAAC,EAAE,iBAAiB,CAAC;IAEtB,4EAA4E;IAC5E,MAAM,EAAE,iBAAiB,CAAC;IAE1B,0FAA0F;IAC1F,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DistanceInterface } from '../distance.js';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { FullOrbitInterface } from '../orbits.js';
|
|
3
|
+
import type { DisplayInterface } from './display.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a **comet** in the solar system simulation.
|
|
6
6
|
*
|
|
@@ -10,13 +10,12 @@ import { CartesianCoordinatesInterface } from './planets.js';
|
|
|
10
10
|
* - **Inclination (`i`)**: The tilt of the orbit relative to the **ecliptic plane**, measured in **degrees**.
|
|
11
11
|
* - **Argument of perihelion (`w`)**: The angle from the **ascending node** to the **perihelion**.
|
|
12
12
|
* - **Longitude of the ascending node (`om`)**: Defines where the orbit crosses the ecliptic.
|
|
13
|
-
* - **Perihelion distance (`q`)**: The closest approach to the Sun
|
|
13
|
+
* - **Perihelion distance (`q`)**: The closest approach to the Sun, as a distance.
|
|
14
|
+
* - **Direction (`retrograde`)**: `true` when `i > 90°`, like Halley's comet.
|
|
14
15
|
* - **Angle (`angle`)**: The **true anomaly** at J2000, as for every other body.
|
|
15
16
|
*
|
|
16
|
-
* **
|
|
17
|
-
*
|
|
18
|
-
* - **Color (`color`)**: Used for visual representation.
|
|
19
|
-
* - **Size (`size`)**: Scaled size for display (not the actual physical size).
|
|
17
|
+
* **Drawing (`display`)**: colour and a scaled drawing size (not the physical
|
|
18
|
+
* `radius`), and state a renderer computes; see {@link DisplayInterface}.
|
|
20
19
|
*
|
|
21
20
|
* @group Celestial Bodies
|
|
22
21
|
*/
|
|
@@ -32,25 +31,17 @@ export interface CometInterface {
|
|
|
32
31
|
/** Id of the star the comet orbits (e.g., `'sun'`). */
|
|
33
32
|
parent: string;
|
|
34
33
|
/** Orbit around the parent, with all elements including `i`, `w`, `om` and `q`. */
|
|
35
|
-
orbit:
|
|
34
|
+
orbit: FullOrbitInterface;
|
|
36
35
|
/** X-coordinate in a distance-based system (optional). */
|
|
37
36
|
x?: DistanceInterface;
|
|
38
37
|
/** Y-coordinate in a distance-based system (optional). */
|
|
39
38
|
y?: DistanceInterface;
|
|
40
39
|
/** Z-coordinate in a distance-based system (optional). */
|
|
41
40
|
z?: DistanceInterface;
|
|
42
|
-
/** Semi-minor axis converted to pixels (calculated from `a` and `e`). */
|
|
43
|
-
miA?: number;
|
|
44
|
-
/** X-offset for the ellipse focus (accounts for eccentricity). */
|
|
45
|
-
focus_x?: number;
|
|
46
41
|
/** Radius of the comet (for visualization purposes). */
|
|
47
42
|
radius: DistanceInterface;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
/** Visual representation color. */
|
|
51
|
-
color: string;
|
|
52
|
-
/** Scaled size for visualization (not actual physical size). */
|
|
53
|
-
size: number;
|
|
43
|
+
/** How to draw the comet: its colour and drawn size, and state a renderer computes. */
|
|
44
|
+
display?: DisplayInterface;
|
|
54
45
|
}
|
|
55
46
|
/**
|
|
56
47
|
* Type alias for an array of **comets**.
|
|
@@ -67,16 +58,16 @@ export interface CometInterface {
|
|
|
67
58
|
* orbit: {
|
|
68
59
|
* a: { value: 17.834, unit: 'au' },
|
|
69
60
|
* e: 0.96714,
|
|
70
|
-
* i: 162.26,
|
|
71
|
-
* w: 111.33,
|
|
72
|
-
* om: 58.42,
|
|
73
|
-
* angle:
|
|
61
|
+
* i: 162.26 as DegreesType,
|
|
62
|
+
* w: 111.33 as DegreesType,
|
|
63
|
+
* om: 58.42 as DegreesType,
|
|
64
|
+
* angle: 2.97966 as Radians,
|
|
74
65
|
* period: { value: 27576, unit: 'd' },
|
|
75
|
-
*
|
|
66
|
+
* retrograde: true,
|
|
67
|
+
* q: { value: 0.586, unit: 'au' }
|
|
76
68
|
* },
|
|
77
69
|
* radius: { value: 11, unit: 'km' },
|
|
78
|
-
* color: '#ffffff',
|
|
79
|
-
* size: 1.2
|
|
70
|
+
* display: { color: '#ffffff', size: 1.2 }
|
|
80
71
|
* }];
|
|
81
72
|
* ```
|
|
82
73
|
* @group Celestial Bodies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/comets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"comets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/comets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,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,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,KAAK,EAAE,kBAAkB,CAAC;IAC1B,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,wDAAwD;IACxD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,uFAAuF;IACvF,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents **2D coordinates**, for example a point on a drawn orbit.
|
|
3
|
+
*
|
|
4
|
+
* @property {number} x - The x-coordinate.
|
|
5
|
+
* @property {number} y - The y-coordinate.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const position: CartesianCoordinatesInterface = { x: 100, y: 200 };
|
|
10
|
+
* ```
|
|
11
|
+
* @group Celestial Bodies
|
|
12
|
+
*/
|
|
13
|
+
export interface CartesianCoordinatesInterface {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* How a body is **drawn**: everything about rendering, kept apart from its
|
|
19
|
+
* physical data and its `orbit`.
|
|
20
|
+
*
|
|
21
|
+
* It holds two kinds of values:
|
|
22
|
+
*
|
|
23
|
+
* - **Hints from the datasets**: `color` on every body, `size` on comets and
|
|
24
|
+
* asteroids, `opacity` and `density` on asteroid belts.
|
|
25
|
+
* - **State a renderer computes** and keeps on the body, so it doesn't have to
|
|
26
|
+
* recompute it every frame: `semiMinorAxis`, `focusOffsetX` and
|
|
27
|
+
* `orbitPath`. The datasets never set these.
|
|
28
|
+
*
|
|
29
|
+
* The computed distances are in whatever unit the renderer uses for
|
|
30
|
+
* `orbit.a` (for example au), measured in the orbit's plane with the parent
|
|
31
|
+
* body at the origin and periapsis along +x.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Drawing an orbit: compute once, keep it on the body
|
|
36
|
+
* const a = convertDistance(body.orbit.a, 'au').value;
|
|
37
|
+
* const { e } = body.orbit;
|
|
38
|
+
*
|
|
39
|
+
* body.display = {
|
|
40
|
+
* ...body.display,
|
|
41
|
+
* semiMinorAxis: a * Math.sqrt(1 - e ** 2),
|
|
42
|
+
* focusOffsetX: a * e
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
* @group Celestial Bodies
|
|
46
|
+
*/
|
|
47
|
+
export interface DisplayInterface {
|
|
48
|
+
/** Colour to draw the body in, as a hex string (`#rrggbb`) or a CSS colour name. */
|
|
49
|
+
color?: string;
|
|
50
|
+
/** Scaled size for drawing, not the physical size (see `radius`). */
|
|
51
|
+
size?: number;
|
|
52
|
+
/** Transparency, from 0 (invisible) to 1 (solid). */
|
|
53
|
+
opacity?: number;
|
|
54
|
+
/** How densely to fill an area, e.g. how many asteroids to draw in a belt. */
|
|
55
|
+
density?: number;
|
|
56
|
+
/** Semi-minor axis of the orbit, $b = a\sqrt{1 - e^2}$, computed by a renderer. */
|
|
57
|
+
semiMinorAxis?: number;
|
|
58
|
+
/** Distance from the ellipse's centre to its focus, $c = a e$, computed by a renderer. */
|
|
59
|
+
focusOffsetX?: number;
|
|
60
|
+
/** Points along the drawn orbit, computed by a renderer. */
|
|
61
|
+
orbitPath?: CartesianCoordinatesInterface[];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,6BAA6B;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/celestial-bodies/display.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAE5B,cAAc,cAAc,CAAC;AAE7B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/celestial-bodies/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/celestial-bodies/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAE5B,cAAc,cAAc,CAAC;AAE7B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { DistanceInterface } from '../distance.js';
|
|
2
2
|
import type { OrbitInterface } from '../orbits.js';
|
|
3
|
-
import {
|
|
3
|
+
import type { DisplayInterface } from './display.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a **moon** (natural satellite) orbiting a planet.
|
|
6
6
|
*
|
|
7
7
|
* A moon always has a `parent` (its planet) and an `orbit` around it; see
|
|
8
8
|
* {@link OrbitInterface}.
|
|
9
9
|
*
|
|
10
|
-
* **
|
|
11
|
-
* - **Orbit Path (`orbitPath`)**: Precomputed trajectory for rendering.
|
|
12
|
-
* - **Color (`color`)**: Visual representation.
|
|
10
|
+
* **Physical and drawing properties:**
|
|
13
11
|
* - **Size (`radius`)**: Actual moon radius in **kilometers (km)**.
|
|
12
|
+
* - **Drawing (`display`)**: colour, and state a renderer computes; see {@link DisplayInterface}.
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
16
15
|
* ```ts
|
|
@@ -22,11 +21,11 @@ import { CartesianCoordinatesInterface } from './planets.js';
|
|
|
22
21
|
* orbit: {
|
|
23
22
|
* a: { value: 0.00448, unit: 'au' },
|
|
24
23
|
* e: 0.009,
|
|
25
|
-
* period: { value:
|
|
24
|
+
* period: { value: 3.551, unit: 'd' },
|
|
26
25
|
* angle: 0 as Radians
|
|
27
26
|
* },
|
|
28
27
|
* radius: { value: 1560.8, unit: 'km' },
|
|
29
|
-
* color: '#a6a6a6'
|
|
28
|
+
* display: { color: '#a6a6a6' }
|
|
30
29
|
* };
|
|
31
30
|
* ```
|
|
32
31
|
* @group Celestial Bodies
|
|
@@ -43,22 +42,16 @@ export interface MoonInterface {
|
|
|
43
42
|
parent: string;
|
|
44
43
|
/** Orbit around the parent planet. */
|
|
45
44
|
orbit: OrbitInterface;
|
|
46
|
-
/** Semi-minor axis converted to pixels (calculated from `a` and `e`). */
|
|
47
|
-
miA?: number;
|
|
48
|
-
/** X-offset for the ellipse focus (accounts for eccentricity). */
|
|
49
|
-
focus_x?: number;
|
|
50
45
|
/** Physical radius of the moon in kilometres. */
|
|
51
46
|
radius: DistanceInterface;
|
|
52
|
-
/** Visual representation color. */
|
|
53
|
-
color: string;
|
|
54
47
|
/** X-coordinate in a distance-based system (optional). */
|
|
55
48
|
x?: DistanceInterface;
|
|
56
49
|
/** Y-coordinate in a distance-based system (optional). */
|
|
57
50
|
y?: DistanceInterface;
|
|
58
51
|
/** Z-coordinate in a distance-based system (optional). */
|
|
59
52
|
z?: DistanceInterface;
|
|
60
|
-
/**
|
|
61
|
-
|
|
53
|
+
/** How to draw the moon: its colour, and state a renderer computes. */
|
|
54
|
+
display?: DisplayInterface;
|
|
62
55
|
}
|
|
63
56
|
/**
|
|
64
57
|
* Type alias for a collection of **moons**.
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;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,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { DistanceInterface } from '../distance.js';
|
|
2
2
|
import type { OrbitInterface } from '../orbits.js';
|
|
3
|
-
|
|
4
|
-
* Represents **2D coordinates** for planetary positioning.
|
|
5
|
-
*
|
|
6
|
-
* @property {number} x - The x-coordinate.
|
|
7
|
-
* @property {number} y - The y-coordinate.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const position: CartesianCoordinatesInterface = { x: 100, y: 200 };
|
|
12
|
-
* ```
|
|
13
|
-
* @group Celestial Bodies
|
|
14
|
-
*/
|
|
15
|
-
export interface CartesianCoordinatesInterface {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
}
|
|
3
|
+
import type { DisplayInterface } from './display.js';
|
|
19
4
|
/**
|
|
20
5
|
* Represents a **planet** or **planetoid**.
|
|
21
6
|
*
|
|
@@ -26,7 +11,7 @@ export interface CartesianCoordinatesInterface {
|
|
|
26
11
|
* **Classification & Visualization:**
|
|
27
12
|
* - **Type (`type`)**: Scientific classification of the planet (e.g., **terrestrial, gas giant, ice planet**).
|
|
28
13
|
* - **Category (`category`)**: Defines whether the object is a **planet** or a **planetoid**.
|
|
29
|
-
* - **
|
|
14
|
+
* - **Drawing (`display`)**: colour, and state a renderer computes; see {@link DisplayInterface}.
|
|
30
15
|
* - **Size (`radius`)**: Physical planet radius in **kilometers (km)**.
|
|
31
16
|
*
|
|
32
17
|
* @example
|
|
@@ -36,15 +21,15 @@ export interface CartesianCoordinatesInterface {
|
|
|
36
21
|
* name: 'Earth',
|
|
37
22
|
* type: 'terrestrial planet',
|
|
38
23
|
* category: 'planet',
|
|
39
|
-
* color: '#4287f5',
|
|
40
24
|
* parent: 'sun',
|
|
41
25
|
* orbit: {
|
|
42
26
|
* a: { value: 1.0, unit: 'au' },
|
|
43
27
|
* e: 0.0167,
|
|
44
|
-
* period: { value:
|
|
28
|
+
* period: { value: 365.256, unit: 'd' },
|
|
45
29
|
* angle: 1.753 as Radians
|
|
46
30
|
* },
|
|
47
31
|
* radius: { value: 6371, unit: 'km' },
|
|
32
|
+
* display: { color: '#4287f5' },
|
|
48
33
|
* x: { value: 0, unit: 'au' },
|
|
49
34
|
* y: { value: 1, unit: 'au' },
|
|
50
35
|
* z: { value: 0, unit: 'au' }
|
|
@@ -61,26 +46,20 @@ export interface PlanetInterface {
|
|
|
61
46
|
type: 'chthonian planet' | 'carbon planet' | 'coreless planet' | 'desert planet' | 'gas dwarf' | 'gas giant' | 'helium planet' | 'hycean planet' | 'ice giant' | 'ice planet' | 'iron planet' | 'lava planet' | 'ocean planet' | 'proto planet' | 'puffy planet' | 'super-puff' | 'silicate planet' | 'terrestrial planet';
|
|
62
47
|
/** Defines whether the object is a planet or a planetoid. */
|
|
63
48
|
category: 'planet' | 'planetoid';
|
|
64
|
-
/** Visual representation color. */
|
|
65
|
-
color: string;
|
|
66
49
|
/** Id of the star, system or galaxy the planet is bound to. */
|
|
67
50
|
parent?: string;
|
|
68
51
|
/** Orbit around the parent. */
|
|
69
52
|
orbit?: OrbitInterface;
|
|
70
53
|
/** Physical radius of the planet in kilometres. */
|
|
71
54
|
radius: DistanceInterface;
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
/** X-offset for the ellipse focus (accounts for eccentricity). */
|
|
75
|
-
focus_x?: number;
|
|
76
|
-
/** X-coordinate in the parent's frame. */
|
|
77
|
-
x: DistanceInterface;
|
|
55
|
+
/** X-coordinate in the parent's frame. Optional: a rogue planet or an exoplanet may have no known position. */
|
|
56
|
+
x?: DistanceInterface;
|
|
78
57
|
/** Y-coordinate in the parent's frame. */
|
|
79
|
-
y
|
|
58
|
+
y?: DistanceInterface;
|
|
80
59
|
/** Z-coordinate in the parent's frame. */
|
|
81
|
-
z
|
|
82
|
-
/**
|
|
83
|
-
|
|
60
|
+
z?: DistanceInterface;
|
|
61
|
+
/** How to draw the planet: its colour, and state a renderer computes. */
|
|
62
|
+
display?: DisplayInterface;
|
|
84
63
|
}
|
|
85
64
|
/**
|
|
86
65
|
* Type alias for a collection of **planets**.
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,+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,+GAA+G;IAC/G,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,yEAAyE;IACzE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DistanceInterface } from '../distance.js';
|
|
2
2
|
import type { OrbitInterface } from '../orbits.js';
|
|
3
|
-
import {
|
|
3
|
+
import type { DisplayInterface } from './display.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a **star**.
|
|
6
6
|
*
|
|
@@ -12,7 +12,7 @@ import { CartesianCoordinatesInterface } from './planets.js';
|
|
|
12
12
|
* **Classification & Visualization:**
|
|
13
13
|
* - **Type (`type`)**: Spectral classification of the star (e.g., `'G2V'`).
|
|
14
14
|
* - **Category (`category`)**: Defined as `'star'`.
|
|
15
|
-
* - **
|
|
15
|
+
* - **Drawing (`display`)**: colour, and state a renderer computes; see {@link DisplayInterface}.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```ts
|
|
@@ -25,11 +25,11 @@ import { CartesianCoordinatesInterface } from './planets.js';
|
|
|
25
25
|
* orbit: {
|
|
26
26
|
* a: { value: 27230, unit: 'ly' },
|
|
27
27
|
* e: 0.005,
|
|
28
|
-
* period: { value:
|
|
28
|
+
* period: { value: 480, unit: 'Myr' },
|
|
29
29
|
* angle: 1.5699 as Radians
|
|
30
30
|
* },
|
|
31
31
|
* radius: { value: 2600000, unit: 'km' },
|
|
32
|
-
* color: 'blue'
|
|
32
|
+
* display: { color: 'blue' }
|
|
33
33
|
* };
|
|
34
34
|
* ```
|
|
35
35
|
* @group Celestial Bodies
|
|
@@ -51,20 +51,14 @@ export interface StarInterface {
|
|
|
51
51
|
mass?: number;
|
|
52
52
|
/** Physical radius of the star. */
|
|
53
53
|
radius: DistanceInterface;
|
|
54
|
-
/** Visual representation color. */
|
|
55
|
-
color: string;
|
|
56
|
-
/** Semi-minor axis of the orbit (calculated from `a` and `e`). */
|
|
57
|
-
miA?: number;
|
|
58
|
-
/** X-offset for the ellipse focus (accounts for eccentricity). */
|
|
59
|
-
focus_x?: number;
|
|
60
54
|
/** X-coordinate in the parent's frame. */
|
|
61
55
|
x?: DistanceInterface;
|
|
62
56
|
/** Y-coordinate in the parent's frame. */
|
|
63
57
|
y?: DistanceInterface;
|
|
64
58
|
/** Z-coordinate in the parent's frame. */
|
|
65
59
|
z?: DistanceInterface;
|
|
66
|
-
/**
|
|
67
|
-
|
|
60
|
+
/** How to draw the star: its colour, and state a renderer computes. */
|
|
61
|
+
display?: DisplayInterface;
|
|
68
62
|
}
|
|
69
63
|
/**
|
|
70
64
|
* Type alias for a collection of **stars**.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stars.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/stars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"stars.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/stars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,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,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
|
|
@@ -34,7 +34,7 @@ export type SystemKindType = 'planetary' | 'binary' | 'multiple' | 'cluster';
|
|
|
34
34
|
* orbit: {
|
|
35
35
|
* a: { value: 503, unit: 'au' },
|
|
36
36
|
* e: 0.5,
|
|
37
|
-
* period: { value:
|
|
37
|
+
* period: { value: 547, unit: 'kyr' },
|
|
38
38
|
* angle: Math.PI as Radians
|
|
39
39
|
* }
|
|
40
40
|
* };
|
package/dist/distance.d.ts
CHANGED
|
@@ -58,17 +58,19 @@ export type DistanceUnitType = 'm' | 'km' | 'au' | 'ly' | 'kly' | 'Mly' | 'Gly'
|
|
|
58
58
|
*
|
|
59
59
|
* ### Typical flow
|
|
60
60
|
* 1) Accept `DistanceUnitAliasType | DistanceUnitType` at your API boundary.
|
|
61
|
-
* 2) Normalize to `DistanceUnitType`
|
|
61
|
+
* 2) Normalize to `DistanceUnitType` with `normalizeDistanceUnit` from
|
|
62
|
+
* `@interstellar-tools/equations`, or convert directly with `convertDistanceUnit`.
|
|
62
63
|
* 3) Perform calculations using canonical units only.
|
|
63
64
|
*
|
|
64
65
|
* @example
|
|
65
66
|
* ```ts
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* normalizeDistanceUnit('
|
|
67
|
+
* import { normalizeDistanceUnit } from '@interstellar-tools/equations';
|
|
68
|
+
*
|
|
69
|
+
* normalizeDistanceUnit('AU'); // 'au'
|
|
70
|
+
* normalizeDistanceUnit('lightyears'); // 'ly'
|
|
69
71
|
* normalizeDistanceUnit('kilolightyears'); // 'kly'
|
|
70
|
-
* normalizeDistanceUnit('parsecs');
|
|
71
|
-
* normalizeDistanceUnit('Mpc');
|
|
72
|
+
* normalizeDistanceUnit('parsecs'); // 'pc'
|
|
73
|
+
* normalizeDistanceUnit('Mpc'); // 'Mpc' (already canonical)
|
|
72
74
|
* ```
|
|
73
75
|
*
|
|
74
76
|
* @see DistanceUnitType for the canonical symbol set.
|
|
@@ -81,6 +83,8 @@ export type DistanceUnitAliasType = 'meter' | 'meters' | 'metre' | 'metres' | 'k
|
|
|
81
83
|
/**
|
|
82
84
|
* Represents a measurement with an associated unit.
|
|
83
85
|
*
|
|
86
|
+
* @deprecated Use {@link DistanceInterface}, which is identical. `MeasureInterface` will be
|
|
87
|
+
* removed in 2.0.
|
|
84
88
|
* @extends ValueInterface
|
|
85
89
|
* @property {DistanceUnitType} unit - The unit of measurement.
|
|
86
90
|
*
|
|
@@ -101,7 +105,7 @@ export interface MeasureInterface extends ValueInterface {
|
|
|
101
105
|
*
|
|
102
106
|
* @example
|
|
103
107
|
* ```ts
|
|
104
|
-
* const distanceToAlphaCentauri: DistanceInterface = { value: 4.367, unit: '
|
|
108
|
+
* const distanceToAlphaCentauri: DistanceInterface = { value: 4.367, unit: 'ly' };
|
|
105
109
|
* ```
|
|
106
110
|
* @group Distance
|
|
107
111
|
*/
|
package/dist/distance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distance.d.ts","sourceRoot":"","sources":["../src/distance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,gBAAgB,GACxB,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV
|
|
1
|
+
{"version":3,"file":"distance.d.ts","sourceRoot":"","sources":["../src/distance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,gBAAgB,GACxB,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,MAAM,qBAAqB,GAE7B,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GAER,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,GAEZ,IAAI,GACJ,IAAI,GACJ,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,GAEpB,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,KAAK,GACL,eAAe,GACf,gBAAgB,GAChB,KAAK,GACL,eAAe,GACf,gBAAgB,GAChB,KAAK,GAEL,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,aAAa,GACb,KAAK,GACL,YAAY,GACZ,aAAa,GACb,KAAK,GACL,YAAY,GACZ,aAAa,GACb,KAAK,CAAC;AAEV;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,IAAI,EAAE,gBAAgB,CAAC;CACxB"}
|
package/dist/orbits.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Radians } from './numeric.js';
|
|
1
|
+
import type { DistanceInterface } from './distance.js';
|
|
2
|
+
import type { DegreesType, Radians } from './numeric.js';
|
|
3
3
|
import type { TemporalInterface } from './temporal.js';
|
|
4
4
|
/**
|
|
5
5
|
* Clohessy–Wiltshire / Hill relative-motion **state vector** in the LVLH frame.
|
|
@@ -102,9 +102,11 @@ export type CwStateDerivative = readonly [
|
|
|
102
102
|
* B), each carries its own orbit. Both share `e`, `period` and `angle`, their
|
|
103
103
|
* periapses point in opposite directions, and their semi-major axes split by
|
|
104
104
|
* mass ratio: $a_1 = a \, m_2 / (m_1 + m_2)$, where $a$ is their separation.
|
|
105
|
-
* - **Direction**:
|
|
105
|
+
* - **Direction**: `period` is always a positive duration. A retrograde orbit,
|
|
106
|
+
* moving against its parent's rotation, has `retrograde: true`; a renderer
|
|
107
|
+
* can use `retrograde ? -1 : 1` as the direction of travel.
|
|
106
108
|
* - `i`, `w`, `om` and `q` are only given where the dataset has them (comets and
|
|
107
|
-
* asteroids).
|
|
109
|
+
* asteroids). Where `i` is given, `retrograde` is set exactly when `i > 90°`.
|
|
108
110
|
*
|
|
109
111
|
* :::
|
|
110
112
|
*
|
|
@@ -113,7 +115,7 @@ export type CwStateDerivative = readonly [
|
|
|
113
115
|
* const earthOrbit: OrbitInterface = {
|
|
114
116
|
* a: { value: 1.0, unit: 'au' },
|
|
115
117
|
* e: 0.0167,
|
|
116
|
-
* period: { value:
|
|
118
|
+
* period: { value: 365.256, unit: 'd' },
|
|
117
119
|
* angle: 1.753 as Radians
|
|
118
120
|
* };
|
|
119
121
|
* ```
|
|
@@ -121,20 +123,38 @@ export type CwStateDerivative = readonly [
|
|
|
121
123
|
*/
|
|
122
124
|
export interface OrbitInterface {
|
|
123
125
|
/** Semi-major axis of this body's orbit around the parent's centre of mass. */
|
|
124
|
-
a:
|
|
126
|
+
a: DistanceInterface;
|
|
125
127
|
/** Orbital eccentricity (0 = circular, closer to 1 = highly elliptical). */
|
|
126
128
|
e: number;
|
|
127
|
-
/** Orbital period.
|
|
129
|
+
/** Orbital period, always positive. See `retrograde` for the direction. */
|
|
128
130
|
period: TemporalInterface;
|
|
131
|
+
/** `true` for a retrograde orbit. Omitted for the usual prograde orbits. */
|
|
132
|
+
retrograde?: boolean;
|
|
129
133
|
/** Current orbital position at J2000 in radians (true anomaly). */
|
|
130
134
|
angle: Radians;
|
|
135
|
+
/** Orbital inclination in degrees, as catalogues give it. */
|
|
136
|
+
i?: DegreesType;
|
|
137
|
+
/** Argument of periapsis in degrees. */
|
|
138
|
+
w?: DegreesType;
|
|
139
|
+
/** Longitude of the ascending node in degrees. */
|
|
140
|
+
om?: DegreesType;
|
|
141
|
+
/** Periapsis distance $q = a(1 - e)$. */
|
|
142
|
+
q?: DistanceInterface;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* An {@link OrbitInterface} with every orientation element given: `i`, `w`,
|
|
146
|
+
* `om` and `q`. Comets and asteroids carry these.
|
|
147
|
+
*
|
|
148
|
+
* @group Orbits
|
|
149
|
+
*/
|
|
150
|
+
export interface FullOrbitInterface extends OrbitInterface {
|
|
131
151
|
/** Orbital inclination in degrees. */
|
|
132
|
-
i
|
|
152
|
+
i: DegreesType;
|
|
133
153
|
/** Argument of periapsis in degrees. */
|
|
134
|
-
w
|
|
154
|
+
w: DegreesType;
|
|
135
155
|
/** Longitude of the ascending node in degrees. */
|
|
136
|
-
om
|
|
137
|
-
/** Periapsis distance $q = a(1 - e)
|
|
138
|
-
q
|
|
156
|
+
om: DegreesType;
|
|
157
|
+
/** Periapsis distance $q = a(1 - e)$. */
|
|
158
|
+
q: DistanceInterface;
|
|
139
159
|
}
|
|
140
160
|
//# sourceMappingURL=orbits.d.ts.map
|
package/dist/orbits.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orbits.d.ts","sourceRoot":"","sources":["../src/orbits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"orbits.d.ts","sourceRoot":"","sources":["../src/orbits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACzD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,CAAC,EAAE,iBAAiB,CAAC;IACrB,4EAA4E;IAC5E,CAAC,EAAE,MAAM,CAAC;IACV,2EAA2E;IAC3E,MAAM,EAAE,iBAAiB,CAAC;IAC1B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,KAAK,EAAE,OAAO,CAAC;IACf,6DAA6D;IAC7D,CAAC,CAAC,EAAE,WAAW,CAAC;IAChB,wCAAwC;IACxC,CAAC,CAAC,EAAE,WAAW,CAAC;IAChB,kDAAkD;IAClD,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,yCAAyC;IACzC,CAAC,CAAC,EAAE,iBAAiB,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,sCAAsC;IACtC,CAAC,EAAE,WAAW,CAAC;IACf,wCAAwC;IACxC,CAAC,EAAE,WAAW,CAAC;IACf,kDAAkD;IAClD,EAAE,EAAE,WAAW,CAAC;IAChB,yCAAyC;IACzC,CAAC,EAAE,iBAAiB,CAAC;CACtB"}
|
package/dist/temporal.d.ts
CHANGED
|
@@ -86,11 +86,11 @@ export interface TemporalInterface extends ValueInterface {
|
|
|
86
86
|
* Represents a **time step measurement** in simulation, restricted to days.
|
|
87
87
|
*
|
|
88
88
|
* @extends ValueInterface
|
|
89
|
-
* @property {'
|
|
89
|
+
* @property {'d'} unit - The unit is always **days** (`'d'`).
|
|
90
90
|
*
|
|
91
91
|
* @example
|
|
92
92
|
* ```ts
|
|
93
|
-
* const timeStep: TimeStepInterface = { value: 1, unit: '
|
|
93
|
+
* const timeStep: TimeStepInterface = { value: 1, unit: 'd' };
|
|
94
94
|
* ```
|
|
95
95
|
* @group Temporal
|
|
96
96
|
*/
|
package/package.json
CHANGED