@interstellar-tools/equations 1.0.0 → 1.2.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.
Files changed (85) hide show
  1. package/dist/categories/anomalies/asymptote-true-anomaly.d.ts +50 -0
  2. package/dist/categories/anomalies/asymptote-true-anomaly.d.ts.map +1 -0
  3. package/dist/categories/anomalies/asymptote-true-anomaly.js +55 -0
  4. package/dist/categories/anomalies/asymptote-true-anomaly.js.map +1 -0
  5. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.d.ts +38 -0
  6. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.d.ts.map +1 -0
  7. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.js +49 -0
  8. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.js.map +1 -0
  9. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.d.ts +40 -0
  10. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.d.ts.map +1 -0
  11. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.js +54 -0
  12. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.js.map +1 -0
  13. package/dist/categories/helpers/misc.d.ts +18 -0
  14. package/dist/categories/helpers/misc.d.ts.map +1 -1
  15. package/dist/categories/helpers/misc.js +24 -0
  16. package/dist/categories/helpers/misc.js.map +1 -1
  17. package/dist/categories/kepler/solve-kepler-hyperbolic.d.ts +49 -0
  18. package/dist/categories/kepler/solve-kepler-hyperbolic.d.ts.map +1 -0
  19. package/dist/categories/kepler/solve-kepler-hyperbolic.js +90 -0
  20. package/dist/categories/kepler/solve-kepler-hyperbolic.js.map +1 -0
  21. package/dist/categories/manoeuvres/burn-time.d.ts +63 -0
  22. package/dist/categories/manoeuvres/burn-time.d.ts.map +1 -0
  23. package/dist/categories/manoeuvres/burn-time.js +87 -0
  24. package/dist/categories/manoeuvres/burn-time.js.map +1 -0
  25. package/dist/categories/manoeuvres/gravity-loss.d.ts +48 -0
  26. package/dist/categories/manoeuvres/gravity-loss.d.ts.map +1 -0
  27. package/dist/categories/manoeuvres/gravity-loss.js +74 -0
  28. package/dist/categories/manoeuvres/gravity-loss.js.map +1 -0
  29. package/dist/categories/manoeuvres/initial-mass-for-delta-v.d.ts +60 -0
  30. package/dist/categories/manoeuvres/initial-mass-for-delta-v.d.ts.map +1 -0
  31. package/dist/categories/manoeuvres/initial-mass-for-delta-v.js +79 -0
  32. package/dist/categories/manoeuvres/initial-mass-for-delta-v.js.map +1 -0
  33. package/dist/categories/manoeuvres/mass-flow-rate.d.ts +57 -0
  34. package/dist/categories/manoeuvres/mass-flow-rate.d.ts.map +1 -0
  35. package/dist/categories/manoeuvres/mass-flow-rate.js +73 -0
  36. package/dist/categories/manoeuvres/mass-flow-rate.js.map +1 -0
  37. package/dist/categories/manoeuvres/rocket-thrust.d.ts +48 -0
  38. package/dist/categories/manoeuvres/rocket-thrust.d.ts.map +1 -0
  39. package/dist/categories/manoeuvres/rocket-thrust.js +62 -0
  40. package/dist/categories/manoeuvres/rocket-thrust.js.map +1 -0
  41. package/dist/categories/manoeuvres/thrust-to-weight.d.ts +57 -0
  42. package/dist/categories/manoeuvres/thrust-to-weight.d.ts.map +1 -0
  43. package/dist/categories/manoeuvres/thrust-to-weight.js +73 -0
  44. package/dist/categories/manoeuvres/thrust-to-weight.js.map +1 -0
  45. package/dist/categories/orbits/elements-to-state.d.ts +61 -0
  46. package/dist/categories/orbits/elements-to-state.d.ts.map +1 -0
  47. package/dist/categories/orbits/elements-to-state.js +107 -0
  48. package/dist/categories/orbits/elements-to-state.js.map +1 -0
  49. package/dist/categories/orbits/hyperbolic-eccentricity.d.ts +56 -0
  50. package/dist/categories/orbits/hyperbolic-eccentricity.d.ts.map +1 -0
  51. package/dist/categories/orbits/hyperbolic-eccentricity.js +72 -0
  52. package/dist/categories/orbits/hyperbolic-eccentricity.js.map +1 -0
  53. package/dist/categories/orbits/hyperbolic-semi-major-axis.d.ts +53 -0
  54. package/dist/categories/orbits/hyperbolic-semi-major-axis.d.ts.map +1 -0
  55. package/dist/categories/orbits/hyperbolic-semi-major-axis.js +66 -0
  56. package/dist/categories/orbits/hyperbolic-semi-major-axis.js.map +1 -0
  57. package/dist/categories/orbits/hyperbolic-time-of-flight.d.ts +64 -0
  58. package/dist/categories/orbits/hyperbolic-time-of-flight.d.ts.map +1 -0
  59. package/dist/categories/orbits/hyperbolic-time-of-flight.js +86 -0
  60. package/dist/categories/orbits/hyperbolic-time-of-flight.js.map +1 -0
  61. package/dist/categories/orbits/inclination-from-launch-azimuth.d.ts +64 -0
  62. package/dist/categories/orbits/inclination-from-launch-azimuth.d.ts.map +1 -0
  63. package/dist/categories/orbits/inclination-from-launch-azimuth.js +76 -0
  64. package/dist/categories/orbits/inclination-from-launch-azimuth.js.map +1 -0
  65. package/dist/categories/orbits/launch-azimuth-for-inclination.d.ts +71 -0
  66. package/dist/categories/orbits/launch-azimuth-for-inclination.d.ts.map +1 -0
  67. package/dist/categories/orbits/launch-azimuth-for-inclination.js +87 -0
  68. package/dist/categories/orbits/launch-azimuth-for-inclination.js.map +1 -0
  69. package/dist/categories/orbits/rotating-launch-azimuth.d.ts +49 -0
  70. package/dist/categories/orbits/rotating-launch-azimuth.d.ts.map +1 -0
  71. package/dist/categories/orbits/rotating-launch-azimuth.js +65 -0
  72. package/dist/categories/orbits/rotating-launch-azimuth.js.map +1 -0
  73. package/dist/categories/orbits/state-to-elements.d.ts +82 -0
  74. package/dist/categories/orbits/state-to-elements.d.ts.map +1 -0
  75. package/dist/categories/orbits/state-to-elements.js +131 -0
  76. package/dist/categories/orbits/state-to-elements.js.map +1 -0
  77. package/dist/categories/orbits/surface-rotation-speed.d.ts +61 -0
  78. package/dist/categories/orbits/surface-rotation-speed.d.ts.map +1 -0
  79. package/dist/categories/orbits/surface-rotation-speed.js +74 -0
  80. package/dist/categories/orbits/surface-rotation-speed.js.map +1 -0
  81. package/dist/index.d.ts +19 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +19 -0
  84. package/dist/index.js.map +1 -1
  85. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ import { trueToHyperbolicAnomaly } from '../anomalies/true-to-hyperbolic-anomaly.js';
2
+ /**
3
+ * Compute the **time of flight between two points on a hyperbola**, given by their true anomalies.
4
+ *
5
+ * $$
6
+ * t_2 - t_1 = \sqrt{\frac{-a^3}{\mu}}\,\Big[(e\sinh F_2 - F_2) - (e\sinh F_1 - F_1)\Big]
7
+ * $$
8
+ *
9
+ * with each hyperbolic anomaly $ F $ from {@link trueToHyperbolicAnomaly}.
10
+ *
11
+ * **Units**
12
+ * - Inputs: `nu1`, `nu2` in **radians**, `e` dimensionless, `a` in **m** (negative), `mu` in **m³/s²**.
13
+ * - Output: time in **s**, negative if `nu2` comes before `nu1`.
14
+ *
15
+ * ::: info Notes
16
+ *
17
+ * - Both points must lie inside the asymptotes. The incoming branch can be given as negative angles or just below 2π.
18
+ * - Crossing periapsis needs no special handling: $ F $ changes sign there.
19
+ * - To go from a time to a position, solve $ M_h = e\sinh F - F $ with {@link solveKeplerHyperbolic}, then use {@link hyperbolicToTrueAnomaly}.
20
+ *
21
+ * :::
22
+ *
23
+ * ::: practice Apollo 11, falling towards the Moon
24
+ *
25
+ * **13.8 h**
26
+ *
27
+ * _From the edge of the Moon's sphere of influence, 62 640 km out, to closest approach_
28
+ *
29
+ * The flight took 14 h 10 min from crossing into the sphere to lighting the engine for lunar orbit insertion. Patched conics leave out Earth's pull inside the sphere, one reason the two differ.
30
+ *
31
+ * ```ts
32
+ * const e = 1.44; // approach hyperbola
33
+ * const a = -4_203_000; // m
34
+ * const p = a * (1 - e * e);
35
+ * const nuSoi = -Math.acos((p / 62_640_000 - 1) / e) as Radians; // incoming
36
+ * hyperbolicTimeOfFlight(nuSoi, 0 as Radians, e, a, 4.902800118e12); // ≈ 49 600 s
37
+ * ```
38
+ *
39
+ * :::
40
+ *
41
+ * @param nu1 - True anomaly at the start $ \nu_1 $ in **radians** (finite, inside the asymptotes).
42
+ * @param nu2 - True anomaly at the end $ \nu_2 $ in **radians** (finite, inside the asymptotes).
43
+ * @param e - Eccentricity $ e $ (finite, > 1).
44
+ * @param a - Semi-major axis $ a $ in **m** (finite, < 0).
45
+ * @param mu - Gravitational parameter $ \mu $ in **m³/s²** (finite, > 0).
46
+ * @returns Time of flight in **s** from `nu1` to `nu2`.
47
+ * @throws {TypeError} If any input is not a finite number.
48
+ * @throws {RangeError} If `e <= 1`, `a >= 0`, `mu <= 0`, or either true anomaly is at or beyond the asymptotes.
49
+ * @group Orbits
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * import type { Radians } from '@interstellar-tools/types';
54
+ *
55
+ * // From periapsis to 90° on a hyperbola with e = 2, a = -10 000 km, around Earth
56
+ * const t = hyperbolicTimeOfFlight(0 as Radians, (Math.PI / 2) as Radians, 2, -10_000e3, 3.986004418e14);
57
+ * // t ≈ 3 401 s
58
+ * ```
59
+ *
60
+ * @see {@link solveKeplerHyperbolic}
61
+ * @see https://en.wikipedia.org/wiki/Hyperbolic_trajectory Hyperbolic trajectory
62
+ */
63
+ export const hyperbolicTimeOfFlight = (nu1, nu2, e, a, mu) => {
64
+ for (const [name, x] of [
65
+ ['nu1', nu1],
66
+ ['nu2', nu2],
67
+ ['e', e],
68
+ ['a', a],
69
+ ['mu', mu]
70
+ ]) {
71
+ if (!Number.isFinite(x))
72
+ throw new TypeError(`${name} must be a finite number. Received: ${x}`);
73
+ }
74
+ if (e <= 1)
75
+ throw new RangeError(`e must be > 1. Received: ${e}`);
76
+ if (a >= 0)
77
+ throw new RangeError(`a must be < 0 for a hyperbola. Received: ${a}`);
78
+ if (mu <= 0)
79
+ throw new RangeError(`mu must be > 0. Received: ${mu}`);
80
+ const meanAnomaly = (nu) => {
81
+ const F = trueToHyperbolicAnomaly(nu, e);
82
+ return e * Math.sinh(F) - F;
83
+ };
84
+ return Math.sqrt((-a * a * a) / mu) * (meanAnomaly(nu2) - meanAnomaly(nu1));
85
+ };
86
+ //# sourceMappingURL=hyperbolic-time-of-flight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperbolic-time-of-flight.js","sourceRoot":"","sources":["../../../src/categories/orbits/hyperbolic-time-of-flight.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,GAAY,EACZ,GAAY,EACZ,CAAS,EACT,CAAS,EACT,EAAU,EACF,EAAE;IACV,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,GAAG,EAAE,CAAC,CAAC;QACR,CAAC,GAAG,EAAE,CAAC,CAAC;QACR,CAAC,IAAI,EAAE,EAAE,CAAC;KACF,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAElE,IAAI,CAAC,IAAI,CAAC;QACR,MAAM,IAAI,UAAU,CAAC,4CAA4C,CAAC,EAAE,CAAC,CAAC;IAExE,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,MAAM,WAAW,GAAG,CAAC,EAAW,EAAE,EAAE;QAClC,MAAM,CAAC,GAAG,uBAAuB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAEzC,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { Radians } from '@interstellar-tools/types';
2
+ /**
3
+ * Compute the **inclination** of the orbit reached by launching from a latitude on an azimuth.
4
+ *
5
+ * $$
6
+ * \cos i = \cos\varphi \,\sin\beta
7
+ * $$
8
+ *
9
+ * Where:
10
+ * - $ i $ is the orbit's inclination (rad)
11
+ * - $ \varphi $ is the geocentric latitude of the point (rad)
12
+ * - $ \beta $ is the inertial azimuth or heading at that point, clockwise from north (rad)
13
+ *
14
+ * **Units**
15
+ * - Inputs: `lat` and `azimuth` in **radians**.
16
+ * - Output: $ i $ in **radians**, in [0, π].
17
+ *
18
+ * ::: info Notes
19
+ *
20
+ * - `lat` is the **geocentric** latitude. Published latitudes are usually geodetic, which on Earth differ by up to 0.19°, and the inclination by about as much. Convert first (see [#186](https://github.com/phun-ky/interstellar-tools/issues/186)).
21
+ * - The relation holds at every point of the ground track, not only at launch: an orbit never reaches a latitude higher than its inclination.
22
+ * - Launching due east ($ \beta = 90° $) gives the lowest inclination a site can reach without a plane change: its own latitude.
23
+ * - Azimuths between 180° and 360° head west, into retrograde orbits ($ i > 90° $).
24
+ * - `azimuth` is inertial. A rocket's azimuth over the ground differs, because the pad is moving east; see {@link rotatingLaunchAzimuth}.
25
+ *
26
+ * :::
27
+ *
28
+ * ::: practice Apollo 11, entering Earth orbit
29
+ *
30
+ * **32.52°**
31
+ *
32
+ * _At orbit insertion: 32.497° N geocentric, heading 88.848°_
33
+ *
34
+ * The flown parking orbit was inclined 32.521°. Apollo 11 entered orbit near the northernmost point of its track, heading almost due east. With the published geodetic latitude, 32.672°, the result would be 32.69°.
35
+ *
36
+ * ```ts
37
+ * inclinationFromLaunchAzimuth(toRad(32.497), toRad(88.848)); // ≈ 32.52°
38
+ * ```
39
+ *
40
+ * :::
41
+ *
42
+ * @param lat - Geocentric latitude $ \varphi $ in **radians** (finite, in [-π/2, π/2]).
43
+ * @param azimuth - Inertial azimuth $ \beta $ in **radians**, clockwise from north (finite).
44
+ * @returns Inclination $ i $ in **radians**, in [0, π].
45
+ * @throws {TypeError} If any input is not a finite number.
46
+ * @throws {RangeError} If `lat` is outside [-π/2, π/2].
47
+ * @group Orbits
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import type { Radians } from '@interstellar-tools/types';
52
+ *
53
+ * const toRad = (deg: number) => ((deg * Math.PI) / 180) as Radians;
54
+ *
55
+ * // Baikonur (45.97° N), launching north-east at 63°
56
+ * const i = inclinationFromLaunchAzimuth(toRad(45.97), toRad(63));
57
+ * // i ≈ 51.7°
58
+ * ```
59
+ *
60
+ * @see {@link launchAzimuthForInclination}
61
+ * @see https://en.wikipedia.org/wiki/Launch_azimuth Launch azimuth
62
+ */
63
+ export declare const inclinationFromLaunchAzimuth: (lat: Radians, azimuth: Radians) => Radians;
64
+ //# sourceMappingURL=inclination-from-launch-azimuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inclination-from-launch-azimuth.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/inclination-from-launch-azimuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,eAAO,MAAM,4BAA4B,GACvC,KAAK,OAAO,EACZ,SAAS,OAAO,KACf,OAgBF,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Compute the **inclination** of the orbit reached by launching from a latitude on an azimuth.
3
+ *
4
+ * $$
5
+ * \cos i = \cos\varphi \,\sin\beta
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ i $ is the orbit's inclination (rad)
10
+ * - $ \varphi $ is the geocentric latitude of the point (rad)
11
+ * - $ \beta $ is the inertial azimuth or heading at that point, clockwise from north (rad)
12
+ *
13
+ * **Units**
14
+ * - Inputs: `lat` and `azimuth` in **radians**.
15
+ * - Output: $ i $ in **radians**, in [0, π].
16
+ *
17
+ * ::: info Notes
18
+ *
19
+ * - `lat` is the **geocentric** latitude. Published latitudes are usually geodetic, which on Earth differ by up to 0.19°, and the inclination by about as much. Convert first (see [#186](https://github.com/phun-ky/interstellar-tools/issues/186)).
20
+ * - The relation holds at every point of the ground track, not only at launch: an orbit never reaches a latitude higher than its inclination.
21
+ * - Launching due east ($ \beta = 90° $) gives the lowest inclination a site can reach without a plane change: its own latitude.
22
+ * - Azimuths between 180° and 360° head west, into retrograde orbits ($ i > 90° $).
23
+ * - `azimuth` is inertial. A rocket's azimuth over the ground differs, because the pad is moving east; see {@link rotatingLaunchAzimuth}.
24
+ *
25
+ * :::
26
+ *
27
+ * ::: practice Apollo 11, entering Earth orbit
28
+ *
29
+ * **32.52°**
30
+ *
31
+ * _At orbit insertion: 32.497° N geocentric, heading 88.848°_
32
+ *
33
+ * The flown parking orbit was inclined 32.521°. Apollo 11 entered orbit near the northernmost point of its track, heading almost due east. With the published geodetic latitude, 32.672°, the result would be 32.69°.
34
+ *
35
+ * ```ts
36
+ * inclinationFromLaunchAzimuth(toRad(32.497), toRad(88.848)); // ≈ 32.52°
37
+ * ```
38
+ *
39
+ * :::
40
+ *
41
+ * @param lat - Geocentric latitude $ \varphi $ in **radians** (finite, in [-π/2, π/2]).
42
+ * @param azimuth - Inertial azimuth $ \beta $ in **radians**, clockwise from north (finite).
43
+ * @returns Inclination $ i $ in **radians**, in [0, π].
44
+ * @throws {TypeError} If any input is not a finite number.
45
+ * @throws {RangeError} If `lat` is outside [-π/2, π/2].
46
+ * @group Orbits
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import type { Radians } from '@interstellar-tools/types';
51
+ *
52
+ * const toRad = (deg: number) => ((deg * Math.PI) / 180) as Radians;
53
+ *
54
+ * // Baikonur (45.97° N), launching north-east at 63°
55
+ * const i = inclinationFromLaunchAzimuth(toRad(45.97), toRad(63));
56
+ * // i ≈ 51.7°
57
+ * ```
58
+ *
59
+ * @see {@link launchAzimuthForInclination}
60
+ * @see https://en.wikipedia.org/wiki/Launch_azimuth Launch azimuth
61
+ */
62
+ export const inclinationFromLaunchAzimuth = (lat, azimuth) => {
63
+ for (const [name, v] of [
64
+ ['lat', lat],
65
+ ['azimuth', azimuth]
66
+ ]) {
67
+ if (!Number.isFinite(v))
68
+ throw new TypeError(`${name} must be a finite number. Received: ${v}`);
69
+ }
70
+ if (Math.abs(lat) > Math.PI / 2)
71
+ throw new RangeError(`lat must be in [-π/2, π/2]. Received: ${lat}`);
72
+ // Clamp against rounding just outside [-1, 1]
73
+ const cosI = Math.min(1, Math.max(-1, Math.cos(lat) * Math.sin(azimuth)));
74
+ return Math.acos(cosI);
75
+ };
76
+ //# sourceMappingURL=inclination-from-launch-azimuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inclination-from-launch-azimuth.js","sourceRoot":"","sources":["../../../src/categories/orbits/inclination-from-launch-azimuth.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,GAAY,EACZ,OAAgB,EACP,EAAE;IACX,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,SAAS,EAAE,OAAO,CAAC;KACZ,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC;QAC7B,MAAM,IAAI,UAAU,CAAC,yCAAyC,GAAG,EAAE,CAAC,CAAC;IAEvE,8CAA8C;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1E,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAY,CAAC;AACpC,CAAC,CAAC"}
@@ -0,0 +1,71 @@
1
+ import type { Radians } from '@interstellar-tools/types';
2
+ export interface LaunchAzimuthsInterface {
3
+ /** Azimuth for the ascending pass: heading north, in [0, π/2] or [3π/2, 2π) */
4
+ northbound: Radians;
5
+ /** Azimuth for the descending pass: heading south, in [π/2, 3π/2] */
6
+ southbound: Radians;
7
+ }
8
+ /**
9
+ * Compute the **inertial launch azimuths** that reach an inclination from a latitude.
10
+ *
11
+ * $$
12
+ * \sin\beta = \frac{\cos i}{\cos\varphi}
13
+ * $$
14
+ *
15
+ * Where:
16
+ * - $ \beta $ is the inertial azimuth, clockwise from north (rad)
17
+ * - $ i $ is the target inclination (rad)
18
+ * - $ \varphi $ is the geocentric launch latitude (rad)
19
+ *
20
+ * Two azimuths reach every reachable inclination: one heading north ($ \beta $) and one heading south ($ \pi - \beta $).
21
+ *
22
+ * **Units**
23
+ * - Inputs: `lat` and `i` in **radians**.
24
+ * - Output: both azimuths in **radians**, in [0, 2π).
25
+ *
26
+ * ::: info Notes
27
+ *
28
+ * - `lat` is the **geocentric** latitude. Published latitudes are usually geodetic, which on Earth differ by up to 0.19°, and the inclination by about as much. Convert first (see [#186](https://github.com/phun-ky/interstellar-tools/issues/186)).
29
+ * - A site can only reach inclinations between $ |\varphi| $ and $ \pi - |\varphi| $ directly. Anything else needs a plane change, or a dogleg during ascent.
30
+ * - The azimuths are inertial. Over the ground, the rocket flies a slightly different heading; see {@link rotatingLaunchAzimuth}.
31
+ * - At $ i = |\varphi| $ the two solutions meet, due east (or due west for retrograde orbits).
32
+ *
33
+ * :::
34
+ *
35
+ * ::: practice To the ISS from Cape Canaveral
36
+ *
37
+ * **44.9°**
38
+ *
39
+ * _Inertial azimuth from Pad 39A, 28.447° N geocentric, to an orbit inclined 51.64°_
40
+ *
41
+ * Over the ground the rocket flies 42.7°, because the pad is already moving east at 409 m/s.
42
+ *
43
+ * ```ts
44
+ * launchAzimuthForInclination(toRad(28.447), toRad(51.64)).northbound; // ≈ 44.9°
45
+ * ```
46
+ *
47
+ * :::
48
+ *
49
+ * @param lat - Geocentric launch latitude $ \varphi $ in **radians** (finite, in (-π/2, π/2)).
50
+ * @param i - Target inclination $ i $ in **radians** (finite, in [0, π]).
51
+ * @returns The northbound and southbound inertial azimuths, in **radians**.
52
+ * @throws {TypeError} If any input is not a finite number.
53
+ * @throws {RangeError} If `lat` is not in (-π/2, π/2), `i` is not in [0, π], or `i` can't be reached from `lat` (`i < |lat|` or `i > π - |lat|`).
54
+ * @group Orbits
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * import type { Radians } from '@interstellar-tools/types';
59
+ *
60
+ * const toRad = (deg: number) => ((deg * Math.PI) / 180) as Radians;
61
+ *
62
+ * // A sun-synchronous orbit (97.8°) from Vandenberg (34.7° N)
63
+ * const { southbound } = launchAzimuthForInclination(toRad(34.7), toRad(97.8));
64
+ * // southbound ≈ 189.5°: south, slightly west
65
+ * ```
66
+ *
67
+ * @see {@link inclinationFromLaunchAzimuth}
68
+ * @see https://en.wikipedia.org/wiki/Launch_azimuth Launch azimuth
69
+ */
70
+ export declare const launchAzimuthForInclination: (lat: Radians, i: Radians) => LaunchAzimuthsInterface;
71
+ //# sourceMappingURL=launch-azimuth-for-inclination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-azimuth-for-inclination.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/launch-azimuth-for-inclination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIzD,MAAM,WAAW,uBAAuB;IACtC,+EAA+E;IAC/E,UAAU,EAAE,OAAO,CAAC;IACpB,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,2BAA2B,GACtC,KAAK,OAAO,EACZ,GAAG,OAAO,KACT,uBA8BF,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { norm2pi } from '../helpers/misc.js';
2
+ /**
3
+ * Compute the **inertial launch azimuths** that reach an inclination from a latitude.
4
+ *
5
+ * $$
6
+ * \sin\beta = \frac{\cos i}{\cos\varphi}
7
+ * $$
8
+ *
9
+ * Where:
10
+ * - $ \beta $ is the inertial azimuth, clockwise from north (rad)
11
+ * - $ i $ is the target inclination (rad)
12
+ * - $ \varphi $ is the geocentric launch latitude (rad)
13
+ *
14
+ * Two azimuths reach every reachable inclination: one heading north ($ \beta $) and one heading south ($ \pi - \beta $).
15
+ *
16
+ * **Units**
17
+ * - Inputs: `lat` and `i` in **radians**.
18
+ * - Output: both azimuths in **radians**, in [0, 2π).
19
+ *
20
+ * ::: info Notes
21
+ *
22
+ * - `lat` is the **geocentric** latitude. Published latitudes are usually geodetic, which on Earth differ by up to 0.19°, and the inclination by about as much. Convert first (see [#186](https://github.com/phun-ky/interstellar-tools/issues/186)).
23
+ * - A site can only reach inclinations between $ |\varphi| $ and $ \pi - |\varphi| $ directly. Anything else needs a plane change, or a dogleg during ascent.
24
+ * - The azimuths are inertial. Over the ground, the rocket flies a slightly different heading; see {@link rotatingLaunchAzimuth}.
25
+ * - At $ i = |\varphi| $ the two solutions meet, due east (or due west for retrograde orbits).
26
+ *
27
+ * :::
28
+ *
29
+ * ::: practice To the ISS from Cape Canaveral
30
+ *
31
+ * **44.9°**
32
+ *
33
+ * _Inertial azimuth from Pad 39A, 28.447° N geocentric, to an orbit inclined 51.64°_
34
+ *
35
+ * Over the ground the rocket flies 42.7°, because the pad is already moving east at 409 m/s.
36
+ *
37
+ * ```ts
38
+ * launchAzimuthForInclination(toRad(28.447), toRad(51.64)).northbound; // ≈ 44.9°
39
+ * ```
40
+ *
41
+ * :::
42
+ *
43
+ * @param lat - Geocentric launch latitude $ \varphi $ in **radians** (finite, in (-π/2, π/2)).
44
+ * @param i - Target inclination $ i $ in **radians** (finite, in [0, π]).
45
+ * @returns The northbound and southbound inertial azimuths, in **radians**.
46
+ * @throws {TypeError} If any input is not a finite number.
47
+ * @throws {RangeError} If `lat` is not in (-π/2, π/2), `i` is not in [0, π], or `i` can't be reached from `lat` (`i < |lat|` or `i > π - |lat|`).
48
+ * @group Orbits
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import type { Radians } from '@interstellar-tools/types';
53
+ *
54
+ * const toRad = (deg: number) => ((deg * Math.PI) / 180) as Radians;
55
+ *
56
+ * // A sun-synchronous orbit (97.8°) from Vandenberg (34.7° N)
57
+ * const { southbound } = launchAzimuthForInclination(toRad(34.7), toRad(97.8));
58
+ * // southbound ≈ 189.5°: south, slightly west
59
+ * ```
60
+ *
61
+ * @see {@link inclinationFromLaunchAzimuth}
62
+ * @see https://en.wikipedia.org/wiki/Launch_azimuth Launch azimuth
63
+ */
64
+ export const launchAzimuthForInclination = (lat, i) => {
65
+ for (const [name, v] of [
66
+ ['lat', lat],
67
+ ['i', i]
68
+ ]) {
69
+ if (!Number.isFinite(v))
70
+ throw new TypeError(`${name} must be a finite number. Received: ${v}`);
71
+ }
72
+ if (Math.abs(lat) >= Math.PI / 2)
73
+ throw new RangeError(`lat must be in (-π/2, π/2). Received: ${lat}`);
74
+ if (i < 0 || i > Math.PI)
75
+ throw new RangeError(`i must be in [0, π]. Received: ${i}`);
76
+ const sinBeta = Math.cos(i) / Math.cos(lat);
77
+ // Allow rounding at the edge, where i = |lat| exactly
78
+ const tolerance = 1e-12;
79
+ if (Math.abs(sinBeta) > 1 + tolerance)
80
+ throw new RangeError(`i can't be reached from lat: it must be in [|lat|, π - |lat|]. Received: i=${i}, lat=${lat}`);
81
+ const beta = Math.asin(Math.min(1, Math.max(-1, sinBeta)));
82
+ return {
83
+ northbound: norm2pi(beta),
84
+ southbound: norm2pi(Math.PI - beta)
85
+ };
86
+ };
87
+ //# sourceMappingURL=launch-azimuth-for-inclination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-azimuth-for-inclination.js","sourceRoot":"","sources":["../../../src/categories/orbits/launch-azimuth-for-inclination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,GAAY,EACZ,CAAU,EACe,EAAE;IAC3B,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,GAAG,EAAE,CAAC,CAAC;KACA,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC;QAC9B,MAAM,IAAI,UAAU,CAAC,yCAAyC,GAAG,EAAE,CAAC,CAAC;IAEvE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE;QACtB,MAAM,IAAI,UAAU,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;IAE9D,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5C,sDAAsD;IACtD,MAAM,SAAS,GAAG,KAAK,CAAC;IAExB,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS;QACnC,MAAM,IAAI,UAAU,CAClB,8EAA8E,CAAC,SAAS,GAAG,EAAE,CAC9F,CAAC;IAEJ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3D,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,IAAI,CAAY;QACpC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAY;KAC/C,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { Radians } from '@interstellar-tools/types';
2
+ /**
3
+ * Compute the **azimuth over the ground** for an inertial launch azimuth, on a rotating body.
4
+ *
5
+ * $$
6
+ * \tan\beta_\text{rot} = \frac{v \sin\beta - v_\text{rot}}{v \cos\beta}
7
+ * $$
8
+ *
9
+ * Where:
10
+ * - $ \beta $ is the inertial azimuth, clockwise from north (rad)
11
+ * - $ v $ is the inertial speed to reach, e.g. the orbital speed at insertion (m/s)
12
+ * - $ v_\text{rot} $ is the pad's eastward speed from the body's rotation (m/s)
13
+ *
14
+ * **Units**
15
+ * - Inputs: `azimuth` in **radians**, `v` and `vRot` in **m/s**.
16
+ * - Output: $ \beta_\text{rot} $ in **radians**, in [0, 2π).
17
+ *
18
+ * ::: info Notes
19
+ *
20
+ * - The pad is already moving east, so the rocket only has to add the difference: it steers a little further from east than the inertial azimuth.
21
+ * - Get $ v_\text{rot} $ from {@link surfaceRotationSpeed} and $ \beta $ from {@link launchAzimuthForInclination}.
22
+ * - Uses a flat, local approximation: good for the azimuth at launch, not for the whole ascent.
23
+ *
24
+ * :::
25
+ *
26
+ * @param azimuth - Inertial azimuth $ \beta $ in **radians**, clockwise from north (finite).
27
+ * @param v - Inertial speed $ v $ in **m/s** (finite, > 0).
28
+ * @param vRot - Eastward surface speed $ v_\text{rot} $ in **m/s** (finite).
29
+ * @returns Azimuth over the ground $ \beta_\text{rot} $ in **radians**, in [0, 2π).
30
+ * @throws {TypeError} If any input is not a finite number.
31
+ * @throws {RangeError} If `v <= 0`, or the speed over the ground is zero (the target velocity equals the pad's).
32
+ * @group Orbits
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * import type { Radians } from '@interstellar-tools/types';
37
+ *
38
+ * const toRad = (deg: number) => ((deg * Math.PI) / 180) as Radians;
39
+ *
40
+ * // Due north inertially at 7.8 km/s, from a pad moving east at 409 m/s
41
+ * const beta = rotatingLaunchAzimuth(toRad(0), 7800, 409);
42
+ * // beta ≈ 357.0°: aim slightly west of north to cancel the pad's eastward speed
43
+ * ```
44
+ *
45
+ * @see {@link launchAzimuthForInclination}
46
+ * @see {@link surfaceRotationSpeed}
47
+ */
48
+ export declare const rotatingLaunchAzimuth: (azimuth: Radians, v: number, vRot: number) => Radians;
49
+ //# sourceMappingURL=rotating-launch-azimuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotating-launch-azimuth.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/rotating-launch-azimuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,qBAAqB,GAChC,SAAS,OAAO,EAChB,GAAG,MAAM,EACT,MAAM,MAAM,KACX,OAqBF,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { norm2pi } from '../helpers/misc.js';
2
+ /**
3
+ * Compute the **azimuth over the ground** for an inertial launch azimuth, on a rotating body.
4
+ *
5
+ * $$
6
+ * \tan\beta_\text{rot} = \frac{v \sin\beta - v_\text{rot}}{v \cos\beta}
7
+ * $$
8
+ *
9
+ * Where:
10
+ * - $ \beta $ is the inertial azimuth, clockwise from north (rad)
11
+ * - $ v $ is the inertial speed to reach, e.g. the orbital speed at insertion (m/s)
12
+ * - $ v_\text{rot} $ is the pad's eastward speed from the body's rotation (m/s)
13
+ *
14
+ * **Units**
15
+ * - Inputs: `azimuth` in **radians**, `v` and `vRot` in **m/s**.
16
+ * - Output: $ \beta_\text{rot} $ in **radians**, in [0, 2π).
17
+ *
18
+ * ::: info Notes
19
+ *
20
+ * - The pad is already moving east, so the rocket only has to add the difference: it steers a little further from east than the inertial azimuth.
21
+ * - Get $ v_\text{rot} $ from {@link surfaceRotationSpeed} and $ \beta $ from {@link launchAzimuthForInclination}.
22
+ * - Uses a flat, local approximation: good for the azimuth at launch, not for the whole ascent.
23
+ *
24
+ * :::
25
+ *
26
+ * @param azimuth - Inertial azimuth $ \beta $ in **radians**, clockwise from north (finite).
27
+ * @param v - Inertial speed $ v $ in **m/s** (finite, > 0).
28
+ * @param vRot - Eastward surface speed $ v_\text{rot} $ in **m/s** (finite).
29
+ * @returns Azimuth over the ground $ \beta_\text{rot} $ in **radians**, in [0, 2π).
30
+ * @throws {TypeError} If any input is not a finite number.
31
+ * @throws {RangeError} If `v <= 0`, or the speed over the ground is zero (the target velocity equals the pad's).
32
+ * @group Orbits
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * import type { Radians } from '@interstellar-tools/types';
37
+ *
38
+ * const toRad = (deg: number) => ((deg * Math.PI) / 180) as Radians;
39
+ *
40
+ * // Due north inertially at 7.8 km/s, from a pad moving east at 409 m/s
41
+ * const beta = rotatingLaunchAzimuth(toRad(0), 7800, 409);
42
+ * // beta ≈ 357.0°: aim slightly west of north to cancel the pad's eastward speed
43
+ * ```
44
+ *
45
+ * @see {@link launchAzimuthForInclination}
46
+ * @see {@link surfaceRotationSpeed}
47
+ */
48
+ export const rotatingLaunchAzimuth = (azimuth, v, vRot) => {
49
+ for (const [name, x] of [
50
+ ['azimuth', azimuth],
51
+ ['v', v],
52
+ ['vRot', vRot]
53
+ ]) {
54
+ if (!Number.isFinite(x))
55
+ throw new TypeError(`${name} must be a finite number. Received: ${x}`);
56
+ }
57
+ if (v <= 0)
58
+ throw new RangeError(`v must be > 0. Received: ${v}`);
59
+ const east = v * Math.sin(azimuth) - vRot;
60
+ const north = v * Math.cos(azimuth);
61
+ if (Math.hypot(east, north) <= 1e-12 * v)
62
+ throw new RangeError('The speed over the ground is zero, so the azimuth is undefined.');
63
+ return norm2pi(Math.atan2(east, north));
64
+ };
65
+ //# sourceMappingURL=rotating-launch-azimuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotating-launch-azimuth.js","sourceRoot":"","sources":["../../../src/categories/orbits/rotating-launch-azimuth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,OAAgB,EAChB,CAAS,EACT,IAAY,EACH,EAAE;IACX,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,SAAS,EAAE,OAAO,CAAC;QACpB,CAAC,GAAG,EAAE,CAAC,CAAC;QACR,CAAC,MAAM,EAAE,IAAI,CAAC;KACN,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAElE,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEpC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QACtC,MAAM,IAAI,UAAU,CAClB,iEAAiE,CAClE,CAAC;IAEJ,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAY,CAAC;AACrD,CAAC,CAAC"}
@@ -0,0 +1,82 @@
1
+ import type { ClassicalElementsInterface, Vector3DTupleType } from '@interstellar-tools/types';
2
+ /**
3
+ * Convert a **state vector** (position and velocity) to the six **classical orbital elements**.
4
+ *
5
+ * $$
6
+ * \mathbf h = \mathbf r \times \mathbf v, \quad
7
+ * \mathbf e = \frac{\mathbf v \times \mathbf h}{\mu} - \frac{\mathbf r}{r}, \quad
8
+ * \mathbf n = \hat{\mathbf k} \times \mathbf h, \quad
9
+ * a = -\frac{\mu}{2\varepsilon}, \quad
10
+ * \varepsilon = \frac{v^2}{2} - \frac{\mu}{r}
11
+ * $$
12
+ *
13
+ * $$
14
+ * i = \arccos\frac{h_z}{h}, \quad
15
+ * \Omega = \operatorname{atan2}(n_y, n_x), \quad
16
+ * \omega = \angle(\mathbf n, \mathbf e), \quad
17
+ * \nu = \angle(\mathbf e, \mathbf r)
18
+ * $$
19
+ *
20
+ * where each angle $ \angle $ is measured in the direction of motion, about $ \mathbf h $.
21
+ *
22
+ * **Units**
23
+ * - Inputs: `r` in **m**, `v` in **m/s**, `mu` in **m³/s²**.
24
+ * - Output: `a` in **m**, `e` dimensionless, angles in **radians**.
25
+ *
26
+ * ::: info Notes
27
+ *
28
+ * - Works for elliptic and hyperbolic orbits. A hyperbolic orbit has a negative `a`, and `nu` in [0, 2π) like the others: the incoming branch is just below 2π.
29
+ * - Some angles are undefined for special orbits. Below `tolerance`, the function uses these conventions, which {@link elementsToState} reverses:
30
+ * - **circular** ($ e \approx 0 $): `argp = 0`, and `nu` is measured from the ascending node (the argument of latitude);
31
+ * - **equatorial** ($ i \approx 0 $ or $ \pi $): `raan = 0`, and `argp` is measured from the x axis (the longitude of periapsis);
32
+ * - **circular and equatorial**: `raan = argp = 0`, and `nu` is measured from the x axis (the true longitude).
33
+ * - The frame is whatever inertial frame `r` and `v` are given in, centred on the body with parameter `mu`; the reference plane is its xy plane.
34
+ *
35
+ * :::
36
+ *
37
+ * ::: practice Apollo 11, leaving for the Moon
38
+ *
39
+ * **e = 0.977**
40
+ *
41
+ * _From the flown state at trans-lunar injection: 6 712.6 km from Earth's centre, 10 834.3 m/s, 7.367° above the horizontal_
42
+ *
43
+ * The AS-506 flight evaluation report gives 0.97696; the inputs here are rounded. An orbit that stretched reaches far beyond the Moon, but the Moon's gravity takes over long before.
44
+ *
45
+ * ```ts
46
+ * const r = 6_712_602; // m
47
+ * const v = 10_834.3; // m/s
48
+ * const gamma = toRad(7.367);
49
+ * stateToElements(
50
+ * [r, 0, 0],
51
+ * [v * Math.sin(gamma), v * Math.cos(gamma), 0],
52
+ * 3.986004418e14
53
+ * ).e; // ≈ 0.97715
54
+ * ```
55
+ *
56
+ * :::
57
+ *
58
+ * @param r - Position vector in **m** (finite components, not zero).
59
+ * @param v - Velocity vector in **m/s** (finite components).
60
+ * @param mu - Gravitational parameter $ \mu $ in **m³/s²** (finite, > 0).
61
+ * @param tolerance - Below this, `e` counts as circular and $ \sin i $ as equatorial. Defaults to `1e-10`.
62
+ * @returns The classical orbital elements.
63
+ * @throws {TypeError} If any input is not a finite number.
64
+ * @throws {RangeError} If `mu <= 0`, `tolerance < 0`, `r` is zero, or the motion is straight up or down (no angular momentum).
65
+ * @group Orbits
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * // Curtis, Orbital Mechanics for Engineering Students, in km and km/s
70
+ * const { a, e, i, raan, argp, nu } = stateToElements(
71
+ * [-6045e3, -3490e3, 2500e3],
72
+ * [-3.457e3, 6.618e3, 2.533e3],
73
+ * 398_600e9
74
+ * );
75
+ * // e ≈ 0.1712, i ≈ 153.2°, raan ≈ 255.3°, argp ≈ 20.07°, nu ≈ 28.45°
76
+ * ```
77
+ *
78
+ * @see {@link elementsToState}
79
+ * @see https://en.wikipedia.org/wiki/Orbital_elements Orbital elements
80
+ */
81
+ export declare const stateToElements: (r: Vector3DTupleType, v: Vector3DTupleType, mu: number, tolerance?: number) => ClassicalElementsInterface;
82
+ //# sourceMappingURL=state-to-elements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-to-elements.d.ts","sourceRoot":"","sources":["../../../src/categories/orbits/state-to-elements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAE1B,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAInC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,eAAO,MAAM,eAAe,GAC1B,GAAG,iBAAiB,EACpB,GAAG,iBAAiB,EACpB,IAAI,MAAM,EACV,kBAAiB,KAChB,0BA6DF,CAAC"}