ootk 2.0.1 → 4.0.0-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 (262) hide show
  1. package/.eslintrc.json +14 -14
  2. package/CHANGELOG.md +122 -0
  3. package/README.md +27 -40
  4. package/jest.config.ts +30 -0
  5. package/lib/coordinate/Hill.d.ts +50 -0
  6. package/lib/coordinate/Hill.js +214 -0
  7. package/lib/coordinate/Hill.js.map +1 -0
  8. package/lib/coordinate/index.d.ts +1 -0
  9. package/lib/coordinate/index.js +2 -0
  10. package/lib/coordinate/index.js.map +1 -0
  11. package/lib/covariance/CovarianceSample.d.ts +44 -0
  12. package/lib/covariance/CovarianceSample.js +146 -0
  13. package/lib/covariance/CovarianceSample.js.map +1 -0
  14. package/lib/covariance/StateCovariance.d.ts +41 -0
  15. package/lib/covariance/StateCovariance.js +62 -0
  16. package/lib/covariance/StateCovariance.js.map +1 -0
  17. package/lib/force/AtmosphericDrag.d.ts +32 -0
  18. package/lib/force/AtmosphericDrag.js +66 -0
  19. package/lib/force/AtmosphericDrag.js.map +1 -0
  20. package/{dist/ootk.d.ts → lib/force/EarthGravity.d.ts} +13 -11
  21. package/lib/force/EarthGravity.js +115 -0
  22. package/lib/force/EarthGravity.js.map +1 -0
  23. package/lib/force/Force.d.ts +25 -0
  24. package/lib/force/Force.js +30 -0
  25. package/lib/force/Force.js.map +1 -0
  26. package/lib/force/ForceModel.d.ts +38 -0
  27. package/lib/force/ForceModel.js +71 -0
  28. package/lib/force/ForceModel.js.map +1 -0
  29. package/lib/force/Gravity.d.ts +41 -0
  30. package/lib/force/Gravity.js +48 -0
  31. package/lib/force/Gravity.js.map +1 -0
  32. package/lib/force/SolarRadiationPressure.d.ts +27 -0
  33. package/lib/force/SolarRadiationPressure.js +42 -0
  34. package/lib/force/SolarRadiationPressure.js.map +1 -0
  35. package/lib/force/ThirdBodyGravity.d.ts +27 -0
  36. package/lib/force/ThirdBodyGravity.js +56 -0
  37. package/lib/force/ThirdBodyGravity.js.map +1 -0
  38. package/lib/force/Thrust.d.ts +35 -0
  39. package/lib/force/Thrust.js +53 -0
  40. package/lib/force/Thrust.js.map +1 -0
  41. package/lib/interpolator/ChebyshevCoefficients.d.ts +54 -0
  42. package/lib/interpolator/ChebyshevCoefficients.js +90 -0
  43. package/lib/interpolator/ChebyshevCoefficients.js.map +1 -0
  44. package/lib/interpolator/ChebyshevInterpolator.d.ts +39 -0
  45. package/lib/interpolator/ChebyshevInterpolator.js +71 -0
  46. package/lib/interpolator/ChebyshevInterpolator.js.map +1 -0
  47. package/lib/interpolator/CubicSpline.d.ts +36 -0
  48. package/lib/interpolator/CubicSpline.js +64 -0
  49. package/lib/interpolator/CubicSpline.js.map +1 -0
  50. package/lib/interpolator/CubicSplineInterpolator.d.ts +37 -0
  51. package/lib/interpolator/CubicSplineInterpolator.js +78 -0
  52. package/lib/interpolator/CubicSplineInterpolator.js.map +1 -0
  53. package/lib/interpolator/FieldInterpolator.d.ts +26 -0
  54. package/lib/interpolator/FieldInterpolator.js +31 -0
  55. package/lib/interpolator/FieldInterpolator.js.map +1 -0
  56. package/lib/interpolator/Interpolator.d.ts +23 -0
  57. package/lib/interpolator/Interpolator.js +48 -0
  58. package/lib/interpolator/Interpolator.js.map +1 -0
  59. package/lib/interpolator/LagrangeInterpolator.d.ts +42 -0
  60. package/lib/interpolator/LagrangeInterpolator.js +156 -0
  61. package/lib/interpolator/LagrangeInterpolator.js.map +1 -0
  62. package/lib/interpolator/StateInterpolator.d.ts +29 -0
  63. package/lib/interpolator/StateInterpolator.js +37 -0
  64. package/lib/interpolator/StateInterpolator.js.map +1 -0
  65. package/lib/interpolator/VerletBlendInterpolator.d.ts +44 -0
  66. package/lib/interpolator/VerletBlendInterpolator.js +115 -0
  67. package/lib/interpolator/VerletBlendInterpolator.js.map +1 -0
  68. package/lib/maneuver/TwoBurnOrbitTransfer.d.ts +43 -0
  69. package/lib/maneuver/TwoBurnOrbitTransfer.js +62 -0
  70. package/lib/maneuver/TwoBurnOrbitTransfer.js.map +1 -0
  71. package/lib/maneuver/Waypoint.d.ts +66 -0
  72. package/lib/maneuver/Waypoint.js +152 -0
  73. package/lib/maneuver/Waypoint.js.map +1 -0
  74. package/lib/objects/DetailedSatellite.d.ts +94 -0
  75. package/lib/objects/DetailedSatellite.js +140 -0
  76. package/lib/objects/DetailedSatellite.js.map +1 -0
  77. package/lib/objects/DetailedSensor.d.ts +43 -0
  78. package/lib/objects/DetailedSensor.js +45 -0
  79. package/lib/objects/DetailedSensor.js.map +1 -0
  80. package/lib/objects/{space-object.d.ts → LandObject.d.ts} +19 -21
  81. package/lib/objects/LandObject.js +28 -0
  82. package/lib/objects/LandObject.js.map +1 -0
  83. package/lib/objects/Marker.d.ts +21 -0
  84. package/lib/objects/Marker.js +25 -0
  85. package/lib/objects/Marker.js.map +1 -0
  86. package/lib/objects/index.d.ts +5 -4
  87. package/lib/objects/index.js +5 -4
  88. package/lib/objects/index.js.map +1 -1
  89. package/lib/observation/Observation.d.ts +51 -0
  90. package/lib/observation/Observation.js +71 -0
  91. package/lib/observation/Observation.js.map +1 -0
  92. package/lib/observation/ObservationOptical.d.ts +47 -0
  93. package/lib/observation/ObservationOptical.js +101 -0
  94. package/lib/observation/ObservationOptical.js.map +1 -0
  95. package/lib/observation/ObservationRadar.d.ts +43 -0
  96. package/lib/observation/ObservationRadar.js +90 -0
  97. package/lib/observation/ObservationRadar.js.map +1 -0
  98. package/lib/observation/ObservationUtils.d.ts +21 -0
  99. package/lib/observation/ObservationUtils.js +33 -0
  100. package/lib/observation/ObservationUtils.js.map +1 -0
  101. package/lib/observation/PropagatorPairs.d.ts +31 -0
  102. package/lib/observation/PropagatorPairs.js +40 -0
  103. package/lib/observation/PropagatorPairs.js.map +1 -0
  104. package/lib/ootk.d.ts +10 -9
  105. package/lib/ootk.js +10 -9
  106. package/lib/ootk.js.map +1 -1
  107. package/lib/operations/BoxMuller.d.ts +41 -0
  108. package/lib/operations/BoxMuller.js +66 -0
  109. package/lib/operations/BoxMuller.js.map +1 -0
  110. package/lib/operations/EulerAngles.d.ts +50 -0
  111. package/lib/operations/EulerAngles.js +111 -0
  112. package/lib/operations/EulerAngles.js.map +1 -0
  113. package/lib/operations/Quaternion.d.ts +57 -0
  114. package/lib/operations/Quaternion.js +164 -0
  115. package/lib/operations/Quaternion.js.map +1 -0
  116. package/lib/operations/RandomGaussianSource.d.ts +25 -0
  117. package/lib/operations/RandomGaussianSource.js +43 -0
  118. package/lib/operations/RandomGaussianSource.js.map +1 -0
  119. package/lib/operations/index.d.ts +4 -0
  120. package/lib/operations/index.js +5 -0
  121. package/lib/operations/index.js.map +1 -0
  122. package/lib/optimize/ChebyshevCompressor.d.ts +31 -0
  123. package/lib/optimize/ChebyshevCompressor.js +80 -0
  124. package/lib/optimize/ChebyshevCompressor.js.map +1 -0
  125. package/lib/optimize/DownhillSimplex.d.ts +50 -0
  126. package/lib/optimize/DownhillSimplex.js +168 -0
  127. package/lib/optimize/DownhillSimplex.js.map +1 -0
  128. package/lib/optimize/GoldenSection.d.ts +33 -0
  129. package/lib/optimize/GoldenSection.js +49 -0
  130. package/lib/optimize/GoldenSection.js.map +1 -0
  131. package/lib/optimize/PolynomialRegression.d.ts +37 -0
  132. package/lib/optimize/PolynomialRegression.js +66 -0
  133. package/lib/optimize/PolynomialRegression.js.map +1 -0
  134. package/lib/optimize/PolynomicalRegressionResult.d.ts +28 -0
  135. package/lib/optimize/PolynomicalRegressionResult.js +32 -0
  136. package/lib/optimize/PolynomicalRegressionResult.js.map +1 -0
  137. package/lib/optimize/SimpleLinearRegression.d.ts +41 -0
  138. package/lib/optimize/SimpleLinearRegression.js +107 -0
  139. package/lib/optimize/SimpleLinearRegression.js.map +1 -0
  140. package/lib/optimize/SimplexEntry.d.ts +33 -0
  141. package/lib/optimize/SimplexEntry.js +39 -0
  142. package/lib/optimize/SimplexEntry.js.map +1 -0
  143. package/lib/orbit_determination/BatchLeastSquaresOD.d.ts +54 -0
  144. package/lib/orbit_determination/BatchLeastSquaresOD.js +118 -0
  145. package/lib/orbit_determination/BatchLeastSquaresOD.js.map +1 -0
  146. package/lib/orbit_determination/BatchLeastSquaresResult.d.ts +29 -0
  147. package/lib/orbit_determination/BatchLeastSquaresResult.js +31 -0
  148. package/lib/orbit_determination/BatchLeastSquaresResult.js.map +1 -0
  149. package/lib/orbit_determination/GibbsIOD.d.ts +33 -0
  150. package/lib/orbit_determination/GibbsIOD.js +70 -0
  151. package/lib/orbit_determination/GibbsIOD.js.map +1 -0
  152. package/lib/orbit_determination/GoodingIOD.d.ts +52 -0
  153. package/lib/orbit_determination/GoodingIOD.js +244 -0
  154. package/lib/orbit_determination/GoodingIOD.js.map +1 -0
  155. package/{dist/objects/space-object.d.ts → lib/orbit_determination/HerrickGibbsIOD.d.ts} +17 -22
  156. package/lib/orbit_determination/HerrickGibbsIOD.js +49 -0
  157. package/lib/orbit_determination/HerrickGibbsIOD.js.map +1 -0
  158. package/lib/orbit_determination/LambertIOD.d.ts +46 -0
  159. package/lib/orbit_determination/LambertIOD.js +199 -0
  160. package/lib/orbit_determination/LambertIOD.js.map +1 -0
  161. package/lib/orbit_determination/ModifiedGoodingIOD.d.ts +41 -0
  162. package/lib/orbit_determination/ModifiedGoodingIOD.js +82 -0
  163. package/lib/orbit_determination/ModifiedGoodingIOD.js.map +1 -0
  164. package/lib/propagator/DormandPrince54Propagator.d.ts +29 -0
  165. package/lib/propagator/DormandPrince54Propagator.js +68 -0
  166. package/lib/propagator/DormandPrince54Propagator.js.map +1 -0
  167. package/lib/propagator/KeplerPropagator.d.ts +36 -0
  168. package/lib/propagator/KeplerPropagator.js +81 -0
  169. package/lib/propagator/KeplerPropagator.js.map +1 -0
  170. package/lib/propagator/Propagator.d.ts +35 -0
  171. package/lib/propagator/Propagator.js +163 -0
  172. package/lib/propagator/Propagator.js.map +1 -0
  173. package/lib/propagator/RkCheckpoint.d.ts +23 -0
  174. package/lib/propagator/RkCheckpoint.js +26 -0
  175. package/lib/propagator/RkCheckpoint.js.map +1 -0
  176. package/lib/propagator/RkResult.d.ts +24 -0
  177. package/lib/propagator/RkResult.js +28 -0
  178. package/lib/propagator/RkResult.js.map +1 -0
  179. package/lib/propagator/RungeKutta4Propagator.d.ts +46 -0
  180. package/lib/propagator/RungeKutta4Propagator.js +132 -0
  181. package/lib/propagator/RungeKutta4Propagator.js.map +1 -0
  182. package/lib/propagator/RungeKutta89Propagator.d.ts +29 -0
  183. package/lib/propagator/RungeKutta89Propagator.js +130 -0
  184. package/lib/propagator/RungeKutta89Propagator.js.map +1 -0
  185. package/lib/propagator/RungeKuttaAdaptive.d.ts +52 -0
  186. package/lib/propagator/RungeKuttaAdaptive.js +152 -0
  187. package/lib/propagator/RungeKuttaAdaptive.js.map +1 -0
  188. package/lib/propagator/Sgp4Propagator.d.ts +35 -0
  189. package/lib/propagator/Sgp4Propagator.js +55 -0
  190. package/lib/propagator/Sgp4Propagator.js.map +1 -0
  191. package/lib/smoothing/ExponentialSmoothing.d.ts +24 -0
  192. package/lib/smoothing/ExponentialSmoothing.js +82 -0
  193. package/lib/smoothing/ExponentialSmoothing.js.map +1 -0
  194. package/lib/types/types.d.ts +68 -262
  195. package/lib/types/types.js +23 -33
  196. package/lib/types/types.js.map +1 -1
  197. package/package.json +28 -42
  198. package/codecov.yml +0 -21
  199. package/dist/objects/base-object.d.ts +0 -40
  200. package/dist/objects/detailed-sat.d.ts +0 -66
  201. package/dist/objects/index.d.ts +0 -4
  202. package/dist/objects/sat.d.ts +0 -92
  203. package/dist/objects/sensor.d.ts +0 -87
  204. package/dist/objects/star.d.ts +0 -46
  205. package/dist/ootk.js +0 -2
  206. package/dist/ootk.js.LICENSE.txt +0 -77
  207. package/dist/sgp4/Sgp4Assembly.d.ts +0 -5
  208. package/dist/sgp4/sgp4.d.ts +0 -82
  209. package/dist/tle/tle-format-data.d.ts +0 -6
  210. package/dist/tle/tle.d.ts +0 -374
  211. package/dist/transforms/transforms.d.ts +0 -55
  212. package/dist/types/types.d.ts +0 -280
  213. package/dist/utils/constants.d.ts +0 -34
  214. package/dist/utils/moon-math.d.ts +0 -113
  215. package/dist/utils/sun-math.d.ts +0 -230
  216. package/dist/utils/utils.d.ts +0 -39
  217. package/lib/objects/base-object.d.ts +0 -40
  218. package/lib/objects/base-object.js +0 -109
  219. package/lib/objects/base-object.js.map +0 -1
  220. package/lib/objects/detailed-sat.d.ts +0 -66
  221. package/lib/objects/detailed-sat.js +0 -149
  222. package/lib/objects/detailed-sat.js.map +0 -1
  223. package/lib/objects/sat.d.ts +0 -92
  224. package/lib/objects/sat.js +0 -188
  225. package/lib/objects/sat.js.map +0 -1
  226. package/lib/objects/sensor.d.ts +0 -87
  227. package/lib/objects/sensor.js +0 -255
  228. package/lib/objects/sensor.js.map +0 -1
  229. package/lib/objects/space-object.js +0 -60
  230. package/lib/objects/space-object.js.map +0 -1
  231. package/lib/objects/star.d.ts +0 -46
  232. package/lib/objects/star.js +0 -91
  233. package/lib/objects/star.js.map +0 -1
  234. package/lib/sgp4/Sgp4Assembly.d.ts +0 -5
  235. package/lib/sgp4/Sgp4Assembly.js +0 -75
  236. package/lib/sgp4/Sgp4Assembly.js.map +0 -1
  237. package/lib/sgp4/sgp4.d.ts +0 -82
  238. package/lib/sgp4/sgp4.js +0 -3274
  239. package/lib/sgp4/sgp4.js.map +0 -1
  240. package/lib/tle/tle-format-data.d.ts +0 -6
  241. package/lib/tle/tle-format-data.js +0 -10
  242. package/lib/tle/tle-format-data.js.map +0 -1
  243. package/lib/tle/tle.d.ts +0 -374
  244. package/lib/tle/tle.js +0 -611
  245. package/lib/tle/tle.js.map +0 -1
  246. package/lib/transforms/transforms.d.ts +0 -55
  247. package/lib/transforms/transforms.js +0 -209
  248. package/lib/transforms/transforms.js.map +0 -1
  249. package/lib/utils/constants.d.ts +0 -34
  250. package/lib/utils/constants.js +0 -35
  251. package/lib/utils/constants.js.map +0 -1
  252. package/lib/utils/moon-math.d.ts +0 -113
  253. package/lib/utils/moon-math.js +0 -387
  254. package/lib/utils/moon-math.js.map +0 -1
  255. package/lib/utils/sun-math.d.ts +0 -230
  256. package/lib/utils/sun-math.js +0 -422
  257. package/lib/utils/sun-math.js.map +0 -1
  258. package/lib/utils/utils.d.ts +0 -39
  259. package/lib/utils/utils.js +0 -100
  260. package/lib/utils/utils.js.map +0 -1
  261. package/sandbox.html +0 -8
  262. /package/{LICENSE.MD → LICENSE.md} +0 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ // / Simple linear regression _(y = mx + b)_.
19
+ export class SimpleLinearRegression {
20
+ /**
21
+ * Create a new [SimpleLinearRegression] object from lists of x and y
22
+ * values.
23
+ */
24
+ constructor(xs, ys) {
25
+ this.xs = xs;
26
+ this.ys = ys;
27
+ // / Line slope
28
+ this._slope = 0.0;
29
+ // / Y-axis intercept
30
+ this._intercept = 0.0;
31
+ this._error = 0.0;
32
+ this.update();
33
+ }
34
+ // / Line slope
35
+ get slope() {
36
+ return this._slope;
37
+ }
38
+ // / Y-axis intercept
39
+ get intercept() {
40
+ return this._intercept;
41
+ }
42
+ // / Linear regression standard deviation
43
+ get error() {
44
+ return this._error;
45
+ }
46
+ // / Data length
47
+ get length() {
48
+ return Math.min(this.xs.length, this.ys.length);
49
+ }
50
+ _calcError() {
51
+ let total = 0.0;
52
+ for (let i = 0; i < this.length; i++) {
53
+ const delta = this.ys[i] - this.evaluate(this.xs[i]);
54
+ total += delta * delta;
55
+ }
56
+ this._error = Math.sqrt(total / (this.length - 1));
57
+ }
58
+ // / Update the linear fit with this object's current [xs] and [ys] values.
59
+ update() {
60
+ const n = Math.min(this.xs.length, this.ys.length);
61
+ let xMu = 0.0;
62
+ let yMu = 0.0;
63
+ for (let i = 0; i < n; i++) {
64
+ xMu += this.xs[i];
65
+ yMu += this.ys[i];
66
+ }
67
+ xMu /= n;
68
+ yMu /= n;
69
+ let pa = 0.0;
70
+ let xSig = 0.0;
71
+ let ySig = 0.0;
72
+ for (let i = 0; i < n; i++) {
73
+ const xd = this.xs[i] - xMu;
74
+ const yd = this.ys[i] - yMu;
75
+ pa += xd * yd;
76
+ xSig += xd * xd;
77
+ ySig += yd * yd;
78
+ }
79
+ const p = pa / (Math.sqrt(xSig) * Math.sqrt(ySig));
80
+ xSig = Math.sqrt(xSig / (n - 1));
81
+ ySig = Math.sqrt(ySig / (n - 1));
82
+ this._slope = p * (ySig / xSig);
83
+ this._intercept = yMu - this._slope * xMu;
84
+ this._calcError();
85
+ }
86
+ // / Evaluate this linear fit for y, given an [x] value.
87
+ evaluate(x) {
88
+ return this._slope * x + this._intercept;
89
+ }
90
+ /**
91
+ * Create a new [SimpleLinearRegression] object with outliers above the
92
+ * provided standard deviation [sigma] value removed.
93
+ */
94
+ filterOutliers(sigma = 1.0) {
95
+ const limit = this.error * sigma;
96
+ const xsOut = [];
97
+ const ysOut = [];
98
+ for (let i = 0; i < this.length; i++) {
99
+ if (Math.abs(this.ys[i] - this.evaluate(this.xs[i])) < limit) {
100
+ xsOut.push(this.xs[i]);
101
+ ysOut.push(this.ys[i]);
102
+ }
103
+ }
104
+ return new SimpleLinearRegression(xsOut, ysOut);
105
+ }
106
+ }
107
+ //# sourceMappingURL=SimpleLinearRegression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ /**
19
+ * Optimization cost function that takes in parameter array [xs] and returns
20
+ * a score.
21
+ */
22
+ export type CostFunction = (points: Float64Array) => number;
23
+ export declare class SimplexEntry {
24
+ private _f;
25
+ points: Float64Array;
26
+ score: number;
27
+ private _x;
28
+ constructor(_f: CostFunction, points: Float64Array);
29
+ getPoints(): Float64Array;
30
+ getScore(): number;
31
+ modify(n: number, xa: SimplexEntry, xb: SimplexEntry): SimplexEntry;
32
+ distance(se: SimplexEntry): number;
33
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { Vector } from 'ootk-core';
19
+ export class SimplexEntry {
20
+ constructor(_f, points) {
21
+ this._f = _f;
22
+ this.points = points;
23
+ this._x = new Vector(points);
24
+ this.score = this._f(points);
25
+ }
26
+ getPoints() {
27
+ return this._x.toArray();
28
+ }
29
+ getScore() {
30
+ return this.score;
31
+ }
32
+ modify(n, xa, xb) {
33
+ return new SimplexEntry(this._f, this._x.add(xa._x.subtract(xb._x).scale(n)).toArray());
34
+ }
35
+ distance(se) {
36
+ return this._x.distance(se._x);
37
+ }
38
+ }
39
+ //# sourceMappingURL=SimplexEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimplexEntry.js","sourceRoot":"","sources":["../../src/optimize/SimplexEntry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC,MAAM,OAAO,YAAY;IAIvB,YAAoB,EAAgB,EAAS,MAAoB;QAA7C,OAAE,GAAF,EAAE,CAAc;QAAS,WAAM,GAAN,MAAM,CAAc;QAC/D,IAAI,CAAC,EAAE,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,CAAS,EAAE,EAAgB,EAAE,EAAgB;QAClD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED,QAAQ,CAAC,EAAgB;QACvB,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { J2000 } from 'ootk-core';
19
+ import { Observation } from '../observation/Observation';
20
+ import { ForceModel } from './../force/ForceModel';
21
+ import { BatchLeastSquaresResult } from './BatchLeastSquaresResult';
22
+ /**
23
+ * Batch least squares orbit determination.
24
+ */
25
+ export declare class BatchLeastSquaresOD {
26
+ private observations_;
27
+ private apriori_;
28
+ private forceModel_?;
29
+ private posStep_;
30
+ private velStep_;
31
+ private fastDerivatives_;
32
+ private propPairs_;
33
+ private propagator_;
34
+ private nominal_;
35
+ private start_;
36
+ /**
37
+ * Create a new [BatchLeastSquaresOD] object from a list of [Observation]
38
+ * objects, an [apriori] state estimate, and an optional
39
+ * spacecraft [forceModel].
40
+ */
41
+ constructor(observations_: Observation[], apriori_: J2000, forceModel_?: ForceModel, posStep_?: number, velStep_?: number, fastDerivatives_?: boolean);
42
+ private buildPropagator_;
43
+ private static stateToX0_;
44
+ private setPropagatorPairs_;
45
+ /**
46
+ * Attempt to solve a state estimate with the given root-mean-squared delta
47
+ * [tolerance].
48
+ */
49
+ solve({ tolerance, maxIter, printIter, }?: {
50
+ tolerance?: number;
51
+ maxIter?: number;
52
+ printIter?: boolean;
53
+ }): BatchLeastSquaresResult;
54
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { concat, J2000, Matrix, Vector, Vector3D } from 'ootk-core';
19
+ import { PropagatorPairs } from '../observation/PropagatorPairs';
20
+ import { CovarianceFrame, StateCovariance } from './../covariance/StateCovariance';
21
+ import { ForceModel } from './../force/ForceModel';
22
+ import { KeplerPropagator } from './../propagator/KeplerPropagator';
23
+ import { RungeKutta89Propagator } from './../propagator/RungeKutta89Propagator';
24
+ import { BatchLeastSquaresResult } from './BatchLeastSquaresResult';
25
+ /**
26
+ * Batch least squares orbit determination.
27
+ */
28
+ export class BatchLeastSquaresOD {
29
+ /**
30
+ * Create a new [BatchLeastSquaresOD] object from a list of [Observation]
31
+ * objects, an [apriori] state estimate, and an optional
32
+ * spacecraft [forceModel].
33
+ */
34
+ constructor(observations_, apriori_, forceModel_, posStep_ = 1e-5, velStep_ = 1e-5, fastDerivatives_ = false) {
35
+ this.observations_ = observations_;
36
+ this.apriori_ = apriori_;
37
+ this.forceModel_ = forceModel_;
38
+ this.posStep_ = posStep_;
39
+ this.velStep_ = velStep_;
40
+ this.fastDerivatives_ = fastDerivatives_;
41
+ this.observations_.sort((a, b) => a.epoch.posix - b.epoch.posix);
42
+ this.start_ = this.observations_[0].epoch;
43
+ this.propPairs_ = new PropagatorPairs(this.posStep_, this.velStep_);
44
+ this.forceModel_ ??= new ForceModel().setGravity();
45
+ this.propagator_ = new RungeKutta89Propagator(this.apriori_, this.forceModel_);
46
+ this.nominal_ = this.propagator_.propagate(this.start_);
47
+ }
48
+ buildPropagator_(x0, simple) {
49
+ const state = new J2000(this.nominal_.epoch, new Vector3D(x0[0], x0[1], x0[2]), new Vector3D(x0[3], x0[4], x0[5]));
50
+ if (simple) {
51
+ return new KeplerPropagator(state.toClassicalElements());
52
+ }
53
+ return new RungeKutta89Propagator(state, this.forceModel_);
54
+ }
55
+ static stateToX0_(state) {
56
+ return concat(state.position.toArray(), state.velocity.toArray());
57
+ }
58
+ setPropagatorPairs_(x0) {
59
+ const pl = this.buildPropagator_(x0, this.fastDerivatives_);
60
+ for (let i = 0; i < 6; i++) {
61
+ const step = this.propPairs_.step(i);
62
+ const xh = x0.slice();
63
+ xh[i] += step;
64
+ const ph = this.buildPropagator_(xh, this.fastDerivatives_);
65
+ this.propPairs_.set(i, ph, pl);
66
+ }
67
+ }
68
+ /**
69
+ * Attempt to solve a state estimate with the given root-mean-squared delta
70
+ * [tolerance].
71
+ */
72
+ solve({ tolerance = 1e-3, maxIter = 250, printIter = false, } = {}) {
73
+ let breakFlag = false;
74
+ const xNom = BatchLeastSquaresOD.stateToX0_(this.nominal_);
75
+ let weightedRms = Infinity;
76
+ const atwaMatInit = Matrix.zero(6, 6);
77
+ const atwbMatInit = Matrix.zero(6, 1);
78
+ let atwaMat = atwaMatInit;
79
+ for (let iter = 0; iter < maxIter; iter++) {
80
+ atwaMat = atwaMatInit;
81
+ let atwbMat = atwbMatInit;
82
+ this.propagator_ = this.buildPropagator_(xNom, false);
83
+ this.setPropagatorPairs_(xNom);
84
+ let rmsTotal = 0.0;
85
+ let measCount = 0;
86
+ for (const ob of this.observations_) {
87
+ const noise = ob.noise;
88
+ const aMat = ob.jacobian(this.propPairs_);
89
+ const aMatTN = aMat.transpose().multiply(noise);
90
+ const bMat = ob.residual(this.propagator_);
91
+ atwaMat = atwaMat.add(aMatTN.multiply(aMat));
92
+ atwbMat = atwbMat.add(aMatTN.multiply(bMat));
93
+ rmsTotal += bMat.transpose().multiply(noise).multiply(bMat)[0][0];
94
+ measCount += noise.rows;
95
+ }
96
+ const newWeightedRms = Math.sqrt(rmsTotal / measCount);
97
+ if (printIter) {
98
+ // eslint-disable-next-line no-console
99
+ console.log(`${iter + 1}: rms=${newWeightedRms} x=${new Vector(xNom)}`);
100
+ }
101
+ if (Math.abs((weightedRms - newWeightedRms) / weightedRms) <= tolerance) {
102
+ breakFlag = true;
103
+ }
104
+ weightedRms = newWeightedRms;
105
+ const dX = atwaMat.inverse().multiply(atwbMat);
106
+ for (let i = 0; i < 6; i++) {
107
+ xNom[i] += dX[i][0];
108
+ }
109
+ if (breakFlag) {
110
+ break;
111
+ }
112
+ }
113
+ const p = atwaMat.inverse();
114
+ const covariance = new StateCovariance(p, CovarianceFrame.ECI);
115
+ return new BatchLeastSquaresResult(this.buildPropagator_(xNom, false).propagate(this.start_), covariance, weightedRms);
116
+ }
117
+ }
118
+ //# sourceMappingURL=BatchLeastSquaresOD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BatchLeastSquaresOD.js","sourceRoot":"","sources":["../../src/orbit_determination/BatchLeastSquaresOD.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAY,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,E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KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EACzD,UAAU,EACV,WAAW,CACZ,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { J2000 } from 'ootk-core';
19
+ import { StateCovariance } from './../covariance/StateCovariance';
20
+ export declare class BatchLeastSquaresResult {
21
+ state: J2000;
22
+ covariance: StateCovariance;
23
+ rms: number;
24
+ /**
25
+ * Create a new [BatchLeastSquaresResult] object, containing the solved
26
+ * [state], [covariance], and root-mean-squared error [rms].
27
+ */
28
+ constructor(state: J2000, covariance: StateCovariance, rms: number);
29
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ // / Batch least squares orbit determination result.
19
+ export class BatchLeastSquaresResult {
20
+ /**
21
+ * Create a new [BatchLeastSquaresResult] object, containing the solved
22
+ * [state], [covariance], and root-mean-squared error [rms].
23
+ */
24
+ constructor(state, covariance, rms) {
25
+ this.state = state;
26
+ this.covariance = covariance;
27
+ this.rms = rms;
28
+ // Nothing to do here.
29
+ }
30
+ }
31
+ //# sourceMappingURL=BatchLeastSquaresResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BatchLeastSquaresResult.js","sourceRoot":"","sources":["../../src/orbit_determination/BatchLeastSquaresResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,oDAAoD;AACpD,MAAM,OAAO,uBAAuB;IAClC;;;OAGG;IACH,YAAmB,KAAY,EAAS,UAA2B,EAAS,GAAW;QAApE,UAAK,GAAL,KAAK,CAAO;QAAS,eAAU,GAAV,UAAU,CAAiB;QAAS,QAAG,GAAH,GAAG,CAAQ;QACrF,sBAAsB;IACxB,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { EpochUTC, J2000, Vector3D } from 'ootk-core';
19
+ /**
20
+ * Gibbs 3-position inital orbit determination.
21
+ */
22
+ export declare class GibbsIOD {
23
+ mu: number;
24
+ constructor(mu?: number);
25
+ /** Abort solve if position plane exceeds this value. */
26
+ private static readonly coplanarThreshold_;
27
+ /**
28
+ * Attempt to create a state estimate from three inertial position vectors.
29
+ *
30
+ * Throws an error if the positions are not coplanar.
31
+ */
32
+ solve(r1: Vector3D, r2: Vector3D, r3: Vector3D, t2: EpochUTC, t3: EpochUTC): J2000;
33
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { DEG2RAD, Earth, halfPi, J2000 } from 'ootk-core';
19
+ import { ForceModel } from './../force/ForceModel';
20
+ import { RungeKutta89Propagator } from './../propagator/RungeKutta89Propagator';
21
+ /**
22
+ * Gibbs 3-position inital orbit determination.
23
+ */
24
+ export class GibbsIOD {
25
+ constructor(mu = Earth.mu) {
26
+ this.mu = mu;
27
+ // Nothing to do here.
28
+ }
29
+ /**
30
+ * Attempt to create a state estimate from three inertial position vectors.
31
+ *
32
+ * Throws an error if the positions are not coplanar.
33
+ */
34
+ solve(r1, r2, r3, t2, t3) {
35
+ const num = r1.normalize().dot(r2.normalize().cross(r3.normalize()));
36
+ const alpha = halfPi - Math.acos(num);
37
+ if (Math.abs(alpha) > GibbsIOD.coplanarThreshold_) {
38
+ throw new Error('Orbits are not coplanar.');
39
+ }
40
+ const r1m = r1.magnitude();
41
+ const r2m = r2.magnitude();
42
+ const r3m = r3.magnitude();
43
+ const d = r1.cross(r2).add(r2.cross(r3).add(r3.cross(r1)));
44
+ const n = r2.cross(r3).scale(r1m).add(r3.cross(r1).scale(r2m)).add(r1.cross(r2).scale(r3m));
45
+ const b = d.cross(r2);
46
+ const s = r1.scale(r2m - r3m).add(r2.scale(r3m - r1m).add(r3.scale(r1m - r2m)));
47
+ const nm = n.magnitude();
48
+ const dm = d.magnitude();
49
+ const vm = Math.sqrt(this.mu / (nm * dm));
50
+ const vlEci = b.scale(vm / r2m).add(s.scale(vm));
51
+ const pv = new J2000(t2, r2, vlEci);
52
+ const forceModel = new ForceModel().setGravity(this.mu);
53
+ const orbit = new RungeKutta89Propagator(pv, forceModel);
54
+ const pv2 = new J2000(t2, r2, vlEci.negate());
55
+ const orbit2 = new RungeKutta89Propagator(pv2, forceModel);
56
+ const estP3 = orbit.propagate(t3).position;
57
+ const dist = estP3.subtract(r3).magnitude();
58
+ const estP3b = orbit2.propagate(t3).position;
59
+ const dist2 = estP3b.subtract(r3).magnitude();
60
+ if (dist <= dist2) {
61
+ orbit.reset();
62
+ return orbit.propagate(t2);
63
+ }
64
+ orbit2.reset();
65
+ return orbit2.propagate(t2);
66
+ }
67
+ }
68
+ /** Abort solve if position plane exceeds this value. */
69
+ GibbsIOD.coplanarThreshold_ = (5.0 * DEG2RAD);
70
+ //# sourceMappingURL=GibbsIOD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GibbsIOD.js","sourceRoot":"","sources":["../../src/orbit_determination/GibbsIOD.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,EAAE,KAAK,EAAqB,MAAM,W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AC,EAAE,CAAC,CAAC,QAAQ,CAAC;QAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC;QAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAE9C,IAAI,IAAI,IAAI,KAAK,EAAE;YACjB,KAAK,CAAC,KAAK,EAAE,CAAC;YAEd,OAAO,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SAC5B;QACD,MAAM,CAAC,KAAK,EAAE,CAAC;QAEf,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;;AApDD,wDAAwD;AAChC,2BAAkB,GAAY,CAAC,GAAG,GAAG,OAAO,CAAY,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ *
4
+ * @license AGPL-3.0-or-later
5
+ * @Copyright (c) 2020-2024 Theodore Kruczek
6
+ *
7
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
8
+ * terms of the GNU Affero General Public License as published by the Free Software
9
+ * Foundation, either version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ * See the GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along with
16
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { J2000 } from 'ootk-core';
19
+ import { ObservationOptical } from './../observation/ObservationOptical';
20
+ /**
21
+ * Gooding angles-only initial orbit determination.
22
+ *
23
+ * Used for orbit determination from three optical observations.
24
+ */
25
+ export declare class GoodingIOD {
26
+ private readonly _mu;
27
+ private readonly _o1;
28
+ private readonly _o2;
29
+ private readonly _o3;
30
+ private _vObserverPosition1;
31
+ private _vObserverPosition2;
32
+ private _vObserverPosition3;
33
+ private _r;
34
+ private _v;
35
+ private _t;
36
+ private _r1;
37
+ private _r2;
38
+ private _r3;
39
+ private _rho1;
40
+ private _rho2;
41
+ private _rho3;
42
+ private _d1;
43
+ private _d3;
44
+ private _facFiniteDiff;
45
+ private readonly _forceModel;
46
+ constructor(o1: ObservationOptical, o2: ObservationOptical, o3: ObservationOptical, mu?: number);
47
+ private _getPositionOnLoS2;
48
+ private _modifyIterate;
49
+ private _computeDerivatives;
50
+ solve(r1Init: number, r3Init: number, nRev?: number, direction?: boolean): J2000;
51
+ private _solveRangeProblem;
52
+ }