ootk 3.0.0 → 4.0.0-1

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 (357) hide show
  1. package/CHANGELOG.md +235 -10
  2. package/README.md +27 -40
  3. package/dist/coordinate/Hill.d.ts +49 -0
  4. package/dist/coordinate/Hill.js +222 -0
  5. package/dist/coordinate/Hill.js.map +1 -0
  6. package/dist/coordinate/index.d.ts +1 -0
  7. package/dist/coordinate/index.js +2 -0
  8. package/dist/coordinate/index.js.map +1 -0
  9. package/dist/covariance/CovarianceSample.d.ts +43 -0
  10. package/dist/covariance/CovarianceSample.js +147 -0
  11. package/dist/covariance/CovarianceSample.js.map +1 -0
  12. package/dist/covariance/StateCovariance.d.ts +42 -0
  13. package/dist/covariance/StateCovariance.js +65 -0
  14. package/dist/covariance/StateCovariance.js.map +1 -0
  15. package/dist/force/AtmosphericDrag.d.ts +31 -0
  16. package/dist/force/AtmosphericDrag.js +73 -0
  17. package/dist/force/AtmosphericDrag.js.map +1 -0
  18. package/dist/force/EarthGravity.d.ts +27 -0
  19. package/dist/force/EarthGravity.js +117 -0
  20. package/dist/force/EarthGravity.js.map +1 -0
  21. package/{lib/ootk.d.ts → dist/force/Force.d.ts} +12 -11
  22. package/dist/force/Force.js +31 -0
  23. package/dist/force/Force.js.map +1 -0
  24. package/dist/force/ForceModel.d.ts +37 -0
  25. package/dist/force/ForceModel.js +75 -0
  26. package/dist/force/ForceModel.js.map +1 -0
  27. package/dist/force/Gravity.d.ts +38 -0
  28. package/dist/force/Gravity.js +47 -0
  29. package/dist/force/Gravity.js.map +1 -0
  30. package/dist/{ootk.d.ts → force/SolarRadiationPressure.d.ts} +12 -11
  31. package/dist/force/SolarRadiationPressure.js +44 -0
  32. package/dist/force/SolarRadiationPressure.js.map +1 -0
  33. package/dist/force/ThirdBodyGravity.d.ts +26 -0
  34. package/dist/force/ThirdBodyGravity.js +57 -0
  35. package/dist/force/ThirdBodyGravity.js.map +1 -0
  36. package/dist/force/Thrust.d.ts +34 -0
  37. package/dist/force/Thrust.js +58 -0
  38. package/dist/force/Thrust.js.map +1 -0
  39. package/dist/interfaces/RfSensorParams.d.ts +28 -0
  40. package/dist/interfaces/RfSensorParams.js +24 -0
  41. package/dist/interfaces/RfSensorParams.js.map +1 -0
  42. package/dist/interfaces/index.d.ts +1 -0
  43. package/dist/interfaces/index.js +2 -0
  44. package/dist/interfaces/index.js.map +1 -0
  45. package/dist/interpolator/ChebyshevCoefficients.d.ts +50 -0
  46. package/dist/interpolator/ChebyshevCoefficients.js +94 -0
  47. package/dist/interpolator/ChebyshevCoefficients.js.map +1 -0
  48. package/dist/interpolator/ChebyshevInterpolator.d.ts +38 -0
  49. package/dist/interpolator/ChebyshevInterpolator.js +71 -0
  50. package/dist/interpolator/ChebyshevInterpolator.js.map +1 -0
  51. package/dist/interpolator/CubicSpline.d.ts +35 -0
  52. package/dist/interpolator/CubicSpline.js +69 -0
  53. package/dist/interpolator/CubicSpline.js.map +1 -0
  54. package/dist/interpolator/CubicSplineInterpolator.d.ts +36 -0
  55. package/dist/interpolator/CubicSplineInterpolator.js +80 -0
  56. package/dist/interpolator/CubicSplineInterpolator.js.map +1 -0
  57. package/dist/interpolator/FieldInterpolator.d.ts +28 -0
  58. package/dist/interpolator/FieldInterpolator.js +34 -0
  59. package/dist/interpolator/FieldInterpolator.js.map +1 -0
  60. package/dist/interpolator/Interpolator.d.ts +22 -0
  61. package/dist/interpolator/Interpolator.js +47 -0
  62. package/dist/interpolator/Interpolator.js.map +1 -0
  63. package/dist/interpolator/LagrangeInterpolator.d.ts +40 -0
  64. package/dist/interpolator/LagrangeInterpolator.js +159 -0
  65. package/dist/interpolator/LagrangeInterpolator.js.map +1 -0
  66. package/dist/interpolator/StateInterpolator.d.ts +27 -0
  67. package/dist/interpolator/StateInterpolator.js +35 -0
  68. package/dist/interpolator/StateInterpolator.js.map +1 -0
  69. package/dist/interpolator/VerletBlendInterpolator.d.ts +43 -0
  70. package/dist/interpolator/VerletBlendInterpolator.js +118 -0
  71. package/dist/interpolator/VerletBlendInterpolator.js.map +1 -0
  72. package/{lib/ootk.js → dist/main.d.ts} +13 -10
  73. package/dist/{objects/space-object.d.ts → main.js} +17 -23
  74. package/dist/main.js.map +1 -0
  75. package/dist/maneuver/TwoBurnOrbitTransfer.d.ts +41 -0
  76. package/dist/maneuver/TwoBurnOrbitTransfer.js +65 -0
  77. package/dist/maneuver/TwoBurnOrbitTransfer.js.map +1 -0
  78. package/dist/maneuver/Waypoint.d.ts +91 -0
  79. package/dist/maneuver/Waypoint.js +179 -0
  80. package/dist/maneuver/Waypoint.js.map +1 -0
  81. package/{lib/objects/detailed-sat.d.ts → dist/objects/DetailedSatellite.d.ts} +40 -36
  82. package/dist/objects/DetailedSatellite.js +136 -0
  83. package/dist/objects/DetailedSatellite.js.map +1 -0
  84. package/dist/objects/DetailedSensor.d.ts +42 -0
  85. package/dist/objects/DetailedSensor.js +65 -0
  86. package/dist/objects/DetailedSensor.js.map +1 -0
  87. package/dist/objects/LandObject.d.ts +33 -0
  88. package/dist/objects/LandObject.js +34 -0
  89. package/dist/objects/LandObject.js.map +1 -0
  90. package/dist/objects/Marker.d.ts +20 -0
  91. package/dist/objects/Marker.js +24 -0
  92. package/dist/objects/Marker.js.map +1 -0
  93. package/dist/objects/RfSensor.d.ts +41 -0
  94. package/dist/objects/RfSensor.js +67 -0
  95. package/dist/objects/RfSensor.js.map +1 -0
  96. package/dist/objects/index.d.ts +5 -4
  97. package/dist/objects/index.js +6 -0
  98. package/dist/objects/index.js.map +1 -0
  99. package/dist/observation/Observation.d.ts +89 -0
  100. package/dist/observation/Observation.js +102 -0
  101. package/dist/observation/Observation.js.map +1 -0
  102. package/dist/observation/ObservationOptical.d.ts +48 -0
  103. package/dist/observation/ObservationOptical.js +105 -0
  104. package/dist/observation/ObservationOptical.js.map +1 -0
  105. package/dist/observation/ObservationRadar.d.ts +46 -0
  106. package/dist/observation/ObservationRadar.js +96 -0
  107. package/dist/observation/ObservationRadar.js.map +1 -0
  108. package/dist/observation/ObservationUtils.d.ts +20 -0
  109. package/dist/observation/ObservationUtils.js +32 -0
  110. package/dist/observation/ObservationUtils.js.map +1 -0
  111. package/dist/observation/PropagatorPairs.d.ts +32 -0
  112. package/dist/observation/PropagatorPairs.js +43 -0
  113. package/dist/observation/PropagatorPairs.js.map +1 -0
  114. package/dist/operations/BoxMuller.d.ts +46 -0
  115. package/dist/operations/BoxMuller.js +77 -0
  116. package/dist/operations/BoxMuller.js.map +1 -0
  117. package/dist/operations/EulerAngles.d.ts +105 -0
  118. package/dist/operations/EulerAngles.js +161 -0
  119. package/dist/operations/EulerAngles.js.map +1 -0
  120. package/dist/operations/Quaternion.d.ts +56 -0
  121. package/dist/operations/Quaternion.js +167 -0
  122. package/dist/operations/Quaternion.js.map +1 -0
  123. package/dist/operations/RandomGaussianSource.d.ts +24 -0
  124. package/dist/operations/RandomGaussianSource.js +43 -0
  125. package/dist/operations/RandomGaussianSource.js.map +1 -0
  126. package/dist/operations/index.d.ts +4 -0
  127. package/dist/operations/index.js +5 -0
  128. package/dist/operations/index.js.map +1 -0
  129. package/dist/optimize/ChebyshevCompressor.d.ts +32 -0
  130. package/dist/optimize/ChebyshevCompressor.js +83 -0
  131. package/dist/optimize/ChebyshevCompressor.js.map +1 -0
  132. package/dist/optimize/DownhillSimplex.d.ts +64 -0
  133. package/dist/optimize/DownhillSimplex.js +182 -0
  134. package/dist/optimize/DownhillSimplex.js.map +1 -0
  135. package/dist/optimize/GoldenSection.d.ts +39 -0
  136. package/dist/optimize/GoldenSection.js +55 -0
  137. package/dist/optimize/GoldenSection.js.map +1 -0
  138. package/dist/optimize/PolynomialRegression.d.ts +49 -0
  139. package/dist/optimize/PolynomialRegression.js +83 -0
  140. package/dist/optimize/PolynomialRegression.js.map +1 -0
  141. package/dist/optimize/PolynomicalRegressionResult.d.ts +31 -0
  142. package/dist/optimize/PolynomicalRegressionResult.js +38 -0
  143. package/dist/optimize/PolynomicalRegressionResult.js.map +1 -0
  144. package/dist/optimize/SimpleLinearRegression.d.ts +44 -0
  145. package/dist/optimize/SimpleLinearRegression.js +112 -0
  146. package/dist/optimize/SimpleLinearRegression.js.map +1 -0
  147. package/dist/optimize/SimplexEntry.d.ts +32 -0
  148. package/dist/optimize/SimplexEntry.js +42 -0
  149. package/dist/optimize/SimplexEntry.js.map +1 -0
  150. package/dist/orbit_determination/BatchLeastSquaresOD.d.ts +65 -0
  151. package/dist/orbit_determination/BatchLeastSquaresOD.js +143 -0
  152. package/dist/orbit_determination/BatchLeastSquaresOD.js.map +1 -0
  153. package/dist/orbit_determination/BatchLeastSquaresResult.d.ts +31 -0
  154. package/{lib/objects/space-object.d.ts → dist/orbit_determination/BatchLeastSquaresResult.js} +21 -23
  155. package/dist/orbit_determination/BatchLeastSquaresResult.js.map +1 -0
  156. package/dist/orbit_determination/GibbsIOD.d.ts +38 -0
  157. package/dist/orbit_determination/GibbsIOD.js +76 -0
  158. package/dist/orbit_determination/GibbsIOD.js.map +1 -0
  159. package/dist/orbit_determination/GoodingIOD.d.ts +51 -0
  160. package/dist/orbit_determination/GoodingIOD.js +247 -0
  161. package/dist/orbit_determination/GoodingIOD.js.map +1 -0
  162. package/dist/orbit_determination/HerrickGibbsIOD.d.ts +33 -0
  163. package/dist/orbit_determination/HerrickGibbsIOD.js +50 -0
  164. package/dist/orbit_determination/HerrickGibbsIOD.js.map +1 -0
  165. package/dist/orbit_determination/LambertIOD.d.ts +59 -0
  166. package/dist/orbit_determination/LambertIOD.js +213 -0
  167. package/dist/orbit_determination/LambertIOD.js.map +1 -0
  168. package/dist/orbit_determination/ModifiedGoodingIOD.d.ts +40 -0
  169. package/dist/orbit_determination/ModifiedGoodingIOD.js +83 -0
  170. package/dist/orbit_determination/ModifiedGoodingIOD.js.map +1 -0
  171. package/dist/propagator/DormandPrince54Propagator.d.ts +28 -0
  172. package/dist/propagator/DormandPrince54Propagator.js +64 -0
  173. package/dist/propagator/DormandPrince54Propagator.js.map +1 -0
  174. package/dist/propagator/KeplerPropagator.d.ts +35 -0
  175. package/dist/propagator/KeplerPropagator.js +84 -0
  176. package/dist/propagator/KeplerPropagator.js.map +1 -0
  177. package/dist/propagator/Propagator.d.ts +34 -0
  178. package/dist/propagator/Propagator.js +162 -0
  179. package/dist/propagator/Propagator.js.map +1 -0
  180. package/dist/propagator/RkCheckpoint.d.ts +22 -0
  181. package/dist/propagator/RkCheckpoint.js +27 -0
  182. package/dist/propagator/RkCheckpoint.js.map +1 -0
  183. package/dist/propagator/RkResult.d.ts +23 -0
  184. package/dist/propagator/RkResult.js +30 -0
  185. package/dist/propagator/RkResult.js.map +1 -0
  186. package/dist/propagator/RungeKutta4Propagator.d.ts +50 -0
  187. package/dist/propagator/RungeKutta4Propagator.js +141 -0
  188. package/dist/propagator/RungeKutta4Propagator.js.map +1 -0
  189. package/dist/propagator/RungeKutta89Propagator.d.ts +28 -0
  190. package/dist/propagator/RungeKutta89Propagator.js +126 -0
  191. package/dist/propagator/RungeKutta89Propagator.js.map +1 -0
  192. package/dist/propagator/RungeKuttaAdaptive.d.ts +54 -0
  193. package/dist/propagator/RungeKuttaAdaptive.js +159 -0
  194. package/dist/propagator/RungeKuttaAdaptive.js.map +1 -0
  195. package/dist/propagator/Sgp4Propagator.d.ts +34 -0
  196. package/dist/propagator/Sgp4Propagator.js +56 -0
  197. package/dist/propagator/Sgp4Propagator.js.map +1 -0
  198. package/dist/smoothing/ExponentialSmoothing.d.ts +23 -0
  199. package/dist/smoothing/ExponentialSmoothing.js +81 -0
  200. package/dist/smoothing/ExponentialSmoothing.js.map +1 -0
  201. package/dist/transforms/index.d.ts +1 -0
  202. package/dist/transforms/index.js +2 -0
  203. package/dist/transforms/index.js.map +1 -0
  204. package/dist/transforms/transforms.d.ts +56 -92
  205. package/dist/transforms/transforms.js +94 -0
  206. package/dist/transforms/transforms.js.map +1 -0
  207. package/dist/types/types.d.ts +105 -584
  208. package/dist/types/types.js +23 -0
  209. package/dist/types/types.js.map +1 -0
  210. package/dist/utils/index.d.ts +1 -0
  211. package/dist/utils/index.js +2 -0
  212. package/dist/utils/index.js.map +1 -0
  213. package/dist/utils/jacobian.d.ts +11 -0
  214. package/dist/utils/jacobian.js +29 -0
  215. package/dist/utils/jacobian.js.map +1 -0
  216. package/package.json +34 -42
  217. package/src/coordinate/Hill.ts +326 -0
  218. package/src/coordinate/index.ts +1 -0
  219. package/src/covariance/CovarianceSample.ts +194 -0
  220. package/src/covariance/StateCovariance.ts +69 -0
  221. package/src/force/AtmosphericDrag.ts +101 -0
  222. package/src/force/EarthGravity.ts +157 -0
  223. package/src/force/Force.ts +33 -0
  224. package/src/force/ForceModel.ts +91 -0
  225. package/src/force/Gravity.ts +53 -0
  226. package/src/force/SolarRadiationPressure.ts +42 -0
  227. package/src/force/ThirdBodyGravity.ts +62 -0
  228. package/src/force/Thrust.ts +83 -0
  229. package/src/interfaces/RfSensorParams.ts +30 -0
  230. package/src/interfaces/index.ts +1 -0
  231. package/src/interpolator/ChebyshevCoefficients.ts +109 -0
  232. package/src/interpolator/ChebyshevInterpolator.ts +87 -0
  233. package/src/interpolator/CubicSpline.ts +72 -0
  234. package/src/interpolator/CubicSplineInterpolator.ts +90 -0
  235. package/src/interpolator/FieldInterpolator.ts +37 -0
  236. package/src/interpolator/Interpolator.ts +56 -0
  237. package/src/interpolator/LagrangeInterpolator.ts +192 -0
  238. package/src/interpolator/StateInterpolator.ts +39 -0
  239. package/src/interpolator/VerletBlendInterpolator.ts +146 -0
  240. package/src/main.ts +32 -0
  241. package/src/maneuver/TwoBurnOrbitTransfer.ts +79 -0
  242. package/src/maneuver/Waypoint.ts +267 -0
  243. package/src/objects/DetailedSatellite.ts +159 -0
  244. package/src/objects/DetailedSensor.ts +68 -0
  245. package/src/objects/LandObject.ts +46 -0
  246. package/src/objects/Marker.ts +25 -0
  247. package/src/objects/RfSensor.ts +78 -0
  248. package/src/objects/index.ts +5 -0
  249. package/src/observation/Observation.ts +125 -0
  250. package/src/observation/ObservationOptical.ts +146 -0
  251. package/src/observation/ObservationRadar.ts +131 -0
  252. package/src/observation/ObservationUtils.ts +40 -0
  253. package/src/observation/PropagatorPairs.ts +45 -0
  254. package/src/operations/BoxMuller.ts +87 -0
  255. package/src/operations/EulerAngles.ts +183 -0
  256. package/src/operations/Quaternion.ts +222 -0
  257. package/src/operations/RandomGaussianSource.ts +51 -0
  258. package/src/operations/index.ts +4 -0
  259. package/src/optimize/ChebyshevCompressor.ts +96 -0
  260. package/src/optimize/DownhillSimplex.ts +212 -0
  261. package/src/optimize/GoldenSection.ts +71 -0
  262. package/src/optimize/PolynomialRegression.ts +109 -0
  263. package/src/optimize/PolynomicalRegressionResult.ts +32 -0
  264. package/src/optimize/SimpleLinearRegression.ts +127 -0
  265. package/src/optimize/SimplexEntry.ts +50 -0
  266. package/src/orbit_determination/BatchLeastSquaresOD.ts +174 -0
  267. package/src/orbit_determination/BatchLeastSquaresResult.ts +33 -0
  268. package/src/orbit_determination/GibbsIOD.ts +95 -0
  269. package/src/orbit_determination/GoodingIOD.ts +380 -0
  270. package/src/orbit_determination/HerrickGibbsIOD.ts +51 -0
  271. package/src/orbit_determination/LambertIOD.ts +260 -0
  272. package/src/orbit_determination/ModifiedGoodingIOD.ts +133 -0
  273. package/src/propagator/DormandPrince54Propagator.ts +73 -0
  274. package/src/propagator/KeplerPropagator.ts +102 -0
  275. package/src/propagator/Propagator.ts +253 -0
  276. package/src/propagator/RkCheckpoint.ts +25 -0
  277. package/src/propagator/RkResult.ts +26 -0
  278. package/src/propagator/RungeKutta4Propagator.ts +179 -0
  279. package/src/propagator/RungeKutta89Propagator.ts +132 -0
  280. package/src/propagator/RungeKuttaAdaptive.ts +232 -0
  281. package/src/propagator/Sgp4Propagator.ts +71 -0
  282. package/src/smoothing/ExponentialSmoothing.ts +90 -0
  283. package/src/transforms/index.ts +1 -0
  284. package/src/transforms/transforms.ts +117 -0
  285. package/src/types/types.ts +135 -0
  286. package/src/utils/index.ts +1 -0
  287. package/src/utils/jacobian.ts +38 -0
  288. package/.eslintrc.json +0 -244
  289. package/.prettierrc +0 -17
  290. package/babel.config.js +0 -16
  291. package/codecov.yml +0 -21
  292. package/dist/objects/base-object.d.ts +0 -40
  293. package/dist/objects/detailed-sat.d.ts +0 -66
  294. package/dist/objects/sat.d.ts +0 -92
  295. package/dist/objects/sensor.d.ts +0 -93
  296. package/dist/objects/star.d.ts +0 -46
  297. package/dist/ootk.js +0 -2
  298. package/dist/ootk.js.LICENSE.txt +0 -77
  299. package/dist/sgp4/sgp4.d.ts +0 -82
  300. package/dist/tle/tle-format-data.d.ts +0 -6
  301. package/dist/tle/tle.d.ts +0 -375
  302. package/dist/utils/constants.d.ts +0 -34
  303. package/dist/utils/moon-math.d.ts +0 -113
  304. package/dist/utils/sun-math.d.ts +0 -230
  305. package/dist/utils/utils.d.ts +0 -39
  306. package/jest.config.ts +0 -30
  307. package/lib/objects/base-object.d.ts +0 -40
  308. package/lib/objects/base-object.js +0 -79
  309. package/lib/objects/base-object.js.map +0 -1
  310. package/lib/objects/detailed-sat.js +0 -149
  311. package/lib/objects/detailed-sat.js.map +0 -1
  312. package/lib/objects/index.d.ts +0 -4
  313. package/lib/objects/index.js +0 -5
  314. package/lib/objects/index.js.map +0 -1
  315. package/lib/objects/sat.d.ts +0 -92
  316. package/lib/objects/sat.js +0 -188
  317. package/lib/objects/sat.js.map +0 -1
  318. package/lib/objects/sensor.d.ts +0 -93
  319. package/lib/objects/sensor.js +0 -273
  320. package/lib/objects/sensor.js.map +0 -1
  321. package/lib/objects/space-object.js +0 -60
  322. package/lib/objects/space-object.js.map +0 -1
  323. package/lib/objects/star.d.ts +0 -46
  324. package/lib/objects/star.js +0 -91
  325. package/lib/objects/star.js.map +0 -1
  326. package/lib/ootk.js.map +0 -1
  327. package/lib/sgp4/sgp4.d.ts +0 -82
  328. package/lib/sgp4/sgp4.js +0 -3262
  329. package/lib/sgp4/sgp4.js.map +0 -1
  330. package/lib/tle/tle-format-data.d.ts +0 -6
  331. package/lib/tle/tle-format-data.js +0 -10
  332. package/lib/tle/tle-format-data.js.map +0 -1
  333. package/lib/tle/tle.d.ts +0 -375
  334. package/lib/tle/tle.js +0 -611
  335. package/lib/tle/tle.js.map +0 -1
  336. package/lib/transforms/transforms.d.ts +0 -94
  337. package/lib/transforms/transforms.js +0 -308
  338. package/lib/transforms/transforms.js.map +0 -1
  339. package/lib/types/types.d.ts +0 -605
  340. package/lib/types/types.js +0 -36
  341. package/lib/types/types.js.map +0 -1
  342. package/lib/utils/constants.d.ts +0 -34
  343. package/lib/utils/constants.js +0 -35
  344. package/lib/utils/constants.js.map +0 -1
  345. package/lib/utils/moon-math.d.ts +0 -113
  346. package/lib/utils/moon-math.js +0 -387
  347. package/lib/utils/moon-math.js.map +0 -1
  348. package/lib/utils/sun-math.d.ts +0 -230
  349. package/lib/utils/sun-math.js +0 -422
  350. package/lib/utils/sun-math.js.map +0 -1
  351. package/lib/utils/utils.d.ts +0 -39
  352. package/lib/utils/utils.js +0 -102
  353. package/lib/utils/utils.js.map +0 -1
  354. package/sandbox.html +0 -8
  355. package/tsconfig.base.json +0 -31
  356. package/tsconfig.build.json +0 -14
  357. /package/{LICENSE.MD → LICENSE.md} +0 -0
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ * @license AGPL-3.0-or-later
4
+ * @copyright (c) 2020-2024 Theodore Kruczek
5
+ *
6
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
7
+ * terms of the GNU Affero General Public License as published by the Free Software
8
+ * Foundation, either version 3 of the License, or (at your option) any later version.
9
+ *
10
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ * See the GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License along with
15
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ import { concat, EpochUTC, J2000, Kilometers, KilometersPerSecond, Matrix, Vector, Vector3D } from 'ootk-core';
19
+ import { Observation } from '../observation/Observation';
20
+ import { PropagatorPairs } from '../observation/PropagatorPairs';
21
+ import { Propagator } from '../propagator/Propagator';
22
+ import { CovarianceFrame, StateCovariance } from './../covariance/StateCovariance';
23
+ import { ForceModel } from './../force/ForceModel';
24
+ import { KeplerPropagator } from './../propagator/KeplerPropagator';
25
+ import { RungeKutta89Propagator } from './../propagator/RungeKutta89Propagator';
26
+ import { BatchLeastSquaresResult } from './BatchLeastSquaresResult';
27
+
28
+ /**
29
+ * Batch least squares orbit determination.
30
+ */
31
+ export class BatchLeastSquaresOD {
32
+ // / Propagator pair cache, for generating observation Jacobians.
33
+ private propPairs_: PropagatorPairs;
34
+ // / Nominal state propagator.
35
+ private propagator_: Propagator;
36
+ // / State estimate during solve.
37
+ private nominal_: J2000;
38
+ // / Solve start epoch.
39
+ private start_: EpochUTC;
40
+
41
+ /**
42
+ * Create a new [BatchLeastSquaresOD] object from a list of [Observation]
43
+ * objects, an [apriori] state estimate, and an optional
44
+ * spacecraft [forceModel].
45
+ * @param observations_ List of observations.
46
+ * @param apriori_ Apriori state estimate.
47
+ * @param forceModel_ Spacecraft force model.
48
+ * @param posStep_ Position step size.
49
+ * @param velStep_ Velocity step size.
50
+ * @param fastDerivatives_ Use fast derivatives.
51
+ * @returns [BatchLeastSquaresOD] object.
52
+ */
53
+ constructor(
54
+ private observations_: Observation[],
55
+ private apriori_: J2000,
56
+ private forceModel_?: ForceModel,
57
+ private posStep_: number = 1e-5,
58
+ private velStep_: number = 1e-5,
59
+ private fastDerivatives_: boolean = false,
60
+ ) {
61
+ this.observations_.sort((a, b) => a.epoch.posix - b.epoch.posix);
62
+ this.start_ = this.observations_[0].epoch;
63
+ this.propPairs_ = new PropagatorPairs(this.posStep_, this.velStep_);
64
+ this.forceModel_ ??= new ForceModel().setGravity();
65
+ this.propagator_ = new RungeKutta89Propagator(this.apriori_, this.forceModel_);
66
+ this.nominal_ = this.propagator_.propagate(this.start_);
67
+ }
68
+
69
+ private buildPropagator_(x0: Float64Array, simple: boolean): Propagator {
70
+ const state = new J2000(
71
+ this.nominal_.epoch,
72
+ new Vector3D(x0[0] as Kilometers, x0[1] as Kilometers, x0[2] as Kilometers),
73
+ new Vector3D(x0[3] as KilometersPerSecond, x0[4] as KilometersPerSecond, x0[5] as KilometersPerSecond),
74
+ );
75
+
76
+ if (simple) {
77
+ return new KeplerPropagator(state.toClassicalElements());
78
+ }
79
+
80
+ return new RungeKutta89Propagator(state, this.forceModel_);
81
+ }
82
+
83
+ private static stateToX0_(state: J2000): Float64Array {
84
+ return concat(state.position.toArray(), state.velocity.toArray());
85
+ }
86
+
87
+ private setPropagatorPairs_(x0: Float64Array): void {
88
+ const pl = this.buildPropagator_(x0, this.fastDerivatives_);
89
+
90
+ for (let i = 0; i < 6; i++) {
91
+ const step = this.propPairs_.step(i);
92
+ const xh = x0.slice();
93
+
94
+ xh[i] += step;
95
+ const ph = this.buildPropagator_(xh, this.fastDerivatives_);
96
+
97
+ this.propPairs_.set(i, ph, pl);
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Attempt to solve a state estimate with the given root-mean-squared delta
103
+ * [tolerance].
104
+ * @param root0 Root initial guess.
105
+ * @param root0.tolerance Root-mean-squared delta tolerance.
106
+ * @param root0.maxIter Maximum number of iterations.
107
+ * @param root0.printIter Print iterations.
108
+ * @returns [BatchLeastSquaresResult] object.
109
+ */
110
+ solve({
111
+ tolerance = 1e-3,
112
+ maxIter = 250,
113
+ printIter = false,
114
+ }: {
115
+ tolerance?: number;
116
+ maxIter?: number;
117
+ printIter?: boolean;
118
+ } = {}): BatchLeastSquaresResult {
119
+ let breakFlag = false;
120
+ const xNom = BatchLeastSquaresOD.stateToX0_(this.nominal_);
121
+ let weightedRms = Infinity;
122
+ const atwaMatInit = Matrix.zero(6, 6);
123
+ const atwbMatInit = Matrix.zero(6, 1);
124
+ let atwaMat = atwaMatInit;
125
+
126
+ for (let iter = 0; iter < maxIter; iter++) {
127
+ atwaMat = atwaMatInit;
128
+ let atwbMat = atwbMatInit;
129
+
130
+ this.propagator_ = this.buildPropagator_(xNom, false);
131
+ this.setPropagatorPairs_(xNom);
132
+ let rmsTotal = 0.0;
133
+ let measCount = 0;
134
+
135
+ for (const ob of this.observations_) {
136
+ const noise = ob.noise;
137
+ const aMat = ob.jacobian(this.propPairs_);
138
+ const aMatTN = aMat.transpose().multiply(noise);
139
+ const bMat = ob.residual(this.propagator_);
140
+
141
+ atwaMat = atwaMat.add(aMatTN.multiply(aMat));
142
+ atwbMat = atwbMat.add(aMatTN.multiply(bMat));
143
+ rmsTotal += bMat.transpose().multiply(noise).multiply(bMat).elements[0][0];
144
+ measCount += noise.rows;
145
+ }
146
+ const newWeightedRms = Math.sqrt(rmsTotal / measCount);
147
+
148
+ if (printIter) {
149
+ // eslint-disable-next-line no-console
150
+ console.log(`${iter + 1}: rms=${newWeightedRms} x=${new Vector(xNom)}`);
151
+ }
152
+ if (Math.abs((weightedRms - newWeightedRms) / weightedRms) <= tolerance) {
153
+ breakFlag = true;
154
+ }
155
+ weightedRms = newWeightedRms;
156
+ const dX = atwaMat.inverse().multiply(atwbMat);
157
+
158
+ for (let i = 0; i < 6; i++) {
159
+ xNom[i] += dX.elements[i][0];
160
+ }
161
+ if (breakFlag) {
162
+ break;
163
+ }
164
+ }
165
+ const p = atwaMat.inverse();
166
+ const covariance = new StateCovariance(p, CovarianceFrame.ECI);
167
+
168
+ return new BatchLeastSquaresResult(
169
+ this.buildPropagator_(xNom, false).propagate(this.start_),
170
+ covariance,
171
+ weightedRms,
172
+ );
173
+ }
174
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ * @license AGPL-3.0-or-later
4
+ * @copyright (c) 2020-2024 Theodore Kruczek
5
+ *
6
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
7
+ * terms of the GNU Affero General Public License as published by the Free Software
8
+ * Foundation, either version 3 of the License, or (at your option) any later version.
9
+ *
10
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ * See the GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License along with
15
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ import { J2000 } from 'ootk-core';
19
+ import { StateCovariance } from './../covariance/StateCovariance';
20
+
21
+ // / Batch least squares orbit determination result.
22
+ export class BatchLeastSquaresResult {
23
+ /**
24
+ * Create a new [BatchLeastSquaresResult] object, containing the solved
25
+ * [state], [covariance], and root-mean-squared error [rms].
26
+ * @param state The solved state.
27
+ * @param covariance The solved covariance.
28
+ * @param rms The root-mean-squared error.
29
+ */
30
+ constructor(public state: J2000, public covariance: StateCovariance, public rms: number) {
31
+ // Nothing to do here.
32
+ }
33
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ * @license AGPL-3.0-or-later
4
+ * @copyright (c) 2020-2024 Theodore Kruczek
5
+ *
6
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
7
+ * terms of the GNU Affero General Public License as published by the Free Software
8
+ * Foundation, either version 3 of the License, or (at your option) any later version.
9
+ *
10
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ * See the GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License along with
15
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ import { DEG2RAD, Earth, EpochUTC, halfPi, J2000, Kilometers, KilometersPerSecond, Radians, Vector3D } from 'ootk-core';
19
+ import { ForceModel } from './../force/ForceModel';
20
+ import { RungeKutta89Propagator } from './../propagator/RungeKutta89Propagator';
21
+
22
+ /**
23
+ * Gibbs 3-position inital orbit determination.
24
+ */
25
+ export class GibbsIOD {
26
+ constructor(public mu: number = Earth.mu) {
27
+ // Nothing to do here.
28
+ }
29
+
30
+ /** Abort solve if position plane exceeds this value. */
31
+ private static readonly coplanarThreshold_: Radians = (5.0 * DEG2RAD) as Radians;
32
+
33
+ /**
34
+ * Attempt to create a state estimate from three inertial position vectors.
35
+ *
36
+ * Throws an error if the positions are not coplanar.
37
+ * @param r1 Position vector 1.
38
+ * @param r2 Position vector 2.
39
+ * @param r3 Position vector 3.
40
+ * @param t2 Time of position 2.
41
+ * @param t3 Time of position 3.
42
+ * @returns State estimate at time t2.
43
+ */
44
+ solve(
45
+ r1: Vector3D<Kilometers>,
46
+ r2: Vector3D<Kilometers>,
47
+ r3: Vector3D<Kilometers>,
48
+ t2: EpochUTC,
49
+ t3: EpochUTC,
50
+ ): J2000 {
51
+ const num = r1.normalize().dot(r2.normalize().cross(r3.normalize()));
52
+ const alpha = halfPi - Math.acos(num);
53
+
54
+ if (Math.abs(alpha) > GibbsIOD.coplanarThreshold_) {
55
+ throw new Error('Orbits are not coplanar.');
56
+ }
57
+
58
+ const r1m = r1.magnitude();
59
+ const r2m = r2.magnitude();
60
+ const r3m = r3.magnitude();
61
+
62
+ const d = r1.cross(r2).add(r2.cross(r3).add(r3.cross(r1)));
63
+ const n = r2.cross(r3).scale(r1m).add(r3.cross(r1).scale(r2m)).add(r1.cross(r2).scale(r3m));
64
+ const b = d.cross(r2);
65
+ const s = r1.scale(r2m - r3m).add(r2.scale(r3m - r1m).add(r3.scale(r1m - r2m)));
66
+
67
+ const nm = n.magnitude();
68
+ const dm = d.magnitude();
69
+
70
+ const vm = Math.sqrt(this.mu / (nm * dm)) as KilometersPerSecond;
71
+ const vlEci = b.scale((vm / r2m) as KilometersPerSecond).add(s.scale(vm));
72
+
73
+ const pv = new J2000(t2, r2, vlEci);
74
+
75
+ const forceModel = new ForceModel().setGravity(this.mu);
76
+ const orbit = new RungeKutta89Propagator(pv, forceModel);
77
+
78
+ const pv2 = new J2000(t2, r2, vlEci.negate());
79
+ const orbit2 = new RungeKutta89Propagator(pv2, forceModel);
80
+
81
+ const estP3 = orbit.propagate(t3).position;
82
+ const dist = estP3.subtract(r3).magnitude();
83
+ const estP3b = orbit2.propagate(t3).position;
84
+ const dist2 = estP3b.subtract(r3).magnitude();
85
+
86
+ if (dist <= dist2) {
87
+ orbit.reset();
88
+
89
+ return orbit.propagate(t2);
90
+ }
91
+ orbit2.reset();
92
+
93
+ return orbit2.propagate(t2);
94
+ }
95
+ }
@@ -0,0 +1,380 @@
1
+ /**
2
+ * @author @thkruz Theodore Kruczek
3
+ * @license AGPL-3.0-or-later
4
+ * @copyright (c) 2020-2024 Theodore Kruczek
5
+ *
6
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
7
+ * terms of the GNU Affero General Public License as published by the Free Software
8
+ * Foundation, either version 3 of the License, or (at your option) any later version.
9
+ *
10
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ * See the GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License along with
15
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ import { Earth, J2000, Kilometers, KilometersPerSecond, Seconds, TAU, Vector3D } from 'ootk-core';
19
+ import { ForceModel } from '../force/ForceModel';
20
+ import { RungeKutta89Propagator } from '../propagator/RungeKutta89Propagator';
21
+ import { ObservationOptical } from './../observation/ObservationOptical';
22
+ import { GibbsIOD } from './GibbsIOD';
23
+ import { LambertIOD } from './LambertIOD';
24
+
25
+ type SolveRangeProblemParams = {
26
+ rho1init: Kilometers;
27
+ rho3init: Kilometers;
28
+ t13: Seconds;
29
+ t12: Seconds;
30
+ nrev: number;
31
+ direction: boolean;
32
+ lineOfSight1: Vector3D<Kilometers>;
33
+ lineOfSight2: Vector3D<Kilometers>;
34
+ lineOfSight3: Vector3D<Kilometers>;
35
+ maxIterations: number;
36
+ };
37
+
38
+ type ComputeDerivativesParams = {
39
+ x: Kilometers;
40
+ y: Kilometers;
41
+ lineOfSight1: Vector3D<Kilometers>;
42
+ lineOfSight3: Vector3D<Kilometers>;
43
+ pin: Vector3D<Kilometers>;
44
+ ein: Vector3D<Kilometers>;
45
+ t13: Seconds
46
+ t12: Seconds;
47
+ nrev: number;
48
+ direction: boolean;
49
+ fd: Float64Array;
50
+ gd: Float64Array;
51
+ };
52
+
53
+ type GetPositionOnLoS2Params = {
54
+ e1: Vector3D<Kilometers>;
55
+ r01: Kilometers;
56
+ e3: Vector3D<Kilometers>;
57
+ r03: Kilometers;
58
+ t13: Seconds;
59
+ t12: Seconds;
60
+ nRev: number;
61
+ posigrade: boolean;
62
+ };
63
+
64
+ /**
65
+ * Gooding angles-only initial orbit determination.
66
+ *
67
+ * Used for orbit determination from three optical observations.
68
+ */
69
+ export class GoodingIOD {
70
+ private readonly _mu: number;
71
+ private readonly o1_: ObservationOptical;
72
+ private readonly o2_: ObservationOptical;
73
+ private readonly o3_: ObservationOptical;
74
+ private vObserverPosition1_ = Vector3D.origin as Vector3D<Kilometers>;
75
+ private vObserverPosition2_ = Vector3D.origin as Vector3D<Kilometers>;
76
+ private vObserverPosition3_ = Vector3D.origin as Vector3D<Kilometers>;
77
+ private r_ = 0.0 as Kilometers;
78
+ private v_ = 0.0;
79
+ private t_ = 0.0;
80
+ private r1_ = 0.0;
81
+ private r2_ = 0.0;
82
+ private r3_ = 0.0;
83
+ private rho1_ = 0.0 as Kilometers;
84
+ private rho2_ = 0.0 as Kilometers;
85
+ private rho3_ = 0.0 as Kilometers;
86
+ private d1_ = 0.0 as Kilometers;
87
+ private d3_ = 0.0 as Kilometers;
88
+ private facFiniteDiff_ = 0.0;
89
+ private readonly _forceModel: ForceModel = new ForceModel().setGravity(1.0);
90
+
91
+ constructor(o1: ObservationOptical, o2: ObservationOptical, o3: ObservationOptical, mu: number = Earth.mu) {
92
+ this._mu = mu;
93
+ this.o1_ = o1;
94
+ this.o2_ = o2;
95
+ this.o3_ = o3;
96
+ }
97
+
98
+ private _getPositionOnLoS2({
99
+ e1,
100
+ r01,
101
+ e3,
102
+ r03,
103
+ t13,
104
+ t12,
105
+ nRev,
106
+ posigrade,
107
+ }: GetPositionOnLoS2Params): Vector3D<Kilometers> | null {
108
+ const p1 = this.vObserverPosition1_.add(e1.scale(r01));
109
+
110
+ this.r1_ = p1.magnitude();
111
+
112
+ const p3 = this.vObserverPosition3_.add(e3.scale(r03));
113
+
114
+ this.r3_ = p3.magnitude();
115
+
116
+ const p13 = p1.cross(p3);
117
+
118
+ let th = Math.atan2(p13.magnitude(), p1.dot(p3));
119
+
120
+ if (!posigrade) {
121
+ th = TAU - th;
122
+ }
123
+
124
+ const v1 = new Float64Array(2);
125
+ const exitflag = LambertIOD.solve(this.r1_, this.r3_, th, t13, nRev, v1);
126
+
127
+ if (exitflag) {
128
+ const pn = p1.cross(p3);
129
+ const pt = pn.cross(p1);
130
+
131
+ let rt = pt.magnitude();
132
+
133
+ if (!posigrade) {
134
+ rt = -rt as Kilometers;
135
+ }
136
+
137
+ const vel1 = p1.scale(v1[0] / this.r1_).add(pt.scale(v1[1] / rt)) as Vector3D<KilometersPerSecond>;
138
+
139
+ const p2 = new RungeKutta89Propagator(new J2000(this.o1_.epoch, p1, vel1), this._forceModel).propagate(
140
+ this.o1_.epoch.roll(t12),
141
+ ).position;
142
+
143
+ return p2;
144
+ }
145
+
146
+ return null;
147
+ }
148
+
149
+ private _modifyIterate(lineOfSight1: Vector3D, lineOfSight3: Vector3D): void {
150
+ const r13 = this.vObserverPosition3_.subtract(this.vObserverPosition1_);
151
+
152
+ this.d1_ = r13.dot(lineOfSight1) as Kilometers;
153
+ this.d3_ = r13.dot(lineOfSight3) as Kilometers;
154
+ const d2 = lineOfSight1.dot(lineOfSight3);
155
+ const d4 = 1.0 - d2 * d2;
156
+
157
+ this.rho1_ = Math.max((this.d1_ - this.d3_ * d2) / d4, 0.0) as Kilometers;
158
+ this.rho3_ = Math.max((this.d1_ * d2 - this.d3_) / d4, 0.0) as Kilometers;
159
+ }
160
+
161
+ private _computeDerivatives({
162
+ x,
163
+ y,
164
+ lineOfSight1,
165
+ lineOfSight3,
166
+ pin,
167
+ ein,
168
+ t13,
169
+ t12,
170
+ nrev,
171
+ direction,
172
+ fd,
173
+ gd,
174
+ }: ComputeDerivativesParams): void {
175
+ const p = pin.normalize();
176
+ const en = ein.normalize();
177
+
178
+ const dx = this.facFiniteDiff_ * x as Kilometers;
179
+ const dy = this.facFiniteDiff_ * y as Kilometers;
180
+
181
+ const cm1 = this._getPositionOnLoS2({
182
+ e1: lineOfSight1,
183
+ r01: x - dx as Kilometers,
184
+ e3: lineOfSight3,
185
+ r03: y,
186
+ t13,
187
+ t12,
188
+ nRev: nrev,
189
+ posigrade: direction,
190
+ })!.subtract(this.vObserverPosition2_);
191
+
192
+ const fm1 = p.dot(cm1);
193
+ const gm1 = en.dot(cm1);
194
+
195
+ const cp1 = this._getPositionOnLoS2({
196
+ e1: lineOfSight1,
197
+ r01: x + dx as Kilometers,
198
+ e3: lineOfSight3,
199
+ r03: y,
200
+ t13,
201
+ t12,
202
+ nRev: nrev,
203
+ posigrade: direction,
204
+ })!.subtract(this.vObserverPosition2_);
205
+
206
+ const fp1 = p.dot(cp1);
207
+ const gp1 = en.dot(cp1);
208
+
209
+ const fx = (fp1 - fm1) / (2.0 * dx);
210
+ const gx = (gp1 - gm1) / (2.0 * dx);
211
+
212
+ const cm3 = this._getPositionOnLoS2({
213
+ e1: lineOfSight1,
214
+ r01: x,
215
+ e3: lineOfSight3,
216
+ r03: y - dy as Kilometers,
217
+ t13,
218
+ t12,
219
+ nRev: nrev,
220
+ posigrade: direction,
221
+ })!.subtract(this.vObserverPosition2_);
222
+
223
+ const fm3 = p.dot(cm3);
224
+ const gm3 = en.dot(cm3);
225
+
226
+ const cp3 = this._getPositionOnLoS2({
227
+ e1: lineOfSight1,
228
+ r01: x,
229
+ e3: lineOfSight3,
230
+ r03: y + dy as Kilometers,
231
+ t13,
232
+ t12,
233
+ nRev: nrev,
234
+ posigrade: direction,
235
+ })!.subtract(this.vObserverPosition2_);
236
+
237
+ const fp3 = p.dot(cp3);
238
+ const gp3 = en.dot(cp3);
239
+
240
+ const fy = (fp3 - fm3) / (2.0 * dy);
241
+ const gy = (gp3 - gm3) / (2.0 * dy);
242
+
243
+ fd[0] = fx;
244
+ fd[1] = fy;
245
+ gd[0] = gx;
246
+ gd[1] = gy;
247
+ }
248
+
249
+ solve(r1Init: Kilometers, r3Init: Kilometers, nRev = 0, direction = true): J2000 {
250
+ const lineOfSight1 = this.o1_.observation.lineOfSight() as Vector3D<Kilometers>;
251
+ const lineOfSight2 = this.o2_.observation.lineOfSight() as Vector3D<Kilometers>;
252
+ const lineOfSight3 = this.o3_.observation.lineOfSight() as Vector3D<Kilometers>;
253
+
254
+ this.r_ = Math.max(r1Init, r3Init) as Kilometers;
255
+ this.v_ = Math.sqrt(this._mu / this.r_);
256
+ this.t_ = this.r_ / this.v_;
257
+
258
+ this.vObserverPosition1_ = this.o1_.site.position.scale(1.0 / this.r_ as Kilometers);
259
+ this.vObserverPosition2_ = this.o2_.site.position.scale(1.0 / this.r_ as Kilometers);
260
+ this.vObserverPosition3_ = this.o3_.site.position.scale(1.0 / this.r_ as Kilometers);
261
+
262
+ const maxiter = 100;
263
+
264
+ this._solveRangeProblem({
265
+ rho1init: r1Init / this.r_ as Kilometers,
266
+ rho3init: r3Init / this.r_ as Kilometers,
267
+ t13: this.o3_.epoch.difference(this.o1_.epoch) / this.t_ as Seconds,
268
+ t12: this.o2_.epoch.difference(this.o1_.epoch) / this.t_ as Seconds,
269
+ nrev: nRev,
270
+ direction,
271
+ lineOfSight1,
272
+ lineOfSight2,
273
+ lineOfSight3,
274
+ maxIterations: maxiter,
275
+ });
276
+ const gibbs = new GibbsIOD(this._mu);
277
+ const p1 = this.vObserverPosition1_.add(lineOfSight1.scale(this.rho1_)).scale(this.r_);
278
+ const p2 = this.vObserverPosition2_.add(lineOfSight2.scale(this.rho2_)).scale(this.r_);
279
+ const p3 = this.vObserverPosition3_.add(lineOfSight3.scale(this.rho3_)).scale(this.r_);
280
+
281
+ return gibbs.solve(p1, p2, p3, this.o2_.epoch, this.o3_.epoch);
282
+ }
283
+
284
+ private _solveRangeProblem({
285
+ rho1init,
286
+ rho3init,
287
+ t13,
288
+ t12,
289
+ nrev,
290
+ direction,
291
+ lineOfSight1,
292
+ lineOfSight2,
293
+ lineOfSight3,
294
+ maxIterations,
295
+ }: SolveRangeProblemParams): void {
296
+ const arbf = 1e-6;
297
+ const cvtol = 1e-14;
298
+
299
+ this.rho1_ = rho1init;
300
+ this.rho3_ = rho3init;
301
+
302
+ let iter = 0;
303
+ let stoppingCriterion = 10.0 * cvtol;
304
+
305
+ while (iter < maxIterations && Math.abs(stoppingCriterion) > cvtol) {
306
+ this.facFiniteDiff_ = arbf;
307
+
308
+ const p2 = this._getPositionOnLoS2({
309
+ e1: lineOfSight1,
310
+ r01: this.rho1_,
311
+ e3: lineOfSight3,
312
+ r03: this.rho3_,
313
+ t13,
314
+ t12,
315
+ nRev: nrev,
316
+ posigrade: direction,
317
+ });
318
+
319
+ if (p2 === null) {
320
+ this._modifyIterate(lineOfSight1, lineOfSight3);
321
+ } else {
322
+ this.r2_ = p2.magnitude();
323
+ const c = p2.subtract(this.vObserverPosition2_);
324
+
325
+ this.rho2_ = c.magnitude();
326
+ const cr = lineOfSight2.dot(c);
327
+
328
+ const u = lineOfSight2.cross(c);
329
+ const p = u.cross(lineOfSight2).normalize();
330
+ const ent = lineOfSight2.cross(p);
331
+
332
+ const enr = ent.magnitude();
333
+
334
+ if (enr === 0.0) {
335
+ return;
336
+ }
337
+
338
+ const en = ent.normalize();
339
+
340
+ const fc = p.dot(c);
341
+
342
+ const fd = new Float64Array(2);
343
+ const gd = new Float64Array(2);
344
+
345
+ this._computeDerivatives({
346
+ x: this.rho1_,
347
+ y: this.rho3_,
348
+ lineOfSight1,
349
+ lineOfSight3,
350
+ pin: p,
351
+ ein: en,
352
+ t13,
353
+ t12,
354
+ nrev,
355
+ direction,
356
+ fd,
357
+ gd,
358
+ });
359
+
360
+ const fr1 = fd[0];
361
+ const fr3 = fd[1];
362
+ const gr1 = gd[0];
363
+ const gr3 = gd[1];
364
+ const detj = fr1 * gr3 - fr3 * gr1;
365
+
366
+ this.d3_ = (-gr3 * fc) / detj as Kilometers;
367
+ this.d1_ = (gr1 * fc) / detj as Kilometers;
368
+
369
+ this.rho1_ = this.rho1_ + this.d3_ as Kilometers;
370
+ this.rho3_ = this.rho3_ + this.d1_ as Kilometers;
371
+
372
+ const den = Math.max(cr, this.r2_);
373
+
374
+ stoppingCriterion = fc / den;
375
+ }
376
+
377
+ ++iter;
378
+ }
379
+ }
380
+ }