@interstellar-tools/equations 0.15.0 → 0.17.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/__tests__/characteristic-energy-c3.spec.d.ts +2 -0
- package/dist/__tests__/characteristic-energy-c3.spec.d.ts.map +1 -0
- package/dist/__tests__/characteristic-energy-c3.spec.js +36 -0
- package/dist/__tests__/characteristic-energy-c3.spec.js.map +1 -0
- package/dist/__tests__/circular-speed.spec.js +2 -2
- package/dist/__tests__/circular-speed.spec.js.map +1 -1
- package/dist/__tests__/combine-burns-delta-v.spec.js +1 -1
- package/dist/__tests__/combine-burns-delta-v.spec.js.map +1 -1
- package/dist/__tests__/cw-hill-derivatives.spec.d.ts +2 -0
- package/dist/__tests__/cw-hill-derivatives.spec.d.ts.map +1 -0
- package/dist/__tests__/cw-hill-derivatives.spec.js +64 -0
- package/dist/__tests__/cw-hill-derivatives.spec.js.map +1 -0
- package/dist/__tests__/escape-speed.spec.js +2 -2
- package/dist/__tests__/escape-speed.spec.js.map +1 -1
- package/dist/__tests__/gravitational-acceleration-on1-by2.int.spec.js +4 -4
- package/dist/__tests__/gravitational-acceleration-on1-by2.int.spec.js.map +1 -1
- package/dist/__tests__/gravitational-force-on1-by2.int.spec.js +1 -1
- package/dist/__tests__/gravitational-force-on1-by2.int.spec.js.map +1 -1
- package/dist/__tests__/gravitational-force.spec.js +2 -2
- package/dist/__tests__/gravitational-force.spec.js.map +1 -1
- package/dist/__tests__/gravitational-parameters.spec.js +1 -1
- package/dist/__tests__/gravitational-parameters.spec.js.map +1 -1
- package/dist/__tests__/gravity-assist-turning-angle.spec.d.ts +2 -0
- package/dist/__tests__/gravity-assist-turning-angle.spec.d.ts.map +1 -0
- package/dist/__tests__/gravity-assist-turning-angle.spec.js +89 -0
- package/dist/__tests__/gravity-assist-turning-angle.spec.js.map +1 -0
- package/dist/__tests__/helpers/index.d.ts +2 -0
- package/dist/__tests__/helpers/index.d.ts.map +1 -1
- package/dist/__tests__/helpers/index.js +6 -0
- package/dist/__tests__/helpers/index.js.map +1 -1
- package/dist/__tests__/hohmann-transfer.spec.js +1 -1
- package/dist/__tests__/hohmann-transfer.spec.js.map +1 -1
- package/dist/__tests__/hyperbolic-periapsis-speed.spec.d.ts +2 -0
- package/dist/__tests__/hyperbolic-periapsis-speed.spec.d.ts.map +1 -0
- package/dist/__tests__/hyperbolic-periapsis-speed.spec.js +64 -0
- package/dist/__tests__/hyperbolic-periapsis-speed.spec.js.map +1 -0
- package/dist/__tests__/kepler-period.spec.js +5 -5
- package/dist/__tests__/kepler-period.spec.js.map +1 -1
- package/dist/__tests__/mean-motion.spec.d.ts +2 -0
- package/dist/__tests__/mean-motion.spec.d.ts.map +1 -0
- package/dist/__tests__/mean-motion.spec.js +48 -0
- package/dist/__tests__/mean-motion.spec.js.map +1 -0
- package/dist/__tests__/oberth-energy-gain.spec.js +2 -2
- package/dist/__tests__/oberth-energy-gain.spec.js.map +1 -1
- package/dist/__tests__/specific-angular-momentum-from-elements.spec.js +5 -5
- package/dist/__tests__/specific-angular-momentum-from-elements.spec.js.map +1 -1
- package/dist/__tests__/specific-mechanical-energy.spec.js +2 -2
- package/dist/__tests__/specific-mechanical-energy.spec.js.map +1 -1
- package/dist/__tests__/sphere-of-influence-radius.spec.d.ts +2 -0
- package/dist/__tests__/sphere-of-influence-radius.spec.d.ts.map +1 -0
- package/dist/__tests__/sphere-of-influence-radius.spec.js +62 -0
- package/dist/__tests__/sphere-of-influence-radius.spec.js.map +1 -0
- package/dist/__tests__/vis-viva-speed.spec.js +1 -1
- package/dist/__tests__/vis-viva-speed.spec.js.map +1 -1
- package/dist/categories/gravity/acceleration-on1-by2.d.ts +1 -1
- package/dist/categories/gravity/acceleration-on1-by2.js +1 -1
- package/dist/categories/gravity/force-on1-by2.d.ts +2 -2
- package/dist/categories/gravity/force-on1-by2.js +2 -2
- package/dist/categories/gravity/gravitational-force.js +1 -1
- package/dist/categories/gravity/gravitational-force.js.map +1 -1
- package/dist/categories/gravity/gravitational-parameter.d.ts +1 -1
- package/dist/categories/gravity/gravitational-parameter.js +1 -1
- package/dist/categories/manoeuvres/gravity-assist-turning-angle.d.ts +36 -0
- package/dist/categories/manoeuvres/gravity-assist-turning-angle.d.ts.map +1 -0
- package/dist/categories/manoeuvres/gravity-assist-turning-angle.js +60 -0
- package/dist/categories/manoeuvres/gravity-assist-turning-angle.js.map +1 -0
- package/dist/categories/manoeuvres/hohmann-transfer.d.ts.map +1 -1
- package/dist/categories/manoeuvres/hohmann-transfer.js +2 -2
- package/dist/categories/manoeuvres/hohmann-transfer.js.map +1 -1
- package/dist/categories/manoeuvres/oberth-energy-gain.d.ts +3 -3
- package/dist/categories/manoeuvres/oberth-energy-gain.js +3 -3
- package/dist/categories/manoeuvres/plane-change-delta-v.d.ts +1 -1
- package/dist/categories/manoeuvres/plane-change-delta-v.js +1 -1
- package/dist/categories/orbits/characteristic-energy-c3.d.ts +32 -0
- package/dist/categories/orbits/characteristic-energy-c3.d.ts.map +1 -0
- package/dist/categories/orbits/characteristic-energy-c3.js +37 -0
- package/dist/categories/orbits/characteristic-energy-c3.js.map +1 -0
- package/dist/categories/orbits/circular-speed.d.ts +1 -1
- package/dist/categories/orbits/circular-speed.js +2 -2
- package/dist/categories/orbits/circular-speed.js.map +1 -1
- package/dist/categories/orbits/cw-hill-derivatives.d.ts +67 -0
- package/dist/categories/orbits/cw-hill-derivatives.d.ts.map +1 -0
- package/dist/categories/orbits/cw-hill-derivatives.js +89 -0
- package/dist/categories/orbits/cw-hill-derivatives.js.map +1 -0
- package/dist/categories/orbits/escape-speed.d.ts +1 -1
- package/dist/categories/orbits/escape-speed.js +2 -2
- package/dist/categories/orbits/escape-speed.js.map +1 -1
- package/dist/categories/orbits/hyperbolic-periapsis-speed.d.ts +34 -0
- package/dist/categories/orbits/hyperbolic-periapsis-speed.d.ts.map +1 -0
- package/dist/categories/orbits/hyperbolic-periapsis-speed.js +61 -0
- package/dist/categories/orbits/hyperbolic-periapsis-speed.js.map +1 -0
- package/dist/categories/orbits/kepler-period.d.ts +2 -2
- package/dist/categories/orbits/kepler-period.js +3 -3
- package/dist/categories/orbits/kepler-period.js.map +1 -1
- package/dist/categories/orbits/mean-motion.d.ts +37 -0
- package/dist/categories/orbits/mean-motion.d.ts.map +1 -0
- package/dist/categories/orbits/mean-motion.js +47 -0
- package/dist/categories/orbits/mean-motion.js.map +1 -0
- package/dist/categories/orbits/specific-angular-momentum-from-elements.d.ts +3 -3
- package/dist/categories/orbits/specific-angular-momentum-from-elements.js +4 -4
- package/dist/categories/orbits/specific-angular-momentum-from-elements.js.map +1 -1
- package/dist/categories/orbits/specific-angular-momentum.d.ts +1 -1
- package/dist/categories/orbits/specific-angular-momentum.js +2 -2
- package/dist/categories/orbits/specific-angular-momentum.js.map +1 -1
- package/dist/categories/orbits/specific-mechanical-energy.d.ts +1 -1
- package/dist/categories/orbits/specific-mechanical-energy.js +2 -2
- package/dist/categories/orbits/specific-mechanical-energy.js.map +1 -1
- package/dist/categories/orbits/sphere-of-influence-radius.d.ts +36 -0
- package/dist/categories/orbits/sphere-of-influence-radius.d.ts.map +1 -0
- package/dist/categories/orbits/sphere-of-influence-radius.js +56 -0
- package/dist/categories/orbits/sphere-of-influence-radius.js.map +1 -0
- package/dist/categories/orbits/vis-viva-speed.d.ts +1 -1
- package/dist/categories/orbits/vis-viva-speed.js +2 -2
- package/dist/categories/orbits/vis-viva-speed.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Radians } from '@interstellar-tools/types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute **gravity-assist turning angle** (flyby deflection) for a hyperbolic encounter.
|
|
4
|
+
*
|
|
5
|
+
* Equation:
|
|
6
|
+
* $$
|
|
7
|
+
* \delta = 2\arcsin\!\left(\frac{1}{1+\frac{r_p v_{\infty}^2}{\mu}}\right)
|
|
8
|
+
* $$
|
|
9
|
+
*
|
|
10
|
+
* Where:
|
|
11
|
+
* - $ r_p $ is periapsis radius from the body's center (m or km)
|
|
12
|
+
* - $ v_{\infty} $ is hyperbolic excess speed (m/s or km/s)
|
|
13
|
+
* - $ \mu $ is the standard gravitational parameter (m³/s² or km³/s²)
|
|
14
|
+
*
|
|
15
|
+
* Unit consistency is required:
|
|
16
|
+
* - If $ \mu $ is in m³/s², then $ r_p $ must be in m and $ v_{\infty} $ in m/s.
|
|
17
|
+
* - If $ \mu $ is in km³/s², then $ r_p $ must be in km and $ v_{\infty} $ in km/s.
|
|
18
|
+
*
|
|
19
|
+
* @param {number} rp Periapsis radius $ r_p $ (finite, > 0).
|
|
20
|
+
* @param {number} vInfinity Hyperbolic excess speed $ v_{\infty} $ (finite, >= 0).
|
|
21
|
+
* @param {number} mu Standard gravitational parameter $ \mu $ (finite, > 0).
|
|
22
|
+
* @returns {Radians} Turning angle $ \delta $ in **radians** (range: 0 to π).
|
|
23
|
+
* @throws {TypeError} If any input is not finite.
|
|
24
|
+
* @throws {RangeError} If `rp <= 0`, `mu <= 0`, or `vInfinity < 0`.
|
|
25
|
+
* @group Manoeuvres
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Example (km-based):
|
|
30
|
+
* // rp = 7000 km, v∞ = 8 km/s, mu(Earth) = 398600.4418 km³/s²
|
|
31
|
+
* const delta = gravityAssistTurningAngle(7000, 8, 398600.4418);
|
|
32
|
+
* // delta is in radians
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const gravityAssistTurningAngle: (rp: number, vInfinity: number, mu: number) => Radians;
|
|
36
|
+
//# sourceMappingURL=gravity-assist-turning-angle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gravity-assist-turning-angle.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/gravity-assist-turning-angle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,yBAAyB,GACpC,IAAI,MAAM,EACV,WAAW,MAAM,EACjB,IAAI,MAAM,KACT,OAkCF,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute **gravity-assist turning angle** (flyby deflection) for a hyperbolic encounter.
|
|
3
|
+
*
|
|
4
|
+
* Equation:
|
|
5
|
+
* $$
|
|
6
|
+
* \delta = 2\arcsin\!\left(\frac{1}{1+\frac{r_p v_{\infty}^2}{\mu}}\right)
|
|
7
|
+
* $$
|
|
8
|
+
*
|
|
9
|
+
* Where:
|
|
10
|
+
* - $ r_p $ is periapsis radius from the body's center (m or km)
|
|
11
|
+
* - $ v_{\infty} $ is hyperbolic excess speed (m/s or km/s)
|
|
12
|
+
* - $ \mu $ is the standard gravitational parameter (m³/s² or km³/s²)
|
|
13
|
+
*
|
|
14
|
+
* Unit consistency is required:
|
|
15
|
+
* - If $ \mu $ is in m³/s², then $ r_p $ must be in m and $ v_{\infty} $ in m/s.
|
|
16
|
+
* - If $ \mu $ is in km³/s², then $ r_p $ must be in km and $ v_{\infty} $ in km/s.
|
|
17
|
+
*
|
|
18
|
+
* @param {number} rp Periapsis radius $ r_p $ (finite, > 0).
|
|
19
|
+
* @param {number} vInfinity Hyperbolic excess speed $ v_{\infty} $ (finite, >= 0).
|
|
20
|
+
* @param {number} mu Standard gravitational parameter $ \mu $ (finite, > 0).
|
|
21
|
+
* @returns {Radians} Turning angle $ \delta $ in **radians** (range: 0 to π).
|
|
22
|
+
* @throws {TypeError} If any input is not finite.
|
|
23
|
+
* @throws {RangeError} If `rp <= 0`, `mu <= 0`, or `vInfinity < 0`.
|
|
24
|
+
* @group Manoeuvres
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Example (km-based):
|
|
29
|
+
* // rp = 7000 km, v∞ = 8 km/s, mu(Earth) = 398600.4418 km³/s²
|
|
30
|
+
* const delta = gravityAssistTurningAngle(7000, 8, 398600.4418);
|
|
31
|
+
* // delta is in radians
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const gravityAssistTurningAngle = (rp, vInfinity, mu) => {
|
|
35
|
+
if (!Number.isFinite(rp)) {
|
|
36
|
+
throw new TypeError(`rp must be a finite number. Received: ${rp}`);
|
|
37
|
+
}
|
|
38
|
+
if (!Number.isFinite(vInfinity)) {
|
|
39
|
+
throw new TypeError(`vInfinity must be a finite number. Received: ${vInfinity}`);
|
|
40
|
+
}
|
|
41
|
+
if (!Number.isFinite(mu)) {
|
|
42
|
+
throw new TypeError(`mu must be a finite number. Received: ${mu}`);
|
|
43
|
+
}
|
|
44
|
+
if (rp <= 0) {
|
|
45
|
+
throw new RangeError(`rp must be > 0. Received: ${rp}`);
|
|
46
|
+
}
|
|
47
|
+
if (vInfinity < 0) {
|
|
48
|
+
throw new RangeError(`vInfinity must be >= 0. Received: ${vInfinity}`);
|
|
49
|
+
}
|
|
50
|
+
if (mu <= 0) {
|
|
51
|
+
throw new RangeError(`mu must be > 0. Received: ${mu}`);
|
|
52
|
+
}
|
|
53
|
+
// x = 1 / (1 + rp*vInf²/mu)
|
|
54
|
+
const denom = 1 + (rp * vInfinity * vInfinity) / mu;
|
|
55
|
+
const x = 1 / denom;
|
|
56
|
+
// numerical guard: due to rounding x can slightly exceed 1
|
|
57
|
+
const clamped = Math.min(1, Math.max(0, x));
|
|
58
|
+
return (2 * Math.asin(clamped));
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=gravity-assist-turning-angle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gravity-assist-turning-angle.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/gravity-assist-turning-angle.ts"],"names":[],"mappings":"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,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAY,CAAC;AAC7C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hohmann-transfer.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/hohmann-transfer.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACzC,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,eAAe,GAC1B,IAAI,MAAM,EACV,IAAI,MAAM,EACV,IAAI,MAAM,KACT,
|
|
1
|
+
{"version":3,"file":"hohmann-transfer.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/hohmann-transfer.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACzC,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,eAAe,GAC1B,IAAI,MAAM,EACV,IAAI,MAAM,EACV,IAAI,MAAM,KACT,yBAgDF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,MAAM,EAAE,IAAI,MAAM,KAAG,MAU7D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC9B,IAAI,MAAM,EACV,IAAI,MAAM,EACV,IAAI,MAAM,KACT,MASF,CAAC"}
|
|
@@ -47,7 +47,7 @@ export const hohmannTransfer = (r1, r2, mu) => {
|
|
|
47
47
|
throw new RangeError('r1, r2, and mu must be finite.');
|
|
48
48
|
}
|
|
49
49
|
if (r1 <= 0 || r2 <= 0 || mu <= 0) {
|
|
50
|
-
throw new RangeError('r1 and r2 must be > 0 (m), mu must be > 0 (m
|
|
50
|
+
throw new RangeError('r1 and r2 must be > 0 (m), mu must be > 0 (m³/s²).');
|
|
51
51
|
}
|
|
52
52
|
const at = 0.5 * (r1 + r2);
|
|
53
53
|
// Circular speeds at the endpoints
|
|
@@ -114,7 +114,7 @@ export const hohmannTransferTime = (r1, r2, mu) => {
|
|
|
114
114
|
if (typeof mu !== 'number')
|
|
115
115
|
throw new TypeError('mu must be a number.');
|
|
116
116
|
if (!Number.isFinite(mu) || mu <= 0)
|
|
117
|
-
throw new RangeError('mu must be finite and > 0 (m
|
|
117
|
+
throw new RangeError('mu must be finite and > 0 (m³/s²).');
|
|
118
118
|
return Math.PI * Math.sqrt((at * at * at) / mu);
|
|
119
119
|
};
|
|
120
120
|
//# sourceMappingURL=hohmann-transfer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hohmann-transfer.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/hohmann-transfer.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,EAAU,EACV,EAAU,EACV,EAAU,EACiB,EAAE;IAC7B,sBAAsB;IACtB,IACE,OAAO,EAAE,KAAK,QAAQ;QACtB,OAAO,EAAE,KAAK,QAAQ;QACtB,OAAO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,OAAO,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* ```ts
|
|
36
36
|
* import { oberthEnergyGain, circularSpeed } from "@interstellar-tools/equations";
|
|
37
37
|
*
|
|
38
|
-
* // Earth's GM (μ) in m
|
|
38
|
+
* // Earth's GM (μ) in m³/s²
|
|
39
39
|
* const muEarth = 3.986004418e14;
|
|
40
40
|
*
|
|
41
41
|
* // Example: small prograde burn at LEO periapsis (~400 km altitude)
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
* // Suppose guidance commands a small impulsive burn Δv = 50 m/s at periapsis
|
|
46
46
|
* const dv = 50; // m/s
|
|
47
47
|
*
|
|
48
|
-
* // Oberth approximation: Δε ≈ v · Δv (specific energy gain, J/kg ≡ m
|
|
48
|
+
* // Oberth approximation: Δε ≈ v · Δv (specific energy gain, J/kg ≡ m²/s²)
|
|
49
49
|
* const deltaEps = oberthEnergyGain(vLEO, dv);
|
|
50
50
|
*
|
|
51
51
|
* // For intuition, translate Δε to an approximate change in semi-major axis (elliptic case):
|
|
52
|
-
* // ε = -μ/(2a) ⇒ Δa ≈ (a
|
|
52
|
+
* // ε = -μ/(2a) ⇒ Δa ≈ (a² / μ) · Δε (valid for small changes around circular LEO)
|
|
53
53
|
* const aLEO = rLEO; // circular → a = r
|
|
54
54
|
* const deltaA = (aLEO * aLEO / muEarth) * deltaEps; // meters
|
|
55
55
|
*
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* ```ts
|
|
36
36
|
* import { oberthEnergyGain, circularSpeed } from "@interstellar-tools/equations";
|
|
37
37
|
*
|
|
38
|
-
* // Earth's GM (μ) in m
|
|
38
|
+
* // Earth's GM (μ) in m³/s²
|
|
39
39
|
* const muEarth = 3.986004418e14;
|
|
40
40
|
*
|
|
41
41
|
* // Example: small prograde burn at LEO periapsis (~400 km altitude)
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
* // Suppose guidance commands a small impulsive burn Δv = 50 m/s at periapsis
|
|
46
46
|
* const dv = 50; // m/s
|
|
47
47
|
*
|
|
48
|
-
* // Oberth approximation: Δε ≈ v · Δv (specific energy gain, J/kg ≡ m
|
|
48
|
+
* // Oberth approximation: Δε ≈ v · Δv (specific energy gain, J/kg ≡ m²/s²)
|
|
49
49
|
* const deltaEps = oberthEnergyGain(vLEO, dv);
|
|
50
50
|
*
|
|
51
51
|
* // For intuition, translate Δε to an approximate change in semi-major axis (elliptic case):
|
|
52
|
-
* // ε = -μ/(2a) ⇒ Δa ≈ (a
|
|
52
|
+
* // ε = -μ/(2a) ⇒ Δa ≈ (a² / μ) · Δε (valid for small changes around circular LEO)
|
|
53
53
|
* const aLEO = rLEO; // circular → a = r
|
|
54
54
|
* const deltaA = (aLEO * aLEO / muEarth) * deltaEps; // meters
|
|
55
55
|
*
|
|
@@ -34,7 +34,7 @@ import type { Radians } from '@interstellar-tools/types';
|
|
|
34
34
|
* // Helper: degrees → radians (branded)
|
|
35
35
|
* const toRadians = (deg: number): Radians => ((deg * Math.PI) / 180) as Radians;
|
|
36
36
|
*
|
|
37
|
-
* // Earth’s GM (μ) in m
|
|
37
|
+
* // Earth’s GM (μ) in m³/s²
|
|
38
38
|
* const muEarth = 3.986004418e14;
|
|
39
39
|
*
|
|
40
40
|
* // Example: instantaneous plane change at LEO (~400 km altitude)
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* // Helper: degrees → radians (branded)
|
|
34
34
|
* const toRadians = (deg: number): Radians => ((deg * Math.PI) / 180) as Radians;
|
|
35
35
|
*
|
|
36
|
-
* // Earth’s GM (μ) in m
|
|
36
|
+
* // Earth’s GM (μ) in m³/s²
|
|
37
37
|
* const muEarth = 3.986004418e14;
|
|
38
38
|
*
|
|
39
39
|
* // Example: instantaneous plane change at LEO (~400 km altitude)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute **characteristic energy** (C3) from hyperbolic excess speed.
|
|
3
|
+
*
|
|
4
|
+
* Characteristic energy is defined as the square of the hyperbolic excess velocity:
|
|
5
|
+
*
|
|
6
|
+
* $$
|
|
7
|
+
* C_3 = v_{\infty}^2
|
|
8
|
+
* $$
|
|
9
|
+
*
|
|
10
|
+
* - If `vInfinity` is in **km/s**, `C3` is in **(km/s)²**.
|
|
11
|
+
* - If `vInfinity` is in **m/s**, `C3` is in **(m/s)²**.
|
|
12
|
+
*
|
|
13
|
+
* Common usage: preliminary interplanetary mission design and launch performance
|
|
14
|
+
* comparisons (e.g., "available C3" from a launch vehicle).
|
|
15
|
+
*
|
|
16
|
+
* @param vInfinity - Hyperbolic excess speed $ v_{\infty} $ (must be a finite number).
|
|
17
|
+
* @returns Characteristic energy $ C_3 $ in squared speed units (e.g., (km/s)² or (m/s)²).
|
|
18
|
+
* @throws {TypeError} If `vInfinity` is not a finite number.
|
|
19
|
+
* @group Orbits
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* // v∞ in km/s
|
|
24
|
+
* const vInf = 3.2;
|
|
25
|
+
* const c3 = characteristicEnergyC3(vInf);
|
|
26
|
+
* // c3 === 10.24 // (km/s)²
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @see https://en.wikipedia.org/wiki/Characteristic_energy
|
|
30
|
+
*/
|
|
31
|
+
export declare const characteristicEnergyC3: (vInfinity: number) => number;
|
|
32
|
+
//# sourceMappingURL=characteristic-energy-c3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characteristic-energy-c3.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/characteristic-energy-c3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,KAAG,MAQ1D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute **characteristic energy** (C3) from hyperbolic excess speed.
|
|
3
|
+
*
|
|
4
|
+
* Characteristic energy is defined as the square of the hyperbolic excess velocity:
|
|
5
|
+
*
|
|
6
|
+
* $$
|
|
7
|
+
* C_3 = v_{\infty}^2
|
|
8
|
+
* $$
|
|
9
|
+
*
|
|
10
|
+
* - If `vInfinity` is in **km/s**, `C3` is in **(km/s)²**.
|
|
11
|
+
* - If `vInfinity` is in **m/s**, `C3` is in **(m/s)²**.
|
|
12
|
+
*
|
|
13
|
+
* Common usage: preliminary interplanetary mission design and launch performance
|
|
14
|
+
* comparisons (e.g., "available C3" from a launch vehicle).
|
|
15
|
+
*
|
|
16
|
+
* @param vInfinity - Hyperbolic excess speed $ v_{\infty} $ (must be a finite number).
|
|
17
|
+
* @returns Characteristic energy $ C_3 $ in squared speed units (e.g., (km/s)² or (m/s)²).
|
|
18
|
+
* @throws {TypeError} If `vInfinity` is not a finite number.
|
|
19
|
+
* @group Orbits
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* // v∞ in km/s
|
|
24
|
+
* const vInf = 3.2;
|
|
25
|
+
* const c3 = characteristicEnergyC3(vInf);
|
|
26
|
+
* // c3 === 10.24 // (km/s)²
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @see https://en.wikipedia.org/wiki/Characteristic_energy
|
|
30
|
+
*/
|
|
31
|
+
export const characteristicEnergyC3 = (vInfinity) => {
|
|
32
|
+
if (!Number.isFinite(vInfinity)) {
|
|
33
|
+
throw new TypeError(`vInfinity must be a finite number. Received: ${vInfinity}`);
|
|
34
|
+
}
|
|
35
|
+
return vInfinity * vInfinity;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=characteristic-energy-c3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characteristic-energy-c3.js","sourceRoot":"","sources":["../../../src/categories/orbits/characteristic-energy-c3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CACjB,gDAAgD,SAAS,EAAE,CAC5D,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,GAAG,SAAS,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // LEO ~400 km altitude around Earth
|
|
34
|
-
* const muEarth = 3.986004418e14; // m
|
|
34
|
+
* const muEarth = 3.986004418e14; // m³/s²
|
|
35
35
|
* const r = 6378e3 + 400e3; // m
|
|
36
36
|
* const v = circularSpeed(r, muEarth); // ≈ 7670 m/s
|
|
37
37
|
* ```
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // LEO ~400 km altitude around Earth
|
|
34
|
-
* const muEarth = 3.986004418e14; // m
|
|
34
|
+
* const muEarth = 3.986004418e14; // m³/s²
|
|
35
35
|
* const r = 6378e3 + 400e3; // m
|
|
36
36
|
* const v = circularSpeed(r, muEarth); // ≈ 7670 m/s
|
|
37
37
|
* ```
|
|
@@ -43,7 +43,7 @@ export const circularSpeed = (r, mu) => {
|
|
|
43
43
|
throw new Error('r must be a finite, positive number (m).');
|
|
44
44
|
}
|
|
45
45
|
if (!Number.isFinite(mu) || mu < 0) {
|
|
46
|
-
throw new Error('mu must be a finite, non-negative number (m
|
|
46
|
+
throw new Error('mu must be a finite, non-negative number (m³/s²).');
|
|
47
47
|
}
|
|
48
48
|
return Math.sqrt(mu / r);
|
|
49
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circular-speed.js","sourceRoot":"","sources":["../../../src/categories/orbits/circular-speed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,EAAU,EAAU,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"circular-speed.js","sourceRoot":"","sources":["../../../src/categories/orbits/circular-speed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,EAAU,EAAU,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CwState, CwStateDerivative } from '@interstellar-tools/types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute the **time-derivative** of a Clohessy–Wiltshire / Hill relative-motion state
|
|
4
|
+
* (right-hand side for ODE integration).
|
|
5
|
+
*
|
|
6
|
+
* This function is intended to be used with a numerical integrator (RK4, Dormand–Prince, etc.)
|
|
7
|
+
* to propagate the relative motion of a deputy spacecraft about a chief on a **near-circular**
|
|
8
|
+
* reference orbit, expressed in the **LVLH** frame:
|
|
9
|
+
*
|
|
10
|
+
* - `x`: radial (outward from the central body)
|
|
11
|
+
* - `y`: along-track (tangential / direction of motion)
|
|
12
|
+
* - `z`: cross-track (orbit-normal)
|
|
13
|
+
*
|
|
14
|
+
* Governing equations (CW/Hill):
|
|
15
|
+
*
|
|
16
|
+
* $$
|
|
17
|
+
* \ddot{x}-2n\dot{y}-3n^2x=0
|
|
18
|
+
* $$
|
|
19
|
+
* $$
|
|
20
|
+
* \ddot{y}+2n\dot{x}=0
|
|
21
|
+
* $$
|
|
22
|
+
* $$
|
|
23
|
+
* \ddot{z}+n^2z=0
|
|
24
|
+
* $$
|
|
25
|
+
*
|
|
26
|
+
* Rearranged into explicit accelerations:
|
|
27
|
+
*
|
|
28
|
+
* $$
|
|
29
|
+
* \ddot{x}=2n\dot{y}+3n^2x,\quad
|
|
30
|
+
* \ddot{y}=-2n\dot{x},\quad
|
|
31
|
+
* \ddot{z}=-n^2z
|
|
32
|
+
* $$
|
|
33
|
+
*
|
|
34
|
+
* Input state:
|
|
35
|
+
* `state = [x, y, z, xDot, yDot, zDot]`
|
|
36
|
+
*
|
|
37
|
+
* Output derivative:
|
|
38
|
+
* `dstate/dt = [xDot, yDot, zDot, xDDot, yDDot, zDDot]`
|
|
39
|
+
*
|
|
40
|
+
* Units (consistent):
|
|
41
|
+
* - Position: m or km
|
|
42
|
+
* - Velocity: m/s or km/s
|
|
43
|
+
* - Mean motion `n`: rad/s
|
|
44
|
+
* - Acceleration: m/s² or km/s²
|
|
45
|
+
*
|
|
46
|
+
* @param {CwState} state - CW/Hill state `[x, y, z, xDot, yDot, zDot]` (all finite).
|
|
47
|
+
* @param {number} n - Mean motion `n` of the reference orbit (finite, >= 0), in **rad/s**.
|
|
48
|
+
* @returns {CwStateDerivative} Time derivative of `state` as `[xDot, yDot, zDot, xDDot, yDDot, zDDot]`.
|
|
49
|
+
* @throws {TypeError} If `n` or any state component is not finite.
|
|
50
|
+
* @throws {RangeError} If `n < 0`.
|
|
51
|
+
* @group Orbits
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { meanMotion, cwHillDerivatives, type CwState } from "...";
|
|
56
|
+
*
|
|
57
|
+
* const mu = 398600.4418; // km³/s²
|
|
58
|
+
* const a = 7000; // km
|
|
59
|
+
* const n = meanMotion(mu, a); // rad/s
|
|
60
|
+
*
|
|
61
|
+
* const s: CwState = [100, 0, 0, 0, 0.01, 0];
|
|
62
|
+
* const ds = cwHillDerivatives(s, n);
|
|
63
|
+
* // feed ds into your integrator (RK4, etc.)
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare const cwHillDerivatives: (state: CwState, n: number) => CwStateDerivative;
|
|
67
|
+
//# sourceMappingURL=cw-hill-derivatives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cw-hill-derivatives.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/cw-hill-derivatives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,OAAO,EACd,GAAG,MAAM,KACR,iBA2BF,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the **time-derivative** of a Clohessy–Wiltshire / Hill relative-motion state
|
|
3
|
+
* (right-hand side for ODE integration).
|
|
4
|
+
*
|
|
5
|
+
* This function is intended to be used with a numerical integrator (RK4, Dormand–Prince, etc.)
|
|
6
|
+
* to propagate the relative motion of a deputy spacecraft about a chief on a **near-circular**
|
|
7
|
+
* reference orbit, expressed in the **LVLH** frame:
|
|
8
|
+
*
|
|
9
|
+
* - `x`: radial (outward from the central body)
|
|
10
|
+
* - `y`: along-track (tangential / direction of motion)
|
|
11
|
+
* - `z`: cross-track (orbit-normal)
|
|
12
|
+
*
|
|
13
|
+
* Governing equations (CW/Hill):
|
|
14
|
+
*
|
|
15
|
+
* $$
|
|
16
|
+
* \ddot{x}-2n\dot{y}-3n^2x=0
|
|
17
|
+
* $$
|
|
18
|
+
* $$
|
|
19
|
+
* \ddot{y}+2n\dot{x}=0
|
|
20
|
+
* $$
|
|
21
|
+
* $$
|
|
22
|
+
* \ddot{z}+n^2z=0
|
|
23
|
+
* $$
|
|
24
|
+
*
|
|
25
|
+
* Rearranged into explicit accelerations:
|
|
26
|
+
*
|
|
27
|
+
* $$
|
|
28
|
+
* \ddot{x}=2n\dot{y}+3n^2x,\quad
|
|
29
|
+
* \ddot{y}=-2n\dot{x},\quad
|
|
30
|
+
* \ddot{z}=-n^2z
|
|
31
|
+
* $$
|
|
32
|
+
*
|
|
33
|
+
* Input state:
|
|
34
|
+
* `state = [x, y, z, xDot, yDot, zDot]`
|
|
35
|
+
*
|
|
36
|
+
* Output derivative:
|
|
37
|
+
* `dstate/dt = [xDot, yDot, zDot, xDDot, yDDot, zDDot]`
|
|
38
|
+
*
|
|
39
|
+
* Units (consistent):
|
|
40
|
+
* - Position: m or km
|
|
41
|
+
* - Velocity: m/s or km/s
|
|
42
|
+
* - Mean motion `n`: rad/s
|
|
43
|
+
* - Acceleration: m/s² or km/s²
|
|
44
|
+
*
|
|
45
|
+
* @param {CwState} state - CW/Hill state `[x, y, z, xDot, yDot, zDot]` (all finite).
|
|
46
|
+
* @param {number} n - Mean motion `n` of the reference orbit (finite, >= 0), in **rad/s**.
|
|
47
|
+
* @returns {CwStateDerivative} Time derivative of `state` as `[xDot, yDot, zDot, xDDot, yDDot, zDDot]`.
|
|
48
|
+
* @throws {TypeError} If `n` or any state component is not finite.
|
|
49
|
+
* @throws {RangeError} If `n < 0`.
|
|
50
|
+
* @group Orbits
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { meanMotion, cwHillDerivatives, type CwState } from "...";
|
|
55
|
+
*
|
|
56
|
+
* const mu = 398600.4418; // km³/s²
|
|
57
|
+
* const a = 7000; // km
|
|
58
|
+
* const n = meanMotion(mu, a); // rad/s
|
|
59
|
+
*
|
|
60
|
+
* const s: CwState = [100, 0, 0, 0, 0.01, 0];
|
|
61
|
+
* const ds = cwHillDerivatives(s, n);
|
|
62
|
+
* // feed ds into your integrator (RK4, etc.)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export const cwHillDerivatives = (state, n) => {
|
|
66
|
+
if (!Number.isFinite(n))
|
|
67
|
+
throw new TypeError(`n must be finite. Received: ${n}`);
|
|
68
|
+
if (n < 0)
|
|
69
|
+
throw new RangeError(`n must be >= 0. Received: ${n}`);
|
|
70
|
+
const [x, y, z, xDot, yDot, zDot] = state;
|
|
71
|
+
for (const [name, v] of [
|
|
72
|
+
['x', x],
|
|
73
|
+
['y', y],
|
|
74
|
+
['z', z],
|
|
75
|
+
['xDot', xDot],
|
|
76
|
+
['yDot', yDot],
|
|
77
|
+
['zDot', zDot]
|
|
78
|
+
]) {
|
|
79
|
+
if (!Number.isFinite(v)) {
|
|
80
|
+
throw new TypeError(`${name} must be finite. Received: ${v}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const n2 = n * n;
|
|
84
|
+
const xDDot = 2 * n * yDot + 3 * n2 * x;
|
|
85
|
+
const yDDot = -2 * n * xDot;
|
|
86
|
+
const zDDot = -n2 * z;
|
|
87
|
+
return [xDot, yDot, zDot, xDDot, yDDot, zDDot];
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=cw-hill-derivatives.js.map
|
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G,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAEtB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAC1D,CAAC,CAAC"}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // Near Earth's surface (approx.)
|
|
34
|
-
* const muEarth = 3.986004418e14; // m
|
|
34
|
+
* const muEarth = 3.986004418e14; // m³/s²
|
|
35
35
|
* const rSurface = 6378e3; // m
|
|
36
36
|
* const vEsc = escapeSpeed(rSurface, muEarth); // ≈ 11186 m/s
|
|
37
37
|
* ```
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // Near Earth's surface (approx.)
|
|
34
|
-
* const muEarth = 3.986004418e14; // m
|
|
34
|
+
* const muEarth = 3.986004418e14; // m³/s²
|
|
35
35
|
* const rSurface = 6378e3; // m
|
|
36
36
|
* const vEsc = escapeSpeed(rSurface, muEarth); // ≈ 11186 m/s
|
|
37
37
|
* ```
|
|
@@ -51,7 +51,7 @@ export const escapeSpeed = (r, mu) => {
|
|
|
51
51
|
throw new Error('r must be a finite, positive number (m).');
|
|
52
52
|
}
|
|
53
53
|
if (!Number.isFinite(mu) || mu < 0) {
|
|
54
|
-
throw new Error('mu must be a finite, non-negative number (m
|
|
54
|
+
throw new Error('mu must be a finite, non-negative number (m³/s²).');
|
|
55
55
|
}
|
|
56
56
|
return Math.sqrt((2 * mu) / r);
|
|
57
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape-speed.js","sourceRoot":"","sources":["../../../src/categories/orbits/escape-speed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAU,EAAU,EAAE;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"escape-speed.js","sourceRoot":"","sources":["../../../src/categories/orbits/escape-speed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAU,EAAU,EAAE;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute **hyperbolic periapsis speed** for a flyby/escape hyperbola.
|
|
3
|
+
*
|
|
4
|
+
* Equation:
|
|
5
|
+
* $$
|
|
6
|
+
* v_p = \sqrt{v_{\infty}^2 + \frac{2\mu}{r_p}}
|
|
7
|
+
* $$
|
|
8
|
+
*
|
|
9
|
+
* Where:
|
|
10
|
+
* - $ v_{\infty} $ is the hyperbolic excess speed (m/s or km/s)
|
|
11
|
+
* - $ \mu $ is the standard gravitational parameter of the central body (m³/s² or km³/s²)
|
|
12
|
+
* - $ r_p $ is the periapsis radius measured from the body's center (m or km)
|
|
13
|
+
*
|
|
14
|
+
* Unit consistency is required:
|
|
15
|
+
* - If $ \mu $ is in m³/s², then $r_p$ must be in m and speeds are in m/s.
|
|
16
|
+
* - If $ \mu $ is in km³/s², then $r_p$ must be in km and speeds are in km/s.
|
|
17
|
+
*
|
|
18
|
+
* @param vInfinity Hyperbolic excess speed $ v_{\infty} $ (must be finite, >= 0).
|
|
19
|
+
* @param mu Standard gravitational parameter $ \mu $ (must be finite, > 0).
|
|
20
|
+
* @param rp Periapsis radius $ r_p $ from the central body's center (must be finite, > 0).
|
|
21
|
+
* @returns Periapsis speed $ v_p $ in the same speed units as `vInfinity`.
|
|
22
|
+
* @throws {TypeError} If any input is not finite.
|
|
23
|
+
* @throws {RangeError} If `vInfinity < 0`, `mu <= 0`, or `rp <= 0`.
|
|
24
|
+
* @group Orbits
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Earth example (km-based):
|
|
29
|
+
* // mu = 398600.4418 km³/s², rp ~ 6678 km (LEO-ish), v∞ = 3.2 km/s
|
|
30
|
+
* const vp = hyperbolicPeriapsisSpeed(3.2, 398600.4418, 6678);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const hyperbolicPeriapsisSpeed: (vInfinity: number, mu: number, rp: number) => number;
|
|
34
|
+
//# sourceMappingURL=hyperbolic-periapsis-speed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperbolic-periapsis-speed.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/hyperbolic-periapsis-speed.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,IAAI,MAAM,EACV,IAAI,MAAM,KACT,MAqCF,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* node:coverage disable */
|
|
2
|
+
/**
|
|
3
|
+
* Compute **hyperbolic periapsis speed** for a flyby/escape hyperbola.
|
|
4
|
+
*
|
|
5
|
+
* Equation:
|
|
6
|
+
* $$
|
|
7
|
+
* v_p = \sqrt{v_{\infty}^2 + \frac{2\mu}{r_p}}
|
|
8
|
+
* $$
|
|
9
|
+
*
|
|
10
|
+
* Where:
|
|
11
|
+
* - $ v_{\infty} $ is the hyperbolic excess speed (m/s or km/s)
|
|
12
|
+
* - $ \mu $ is the standard gravitational parameter of the central body (m³/s² or km³/s²)
|
|
13
|
+
* - $ r_p $ is the periapsis radius measured from the body's center (m or km)
|
|
14
|
+
*
|
|
15
|
+
* Unit consistency is required:
|
|
16
|
+
* - If $ \mu $ is in m³/s², then $r_p$ must be in m and speeds are in m/s.
|
|
17
|
+
* - If $ \mu $ is in km³/s², then $r_p$ must be in km and speeds are in km/s.
|
|
18
|
+
*
|
|
19
|
+
* @param vInfinity Hyperbolic excess speed $ v_{\infty} $ (must be finite, >= 0).
|
|
20
|
+
* @param mu Standard gravitational parameter $ \mu $ (must be finite, > 0).
|
|
21
|
+
* @param rp Periapsis radius $ r_p $ from the central body's center (must be finite, > 0).
|
|
22
|
+
* @returns Periapsis speed $ v_p $ in the same speed units as `vInfinity`.
|
|
23
|
+
* @throws {TypeError} If any input is not finite.
|
|
24
|
+
* @throws {RangeError} If `vInfinity < 0`, `mu <= 0`, or `rp <= 0`.
|
|
25
|
+
* @group Orbits
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Earth example (km-based):
|
|
30
|
+
* // mu = 398600.4418 km³/s², rp ~ 6678 km (LEO-ish), v∞ = 3.2 km/s
|
|
31
|
+
* const vp = hyperbolicPeriapsisSpeed(3.2, 398600.4418, 6678);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
/* node:coverage enable */
|
|
35
|
+
export const hyperbolicPeriapsisSpeed = (vInfinity, mu, rp) => {
|
|
36
|
+
if (!Number.isFinite(vInfinity)) {
|
|
37
|
+
throw new TypeError(`vInfinity must be a finite number. Received: ${vInfinity}`);
|
|
38
|
+
}
|
|
39
|
+
if (!Number.isFinite(mu)) {
|
|
40
|
+
throw new TypeError(`mu must be a finite number. Received: ${mu}`);
|
|
41
|
+
}
|
|
42
|
+
if (!Number.isFinite(rp)) {
|
|
43
|
+
throw new TypeError(`rp must be a finite number. Received: ${rp}`);
|
|
44
|
+
}
|
|
45
|
+
if (vInfinity < 0) {
|
|
46
|
+
throw new RangeError(`vInfinity must be >= 0. Received: ${vInfinity}`);
|
|
47
|
+
}
|
|
48
|
+
if (mu <= 0) {
|
|
49
|
+
throw new RangeError(`mu must be > 0. Received: ${mu}`);
|
|
50
|
+
}
|
|
51
|
+
if (rp <= 0) {
|
|
52
|
+
throw new RangeError(`rp must be > 0. Received: ${rp}`);
|
|
53
|
+
}
|
|
54
|
+
const term = vInfinity * vInfinity + (2 * mu) / rp;
|
|
55
|
+
// With valid ranges above, term should be positive, but guard anyway.
|
|
56
|
+
if (term < 0) {
|
|
57
|
+
throw new RangeError(`Expression under square root must be >= 0. Computed: ${term}`);
|
|
58
|
+
}
|
|
59
|
+
return Math.sqrt(term);
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=hyperbolic-periapsis-speed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperbolic-periapsis-speed.js","sourceRoot":"","sources":["../../../src/categories/orbits/hyperbolic-periapsis-speed.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,SAAiB,EACjB,EAAU,EACV,EAAU,E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