ootk 4.0.9 → 5.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 (535) hide show
  1. package/README.md +0 -15
  2. package/dist/body/Celestial.d.ts +96 -0
  3. package/dist/body/Celestial.js +124 -0
  4. package/dist/body/Celestial.js.map +1 -0
  5. package/dist/body/Earth.d.ts +68 -0
  6. package/dist/body/Earth.js +198 -0
  7. package/dist/body/Earth.js.map +1 -0
  8. package/dist/body/Moon.d.ts +137 -0
  9. package/dist/body/Moon.js +464 -0
  10. package/dist/body/Moon.js.map +1 -0
  11. package/dist/body/NutationAngles.d.ts +38 -0
  12. package/dist/body/NutationAngles.js +24 -0
  13. package/dist/body/NutationAngles.js.map +1 -0
  14. package/dist/body/PrecessionAngles.d.ts +29 -0
  15. package/dist/body/PrecessionAngles.js +24 -0
  16. package/dist/body/PrecessionAngles.js.map +1 -0
  17. package/dist/body/Sun.d.ts +305 -0
  18. package/dist/body/Sun.js +548 -0
  19. package/dist/body/Sun.js.map +1 -0
  20. package/dist/body/index.d.ts +26 -0
  21. package/dist/body/index.js +27 -0
  22. package/dist/body/index.js.map +1 -0
  23. package/dist/coordinate/ClassicalElements.d.ts +132 -0
  24. package/dist/coordinate/ClassicalElements.js +279 -0
  25. package/dist/coordinate/ClassicalElements.js.map +1 -0
  26. package/dist/coordinate/EquinoctialElements.d.ts +114 -0
  27. package/dist/coordinate/EquinoctialElements.js +172 -0
  28. package/dist/coordinate/EquinoctialElements.js.map +1 -0
  29. package/dist/coordinate/FormatTle.d.ts +95 -0
  30. package/dist/coordinate/FormatTle.js +184 -0
  31. package/dist/coordinate/FormatTle.js.map +1 -0
  32. package/dist/coordinate/Geodetic.d.ts +110 -0
  33. package/dist/coordinate/Geodetic.js +163 -0
  34. package/dist/coordinate/Geodetic.js.map +1 -0
  35. package/dist/coordinate/Hill.d.ts +1 -1
  36. package/dist/coordinate/Hill.js +1 -1
  37. package/dist/coordinate/Hill.js.map +1 -1
  38. package/dist/coordinate/ITRF.d.ts +75 -0
  39. package/dist/coordinate/ITRF.js +135 -0
  40. package/dist/coordinate/ITRF.js.map +1 -0
  41. package/dist/coordinate/J2000.d.ts +65 -0
  42. package/dist/coordinate/J2000.js +120 -0
  43. package/dist/coordinate/J2000.js.map +1 -0
  44. package/dist/coordinate/RIC.d.ts +64 -0
  45. package/dist/coordinate/RIC.js +79 -0
  46. package/dist/coordinate/RIC.js.map +1 -0
  47. package/dist/coordinate/RelativeState.d.ts +70 -0
  48. package/dist/coordinate/RelativeState.js +79 -0
  49. package/dist/coordinate/RelativeState.js.map +1 -0
  50. package/dist/coordinate/StateVector.d.ts +76 -0
  51. package/dist/coordinate/StateVector.js +97 -0
  52. package/dist/coordinate/StateVector.js.map +1 -0
  53. package/dist/coordinate/TEME.d.ts +57 -0
  54. package/dist/coordinate/TEME.js +89 -0
  55. package/dist/coordinate/TEME.js.map +1 -0
  56. package/dist/coordinate/Tle.d.ts +430 -0
  57. package/dist/coordinate/Tle.js +865 -0
  58. package/dist/coordinate/Tle.js.map +1 -0
  59. package/dist/coordinate/index.d.ts +11 -0
  60. package/dist/coordinate/index.js +12 -0
  61. package/dist/coordinate/index.js.map +1 -1
  62. package/dist/coordinate/tle-format-data.d.ts +41 -0
  63. package/dist/coordinate/tle-format-data.js +46 -0
  64. package/dist/coordinate/tle-format-data.js.map +1 -0
  65. package/dist/covariance/CovarianceSample.d.ts +1 -1
  66. package/dist/covariance/CovarianceSample.js +1 -1
  67. package/dist/covariance/CovarianceSample.js.map +1 -1
  68. package/dist/covariance/StateCovariance.d.ts +1 -1
  69. package/dist/covariance/StateCovariance.js +1 -1
  70. package/dist/covariance/StateCovariance.js.map +1 -1
  71. package/dist/data/DataHandler.d.ts +66 -0
  72. package/dist/data/DataHandler.js +80 -0
  73. package/dist/data/DataHandler.js.map +1 -0
  74. package/dist/data/values/Egm96Data.d.ts +37 -0
  75. package/dist/data/values/Egm96Data.js +63 -0
  76. package/dist/data/values/Egm96Data.js.map +1 -0
  77. package/dist/data/values/HpAtmosphereData.d.ts +33 -0
  78. package/dist/data/values/HpAtmosphereData.js +58 -0
  79. package/dist/data/values/HpAtmosphereData.js.map +1 -0
  80. package/dist/data/values/HpAtmosphereResult.d.ts +29 -0
  81. package/dist/data/values/HpAtmosphereResult.js +38 -0
  82. package/dist/data/values/HpAtmosphereResult.js.map +1 -0
  83. package/dist/data/values/Iau1980Data.d.ts +36 -0
  84. package/dist/data/values/Iau1980Data.js +52 -0
  85. package/dist/data/values/Iau1980Data.js.map +1 -0
  86. package/dist/data/values/LeapSecond.d.ts +27 -0
  87. package/dist/data/values/LeapSecond.js +35 -0
  88. package/dist/data/values/LeapSecond.js.map +1 -0
  89. package/dist/data/values/LeapSecondData.d.ts +41 -0
  90. package/dist/data/values/LeapSecondData.js +103 -0
  91. package/dist/data/values/LeapSecondData.js.map +1 -0
  92. package/dist/data/values/egm96.d.ts +24 -0
  93. package/dist/data/values/egm96.js +726 -0
  94. package/dist/data/values/egm96.js.map +1 -0
  95. package/dist/data/values/hpAtmosphere.d.ts +24 -0
  96. package/dist/data/values/hpAtmosphere.js +76 -0
  97. package/dist/data/values/hpAtmosphere.js.map +1 -0
  98. package/dist/data/values/iau1980.d.ts +24 -0
  99. package/dist/data/values/iau1980.js +30 -0
  100. package/dist/data/values/iau1980.js.map +1 -0
  101. package/dist/enums/AngularDiameterMethod.d.ts +27 -0
  102. package/dist/enums/AngularDiameterMethod.js +29 -0
  103. package/dist/enums/AngularDiameterMethod.js.map +1 -0
  104. package/dist/enums/AngularDistanceMethod.d.ts +27 -0
  105. package/dist/enums/AngularDistanceMethod.js +29 -0
  106. package/dist/enums/AngularDistanceMethod.js.map +1 -0
  107. package/dist/enums/OrbitRegime.d.ts +30 -0
  108. package/dist/enums/OrbitRegime.js +32 -0
  109. package/dist/enums/OrbitRegime.js.map +1 -0
  110. package/dist/enums/PassType.d.ts +28 -0
  111. package/dist/enums/PassType.js +30 -0
  112. package/dist/enums/PassType.js.map +1 -0
  113. package/dist/enums/Sgp4OpsMode.d.ts +26 -0
  114. package/dist/enums/Sgp4OpsMode.js +28 -0
  115. package/dist/enums/Sgp4OpsMode.js.map +1 -0
  116. package/dist/enums/index.d.ts +5 -0
  117. package/dist/enums/index.js +5 -0
  118. package/dist/enums/index.js.map +1 -1
  119. package/dist/force/AtmosphericDrag.d.ts +1 -1
  120. package/dist/force/AtmosphericDrag.js +1 -1
  121. package/dist/force/AtmosphericDrag.js.map +1 -1
  122. package/dist/force/EarthGravity.d.ts +1 -1
  123. package/dist/force/EarthGravity.js +1 -1
  124. package/dist/force/EarthGravity.js.map +1 -1
  125. package/dist/force/Force.d.ts +1 -1
  126. package/dist/force/ForceModel.d.ts +1 -1
  127. package/dist/force/ForceModel.js +1 -1
  128. package/dist/force/ForceModel.js.map +1 -1
  129. package/dist/force/Gravity.d.ts +1 -1
  130. package/dist/force/Gravity.js +1 -1
  131. package/dist/force/Gravity.js.map +1 -1
  132. package/dist/force/SolarRadiationPressure.d.ts +1 -1
  133. package/dist/force/SolarRadiationPressure.js +1 -1
  134. package/dist/force/SolarRadiationPressure.js.map +1 -1
  135. package/dist/force/ThirdBodyGravity.d.ts +1 -1
  136. package/dist/force/ThirdBodyGravity.js +1 -1
  137. package/dist/force/ThirdBodyGravity.js.map +1 -1
  138. package/dist/force/Thrust.d.ts +1 -1
  139. package/dist/force/Thrust.js +1 -1
  140. package/dist/force/Thrust.js.map +1 -1
  141. package/dist/interfaces/BaseObjectParams.d.ts +31 -0
  142. package/dist/interfaces/BaseObjectParams.js +24 -0
  143. package/dist/interfaces/BaseObjectParams.js.map +1 -0
  144. package/dist/interfaces/ClassicalElementsParams.d.ts +33 -0
  145. package/dist/interfaces/ClassicalElementsParams.js +24 -0
  146. package/dist/interfaces/ClassicalElementsParams.js.map +1 -0
  147. package/dist/interfaces/EquinoctialElementsParams.d.ts +35 -0
  148. package/dist/interfaces/EquinoctialElementsParams.js +24 -0
  149. package/dist/interfaces/EquinoctialElementsParams.js.map +1 -0
  150. package/dist/interfaces/GroundPositionParams.d.ts +28 -0
  151. package/dist/interfaces/GroundPositionParams.js +24 -0
  152. package/dist/interfaces/GroundPositionParams.js.map +1 -0
  153. package/dist/interfaces/OmmFormat.d.ts +62 -0
  154. package/dist/interfaces/OmmFormat.js +2 -0
  155. package/dist/interfaces/OmmFormat.js.map +1 -0
  156. package/dist/interfaces/OptionsParams.d.ts +3 -0
  157. package/dist/interfaces/OptionsParams.js +2 -0
  158. package/dist/interfaces/OptionsParams.js.map +1 -0
  159. package/dist/interfaces/RfSensorParams.d.ts +1 -1
  160. package/dist/interfaces/SatelliteParams.d.ts +18 -0
  161. package/dist/interfaces/SatelliteParams.js +2 -0
  162. package/dist/interfaces/SatelliteParams.js.map +1 -0
  163. package/dist/interfaces/SensorParams.d.ts +38 -0
  164. package/dist/interfaces/SensorParams.js +2 -0
  165. package/dist/interfaces/SensorParams.js.map +1 -0
  166. package/dist/interfaces/StarObjectParams.d.ts +10 -0
  167. package/dist/interfaces/StarObjectParams.js +2 -0
  168. package/dist/interfaces/StarObjectParams.js.map +1 -0
  169. package/dist/interfaces/TimeVariables.d.ts +6 -0
  170. package/dist/interfaces/TimeVariables.js +2 -0
  171. package/dist/interfaces/TimeVariables.js.map +1 -0
  172. package/dist/interfaces/index.d.ts +8 -0
  173. package/dist/interpolator/ChebyshevCoefficients.d.ts +1 -1
  174. package/dist/interpolator/ChebyshevCoefficients.js +1 -1
  175. package/dist/interpolator/ChebyshevCoefficients.js.map +1 -1
  176. package/dist/interpolator/ChebyshevInterpolator.d.ts +1 -1
  177. package/dist/interpolator/ChebyshevInterpolator.js +1 -1
  178. package/dist/interpolator/ChebyshevInterpolator.js.map +1 -1
  179. package/dist/interpolator/CubicSpline.d.ts +1 -1
  180. package/dist/interpolator/CubicSplineInterpolator.d.ts +1 -1
  181. package/dist/interpolator/CubicSplineInterpolator.js +1 -1
  182. package/dist/interpolator/CubicSplineInterpolator.js.map +1 -1
  183. package/dist/interpolator/Interpolator.d.ts +1 -1
  184. package/dist/interpolator/Interpolator.js +1 -1
  185. package/dist/interpolator/Interpolator.js.map +1 -1
  186. package/dist/interpolator/LagrangeInterpolator.d.ts +1 -1
  187. package/dist/interpolator/LagrangeInterpolator.js +1 -1
  188. package/dist/interpolator/LagrangeInterpolator.js.map +1 -1
  189. package/dist/interpolator/StateInterpolator.d.ts +1 -1
  190. package/dist/interpolator/VerletBlendInterpolator.d.ts +1 -1
  191. package/dist/interpolator/VerletBlendInterpolator.js +1 -1
  192. package/dist/interpolator/VerletBlendInterpolator.js.map +1 -1
  193. package/dist/main.d.ts +11 -3
  194. package/dist/main.js +11 -3
  195. package/dist/main.js.map +1 -1
  196. package/dist/maneuver/TwoBurnOrbitTransfer.d.ts +1 -1
  197. package/dist/maneuver/TwoBurnOrbitTransfer.js +1 -1
  198. package/dist/maneuver/TwoBurnOrbitTransfer.js.map +1 -1
  199. package/dist/maneuver/Waypoint.d.ts +1 -1
  200. package/dist/maneuver/Waypoint.js +1 -1
  201. package/dist/maneuver/Waypoint.js.map +1 -1
  202. package/dist/objects/BaseObject.d.ts +74 -0
  203. package/dist/objects/BaseObject.js +151 -0
  204. package/dist/objects/BaseObject.js.map +1 -0
  205. package/dist/objects/DetailedSatellite.d.ts +2 -1
  206. package/dist/objects/DetailedSatellite.js +2 -2
  207. package/dist/objects/DetailedSatellite.js.map +1 -1
  208. package/dist/objects/DetailedSensor.d.ts +2 -1
  209. package/dist/objects/DetailedSensor.js +1 -1
  210. package/dist/objects/DetailedSensor.js.map +1 -1
  211. package/dist/objects/GroundObject.d.ts +85 -0
  212. package/dist/objects/GroundObject.js +143 -0
  213. package/dist/objects/GroundObject.js.map +1 -0
  214. package/dist/objects/LandObject.d.ts +2 -1
  215. package/dist/objects/LandObject.js +1 -1
  216. package/dist/objects/LandObject.js.map +1 -1
  217. package/dist/objects/Marker.d.ts +1 -1
  218. package/dist/objects/Marker.js +1 -1
  219. package/dist/objects/Marker.js.map +1 -1
  220. package/dist/objects/RfSensor.d.ts +1 -2
  221. package/dist/objects/RfSensor.js +1 -2
  222. package/dist/objects/RfSensor.js.map +1 -1
  223. package/dist/objects/Satellite.d.ts +226 -0
  224. package/dist/objects/Satellite.js +443 -0
  225. package/dist/objects/Satellite.js.map +1 -0
  226. package/dist/objects/Sensor.d.ts +100 -0
  227. package/dist/objects/Sensor.js +239 -0
  228. package/dist/objects/Sensor.js.map +1 -0
  229. package/dist/objects/Star.d.ts +36 -0
  230. package/dist/objects/Star.js +59 -0
  231. package/dist/objects/Star.js.map +1 -0
  232. package/dist/objects/index.d.ts +5 -0
  233. package/dist/objects/index.js +5 -0
  234. package/dist/objects/index.js.map +1 -1
  235. package/dist/observation/Observation.d.ts +1 -1
  236. package/dist/observation/ObservationOptical.d.ts +1 -1
  237. package/dist/observation/ObservationOptical.js +1 -1
  238. package/dist/observation/ObservationOptical.js.map +1 -1
  239. package/dist/observation/ObservationRadar.d.ts +1 -1
  240. package/dist/observation/ObservationRadar.js +1 -1
  241. package/dist/observation/ObservationRadar.js.map +1 -1
  242. package/dist/observation/ObservationUtils.d.ts +3 -1
  243. package/dist/observation/ObservationUtils.js +15 -1
  244. package/dist/observation/ObservationUtils.js.map +1 -1
  245. package/dist/observation/RAE.d.ts +111 -0
  246. package/dist/observation/RAE.js +215 -0
  247. package/dist/observation/RAE.js.map +1 -0
  248. package/dist/observation/RadecGeocentric.d.ts +111 -0
  249. package/dist/observation/RadecGeocentric.js +169 -0
  250. package/dist/observation/RadecGeocentric.js.map +1 -0
  251. package/dist/observation/RadecTopocentric.d.ts +123 -0
  252. package/dist/observation/RadecTopocentric.js +196 -0
  253. package/dist/observation/RadecTopocentric.js.map +1 -0
  254. package/dist/observation/index.d.ts +26 -0
  255. package/dist/observation/index.js +27 -0
  256. package/dist/observation/index.js.map +1 -0
  257. package/dist/operations/BoxMuller.d.ts +1 -1
  258. package/dist/operations/BoxMuller.js +1 -1
  259. package/dist/operations/BoxMuller.js.map +1 -1
  260. package/dist/operations/EulerAngles.d.ts +1 -1
  261. package/dist/operations/EulerAngles.js +1 -1
  262. package/dist/operations/EulerAngles.js.map +1 -1
  263. package/dist/operations/Matrix.d.ts +170 -0
  264. package/dist/operations/Matrix.js +405 -0
  265. package/dist/operations/Matrix.js.map +1 -0
  266. package/dist/operations/Quaternion.d.ts +1 -1
  267. package/dist/operations/Quaternion.js +1 -1
  268. package/dist/operations/Quaternion.js.map +1 -1
  269. package/dist/operations/Random.d.ts +40 -0
  270. package/dist/operations/Random.js +50 -0
  271. package/dist/operations/Random.js.map +1 -0
  272. package/dist/operations/RandomGaussianSource.d.ts +1 -1
  273. package/dist/operations/RandomGaussianSource.js +1 -1
  274. package/dist/operations/RandomGaussianSource.js.map +1 -1
  275. package/dist/operations/Vector.d.ts +262 -0
  276. package/dist/operations/Vector.js +415 -0
  277. package/dist/operations/Vector.js.map +1 -0
  278. package/dist/operations/Vector3D.d.ts +86 -0
  279. package/dist/operations/Vector3D.js +241 -0
  280. package/dist/operations/Vector3D.js.map +1 -0
  281. package/dist/operations/operations.d.ts +26 -0
  282. package/dist/operations/operations.js +27 -0
  283. package/dist/operations/operations.js.map +1 -0
  284. package/dist/optimize/ChebyshevCompressor.js +1 -1
  285. package/dist/optimize/ChebyshevCompressor.js.map +1 -1
  286. package/dist/optimize/PolynomialRegression.js +1 -1
  287. package/dist/optimize/PolynomialRegression.js.map +1 -1
  288. package/dist/optimize/SimplexEntry.js +1 -1
  289. package/dist/optimize/SimplexEntry.js.map +1 -1
  290. package/dist/orbit_determination/BatchLeastSquaresOD.d.ts +1 -1
  291. package/dist/orbit_determination/BatchLeastSquaresOD.js +1 -1
  292. package/dist/orbit_determination/BatchLeastSquaresOD.js.map +1 -1
  293. package/dist/orbit_determination/BatchLeastSquaresResult.d.ts +1 -1
  294. package/dist/orbit_determination/GibbsIOD.d.ts +1 -1
  295. package/dist/orbit_determination/GibbsIOD.js +1 -1
  296. package/dist/orbit_determination/GibbsIOD.js.map +1 -1
  297. package/dist/orbit_determination/GoodingIOD.d.ts +1 -1
  298. package/dist/orbit_determination/GoodingIOD.js +1 -1
  299. package/dist/orbit_determination/GoodingIOD.js.map +1 -1
  300. package/dist/orbit_determination/HerrickGibbsIOD.d.ts +1 -1
  301. package/dist/orbit_determination/HerrickGibbsIOD.js +1 -1
  302. package/dist/orbit_determination/HerrickGibbsIOD.js.map +1 -1
  303. package/dist/orbit_determination/LambertIOD.d.ts +1 -1
  304. package/dist/orbit_determination/LambertIOD.js +1 -1
  305. package/dist/orbit_determination/LambertIOD.js.map +1 -1
  306. package/dist/orbit_determination/ModifiedGoodingIOD.d.ts +1 -1
  307. package/dist/orbit_determination/ModifiedGoodingIOD.js +1 -1
  308. package/dist/orbit_determination/ModifiedGoodingIOD.js.map +1 -1
  309. package/dist/orbit_determination/index.d.ts +7 -0
  310. package/dist/orbit_determination/index.js +8 -0
  311. package/dist/orbit_determination/index.js.map +1 -0
  312. package/dist/propagator/KeplerPropagator.d.ts +1 -1
  313. package/dist/propagator/KeplerPropagator.js +1 -1
  314. package/dist/propagator/KeplerPropagator.js.map +1 -1
  315. package/dist/propagator/Propagator.d.ts +1 -1
  316. package/dist/propagator/Propagator.js +1 -1
  317. package/dist/propagator/Propagator.js.map +1 -1
  318. package/dist/propagator/RkCheckpoint.d.ts +1 -1
  319. package/dist/propagator/RkResult.d.ts +1 -1
  320. package/dist/propagator/RungeKutta4Propagator.d.ts +1 -1
  321. package/dist/propagator/RungeKutta4Propagator.js +1 -1
  322. package/dist/propagator/RungeKutta4Propagator.js.map +1 -1
  323. package/dist/propagator/RungeKuttaAdaptive.d.ts +1 -1
  324. package/dist/propagator/RungeKuttaAdaptive.js +1 -1
  325. package/dist/propagator/RungeKuttaAdaptive.js.map +1 -1
  326. package/dist/propagator/Sgp4Propagator.d.ts +1 -1
  327. package/dist/sgp4/index.d.ts +23 -0
  328. package/dist/sgp4/index.js +24 -0
  329. package/dist/sgp4/index.js.map +1 -0
  330. package/dist/sgp4/sgp4-error.d.ts +22 -0
  331. package/dist/sgp4/sgp4-error.js +44 -0
  332. package/dist/sgp4/sgp4-error.js.map +1 -0
  333. package/dist/sgp4/sgp4.d.ts +102 -0
  334. package/dist/sgp4/sgp4.js +3167 -0
  335. package/dist/sgp4/sgp4.js.map +1 -0
  336. package/dist/smoothing/ExponentialSmoothing.d.ts +1 -1
  337. package/dist/time/Epoch.d.ts +44 -0
  338. package/dist/time/Epoch.js +109 -0
  339. package/dist/time/Epoch.js.map +1 -0
  340. package/dist/time/EpochGPS.d.ts +42 -0
  341. package/dist/time/EpochGPS.js +70 -0
  342. package/dist/time/EpochGPS.js.map +1 -0
  343. package/dist/time/EpochTAI.d.ts +26 -0
  344. package/dist/time/EpochTAI.js +27 -0
  345. package/dist/time/EpochTAI.js.map +1 -0
  346. package/dist/time/EpochTDB.d.ts +26 -0
  347. package/dist/time/EpochTDB.js +27 -0
  348. package/dist/time/EpochTDB.js.map +1 -0
  349. package/dist/time/EpochTT.d.ts +26 -0
  350. package/dist/time/EpochTT.js +27 -0
  351. package/dist/time/EpochTT.js.map +1 -0
  352. package/dist/time/EpochUTC.d.ts +59 -0
  353. package/dist/time/EpochUTC.js +137 -0
  354. package/dist/time/EpochUTC.js.map +1 -0
  355. package/dist/time/EpochWindow.d.ts +28 -0
  356. package/dist/time/EpochWindow.js +31 -0
  357. package/dist/time/EpochWindow.js.map +1 -0
  358. package/dist/time/TimeStamped.d.ts +43 -0
  359. package/dist/time/TimeStamped.js +46 -0
  360. package/dist/time/TimeStamped.js.map +1 -0
  361. package/dist/time/index.d.ts +30 -0
  362. package/dist/time/index.js +31 -0
  363. package/dist/time/index.js.map +1 -0
  364. package/dist/transforms/TransformCache.d.ts +27 -0
  365. package/dist/transforms/TransformCache.js +41 -0
  366. package/dist/transforms/TransformCache.js.map +1 -0
  367. package/dist/transforms/conversions.d.ts +63 -0
  368. package/dist/transforms/conversions.js +88 -0
  369. package/dist/transforms/conversions.js.map +1 -0
  370. package/dist/transforms/index.d.ts +1 -0
  371. package/dist/transforms/index.js +1 -0
  372. package/dist/transforms/index.js.map +1 -1
  373. package/dist/transforms/transforms.d.ts +166 -2
  374. package/dist/transforms/transforms.js +372 -1
  375. package/dist/transforms/transforms.js.map +1 -1
  376. package/dist/types/types.d.ts +674 -2
  377. package/dist/types/types.js +36 -0
  378. package/dist/types/types.js.map +1 -1
  379. package/dist/utils/constants.d.ts +80 -0
  380. package/dist/utils/constants.js +87 -0
  381. package/dist/utils/constants.js.map +1 -0
  382. package/dist/utils/functions.d.ts +228 -0
  383. package/dist/utils/functions.js +476 -0
  384. package/dist/utils/functions.js.map +1 -1
  385. package/dist/utils/index.d.ts +3 -1
  386. package/dist/utils/index.js +3 -1
  387. package/dist/utils/index.js.map +1 -1
  388. package/dist/utils/jacobian.d.ts +1 -1
  389. package/dist/utils/jacobian.js +1 -1
  390. package/dist/utils/jacobian.js.map +1 -1
  391. package/dist/utils/linearDistance.d.ts +8 -0
  392. package/dist/utils/linearDistance.js +10 -0
  393. package/dist/utils/linearDistance.js.map +1 -0
  394. package/package.json +4 -7
  395. package/src/body/Celestial.ts +134 -0
  396. package/src/body/Earth.ts +260 -0
  397. package/src/body/Moon.ts +556 -0
  398. package/src/body/NutationAngles.ts +40 -0
  399. package/src/body/PrecessionAngles.ts +31 -0
  400. package/src/body/Sun.ts +669 -0
  401. package/src/body/index.ts +27 -0
  402. package/src/body/suncalc.LICENSE.md +18 -0
  403. package/src/coordinate/ClassicalElements.ts +326 -0
  404. package/src/coordinate/EquinoctialElements.ts +189 -0
  405. package/src/coordinate/FormatTle.ts +214 -0
  406. package/src/coordinate/Geodetic.ts +186 -0
  407. package/src/coordinate/Hill.ts +1 -1
  408. package/src/coordinate/ITRF.ts +146 -0
  409. package/src/coordinate/J2000.ts +130 -0
  410. package/src/coordinate/RIC.ts +87 -0
  411. package/src/coordinate/RelativeState.ts +101 -0
  412. package/src/coordinate/StateVector.ts +122 -0
  413. package/src/coordinate/TEME.ts +97 -0
  414. package/src/coordinate/Tle.ts +1024 -0
  415. package/src/coordinate/index.ts +12 -0
  416. package/src/coordinate/tle-format-data.ts +47 -0
  417. package/src/covariance/CovarianceSample.ts +1 -1
  418. package/src/covariance/StateCovariance.ts +1 -1
  419. package/src/data/DataHandler.ts +88 -0
  420. package/src/data/values/Egm96Data.ts +75 -0
  421. package/src/data/values/HpAtmosphereData.ts +76 -0
  422. package/src/data/values/HpAtmosphereResult.ts +41 -0
  423. package/src/data/values/Iau1980Data.ts +63 -0
  424. package/src/data/values/LeapSecond.ts +37 -0
  425. package/src/data/values/LeapSecondData.ts +113 -0
  426. package/src/data/values/egm96.ts +728 -0
  427. package/src/data/values/hpAtmosphere.ts +79 -0
  428. package/src/data/values/iau1980.ts +32 -0
  429. package/src/enums/AngularDiameterMethod.ts +28 -0
  430. package/src/enums/AngularDistanceMethod.ts +28 -0
  431. package/src/enums/OrbitRegime.ts +31 -0
  432. package/src/enums/PassType.ts +29 -0
  433. package/src/enums/Sgp4OpsMode.ts +27 -0
  434. package/src/enums/index.ts +5 -0
  435. package/src/force/AtmosphericDrag.ts +1 -1
  436. package/src/force/EarthGravity.ts +1 -1
  437. package/src/force/Force.ts +1 -1
  438. package/src/force/ForceModel.ts +1 -1
  439. package/src/force/Gravity.ts +1 -1
  440. package/src/force/SolarRadiationPressure.ts +1 -1
  441. package/src/force/ThirdBodyGravity.ts +1 -1
  442. package/src/force/Thrust.ts +1 -1
  443. package/src/interfaces/BaseObjectParams.ts +33 -0
  444. package/src/interfaces/ClassicalElementsParams.ts +35 -0
  445. package/src/interfaces/EquinoctialElementsParams.ts +37 -0
  446. package/src/interfaces/GroundPositionParams.ts +30 -0
  447. package/src/interfaces/OmmFormat.ts +63 -0
  448. package/src/interfaces/OptionsParams.ts +3 -0
  449. package/src/interfaces/RfSensorParams.ts +1 -1
  450. package/src/interfaces/SatelliteParams.ts +20 -0
  451. package/src/interfaces/SensorParams.ts +39 -0
  452. package/src/interfaces/StarObjectParams.ts +11 -0
  453. package/src/interfaces/TimeVariables.ts +7 -0
  454. package/src/interfaces/index.ts +8 -0
  455. package/src/interpolator/ChebyshevCoefficients.ts +1 -1
  456. package/src/interpolator/ChebyshevInterpolator.ts +1 -1
  457. package/src/interpolator/CubicSpline.ts +1 -1
  458. package/src/interpolator/CubicSplineInterpolator.ts +1 -1
  459. package/src/interpolator/Interpolator.ts +1 -1
  460. package/src/interpolator/LagrangeInterpolator.ts +1 -1
  461. package/src/interpolator/StateInterpolator.ts +1 -1
  462. package/src/interpolator/VerletBlendInterpolator.ts +1 -1
  463. package/src/main.ts +11 -3
  464. package/src/maneuver/TwoBurnOrbitTransfer.ts +1 -1
  465. package/src/maneuver/Waypoint.ts +1 -1
  466. package/src/objects/BaseObject.ts +171 -0
  467. package/src/objects/DetailedSatellite.ts +3 -3
  468. package/src/objects/DetailedSensor.ts +2 -1
  469. package/src/objects/GroundObject.ts +176 -0
  470. package/src/objects/LandObject.ts +2 -1
  471. package/src/objects/Marker.ts +1 -1
  472. package/src/objects/RfSensor.ts +1 -2
  473. package/src/objects/Satellite.ts +552 -0
  474. package/src/objects/Sensor.ts +280 -0
  475. package/src/objects/Star.ts +96 -0
  476. package/src/objects/index.ts +5 -0
  477. package/src/observation/Observation.ts +1 -1
  478. package/src/observation/ObservationOptical.ts +1 -1
  479. package/src/observation/ObservationRadar.ts +1 -1
  480. package/src/observation/ObservationUtils.ts +30 -1
  481. package/src/observation/RAE.ts +262 -0
  482. package/src/observation/RadecGeocentric.ts +206 -0
  483. package/src/observation/RadecTopocentric.ts +241 -0
  484. package/src/observation/index.ts +27 -0
  485. package/src/operations/BoxMuller.ts +1 -1
  486. package/src/operations/EulerAngles.ts +1 -1
  487. package/src/operations/Matrix.ts +473 -0
  488. package/src/operations/Quaternion.ts +1 -1
  489. package/src/operations/Random.ts +54 -0
  490. package/src/operations/RandomGaussianSource.ts +1 -1
  491. package/src/operations/Vector.ts +484 -0
  492. package/src/operations/Vector3D.ts +289 -0
  493. package/src/operations/operations.ts +27 -0
  494. package/src/optimize/ChebyshevCompressor.ts +1 -1
  495. package/src/optimize/PolynomialRegression.ts +1 -1
  496. package/src/optimize/SimplexEntry.ts +1 -1
  497. package/src/orbit_determination/BatchLeastSquaresOD.ts +1 -1
  498. package/src/orbit_determination/BatchLeastSquaresResult.ts +1 -1
  499. package/src/orbit_determination/GibbsIOD.ts +3 -1
  500. package/src/orbit_determination/GoodingIOD.ts +1 -1
  501. package/src/orbit_determination/HerrickGibbsIOD.ts +1 -1
  502. package/src/orbit_determination/LambertIOD.ts +1 -1
  503. package/src/orbit_determination/ModifiedGoodingIOD.ts +1 -1
  504. package/src/orbit_determination/index.ts +7 -0
  505. package/src/propagator/KeplerPropagator.ts +1 -1
  506. package/src/propagator/Propagator.ts +1 -1
  507. package/src/propagator/RkCheckpoint.ts +1 -1
  508. package/src/propagator/RkResult.ts +1 -1
  509. package/src/propagator/RungeKutta4Propagator.ts +1 -1
  510. package/src/propagator/RungeKuttaAdaptive.ts +1 -1
  511. package/src/propagator/Sgp4Propagator.ts +1 -1
  512. package/src/sgp4/index.ts +24 -0
  513. package/src/sgp4/sgp4-error.ts +53 -0
  514. package/src/sgp4/sgp4.LICENSE.md +28 -0
  515. package/src/sgp4/sgp4.ts +3986 -0
  516. package/src/smoothing/ExponentialSmoothing.ts +1 -1
  517. package/src/time/Epoch.ts +128 -0
  518. package/src/time/EpochGPS.ts +76 -0
  519. package/src/time/EpochTAI.ts +27 -0
  520. package/src/time/EpochTDB.ts +27 -0
  521. package/src/time/EpochTT.ts +27 -0
  522. package/src/time/EpochUTC.ts +188 -0
  523. package/src/time/EpochWindow.ts +33 -0
  524. package/src/time/TimeStamped.ts +50 -0
  525. package/src/time/index.ts +31 -0
  526. package/src/transforms/TransformCache.ts +46 -0
  527. package/src/transforms/conversions.ts +98 -0
  528. package/src/transforms/index.ts +1 -0
  529. package/src/transforms/transforms.ts +478 -2
  530. package/src/types/types.ts +721 -2
  531. package/src/utils/constants.ts +113 -0
  532. package/src/utils/functions.ts +562 -0
  533. package/src/utils/index.ts +3 -1
  534. package/src/utils/jacobian.ts +1 -1
  535. package/src/utils/linearDistance.ts +11 -0
@@ -0,0 +1,669 @@
1
+ /**
2
+ * @author Theodore Kruczek.
3
+ * @license MIT
4
+ * @copyright (c) 2022-2025 Theodore Kruczek Permission is
5
+ * hereby granted, free of charge, to any person obtaining a copy of this
6
+ * software and associated documentation files (the "Software"), to deal in the
7
+ * Software without restriction, including without limitation the rights to use,
8
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ * the Software, and to permit persons to whom the Software is furnished to do
10
+ * so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ * @copyright (c) 2011-2015, Vladimir Agafonkin
23
+ * @copyright (c) 2022 Robert Gester https://github.com/hypnos3/suncalc3
24
+ * @see suncalc.LICENSE.md
25
+ * Some of the math in this file was originally created by Vladimir Agafonkin.
26
+ * Robert Gester's update was referenced for documentation. There were a couple
27
+ * of bugs in both versions so there will be some differences if you are
28
+ * migrating from either to this library.
29
+ *
30
+ * suncalc is a JavaScript library for calculating sun/moon position and light
31
+ * phases. https://github.com/mourner/suncalc
32
+ * It was reworked and enhanced by Robert Gester.
33
+ *
34
+ * The original suncalc is released under the terms of the BSD 2-Clause License.
35
+ */
36
+
37
+ import {
38
+ angularDiameter,
39
+ AngularDiameterMethod,
40
+ astronomicalUnit,
41
+ AzEl,
42
+ Celestial,
43
+ cKmPerSec,
44
+ DEG2RAD,
45
+ Degrees,
46
+ Earth,
47
+ EpochUTC,
48
+ Kilometers,
49
+ Meters,
50
+ MS_PER_DAY,
51
+ RAD2DEG,
52
+ RaDec,
53
+ Radians,
54
+ Seconds,
55
+ SunTime,
56
+ TAU,
57
+ Vector3D,
58
+ } from '../main.js';
59
+
60
+ /**
61
+ * Sun metrics and operations.
62
+ */
63
+ export class Sun {
64
+ private static readonly J0_ = 0.0009;
65
+ private static readonly J1970_ = 2440587.5;
66
+ private static readonly J2000_ = 2451545;
67
+ static readonly e = DEG2RAD * 23.4397;
68
+
69
+ /**
70
+ * Array representing the times for different phases of the sun. Each element
71
+ * in the array contains:
72
+ * - The angle in degrees representing the time offset from solar noon.
73
+ * - The name of the start time for the phase.
74
+ * - The name of the end time for the phase.
75
+ */
76
+ private static readonly times_ = [
77
+ [6, 'goldenHourDawnEnd', 'goldenHourDuskStart'], // GOLDEN_HOUR_2
78
+ [-0.3, 'sunriseEnd', 'sunsetStart'], // SUNRISE_END
79
+ [-0.833, 'sunriseStart', 'sunsetEnd'], // SUNRISE
80
+ [-1, 'goldenHourDawnStart', 'goldenHourDuskEnd'], // GOLDEN_HOUR_1
81
+ [-4, 'blueHourDawnEnd', 'blueHourDuskStart'], // BLUE_HOUR
82
+ [-6, 'civilDawn', 'civilDusk'], // DAWN
83
+ [-8, 'blueHourDawnStart', 'blueHourDuskEnd'], // BLUE_HOUR
84
+ [-12, 'nauticalDawn', 'nauticalDusk'], // NAUTIC_DAWN
85
+ [-15, 'amateurDawn', 'amateurDusk'],
86
+ [-18, 'astronomicalDawn', 'astronomicalDusk'], // ASTRO_DAWN
87
+ ] as [Degrees, string, string][];
88
+
89
+ /**
90
+ * Gravitational parameter of the Sun. (km³/s²)
91
+ */
92
+ static readonly mu = 1.32712428e11;
93
+ /**
94
+ * The angle of the penumbra of the Sun, in radians.
95
+ */
96
+ static readonly penumbraAngle = (0.26900424 * DEG2RAD) as Radians;
97
+ /**
98
+ * The radius of the Sun in kilometers.
99
+ */
100
+ static readonly radius = 695500.0 as Kilometers;
101
+ /**
102
+ * The mean solar flux of the Sun. (W/m²)
103
+ */
104
+ static readonly solarFlux = 1367.0;
105
+ /**
106
+ * The solar pressure exerted by the Sun. (N/m²) It is calculated as the solar
107
+ * flux divided by the speed of light.
108
+ */
109
+ static readonly solarPressure = Sun.solarFlux / (cKmPerSec * 1000);
110
+ /**
111
+ * The angle of the umbra, in radians.
112
+ */
113
+ static readonly umbraAngle = (0.26411888 * DEG2RAD) as Radians;
114
+
115
+ private constructor() {
116
+ // disable constructor
117
+ }
118
+
119
+ /**
120
+ * Calculates the azimuth and elevation of the Sun for a given date, latitude,
121
+ * and longitude.
122
+ * @param date - The date for which to calculate the azimuth and elevation.
123
+ * @param lat - The latitude in degrees.
124
+ * @param lon - The longitude in degrees.
125
+ * @param c - The right ascension and declination of the target. Defaults to
126
+ * the Sun's right ascension and declination
127
+ * @returns An object containing the azimuth and elevation of the Sun in
128
+ * radians.
129
+ */
130
+ static azEl(date: Date, lat: Degrees, lon: Degrees, c?: RaDec): AzEl<Radians> {
131
+ const lw = <Radians>(-lon * DEG2RAD);
132
+ const phi = <Radians>(lat * DEG2RAD);
133
+ const d = Sun.date2jSince2000(date);
134
+
135
+ c ??= Sun.raDec(date);
136
+ const H = Sun.siderealTime(d, lw) - c.ra;
137
+
138
+ return {
139
+ az: Celestial.azimuth(H, phi, c.dec),
140
+ el: Celestial.elevation(H, phi, c.dec),
141
+ };
142
+ }
143
+
144
+ /**
145
+ * get number of days for a dateValue since 2000
146
+ * See: https://en.wikipedia.org/wiki/Epoch_(astronomy)
147
+ * @param date date as timestamp to get days
148
+ * @returns count of days
149
+ */
150
+ static date2jSince2000(date: Date): number {
151
+ return date.getTime() / MS_PER_DAY + Sun.J1970_ - Sun.J2000_;
152
+ }
153
+
154
+ /**
155
+ * Calculates the angular diameter of the Sun given the observer's position
156
+ * and the Sun's position.
157
+ * @param obsPos The observer's position in kilometers.
158
+ * @param sunPos The Sun's position in kilometers.
159
+ * @returns The angular diameter of the Sun in radians.
160
+ */
161
+ static diameter(obsPos: Vector3D<Kilometers>, sunPos: Vector3D<Kilometers>): Radians {
162
+ return angularDiameter(
163
+ this.radius * 2,
164
+ obsPos.subtract(sunPos).magnitude(),
165
+ AngularDiameterMethod.Sphere,
166
+ ) as Radians;
167
+ }
168
+
169
+ /**
170
+ * Calculate eclipse angles given a satellite ECI position and Sun ECI
171
+ * position.
172
+ * @param satPos the satellite position
173
+ * @param sunPos the sun position
174
+ * @returns [central body angle, central body apparent radius, sun apparent]
175
+ */
176
+ static eclipseAngles(satPos: Vector3D<Kilometers>, sunPos: Vector3D<Kilometers>): [Radians, Radians, Radians] {
177
+ const satSun = sunPos.subtract(satPos);
178
+ const r = satPos.magnitude();
179
+
180
+ return [
181
+ // central body angle
182
+ satSun.angle(satPos.negate()),
183
+ // central body apparent radius
184
+ Math.asin(Earth.radiusEquator / r) as Radians,
185
+ // sun apparent radius
186
+ Math.asin(this.radius / satSun.magnitude()) as Radians,
187
+ ];
188
+ }
189
+
190
+ /**
191
+ * Ecliptic latitude measures the distance north or south of the ecliptic,
192
+ * attaining +90° at the north ecliptic pole (NEP) and -90° at the south
193
+ * ecliptic pole (SEP). The ecliptic itself is 0° latitude.
194
+ * @param B - ?
195
+ * @returns ecliptic latitude
196
+ */
197
+ static eclipticLatitude(B: number): number {
198
+ const C = TAU / 360;
199
+ const L = B - 0.00569 - 0.00478 * Math.sin(C * B);
200
+
201
+ return TAU * (L + 0.0003 * Math.sin(C * 2 * L));
202
+ }
203
+
204
+ /**
205
+ * Ecliptic longitude, also known as celestial longitude, measures the angular
206
+ * distance of an object along the ecliptic from the primary direction. It is
207
+ * measured positive eastwards in the fundamental plane (the ecliptic) from 0°
208
+ * to 360°. The primary direction (0° ecliptic longitude) points from the
209
+ * Earth towards the Sun at the vernal equinox of the Northern Hemisphere. Due
210
+ * to axial precession, the ecliptic longitude of most "fixed stars" increases
211
+ * by about 50.3 arcseconds per year, or 83.8 arcminutes per century.
212
+ * @param M - solar mean anomaly
213
+ * @returns ecliptic longitude
214
+ */
215
+ static eclipticLongitude(M: number): Radians {
216
+ const C = DEG2RAD * (1.9148 * Math.sin(M) + 0.02 * Math.sin(2 * M) + 0.0003 * Math.sin(3 * M));
217
+ const P = DEG2RAD * 102.9372; // perihelion of Earth
218
+
219
+ return <Radians>(M + C + P + Math.PI); // Sun's mean longitude
220
+ }
221
+
222
+ /**
223
+ * returns set time for the given sun altitude
224
+ * @param h - height at 0
225
+ * @param lw - rad * -lng
226
+ * @param phi - rad * lat;
227
+ * @param dec - declination
228
+ * @param n - Julian cycle
229
+ * @param M - solar mean anomal
230
+ * @param L - ecliptic longitude
231
+ * @returns set time
232
+ */
233
+ static getSetJulian(h: Meters, lw: number, phi: number, dec: number, n: number, M: number, L: number): number {
234
+ const w = Sun.hourAngle(h, phi, dec);
235
+ const a = Sun.approxTransit_(w, lw, n);
236
+
237
+ return Sun.solarTransitJulian(a, M, L);
238
+ }
239
+
240
+ /**
241
+ * Calculates the time of the sun based on the given azimuth.
242
+ * @param dateValue - The date value or Date object.
243
+ * @param lat - The latitude in degrees.
244
+ * @param lon - The longitude in degrees.
245
+ * @param az - The azimuth in radians or degrees.
246
+ * @param isDegrees - Indicates if the azimuth is in degrees. Default is false.
247
+ * @returns The calculated time of the sun.
248
+ * @throws Error if the azimuth, latitude, or longitude is missing.
249
+ */
250
+ static getSunTimeByAz(
251
+ dateValue: number | Date,
252
+ lat: Degrees,
253
+ lon: Degrees,
254
+ az: Radians | Degrees,
255
+ isDegrees = false,
256
+ ) {
257
+ if (isNaN(az)) {
258
+ throw new Error('azimuth missing');
259
+ }
260
+ if (isNaN(lat)) {
261
+ throw new Error('latitude missing');
262
+ }
263
+ if (isNaN(lon)) {
264
+ throw new Error('longitude missing');
265
+ }
266
+
267
+ if (isDegrees) {
268
+ az = <Radians>(az * DEG2RAD);
269
+ }
270
+ const date = dateValue instanceof Date ? dateValue : new Date(dateValue);
271
+ const lw = <Radians>(DEG2RAD * -lon);
272
+ const phi = <Radians>(DEG2RAD * lat);
273
+
274
+ let dateVal = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0).getTime();
275
+ let addval = MS_PER_DAY; // / 2);
276
+
277
+ dateVal += addval;
278
+
279
+ while (addval > 200) {
280
+ const newDate = new Date(dateVal);
281
+ const d = Sun.date2jSince2000(newDate);
282
+ const c = Sun.raDec(newDate);
283
+ const H = Sun.siderealTime(d, lw) - c.ra;
284
+ const newAz = Celestial.azimuth(H, phi, c.dec);
285
+
286
+ addval /= 2;
287
+ if (newAz < az) {
288
+ dateVal += addval;
289
+ } else {
290
+ dateVal -= addval;
291
+ }
292
+ }
293
+
294
+ return new Date(Math.floor(dateVal));
295
+ }
296
+
297
+ /**
298
+ * Calculates sun times for a given date and latitude/longitude
299
+ *
300
+ * Default altitude is 0 meters. If `isUtc` is `true`, the times are returned
301
+ * as UTC, otherwise in local time.
302
+ * @param dateVal - The date value or Date object.
303
+ * @param lat - The latitude in degrees.
304
+ * @param lon - The longitude in degrees.
305
+ * @param alt - The altitude in meters. Default is 0.
306
+ * @param isUtc - Indicates if the times should be returned as UTC. Default is
307
+ * false.
308
+ * @returns An object containing the times of the sun.
309
+ */
310
+ static getTimes(dateVal: Date | number, lat: Degrees, lon: Degrees, alt: Meters = <Meters>0, isUtc = false): SunTime {
311
+ if (isNaN(lat)) {
312
+ throw new Error('latitude missing');
313
+ }
314
+ if (isNaN(lon)) {
315
+ throw new Error('longitude missing');
316
+ }
317
+
318
+ // Ensure date is a Date object
319
+ const date = dateVal instanceof Date ? dateVal : new Date(dateVal);
320
+
321
+ if (isUtc) {
322
+ date.setUTCHours(12, 0, 0, 0);
323
+ } else {
324
+ date.setHours(12, 0, 0, 0);
325
+ }
326
+
327
+ let time: [Degrees, string, string];
328
+ let h0 = <Meters>0;
329
+ let Jset = 0;
330
+ let Jrise = 0;
331
+
332
+ const { Jnoon, dh, lw, phi, dec, n, M, L } = Sun.calculateJnoon_(lon, lat, alt, date);
333
+
334
+ // Determine when the sun is at its highest and lowest (darkest) points.
335
+ const result: SunTime = {
336
+ solarNoon: Sun.julian2date(Jnoon),
337
+ nadir: Sun.julian2date(Jnoon + 0.5), // https://github.com/mourner/suncalc/pull/125
338
+ } as SunTime;
339
+
340
+ // Add all other unique times using Jnoon as a reference
341
+ for (let i = 0, len = Sun.times_.length; i < len; i += 1) {
342
+ time = Sun.times_[i]!;
343
+ const angle = time[0];
344
+
345
+ h0 = <Meters>((angle + dh) * DEG2RAD);
346
+
347
+ Jset = Sun.getSetJ_(h0, lw, phi, dec, n, M, L);
348
+ Jrise = Jnoon - (Jset - Jnoon);
349
+
350
+ result[time[1] as keyof SunTime] = Sun.julian2date(Jrise);
351
+ result[time[2] as keyof SunTime] = Sun.julian2date(Jset);
352
+ }
353
+
354
+ return result;
355
+ }
356
+
357
+ /**
358
+ * hour angle
359
+ * @param h - heigh at 0
360
+ * @param phi - rad * lat;
361
+ * @param dec - declination
362
+ * @returns hour angle
363
+ */
364
+ static hourAngle(h: number, phi: number, dec: number): number {
365
+ return Math.acos((Math.sin(h) - Math.sin(phi) * Math.sin(dec)) / (Math.cos(phi) * Math.cos(dec)));
366
+ }
367
+
368
+ /**
369
+ * convert Julian calendar to date object
370
+ * @param julian day number in Julian calendar to convert
371
+ * @returns result date as timestamp
372
+ */
373
+ static julian2date(julian: number): Date {
374
+ return new Date((julian - Sun.J1970_) * MS_PER_DAY);
375
+ }
376
+
377
+ /**
378
+ * Julian cycle
379
+ *
380
+ * The Julian cycle is a period of 7980 years after which the positions of the
381
+ * Sun, Moon, and planets repeat. It is used in astronomical calculations to
382
+ * determine the position of celestial bodies.
383
+ *
384
+ * The Julian Period starts at noon on January 1, 4713 B.C.E. (Julian
385
+ * calendar) and lasts for 7980 years. This was determined because it is a
386
+ * time period long enough to include all of recorded history and includes
387
+ * some time in the future that would incorporate the three important
388
+ * calendrical cycles, the Golden Number Cycle, the Solar Cycle, and the Roman
389
+ * Indiction.
390
+ *
391
+ * The Golden Number Cycle is a cycle of 19 years, while the Solar Cycle is a
392
+ * cycle of 28 years and the Roman Indiction repeats every 15 years. Thus the
393
+ * Julian Period is calculated to be 7980 years long or 2,914,695 days because
394
+ * 19*28*15 = 7980.
395
+ * @param date - Date object for calculating julian cycle
396
+ * @param lon - Degrees longitude
397
+ * @returns julian cycle
398
+ */
399
+ static julianCycle(date: Date, lon: Degrees): number {
400
+ const lw = <Radians>(-lon * DEG2RAD);
401
+ const d = Sun.date2jSince2000(date);
402
+
403
+ return Math.round(d - Sun.J0_ - lw / ((2 * TAU) / 2));
404
+ }
405
+
406
+ /**
407
+ * Calculate the lighting ratio given a satellite ECI position [satPos] _(km)_
408
+ * and Sun ECI position [sunPos] _(km)_.
409
+ *
410
+ * Returns `1.0` if the satellite is fully illuminated and `0.0` when fully
411
+ * eclipsed.
412
+ * @param satPos - The position of the satellite.
413
+ * @param sunPos - The position of the sun.
414
+ * @returns The lighting ratio.
415
+ */
416
+ static lightingRatio(satPos: Vector3D<Kilometers>, sunPos: Vector3D<Kilometers>): number {
417
+ const [sunSatAngle, aCent, aSun] = Sun.eclipseAngles(satPos, sunPos);
418
+
419
+ if (sunSatAngle - aCent + aSun <= 1e-10) {
420
+ return 0.0;
421
+ } else if (sunSatAngle - aCent - aSun < -1e-10) {
422
+ const ssa2 = sunSatAngle * sunSatAngle;
423
+ const ssaInv = 1.0 / (2.0 * sunSatAngle);
424
+ const ac2 = aCent * aCent;
425
+ const as2 = aSun * aSun;
426
+ const acAsDiff = ac2 - as2;
427
+ const a1 = (ssa2 - acAsDiff) * ssaInv;
428
+ const a2 = (ssa2 + acAsDiff) * ssaInv;
429
+ const asr1 = a1 / aSun;
430
+ const asr2 = as2 - a1 * a1;
431
+ const acr1 = a2 / aCent;
432
+ const acr2 = ac2 - a2 * a2;
433
+ const p1 = as2 * Math.acos(asr1) - a1 * Math.sqrt(asr2);
434
+ const p2 = ac2 * Math.acos(acr1) - a2 * Math.sqrt(acr2);
435
+
436
+ return 1.0 - (p1 + p2) / (Math.PI * as2);
437
+ }
438
+
439
+ return 1.0;
440
+ }
441
+
442
+ /**
443
+ * Calculates the lighting factor based on the position of the satellite and the sun.
444
+ * @deprecated This method was previously used. It is now deprecated and will be removed
445
+ * in a future release.
446
+ * @param satPos The position of the satellite.
447
+ * @param sunPos The position of the sun.
448
+ * @returns The lighting factor.
449
+ */
450
+ static sunlightLegacy(satPos: Vector3D, sunPos: Vector3D): number {
451
+ let lighting = 1.0;
452
+
453
+ const semiDiamEarth =
454
+ Math.asin(Earth.radiusMean / Math.sqrt((-satPos.x) ** 2 + (-satPos.y) ** 2 + (-satPos.z) ** 2)) * RAD2DEG;
455
+
456
+ const semiDiamSun =
457
+ Math.asin(
458
+ Sun.radius / Math.sqrt((-satPos.x + sunPos.x) ** 2 + (-satPos.y + sunPos.y) ** 2 + (-satPos.z + sunPos.z) ** 2),
459
+ ) * RAD2DEG;
460
+
461
+ // Angle between earth and sun
462
+ const theta =
463
+ Math.acos(
464
+ satPos.negate().dot(sunPos.negate()) /
465
+ (Math.sqrt((-satPos.x) ** 2 + (-satPos.y) ** 2 + (-satPos.z) ** 2) *
466
+ Math.sqrt((-satPos.x + sunPos.x) ** 2 + (-satPos.y + sunPos.y) ** 2 + (-satPos.z + sunPos.z) ** 2)),
467
+ ) * RAD2DEG;
468
+
469
+ if (semiDiamEarth > semiDiamSun && theta < semiDiamEarth - semiDiamSun) {
470
+ lighting = 0;
471
+ }
472
+
473
+ if (Math.abs(semiDiamEarth - semiDiamSun) < theta && theta < semiDiamEarth + semiDiamSun) {
474
+ lighting = 0.5;
475
+ }
476
+
477
+ if (semiDiamSun > semiDiamEarth) {
478
+ lighting = 0.5;
479
+ }
480
+
481
+ if (theta < semiDiamSun - semiDiamEarth) {
482
+ lighting = 0.5;
483
+ }
484
+
485
+ return lighting;
486
+ }
487
+
488
+ /**
489
+ * Calculates the position vector of the Sun at a given epoch in the
490
+ * Earth-centered inertial (ECI) coordinate system.
491
+ * @param epoch - The epoch in UTC.
492
+ * @returns The position vector of the Sun in Kilometers.
493
+ */
494
+ static position(epoch: EpochUTC): Vector3D<Kilometers> {
495
+ const jc = epoch.toJulianCenturies();
496
+ const dtr = DEG2RAD;
497
+ const lamSun = 280.46 + 36000.77 * jc;
498
+ const mSun = 357.5291092 + 35999.05034 * jc;
499
+ const lamEc = lamSun + 1.914666471 * Math.sin(mSun * dtr) + 0.019994643 * Math.sin(2.0 * mSun * dtr);
500
+ const obliq = 23.439291 - 0.0130042 * jc;
501
+ const rMag = 1.000140612 - 0.016708617 * Math.cos(mSun * dtr) - 0.000139589 * Math.cos(2.0 * mSun * dtr);
502
+ const r = new Vector3D(
503
+ rMag * Math.cos(lamEc * dtr),
504
+ rMag * Math.cos(obliq * dtr) * Math.sin(lamEc * dtr),
505
+ rMag * Math.sin(obliq * dtr) * Math.sin(lamEc * dtr),
506
+ );
507
+ const rMOD = r.scale(astronomicalUnit);
508
+ const p = Earth.precession(epoch);
509
+
510
+ return rMOD
511
+ .rotZ(p.zed)
512
+ .rotY(-p.theta as Radians)
513
+ .rotZ(p.zeta) as Vector3D<Kilometers>;
514
+ }
515
+
516
+ /**
517
+ * Calculate the Sun's apparent ECI position _(km)_ from Earth for a given UTC
518
+ * [epoch].
519
+ * @param epoch - The epoch in UTC.
520
+ * @returns The Sun's apparent ECI position in kilometers.
521
+ */
522
+ static positionApparent(epoch: EpochUTC): Vector3D<Kilometers> {
523
+ const distance = Sun.position(epoch).magnitude();
524
+ const dSec = distance / cKmPerSec;
525
+
526
+ return Sun.position(epoch.roll(-dSec as Seconds));
527
+ }
528
+
529
+ /**
530
+ * Calculates the right ascension and declination of the Sun for a given date.
531
+ * @param date - The date for which to calculate the right ascension and declination.
532
+ * @returns An object containing the declination and right ascension of the Sun.
533
+ */
534
+ static raDec(date: Date): RaDec {
535
+ const d = Sun.date2jSince2000(date);
536
+ const M = Sun.solarMeanAnomaly_(d);
537
+ const L = Sun.eclipticLongitude(M);
538
+
539
+ return {
540
+ dec: Celestial.declination(L, 0),
541
+ ra: Celestial.rightAscension(L, 0),
542
+ dist: 0 as Kilometers,
543
+ };
544
+ }
545
+
546
+ /**
547
+ * Return `true` if the ECI satellite position [posSat] is in eclipse at the
548
+ * given UTC [epoch].
549
+ * @param epoch - The epoch in UTC.
550
+ * @param posSat - The ECI position of the satellite in kilometers.
551
+ * @returns `true` if the satellite is in eclipse.
552
+ */
553
+ static shadow(epoch: EpochUTC, posSat: Vector3D<Kilometers>): boolean {
554
+ const posSun = Sun.positionApparent(epoch);
555
+ let shadow = false;
556
+
557
+ if (posSun.dot(posSat) < 0) {
558
+ const angle = posSun.angle(posSat);
559
+ const r = posSat.magnitude();
560
+ const satHoriz = r * Math.cos(angle);
561
+ const satVert = r * Math.sin(angle);
562
+ const penVert = Earth.radiusEquator + Math.tan(this.penumbraAngle) * satHoriz;
563
+
564
+ if (satVert <= penVert) {
565
+ shadow = true;
566
+ }
567
+ }
568
+
569
+ return shadow;
570
+ }
571
+
572
+ /**
573
+ * side real time
574
+ * @param d - julian day
575
+ * @param lw - longitude of the observer
576
+ * @returns sidereal time
577
+ */
578
+ static siderealTime(d: number, lw: Radians): number {
579
+ return DEG2RAD * (280.16 + 360.9856235 * d) - lw;
580
+ }
581
+
582
+ /**
583
+ * solar transit in Julian
584
+ * @param ds approxTransit
585
+ * @param M solar mean anomal
586
+ * @param L ecliptic longitude
587
+ * @returns solar transit in Julian
588
+ */
589
+ static solarTransitJulian(ds: number, M: number, L: number): number {
590
+ return Sun.J2000_ + ds + 0.0053 * Math.sin(M) - 0.0069 * Math.sin(2 * L);
591
+ }
592
+
593
+ /**
594
+ * The approximate transit time
595
+ * @param Ht hourAngle
596
+ * @param lw rad * -lng
597
+ * @param n Julian cycle
598
+ * @returns approx transit
599
+ */
600
+ private static approxTransit_(Ht: number, lw: number, n: number): number {
601
+ return Sun.J0_ + (Ht + lw) / TAU + n;
602
+ }
603
+
604
+ private static calculateJnoon_(lon: Degrees, lat: Degrees, alt: Meters, date: Date) {
605
+ const lw = <Radians>(DEG2RAD * -lon);
606
+ const phi = <Radians>(DEG2RAD * lat);
607
+ const dh = Sun.observerAngle_(alt);
608
+ const d = Sun.date2jSince2000(date);
609
+
610
+ const n = Sun.julianCycle_(d, lw);
611
+ const ds = Sun.approxTransit_(0, lw, n);
612
+ const M = Sun.solarMeanAnomaly_(ds);
613
+ const L = Sun.eclipticLongitude(M);
614
+ const dec = Celestial.declination(L, 0);
615
+ const Jnoon = Sun.solarTransitJulian(ds, M, L);
616
+
617
+ return { Jnoon, dh, lw, phi, dec, n, M, L };
618
+ }
619
+
620
+ /**
621
+ * returns set time for the given sun altitude
622
+ * @param alt altitude at 0
623
+ * @param lw lng
624
+ * @param phi lat
625
+ * @param dec declination
626
+ * @param n Julian cycle
627
+ * @param M solar mean anomal
628
+ * @param L ecliptic longitude
629
+ * @returns sunset time in days since 2000
630
+ */
631
+ private static getSetJ_(
632
+ alt: Meters,
633
+ lw: Radians,
634
+ phi: Radians,
635
+ dec: Radians,
636
+ n: number,
637
+ M: number,
638
+ L: Radians,
639
+ ): number {
640
+ const w = Sun.hourAngle(alt, phi, dec);
641
+ const a = Sun.approxTransit_(w, lw, n);
642
+
643
+ return Sun.solarTransitJulian(a, M, L);
644
+ }
645
+
646
+ private static julianCycle_(d: number, lw: number): number {
647
+ const lonOffset = lw / TAU;
648
+
649
+ return Math.round(d - Sun.J0_ - lonOffset);
650
+ }
651
+
652
+ /**
653
+ * calculates the obderver angle
654
+ * @param alt the observer altitude (in meters) relative to the horizon
655
+ * @returns height for further calculations
656
+ */
657
+ private static observerAngle_(alt: Meters): Degrees {
658
+ return <Degrees>((-2.076 * Math.sqrt(alt)) / 60);
659
+ }
660
+
661
+ /**
662
+ * get solar mean anomaly
663
+ * @param d julian day
664
+ * @returns solar mean anomaly
665
+ */
666
+ private static solarMeanAnomaly_(d: number): number {
667
+ return DEG2RAD * (357.5291 + 0.98560028 * d);
668
+ }
669
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @author Theodore Kruczek.
3
+ * @license MIT
4
+ * @copyright (c) 2022-2025 Theodore Kruczek Permission is
5
+ * hereby granted, free of charge, to any person obtaining a copy of this
6
+ * software and associated documentation files (the "Software"), to deal in the
7
+ * Software without restriction, including without limitation the rights to use,
8
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ * the Software, and to permit persons to whom the Software is furnished to do
10
+ * so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+
24
+ export { Celestial } from './Celestial.js';
25
+ export { Earth } from './Earth.js';
26
+ export { Moon } from './Moon.js';
27
+ export { Sun } from './Sun.js';