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,232 @@
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 { EpochUTC, J2000, Kilometers, KilometersPerSecond, Seconds, Vector, Vector3D } from 'ootk-core';
19
+ import { ForceModel } from '../force/ForceModel';
20
+ import { Thrust } from '../force/Thrust';
21
+ import { VerletBlendInterpolator } from './../interpolator/VerletBlendInterpolator';
22
+ import { Propagator } from './Propagator';
23
+ import { RkCheckpoint } from './RkCheckpoint';
24
+ import { RkResult } from './RkResult';
25
+
26
+ // / Adaptive Runge-Kutta propagator base class.
27
+ export abstract class RungeKuttaAdaptive extends Propagator {
28
+ /**
29
+ * Create a new [RungeKuttaAdaptive] object from an initial state vector
30
+ * along with an optional [ForceModel] and [tolerance].
31
+ * @param initState_ Initial state vector.
32
+ * @param forceModel_ Numerical integration force model.
33
+ * @param tolerance_ Minimum allowable local error tolerance.
34
+ */
35
+ constructor(
36
+ private initState_: J2000,
37
+ private forceModel_: ForceModel = new ForceModel().setGravity(),
38
+ private tolerance_: number = 1e-9,
39
+ ) {
40
+ super();
41
+ this._cacheState = this.initState_;
42
+ this.tolerance_ = Math.max(RungeKuttaAdaptive._minTolerance, Math.abs(tolerance_));
43
+ }
44
+
45
+ // / Initial state vector.
46
+ private _cacheState: J2000;
47
+
48
+ private readonly _checkpoints: RkCheckpoint[] = [];
49
+
50
+ // / Integration step size _(seconds)_.
51
+ private _stepSize = 60.0;
52
+
53
+ // / Minimum allowable local error tolerance.
54
+ private static readonly _minTolerance: number = 1e-15;
55
+
56
+ // / Butcher tableau `A` values.
57
+ protected abstract get a(): Float64Array;
58
+
59
+ // / Butcher tableau `B` values.
60
+ protected abstract get b(): Float64Array[];
61
+
62
+ // / Butcher tableau `CH` values.
63
+ protected abstract get ch(): Float64Array;
64
+
65
+ // / Butcher tableau `C` values
66
+ protected abstract get c(): Float64Array;
67
+
68
+ // / Integrator order.
69
+ protected abstract get order(): number;
70
+
71
+ get state(): J2000 {
72
+ return this._cacheState;
73
+ }
74
+
75
+ reset(): void {
76
+ this._cacheState = this.initState_;
77
+ this._stepSize = 60.0;
78
+ }
79
+
80
+ // / Set numerical integration force model.
81
+ setForceModel(forceModel: ForceModel): void {
82
+ this.forceModel_ = forceModel;
83
+ }
84
+
85
+ private kfn_(
86
+ epoch: EpochUTC,
87
+ rv: Vector<Kilometers|KilometersPerSecond>,
88
+ hArg: Seconds,
89
+ kArg: Vector<Kilometers>,
90
+ step: Seconds,
91
+ ): Vector {
92
+ const t = epoch.roll(hArg * step as Seconds);
93
+ const rvNew = rv.add(kArg);
94
+ const sample = new J2000(
95
+ t,
96
+ rvNew.toVector3D(0) as Vector3D<Kilometers>,
97
+ rvNew.toVector3D(3) as Vector3D<KilometersPerSecond>,
98
+ );
99
+
100
+ return this.forceModel_.derivative(sample).scale(step);
101
+ }
102
+
103
+ private integrate_(state: J2000, step: Seconds): RkResult {
104
+ const k: Vector[] = new Array(this.a.length).fill(Vector.origin3);
105
+ const y = state.position.join(state.velocity) as Vector<Kilometers>;
106
+
107
+ for (let i = 0; i < this.a.length; i++) {
108
+ let kArg = Vector.origin6 as Vector<Kilometers>;
109
+
110
+ if (i !== 0) {
111
+ for (let j = 0; j < i; j++) {
112
+ kArg = kArg.add(k[j].scale(this.b[i][j])) as Vector<Kilometers>;
113
+ }
114
+ }
115
+ k[i] = this.kfn_(state.epoch, y, this.a[i] as Seconds, kArg, step);
116
+ }
117
+ let y1 = y;
118
+ let y2 = y;
119
+
120
+ for (let i = 0; i < k.length; i++) {
121
+ y1 = y1.add(k[i].scale(this.ch[i])) as Vector<Kilometers>;
122
+ y2 = y2.add(k[i].scale(this.c[i])) as Vector<Kilometers>;
123
+ }
124
+ const teVal = y1.distance(y2);
125
+ let hNew = 0.9 * step * (this.tolerance_ / teVal) ** (1.0 / this.order);
126
+ const hOld = Math.abs(step);
127
+
128
+ hNew = Math.max(0.2 * hOld, Math.min(5.0 * hOld, hNew));
129
+ hNew = Math.max(1e-5, Math.min(1000.0, hNew));
130
+
131
+ return new RkResult(
132
+ new J2000(
133
+ state.epoch.roll(step),
134
+ y1.toVector3D(0) as Vector3D<Kilometers>,
135
+ y1.toVector3D(3) as Vector3D<KilometersPerSecond>,
136
+ ),
137
+ teVal,
138
+ hNew,
139
+ );
140
+ }
141
+
142
+ propagate(epoch: EpochUTC): J2000 {
143
+ let delta = epoch.difference(this._cacheState.epoch);
144
+
145
+ while (delta !== 0) {
146
+ const direction = delta >= 0 ? 1 : -1;
147
+ const dt = Math.min(Math.abs(delta), this._stepSize) * direction as Seconds;
148
+ const result = this.integrate_(this._cacheState, dt);
149
+
150
+ this._stepSize = result.newStep;
151
+ if (result.error > this.tolerance_) {
152
+ continue;
153
+ }
154
+ this._cacheState = result.state;
155
+ delta = epoch.difference(this._cacheState.epoch);
156
+ }
157
+
158
+ return this._cacheState;
159
+ }
160
+
161
+ maneuver(maneuver: Thrust, interval = 60.0 as Seconds): J2000[] {
162
+ if (maneuver.isImpulsive) {
163
+ this._cacheState = maneuver.apply(this.propagate(maneuver.center));
164
+
165
+ return [this._cacheState];
166
+ }
167
+ let tState = this.propagate(maneuver.start);
168
+
169
+ this.forceModel_.loadManeuver(maneuver);
170
+ const ephemeris: J2000[] = [tState];
171
+
172
+ while (tState.epoch < maneuver.stop) {
173
+ const step = Math.min(maneuver.stop.difference(tState.epoch), interval) as Seconds;
174
+
175
+ tState = this.propagate(tState.epoch.roll(step));
176
+ ephemeris.push(tState);
177
+ }
178
+ this.forceModel_.clearManeuver();
179
+
180
+ return ephemeris;
181
+ }
182
+
183
+ ephemerisManeuver(
184
+ start: EpochUTC,
185
+ finish: EpochUTC,
186
+ maneuvers: Thrust[],
187
+ interval = 60.0 as Seconds,
188
+ ): VerletBlendInterpolator {
189
+ const tMvr = maneuvers.filter((mvr) => mvr.start >= start || mvr.stop <= finish);
190
+ const ephemeris: J2000[] = [];
191
+
192
+ if (tMvr[0].start > start) {
193
+ ephemeris.push(this.propagate(start));
194
+ }
195
+ for (const mvr of tMvr) {
196
+ while (this._cacheState.epoch < mvr.start) {
197
+ const step = Math.min(mvr.start.difference(this._cacheState.epoch), interval) as Seconds;
198
+
199
+ this.propagate(this._cacheState.epoch.roll(step));
200
+ if (this._cacheState.epoch.posix !== mvr.start.posix) {
201
+ ephemeris.push(this._cacheState);
202
+ }
203
+ }
204
+ ephemeris.push(...this.maneuver(mvr, interval));
205
+ }
206
+ while (this._cacheState.epoch.posix < finish.posix) {
207
+ const step = Math.min(finish.difference(this._cacheState.epoch), interval) as Seconds;
208
+
209
+ this.propagate(this._cacheState.epoch.roll(step));
210
+ ephemeris.push(this._cacheState);
211
+ }
212
+
213
+ return new VerletBlendInterpolator(ephemeris);
214
+ }
215
+
216
+ checkpoint(): number {
217
+ this._checkpoints.push(new RkCheckpoint(this._cacheState, this._stepSize));
218
+
219
+ return this._checkpoints.length - 1;
220
+ }
221
+
222
+ clearCheckpoints(): void {
223
+ this._checkpoints.length = 0;
224
+ }
225
+
226
+ restore(index: number): void {
227
+ const checkpoint = this._checkpoints[index];
228
+
229
+ this._cacheState = checkpoint.cacheState;
230
+ this._stepSize = checkpoint.stepSize;
231
+ }
232
+ }
@@ -0,0 +1,71 @@
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
+ /* eslint-disable @typescript-eslint/no-unused-vars */
19
+ /* eslint-disable class-methods-use-this */
20
+ import { EpochUTC, J2000, Tle } from 'ootk-core';
21
+ import { Thrust } from '../force/Thrust';
22
+ import { VerletBlendInterpolator } from '../interpolator/VerletBlendInterpolator';
23
+ import { Propagator } from './Propagator';
24
+
25
+ // / SGP4 propagator.
26
+ export class Sgp4Propagator extends Propagator {
27
+ // / Create a new [Sgp4Propagator] object from a [TLE].
28
+ constructor(private tle: Tle) {
29
+ super();
30
+ this._cacheState = tle.state.toJ2000();
31
+ }
32
+
33
+ private _cacheState: J2000;
34
+ private _checkpoints: J2000[] = [];
35
+
36
+ get state(): J2000 {
37
+ return this._cacheState;
38
+ }
39
+
40
+ ephemerisManeuver(start: EpochUTC, finish: EpochUTC, maneuvers: Thrust[], interval = 60.0): VerletBlendInterpolator {
41
+ throw new Error('Maneuvers cannot be modelled with SGP4.');
42
+ }
43
+
44
+ maneuver(maneuver: Thrust, interval = 60.0): J2000[] {
45
+ throw new Error('Maneuvers cannot be modelled with SGP4.');
46
+ }
47
+
48
+ propagate(epoch: EpochUTC): J2000 {
49
+ this._cacheState = this.tle.propagate(epoch).toJ2000();
50
+
51
+ return this._cacheState;
52
+ }
53
+
54
+ reset(): void {
55
+ this._cacheState = this.tle.state.toJ2000();
56
+ }
57
+
58
+ checkpoint(): number {
59
+ this._checkpoints.push(this._cacheState);
60
+
61
+ return this._checkpoints.length - 1;
62
+ }
63
+
64
+ clearCheckpoints(): void {
65
+ this._checkpoints = [];
66
+ }
67
+
68
+ restore(index: number): void {
69
+ this._cacheState = this._checkpoints[index];
70
+ }
71
+ }
@@ -0,0 +1,90 @@
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 { EpochUTC } from 'ootk-core';
19
+
20
+ // / Exponential data smoothing methods.
21
+ export class ExponentialSmoothing {
22
+ private constructor() {
23
+ // disable constructor
24
+ }
25
+
26
+ /*
27
+ * Perform exponential smoothing on data set [xs] using the provided
28
+ * data smoothing factor [alpha] _(0.0 <= alpha <= 1.0)_.
29
+ */
30
+ static smooth(xs: number[], alpha: number): number[] {
31
+ const ss: number[] = [];
32
+
33
+ for (let i = 0; i < xs.length; i++) {
34
+ if (i === 0) {
35
+ ss.push(xs[0]);
36
+ } else {
37
+ ss.push(alpha * xs[i] + (1 - alpha) * ss[i - 1]);
38
+ }
39
+ }
40
+
41
+ return ss;
42
+ }
43
+
44
+ /*
45
+ * Perform exponential smoothing on data set [xs] using the provided data
46
+ * smoothing factor [alpha] _(0.0 <= alpha <= 1.0)_ and trend smoothing
47
+ * factor [beta] _(0.0 <= beta <= 1.0)_.
48
+ */
49
+ static smoothDouble(xs: number[], alpha: number, beta: number): number[] {
50
+ const bs: number[] = [];
51
+ const ss: number[] = [];
52
+
53
+ for (let i = 0; i < xs.length; i++) {
54
+ if (i === 0) {
55
+ ss.push(xs[0]);
56
+ bs.push(xs[1] - xs[0]);
57
+ } else {
58
+ ss.push(alpha * xs[i] + (1 - alpha) * (ss[i - 1] + bs[i - 1]));
59
+ bs.push(beta * (ss[i] - ss[i - 1]) + (1 - beta) * bs[i - 1]);
60
+ }
61
+ }
62
+
63
+ return ss;
64
+ }
65
+
66
+ /*
67
+ * Perform exponential smoothing on time series data set [xs] correlated
68
+ * with the [epochs] array using the provided [timeConstant]
69
+ * value _(seconds)_.
70
+ *
71
+ * Note: the [timeConstant] is the amount of time for the smoothed response
72
+ * of a unit step function to reach ~63.2% of the original signal.
73
+ */
74
+ static smoothTime(epochs: EpochUTC[], xs: number[], timeConstant: number): number[] {
75
+ const ts = epochs.map((e) => e.posix);
76
+ const ss: number[] = [];
77
+
78
+ for (let i = 0; i < xs.length; i++) {
79
+ if (i === 0) {
80
+ ss.push(xs[0]);
81
+ } else {
82
+ const a = 1 - Math.exp(-(ts[i] - ts[i - 1]) / timeConstant);
83
+
84
+ ss.push(a * xs[i] + (1 - a) * ss[i - 1]);
85
+ }
86
+ }
87
+
88
+ return ss;
89
+ }
90
+ }
@@ -0,0 +1 @@
1
+ export * from './transforms';
@@ -0,0 +1,117 @@
1
+ import { DEG2RAD, Degrees, EnuVec3, RAD2DEG, Radians, RaeVec3, TAU } from 'ootk-core';
2
+ import { RfSensor } from 'src/objects/RfSensor';
3
+ import { RfVec3, RuvVec3 } from 'src/types/types';
4
+
5
+ /**
6
+ * Converts Azimuth and Elevation to U and V.
7
+ * Azimuth is the angle off of boresight in the horizontal plane.
8
+ * Elevation is the angle off of boresight in the vertical plane.
9
+ * Cone half angle is the angle of the cone of the radar max field of view.
10
+ * @param az - Azimuth in radians
11
+ * @param el - Elevation in radians
12
+ * @param coneHalfAngle - Cone half angle in radians
13
+ * @returns U and V in radians
14
+ */
15
+ export function azel2uv(az: Radians, el: Radians, coneHalfAngle: Radians): { u: number; v: number } {
16
+ if (az > coneHalfAngle && az < coneHalfAngle) {
17
+ throw new RangeError(`Azimuth is out of bounds: ${az}`);
18
+ }
19
+
20
+ if (el > coneHalfAngle && el < coneHalfAngle) {
21
+ throw new RangeError(`Elevation is out of bounds: ${el}`);
22
+ }
23
+
24
+ const alpha = (az / (coneHalfAngle * RAD2DEG)) * 90;
25
+ const beta = (el / (coneHalfAngle * RAD2DEG)) * 90;
26
+
27
+ const u = Math.sin(alpha) as Radians;
28
+ let v = -Math.sin(beta) as Radians;
29
+
30
+ v = Object.is(v, -0) ? (0 as Radians) : v;
31
+
32
+ return { u, v };
33
+ }
34
+
35
+ /**
36
+ * Determine azimuth and elevation off of boresight based on sensor orientation and RAE.
37
+ * @param rae Range, Azimuth, Elevation
38
+ * @param sensor Radar sensor object
39
+ * @param maxSensorAz Maximum sensor azimuth
40
+ * @returns Azimuth and Elevation off of boresight
41
+ */
42
+ export function rae2raeOffBoresight(
43
+ rae: RaeVec3,
44
+ sensor: RfSensor,
45
+ maxSensorAz: Degrees,
46
+ ): { az: Radians; el: Radians } {
47
+ let az = (rae.az * DEG2RAD) as Radians;
48
+ let el = (rae.el * DEG2RAD) as Radians;
49
+
50
+ // Correct azimuth for sensor orientation.
51
+ az = az > maxSensorAz * DEG2RAD ? ((az - TAU) as Radians) : az;
52
+
53
+ az = (az - sensor.boresightAz) as Radians;
54
+ el = (el - sensor.boresightEl) as Radians;
55
+
56
+ return { az, el };
57
+ }
58
+
59
+ /**
60
+ * Converts Range Az El to Range U V.
61
+ * @param rae Range, Azimuth, Elevation
62
+ * @param sensor Radar sensor object
63
+ * @param maxSensorAz Maximum sensor azimuth
64
+ * @returns Range, U, V
65
+ */
66
+ export function rae2ruv(rae: RaeVec3, sensor: RfSensor, maxSensorAz: Degrees): RuvVec3 {
67
+ const { az, el } = rae2raeOffBoresight(rae, sensor, maxSensorAz);
68
+ const { u, v } = azel2uv(az, el, sensor.coneHalfAngleRad);
69
+
70
+ return { rng: rae.rng, u, v };
71
+ }
72
+
73
+ /**
74
+ * Converts U and V to Azimuth and Elevation off of boresight.
75
+ * @param u The U coordinate.
76
+ * @param v The V coordinate.
77
+ * @param coneHalfAngle The cone half angle of the radar.
78
+ * @returns Azimuth and Elevation off of boresight.
79
+ */
80
+ export function uv2azel(u: number, v: number, coneHalfAngle: Radians): { az: Radians; el: Radians } {
81
+ if (u > 1 || u < -1) {
82
+ throw new RangeError(`u is out of bounds: ${u}`);
83
+ }
84
+
85
+ if (v > 1 || v < -1) {
86
+ throw new RangeError(`v is out of bounds: ${v}`);
87
+ }
88
+
89
+ const alpha = Math.asin(u) as Radians;
90
+ const beta = Math.asin(v) as Radians;
91
+ const az = ((alpha / 90) * (coneHalfAngle * RAD2DEG)) as Radians;
92
+ const el = ((beta / 90) * (coneHalfAngle * RAD2DEG)) as Radians;
93
+
94
+ return { az, el };
95
+ }
96
+
97
+ /**
98
+ * Converts coordinates from East-North-Up (ENU) to Right-Front-Up (RF) coordinate system.
99
+ * @param enu - The ENU coordinates to be converted.
100
+ * @param enu.x - The east coordinate.
101
+ * @param enu.y - The north coordinate.
102
+ * @param enu.z - The up coordinate.
103
+ * @param az - The azimuth angle in radians.
104
+ * @param el - The elevation angle in radians.
105
+ * @returns The converted RF coordinates.
106
+ */
107
+ export function enu2rf<D extends number, A extends number = Radians>({ x, y, z }: EnuVec3<D>, az: A, el: A): RfVec3<D> {
108
+ const xrf = Math.cos(el) * Math.cos(az) * x - Math.sin(az) * y + Math.sin(el) * Math.cos(az) * z;
109
+ const yrf = Math.cos(el) * Math.sin(az) * x + Math.cos(az) * y + Math.sin(el) * Math.sin(az) * z;
110
+ const zrf = -Math.sin(el) * x + Math.cos(el) * z;
111
+
112
+ return {
113
+ x: xrf as D,
114
+ y: yrf as D,
115
+ z: zrf as D,
116
+ };
117
+ }
@@ -0,0 +1,135 @@
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 { Degrees, Kilometers, Milliseconds, SatelliteParams, Vec3 } from 'ootk-core';
19
+
20
+ export enum ZoomValue {
21
+ LEO = 0.45,
22
+ GEO = 0.82,
23
+ MAX = 1,
24
+ }
25
+
26
+ export interface DetailedSatelliteParams extends SatelliteParams {
27
+ id: number;
28
+ active?: boolean;
29
+ configuration?: string;
30
+ country?: string;
31
+ dryMass?: string;
32
+ equipment?: string;
33
+ launchDate?: string;
34
+ launchMass?: string;
35
+ launchSite?: string;
36
+ launchVehicle?: string;
37
+ lifetime?: string | number;
38
+ maneuver?: string;
39
+ manufacturer?: string;
40
+ mission?: string;
41
+ motor?: string;
42
+ owner?: string;
43
+ bus?: string;
44
+ payload?: string;
45
+ power?: string;
46
+ purpose?: string;
47
+ length?: string;
48
+ diameter?: string;
49
+ shape?: string;
50
+ span?: string;
51
+ user?: string;
52
+ vmag?: number;
53
+ rcs?: number;
54
+ source?: string;
55
+ altId?: string;
56
+ altName?: string;
57
+ }
58
+
59
+ export interface DetailedSensorParams {
60
+ /** The country that owns the sensor */
61
+ country?: string;
62
+ /** 3 Letter Designation */
63
+ shortName?: string;
64
+ /** For radars, this is the width of the beam */
65
+ beamwidth?: Degrees;
66
+ changeObjectInterval?: Milliseconds;
67
+ linkAehf?: boolean;
68
+ linkGalileo?: boolean;
69
+ linkIridium?: boolean;
70
+ linkStarlink?: boolean;
71
+ linkWgs?: boolean;
72
+ static?: boolean;
73
+ sensorId?: number;
74
+ url?: string;
75
+ /** Does this sensor use a volumetric search pattern? */
76
+ volume?: boolean;
77
+ /** How far away should we zoom when selecting this sensor? */
78
+ zoom: ZoomValue;
79
+ /** For radar sensors, what frequency does this sensor operate in? */
80
+ band?: string;
81
+ /** This is the name of the object in the array */
82
+ objName?: string;
83
+ /** This is the name of the object in the UI */
84
+ uiName?: string;
85
+ /** This is the specific system (ex. AN/FPS-132) */
86
+ system?: string;
87
+ /** This is who operates the sensor */
88
+ operator?: string;
89
+ }
90
+ /**
91
+ * The RUV coordinate system is a spherical coordinate system with the origin at
92
+ * the radar. The RUV coordinate system is defined with respect to the radar
93
+ * boresight. The R-axis points outward along the boresight with the origin at
94
+ * the radar. The U-axis is in the horizontal plane and points to the right of
95
+ * the boresight. The V-axis is in the vertical plane and points down from the
96
+ * boresight.
97
+ * @template DistanceUnit The unit of measure used for the altitude dimension.
98
+ * This is typically a type representing a distance, such as kilometers or
99
+ * meters. The default is Kilometers.
100
+ * @template AngleUnit The unit of measure used for the latitude and longitude
101
+ * dimensions. This is typically a type representing an angle, such as degrees
102
+ * or radians. The default is Radians.
103
+ */
104
+
105
+ export type RuvVec3<DistanceUnit = Kilometers> = {
106
+ rng: DistanceUnit;
107
+ u: number;
108
+ v: number;
109
+ };
110
+ /**
111
+ * Phased Array Radar Face Cartesian Coordinates The cartesian coordinates (XRF,
112
+ * YRF ZRF) are defined with respect to the phased array radar face. The radar
113
+ * face lies in the XRF-YRF plane, with the XRF-axis horizontal and the YRF-axis
114
+ * pointing upward. The ZRF-axis points outward along the normal to the array
115
+ * face.
116
+ *
117
+ * The orientation of the phased array face is defined by the azimuth and the
118
+ * elevation of the phased array boresight (i.e., the phased array Z-axis).
119
+ */
120
+
121
+ export type RfVec3<Units = Kilometers> = Vec3<Units>;
122
+
123
+ /**
124
+ * Represents a function that calculates the Jacobian matrix.
125
+ * @param xs - The input values as a Float64Array. @returns The Jacobian matrix
126
+ * as a Float64Array.
127
+ */
128
+ export type JacobianFunction = (xs: Float64Array) => Float64Array;
129
+
130
+ /**
131
+ * Represents a differentiable function.
132
+ * @param x The input value. @returns The output value.
133
+ */
134
+
135
+ export type DifferentiableFunction = (x: number) => number;
@@ -0,0 +1 @@
1
+ export * from './jacobian';
@@ -0,0 +1,38 @@
1
+ import { array2d, Matrix, Vector } from 'ootk-core';
2
+ import { JacobianFunction } from '../types/types';
3
+
4
+ // TODO: #11 Expand documentation of Jacobian function.
5
+
6
+ /**
7
+ * Calculates the Jacobian matrix of a given Jacobian function.
8
+ * @param f The Jacobian function.
9
+ * @param m The number of rows in the Jacobian matrix.
10
+ * @param x0 The initial values of the variables.
11
+ * @param step The step size for numerical differentiation (default: 1e-5).
12
+ * @returns The Jacobian matrix.
13
+ */
14
+ export function jacobian(f: JacobianFunction, m: number, x0: Float64Array, step = 0.00001): Matrix {
15
+ const n = x0.length;
16
+ const j = array2d(m, n, 0);
17
+ const h = 0.5 * step;
18
+
19
+ for (let k = 0; k < n; k++) {
20
+ const xp = x0.slice();
21
+
22
+ xp[k] += h;
23
+ const fp = new Vector(f(xp));
24
+
25
+ const xm = x0.slice();
26
+
27
+ xm[k] -= h;
28
+ const fm = new Vector(f(xm));
29
+
30
+ const cd = fp.subtract(fm).scale(1 / step);
31
+
32
+ for (let i = 0; i < m; i++) {
33
+ j[i][k] = cd.elements[i];
34
+ }
35
+ }
36
+
37
+ return new Matrix(j);
38
+ }