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.
- package/CHANGELOG.md +235 -10
- package/README.md +27 -40
- package/dist/coordinate/Hill.d.ts +49 -0
- package/dist/coordinate/Hill.js +222 -0
- package/dist/coordinate/Hill.js.map +1 -0
- package/dist/coordinate/index.d.ts +1 -0
- package/dist/coordinate/index.js +2 -0
- package/dist/coordinate/index.js.map +1 -0
- package/dist/covariance/CovarianceSample.d.ts +43 -0
- package/dist/covariance/CovarianceSample.js +147 -0
- package/dist/covariance/CovarianceSample.js.map +1 -0
- package/dist/covariance/StateCovariance.d.ts +42 -0
- package/dist/covariance/StateCovariance.js +65 -0
- package/dist/covariance/StateCovariance.js.map +1 -0
- package/dist/force/AtmosphericDrag.d.ts +31 -0
- package/dist/force/AtmosphericDrag.js +73 -0
- package/dist/force/AtmosphericDrag.js.map +1 -0
- package/dist/force/EarthGravity.d.ts +27 -0
- package/dist/force/EarthGravity.js +117 -0
- package/dist/force/EarthGravity.js.map +1 -0
- package/{lib/ootk.d.ts → dist/force/Force.d.ts} +12 -11
- package/dist/force/Force.js +31 -0
- package/dist/force/Force.js.map +1 -0
- package/dist/force/ForceModel.d.ts +37 -0
- package/dist/force/ForceModel.js +75 -0
- package/dist/force/ForceModel.js.map +1 -0
- package/dist/force/Gravity.d.ts +38 -0
- package/dist/force/Gravity.js +47 -0
- package/dist/force/Gravity.js.map +1 -0
- package/dist/{ootk.d.ts → force/SolarRadiationPressure.d.ts} +12 -11
- package/dist/force/SolarRadiationPressure.js +44 -0
- package/dist/force/SolarRadiationPressure.js.map +1 -0
- package/dist/force/ThirdBodyGravity.d.ts +26 -0
- package/dist/force/ThirdBodyGravity.js +57 -0
- package/dist/force/ThirdBodyGravity.js.map +1 -0
- package/dist/force/Thrust.d.ts +34 -0
- package/dist/force/Thrust.js +58 -0
- package/dist/force/Thrust.js.map +1 -0
- package/dist/interfaces/RfSensorParams.d.ts +28 -0
- package/dist/interfaces/RfSensorParams.js +24 -0
- package/dist/interfaces/RfSensorParams.js.map +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +2 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interpolator/ChebyshevCoefficients.d.ts +50 -0
- package/dist/interpolator/ChebyshevCoefficients.js +94 -0
- package/dist/interpolator/ChebyshevCoefficients.js.map +1 -0
- package/dist/interpolator/ChebyshevInterpolator.d.ts +38 -0
- package/dist/interpolator/ChebyshevInterpolator.js +71 -0
- package/dist/interpolator/ChebyshevInterpolator.js.map +1 -0
- package/dist/interpolator/CubicSpline.d.ts +35 -0
- package/dist/interpolator/CubicSpline.js +69 -0
- package/dist/interpolator/CubicSpline.js.map +1 -0
- package/dist/interpolator/CubicSplineInterpolator.d.ts +36 -0
- package/dist/interpolator/CubicSplineInterpolator.js +80 -0
- package/dist/interpolator/CubicSplineInterpolator.js.map +1 -0
- package/dist/interpolator/FieldInterpolator.d.ts +28 -0
- package/dist/interpolator/FieldInterpolator.js +34 -0
- package/dist/interpolator/FieldInterpolator.js.map +1 -0
- package/dist/interpolator/Interpolator.d.ts +22 -0
- package/dist/interpolator/Interpolator.js +47 -0
- package/dist/interpolator/Interpolator.js.map +1 -0
- package/dist/interpolator/LagrangeInterpolator.d.ts +40 -0
- package/dist/interpolator/LagrangeInterpolator.js +159 -0
- package/dist/interpolator/LagrangeInterpolator.js.map +1 -0
- package/dist/interpolator/StateInterpolator.d.ts +27 -0
- package/dist/interpolator/StateInterpolator.js +35 -0
- package/dist/interpolator/StateInterpolator.js.map +1 -0
- package/dist/interpolator/VerletBlendInterpolator.d.ts +43 -0
- package/dist/interpolator/VerletBlendInterpolator.js +118 -0
- package/dist/interpolator/VerletBlendInterpolator.js.map +1 -0
- package/{lib/ootk.js → dist/main.d.ts} +13 -10
- package/dist/{objects/space-object.d.ts → main.js} +17 -23
- package/dist/main.js.map +1 -0
- package/dist/maneuver/TwoBurnOrbitTransfer.d.ts +41 -0
- package/dist/maneuver/TwoBurnOrbitTransfer.js +65 -0
- package/dist/maneuver/TwoBurnOrbitTransfer.js.map +1 -0
- package/dist/maneuver/Waypoint.d.ts +91 -0
- package/dist/maneuver/Waypoint.js +179 -0
- package/dist/maneuver/Waypoint.js.map +1 -0
- package/{lib/objects/detailed-sat.d.ts → dist/objects/DetailedSatellite.d.ts} +40 -36
- package/dist/objects/DetailedSatellite.js +136 -0
- package/dist/objects/DetailedSatellite.js.map +1 -0
- package/dist/objects/DetailedSensor.d.ts +42 -0
- package/dist/objects/DetailedSensor.js +65 -0
- package/dist/objects/DetailedSensor.js.map +1 -0
- package/dist/objects/LandObject.d.ts +33 -0
- package/dist/objects/LandObject.js +34 -0
- package/dist/objects/LandObject.js.map +1 -0
- package/dist/objects/Marker.d.ts +20 -0
- package/dist/objects/Marker.js +24 -0
- package/dist/objects/Marker.js.map +1 -0
- package/dist/objects/RfSensor.d.ts +41 -0
- package/dist/objects/RfSensor.js +67 -0
- package/dist/objects/RfSensor.js.map +1 -0
- package/dist/objects/index.d.ts +5 -4
- package/dist/objects/index.js +6 -0
- package/dist/objects/index.js.map +1 -0
- package/dist/observation/Observation.d.ts +89 -0
- package/dist/observation/Observation.js +102 -0
- package/dist/observation/Observation.js.map +1 -0
- package/dist/observation/ObservationOptical.d.ts +48 -0
- package/dist/observation/ObservationOptical.js +105 -0
- package/dist/observation/ObservationOptical.js.map +1 -0
- package/dist/observation/ObservationRadar.d.ts +46 -0
- package/dist/observation/ObservationRadar.js +96 -0
- package/dist/observation/ObservationRadar.js.map +1 -0
- package/dist/observation/ObservationUtils.d.ts +20 -0
- package/dist/observation/ObservationUtils.js +32 -0
- package/dist/observation/ObservationUtils.js.map +1 -0
- package/dist/observation/PropagatorPairs.d.ts +32 -0
- package/dist/observation/PropagatorPairs.js +43 -0
- package/dist/observation/PropagatorPairs.js.map +1 -0
- package/dist/operations/BoxMuller.d.ts +46 -0
- package/dist/operations/BoxMuller.js +77 -0
- package/dist/operations/BoxMuller.js.map +1 -0
- package/dist/operations/EulerAngles.d.ts +105 -0
- package/dist/operations/EulerAngles.js +161 -0
- package/dist/operations/EulerAngles.js.map +1 -0
- package/dist/operations/Quaternion.d.ts +56 -0
- package/dist/operations/Quaternion.js +167 -0
- package/dist/operations/Quaternion.js.map +1 -0
- package/dist/operations/RandomGaussianSource.d.ts +24 -0
- package/dist/operations/RandomGaussianSource.js +43 -0
- package/dist/operations/RandomGaussianSource.js.map +1 -0
- package/dist/operations/index.d.ts +4 -0
- package/dist/operations/index.js +5 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/optimize/ChebyshevCompressor.d.ts +32 -0
- package/dist/optimize/ChebyshevCompressor.js +83 -0
- package/dist/optimize/ChebyshevCompressor.js.map +1 -0
- package/dist/optimize/DownhillSimplex.d.ts +64 -0
- package/dist/optimize/DownhillSimplex.js +182 -0
- package/dist/optimize/DownhillSimplex.js.map +1 -0
- package/dist/optimize/GoldenSection.d.ts +39 -0
- package/dist/optimize/GoldenSection.js +55 -0
- package/dist/optimize/GoldenSection.js.map +1 -0
- package/dist/optimize/PolynomialRegression.d.ts +49 -0
- package/dist/optimize/PolynomialRegression.js +83 -0
- package/dist/optimize/PolynomialRegression.js.map +1 -0
- package/dist/optimize/PolynomicalRegressionResult.d.ts +31 -0
- package/dist/optimize/PolynomicalRegressionResult.js +38 -0
- package/dist/optimize/PolynomicalRegressionResult.js.map +1 -0
- package/dist/optimize/SimpleLinearRegression.d.ts +44 -0
- package/dist/optimize/SimpleLinearRegression.js +112 -0
- package/dist/optimize/SimpleLinearRegression.js.map +1 -0
- package/dist/optimize/SimplexEntry.d.ts +32 -0
- package/dist/optimize/SimplexEntry.js +42 -0
- package/dist/optimize/SimplexEntry.js.map +1 -0
- package/dist/orbit_determination/BatchLeastSquaresOD.d.ts +65 -0
- package/dist/orbit_determination/BatchLeastSquaresOD.js +143 -0
- package/dist/orbit_determination/BatchLeastSquaresOD.js.map +1 -0
- package/dist/orbit_determination/BatchLeastSquaresResult.d.ts +31 -0
- package/{lib/objects/space-object.d.ts → dist/orbit_determination/BatchLeastSquaresResult.js} +21 -23
- package/dist/orbit_determination/BatchLeastSquaresResult.js.map +1 -0
- package/dist/orbit_determination/GibbsIOD.d.ts +38 -0
- package/dist/orbit_determination/GibbsIOD.js +76 -0
- package/dist/orbit_determination/GibbsIOD.js.map +1 -0
- package/dist/orbit_determination/GoodingIOD.d.ts +51 -0
- package/dist/orbit_determination/GoodingIOD.js +247 -0
- package/dist/orbit_determination/GoodingIOD.js.map +1 -0
- package/dist/orbit_determination/HerrickGibbsIOD.d.ts +33 -0
- package/dist/orbit_determination/HerrickGibbsIOD.js +50 -0
- package/dist/orbit_determination/HerrickGibbsIOD.js.map +1 -0
- package/dist/orbit_determination/LambertIOD.d.ts +59 -0
- package/dist/orbit_determination/LambertIOD.js +213 -0
- package/dist/orbit_determination/LambertIOD.js.map +1 -0
- package/dist/orbit_determination/ModifiedGoodingIOD.d.ts +40 -0
- package/dist/orbit_determination/ModifiedGoodingIOD.js +83 -0
- package/dist/orbit_determination/ModifiedGoodingIOD.js.map +1 -0
- package/dist/propagator/DormandPrince54Propagator.d.ts +28 -0
- package/dist/propagator/DormandPrince54Propagator.js +64 -0
- package/dist/propagator/DormandPrince54Propagator.js.map +1 -0
- package/dist/propagator/KeplerPropagator.d.ts +35 -0
- package/dist/propagator/KeplerPropagator.js +84 -0
- package/dist/propagator/KeplerPropagator.js.map +1 -0
- package/dist/propagator/Propagator.d.ts +34 -0
- package/dist/propagator/Propagator.js +162 -0
- package/dist/propagator/Propagator.js.map +1 -0
- package/dist/propagator/RkCheckpoint.d.ts +22 -0
- package/dist/propagator/RkCheckpoint.js +27 -0
- package/dist/propagator/RkCheckpoint.js.map +1 -0
- package/dist/propagator/RkResult.d.ts +23 -0
- package/dist/propagator/RkResult.js +30 -0
- package/dist/propagator/RkResult.js.map +1 -0
- package/dist/propagator/RungeKutta4Propagator.d.ts +50 -0
- package/dist/propagator/RungeKutta4Propagator.js +141 -0
- package/dist/propagator/RungeKutta4Propagator.js.map +1 -0
- package/dist/propagator/RungeKutta89Propagator.d.ts +28 -0
- package/dist/propagator/RungeKutta89Propagator.js +126 -0
- package/dist/propagator/RungeKutta89Propagator.js.map +1 -0
- package/dist/propagator/RungeKuttaAdaptive.d.ts +54 -0
- package/dist/propagator/RungeKuttaAdaptive.js +159 -0
- package/dist/propagator/RungeKuttaAdaptive.js.map +1 -0
- package/dist/propagator/Sgp4Propagator.d.ts +34 -0
- package/dist/propagator/Sgp4Propagator.js +56 -0
- package/dist/propagator/Sgp4Propagator.js.map +1 -0
- package/dist/smoothing/ExponentialSmoothing.d.ts +23 -0
- package/dist/smoothing/ExponentialSmoothing.js +81 -0
- package/dist/smoothing/ExponentialSmoothing.js.map +1 -0
- package/dist/transforms/index.d.ts +1 -0
- package/dist/transforms/index.js +2 -0
- package/dist/transforms/index.js.map +1 -0
- package/dist/transforms/transforms.d.ts +56 -92
- package/dist/transforms/transforms.js +94 -0
- package/dist/transforms/transforms.js.map +1 -0
- package/dist/types/types.d.ts +105 -584
- package/dist/types/types.js +23 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/jacobian.d.ts +11 -0
- package/dist/utils/jacobian.js +29 -0
- package/dist/utils/jacobian.js.map +1 -0
- package/package.json +34 -42
- package/src/coordinate/Hill.ts +326 -0
- package/src/coordinate/index.ts +1 -0
- package/src/covariance/CovarianceSample.ts +194 -0
- package/src/covariance/StateCovariance.ts +69 -0
- package/src/force/AtmosphericDrag.ts +101 -0
- package/src/force/EarthGravity.ts +157 -0
- package/src/force/Force.ts +33 -0
- package/src/force/ForceModel.ts +91 -0
- package/src/force/Gravity.ts +53 -0
- package/src/force/SolarRadiationPressure.ts +42 -0
- package/src/force/ThirdBodyGravity.ts +62 -0
- package/src/force/Thrust.ts +83 -0
- package/src/interfaces/RfSensorParams.ts +30 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interpolator/ChebyshevCoefficients.ts +109 -0
- package/src/interpolator/ChebyshevInterpolator.ts +87 -0
- package/src/interpolator/CubicSpline.ts +72 -0
- package/src/interpolator/CubicSplineInterpolator.ts +90 -0
- package/src/interpolator/FieldInterpolator.ts +37 -0
- package/src/interpolator/Interpolator.ts +56 -0
- package/src/interpolator/LagrangeInterpolator.ts +192 -0
- package/src/interpolator/StateInterpolator.ts +39 -0
- package/src/interpolator/VerletBlendInterpolator.ts +146 -0
- package/src/main.ts +32 -0
- package/src/maneuver/TwoBurnOrbitTransfer.ts +79 -0
- package/src/maneuver/Waypoint.ts +267 -0
- package/src/objects/DetailedSatellite.ts +159 -0
- package/src/objects/DetailedSensor.ts +68 -0
- package/src/objects/LandObject.ts +46 -0
- package/src/objects/Marker.ts +25 -0
- package/src/objects/RfSensor.ts +78 -0
- package/src/objects/index.ts +5 -0
- package/src/observation/Observation.ts +125 -0
- package/src/observation/ObservationOptical.ts +146 -0
- package/src/observation/ObservationRadar.ts +131 -0
- package/src/observation/ObservationUtils.ts +40 -0
- package/src/observation/PropagatorPairs.ts +45 -0
- package/src/operations/BoxMuller.ts +87 -0
- package/src/operations/EulerAngles.ts +183 -0
- package/src/operations/Quaternion.ts +222 -0
- package/src/operations/RandomGaussianSource.ts +51 -0
- package/src/operations/index.ts +4 -0
- package/src/optimize/ChebyshevCompressor.ts +96 -0
- package/src/optimize/DownhillSimplex.ts +212 -0
- package/src/optimize/GoldenSection.ts +71 -0
- package/src/optimize/PolynomialRegression.ts +109 -0
- package/src/optimize/PolynomicalRegressionResult.ts +32 -0
- package/src/optimize/SimpleLinearRegression.ts +127 -0
- package/src/optimize/SimplexEntry.ts +50 -0
- package/src/orbit_determination/BatchLeastSquaresOD.ts +174 -0
- package/src/orbit_determination/BatchLeastSquaresResult.ts +33 -0
- package/src/orbit_determination/GibbsIOD.ts +95 -0
- package/src/orbit_determination/GoodingIOD.ts +380 -0
- package/src/orbit_determination/HerrickGibbsIOD.ts +51 -0
- package/src/orbit_determination/LambertIOD.ts +260 -0
- package/src/orbit_determination/ModifiedGoodingIOD.ts +133 -0
- package/src/propagator/DormandPrince54Propagator.ts +73 -0
- package/src/propagator/KeplerPropagator.ts +102 -0
- package/src/propagator/Propagator.ts +253 -0
- package/src/propagator/RkCheckpoint.ts +25 -0
- package/src/propagator/RkResult.ts +26 -0
- package/src/propagator/RungeKutta4Propagator.ts +179 -0
- package/src/propagator/RungeKutta89Propagator.ts +132 -0
- package/src/propagator/RungeKuttaAdaptive.ts +232 -0
- package/src/propagator/Sgp4Propagator.ts +71 -0
- package/src/smoothing/ExponentialSmoothing.ts +90 -0
- package/src/transforms/index.ts +1 -0
- package/src/transforms/transforms.ts +117 -0
- package/src/types/types.ts +135 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/jacobian.ts +38 -0
- package/.eslintrc.json +0 -244
- package/.prettierrc +0 -17
- package/babel.config.js +0 -16
- package/codecov.yml +0 -21
- package/dist/objects/base-object.d.ts +0 -40
- package/dist/objects/detailed-sat.d.ts +0 -66
- package/dist/objects/sat.d.ts +0 -92
- package/dist/objects/sensor.d.ts +0 -93
- package/dist/objects/star.d.ts +0 -46
- package/dist/ootk.js +0 -2
- package/dist/ootk.js.LICENSE.txt +0 -77
- package/dist/sgp4/sgp4.d.ts +0 -82
- package/dist/tle/tle-format-data.d.ts +0 -6
- package/dist/tle/tle.d.ts +0 -375
- package/dist/utils/constants.d.ts +0 -34
- package/dist/utils/moon-math.d.ts +0 -113
- package/dist/utils/sun-math.d.ts +0 -230
- package/dist/utils/utils.d.ts +0 -39
- package/jest.config.ts +0 -30
- package/lib/objects/base-object.d.ts +0 -40
- package/lib/objects/base-object.js +0 -79
- package/lib/objects/base-object.js.map +0 -1
- package/lib/objects/detailed-sat.js +0 -149
- package/lib/objects/detailed-sat.js.map +0 -1
- package/lib/objects/index.d.ts +0 -4
- package/lib/objects/index.js +0 -5
- package/lib/objects/index.js.map +0 -1
- package/lib/objects/sat.d.ts +0 -92
- package/lib/objects/sat.js +0 -188
- package/lib/objects/sat.js.map +0 -1
- package/lib/objects/sensor.d.ts +0 -93
- package/lib/objects/sensor.js +0 -273
- package/lib/objects/sensor.js.map +0 -1
- package/lib/objects/space-object.js +0 -60
- package/lib/objects/space-object.js.map +0 -1
- package/lib/objects/star.d.ts +0 -46
- package/lib/objects/star.js +0 -91
- package/lib/objects/star.js.map +0 -1
- package/lib/ootk.js.map +0 -1
- package/lib/sgp4/sgp4.d.ts +0 -82
- package/lib/sgp4/sgp4.js +0 -3262
- package/lib/sgp4/sgp4.js.map +0 -1
- package/lib/tle/tle-format-data.d.ts +0 -6
- package/lib/tle/tle-format-data.js +0 -10
- package/lib/tle/tle-format-data.js.map +0 -1
- package/lib/tle/tle.d.ts +0 -375
- package/lib/tle/tle.js +0 -611
- package/lib/tle/tle.js.map +0 -1
- package/lib/transforms/transforms.d.ts +0 -94
- package/lib/transforms/transforms.js +0 -308
- package/lib/transforms/transforms.js.map +0 -1
- package/lib/types/types.d.ts +0 -605
- package/lib/types/types.js +0 -36
- package/lib/types/types.js.map +0 -1
- package/lib/utils/constants.d.ts +0 -34
- package/lib/utils/constants.js +0 -35
- package/lib/utils/constants.js.map +0 -1
- package/lib/utils/moon-math.d.ts +0 -113
- package/lib/utils/moon-math.js +0 -387
- package/lib/utils/moon-math.js.map +0 -1
- package/lib/utils/sun-math.d.ts +0 -230
- package/lib/utils/sun-math.js +0 -422
- package/lib/utils/sun-math.js.map +0 -1
- package/lib/utils/utils.d.ts +0 -39
- package/lib/utils/utils.js +0 -102
- package/lib/utils/utils.js.map +0 -1
- package/sandbox.html +0 -8
- package/tsconfig.base.json +0 -31
- package/tsconfig.build.json +0 -14
- /package/{LICENSE.MD → LICENSE.md} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
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 { astronomicalUnit, J2000, Sun, Vector3D } from 'ootk-core';
|
|
19
|
+
import { Force } from './Force';
|
|
20
|
+
|
|
21
|
+
// / Solar radiation pressure model.
|
|
22
|
+
export class SolarRadiationPressure extends Force {
|
|
23
|
+
// / Create a new [SolarRadiationPressure] object.
|
|
24
|
+
constructor(public mass: number, public area: number, public reflectCoeff: number) {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// / Solar pressure _(N/m²)_;
|
|
29
|
+
private static readonly _kRef: number = 4.56e-6 * astronomicalUnit ** 2;
|
|
30
|
+
|
|
31
|
+
acceleration(state: J2000): Vector3D {
|
|
32
|
+
const rSun = Sun.positionApparent(state.epoch);
|
|
33
|
+
const r = state.position.subtract(rSun);
|
|
34
|
+
const rMag = r.magnitude();
|
|
35
|
+
const r2 = rMag * rMag;
|
|
36
|
+
const ratio = Sun.lightingRatio(state.position, rSun);
|
|
37
|
+
const p = (ratio * SolarRadiationPressure._kRef) / r2;
|
|
38
|
+
const flux = r.scale(p / rMag);
|
|
39
|
+
|
|
40
|
+
return flux.scale(((this.area * this.reflectCoeff) / this.mass) * 1e-3);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
* @license AGPL-3.0-or-later
|
|
4
|
+
* @copyright (c) 2020-2024 Theodore Kruczek
|
|
5
|
+
*
|
|
6
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
7
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
8
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
11
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
* See the GNU Affero General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
15
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { J2000, Moon, Sun, Vector3D } from 'ootk-core';
|
|
19
|
+
import { Force } from './Force';
|
|
20
|
+
|
|
21
|
+
// / Third-body gravity model.
|
|
22
|
+
export class ThirdBodyGravity implements Force {
|
|
23
|
+
// / Create a new [ThirdBodyGravity] object with the selected bodies enabled.
|
|
24
|
+
constructor(public moon: boolean = false, public sun: boolean = false) {
|
|
25
|
+
// Nothing to do here.
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private static _moonGravity(state: J2000): Vector3D {
|
|
29
|
+
const rMoon = Moon.eci(state.epoch);
|
|
30
|
+
const aNum = rMoon.subtract(state.position);
|
|
31
|
+
const aDen = aNum.magnitude() ** 3;
|
|
32
|
+
const bNum = rMoon;
|
|
33
|
+
const bDen = rMoon.magnitude() ** 3;
|
|
34
|
+
const gravity = aNum.scale(1 / aDen).add(bNum.scale(-1 / bDen));
|
|
35
|
+
|
|
36
|
+
return gravity.scale(Moon.mu);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private static _sunGravity(state: J2000): Vector3D {
|
|
40
|
+
const rSun = Sun.positionApparent(state.epoch);
|
|
41
|
+
const aNum = rSun.subtract(state.position);
|
|
42
|
+
const aDen = aNum.magnitude() ** 3;
|
|
43
|
+
const bNum = rSun;
|
|
44
|
+
const bDen = rSun.magnitude() ** 3;
|
|
45
|
+
const gravity = aNum.scale(1 / aDen).add(bNum.scale(-1 / bDen));
|
|
46
|
+
|
|
47
|
+
return gravity.scale(Sun.mu);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
acceleration(state: J2000): Vector3D {
|
|
51
|
+
let accVec = Vector3D.origin;
|
|
52
|
+
|
|
53
|
+
if (this.moon) {
|
|
54
|
+
accVec = accVec.add(ThirdBodyGravity._moonGravity(state));
|
|
55
|
+
}
|
|
56
|
+
if (this.sun) {
|
|
57
|
+
accVec = accVec.add(ThirdBodyGravity._sunGravity(state));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return accVec;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 {
|
|
19
|
+
EpochUTC,
|
|
20
|
+
J2000,
|
|
21
|
+
Kilometers,
|
|
22
|
+
KilometersPerSecond,
|
|
23
|
+
MetersPerSecond,
|
|
24
|
+
RIC,
|
|
25
|
+
Seconds,
|
|
26
|
+
SecondsPerMeterPerSecond,
|
|
27
|
+
Vector3D,
|
|
28
|
+
} from 'ootk-core';
|
|
29
|
+
import { Force } from './Force';
|
|
30
|
+
|
|
31
|
+
// / Thrust force model.
|
|
32
|
+
export class Thrust implements Force {
|
|
33
|
+
constructor(
|
|
34
|
+
public center: EpochUTC,
|
|
35
|
+
public radial: MetersPerSecond,
|
|
36
|
+
public intrack: MetersPerSecond,
|
|
37
|
+
public crosstrack: MetersPerSecond,
|
|
38
|
+
public durationRate = 0.0 as SecondsPerMeterPerSecond,
|
|
39
|
+
) {
|
|
40
|
+
this.deltaV = new Vector3D<KilometersPerSecond>(
|
|
41
|
+
radial * 1e-3 as KilometersPerSecond,
|
|
42
|
+
intrack * 1e-3 as KilometersPerSecond,
|
|
43
|
+
crosstrack * 1e-3 as KilometersPerSecond,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
deltaV: Vector3D<KilometersPerSecond>;
|
|
48
|
+
|
|
49
|
+
get magnitude(): MetersPerSecond {
|
|
50
|
+
return this.deltaV.magnitude() * 1000.0 as MetersPerSecond;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get duration(): Seconds {
|
|
54
|
+
return this.magnitude * this.durationRate as Seconds;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get start(): EpochUTC {
|
|
58
|
+
return this.center.roll(-0.5 * this.duration as Seconds);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get stop(): EpochUTC {
|
|
62
|
+
return this.center.roll(0.5 * this.duration as Seconds);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
acceleration(state: J2000): Vector3D {
|
|
66
|
+
const relative = new RIC(
|
|
67
|
+
Vector3D.origin as Vector3D<Kilometers>,
|
|
68
|
+
this.deltaV.scale(1.0 / this.duration as KilometersPerSecond),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return relative.toJ2000(state).velocity.subtract(state.velocity);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
apply(state: J2000): J2000 {
|
|
75
|
+
const relative = new RIC(Vector3D.origin as Vector3D<Kilometers>, this.deltaV);
|
|
76
|
+
|
|
77
|
+
return relative.toJ2000(state);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get isImpulsive(): boolean {
|
|
81
|
+
return this.duration <= 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Theodore Kruczek.
|
|
3
|
+
* @license MIT
|
|
4
|
+
* @copyright (c) 2022-2024 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
|
+
import { Degrees, SensorParams } from 'ootk-core';
|
|
25
|
+
|
|
26
|
+
export interface RfSensorParams extends SensorParams {
|
|
27
|
+
coneHalfAngle: Degrees;
|
|
28
|
+
boresightAz: Degrees;
|
|
29
|
+
boresightEl: Degrees;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { RfSensorParams } from './RfSensorParams';
|
|
@@ -0,0 +1,109 @@
|
|
|
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 { Kilometers, KilometersPerSecond, PositionVelocity, Seconds, Vector3D } from 'ootk-core';
|
|
19
|
+
|
|
20
|
+
// / Chebyshev compressed ephemeris coefficients.
|
|
21
|
+
export class ChebyshevCoefficients {
|
|
22
|
+
cxd_: Float64Array;
|
|
23
|
+
cyd_: Float64Array;
|
|
24
|
+
czd_: Float64Array;
|
|
25
|
+
// / Create a new [ChebyshevCoefficients] object.
|
|
26
|
+
constructor(
|
|
27
|
+
public a: Seconds,
|
|
28
|
+
public b: Seconds,
|
|
29
|
+
private cx_: Float64Array,
|
|
30
|
+
private cy_: Float64Array,
|
|
31
|
+
private cz_: Float64Array,
|
|
32
|
+
) {
|
|
33
|
+
this.cxd_ = ChebyshevCoefficients._derivative(a, b, cx_);
|
|
34
|
+
this.cyd_ = ChebyshevCoefficients._derivative(a, b, cy_);
|
|
35
|
+
this.czd_ = ChebyshevCoefficients._derivative(a, b, cz_);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Calculates the derivative of a polynomial represented by Chebyshev coefficients.
|
|
40
|
+
* @param a - The lower bound of the polynomial's domain.
|
|
41
|
+
* @param b - The upper bound of the polynomial's domain.
|
|
42
|
+
* @param c - The Chebyshev coefficients of the polynomial.
|
|
43
|
+
* @returns The derivative of the polynomial as an array of coefficients.
|
|
44
|
+
*/
|
|
45
|
+
private static _derivative(a: number, b: number, c: Float64Array): Float64Array {
|
|
46
|
+
const n = c.length;
|
|
47
|
+
const d = new Float64Array(n);
|
|
48
|
+
|
|
49
|
+
d[n - 1] = 0;
|
|
50
|
+
d[n - 2] = 2 * (n - 1) * c[n - 1];
|
|
51
|
+
for (let k = n - 3; k >= 0; k--) {
|
|
52
|
+
d[k] = d[k + 2] + 2 * (k + 1) * c[k + 1];
|
|
53
|
+
}
|
|
54
|
+
for (let k = 0; k < n; k++) {
|
|
55
|
+
d[k] *= 2 / (b - a);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return d;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// / Return the size _(bytes)_ of this coefficient set's cached data.
|
|
62
|
+
get sizeBytes(): number {
|
|
63
|
+
return (64 * 2 + 64 * 3 * this.cx_.length) / 8;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Evaluates the Chebyshev polynomial represented by the given coefficients at the specified value.
|
|
68
|
+
* @param c - The coefficients of the Chebyshev polynomial.
|
|
69
|
+
* @param t - The value at which to evaluate the polynomial _(POSIX seconds)_.
|
|
70
|
+
* @returns The result of evaluating the polynomial at the specified value.
|
|
71
|
+
*/
|
|
72
|
+
evaluate(c: Float64Array, t: number): number {
|
|
73
|
+
const n = c.length;
|
|
74
|
+
const x = (t - 0.5 * (this.b + this.a)) / (0.5 * (this.b - this.a));
|
|
75
|
+
const alpha = 2 * x;
|
|
76
|
+
const beta = -1;
|
|
77
|
+
let y1 = 0.0;
|
|
78
|
+
let y2 = 0.0;
|
|
79
|
+
|
|
80
|
+
for (let k = n - 1; k >= 1; k--) {
|
|
81
|
+
const tmp = y1;
|
|
82
|
+
|
|
83
|
+
y1 = alpha * y1 + beta * y2 + c[k];
|
|
84
|
+
y2 = tmp;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return x * y1 - y2 + 0.5 * c[0];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Interpolates the position and velocity at a given time (km, km/s).
|
|
92
|
+
* @param t - The time value to interpolate at _(POSIX seconds)_.
|
|
93
|
+
* @returns An object containing the interpolated position and velocity.
|
|
94
|
+
*/
|
|
95
|
+
interpolate(t: number): PositionVelocity {
|
|
96
|
+
const pos = new Vector3D(
|
|
97
|
+
this.evaluate(this.cx_, t) as Kilometers,
|
|
98
|
+
this.evaluate(this.cy_, t) as Kilometers,
|
|
99
|
+
this.evaluate(this.cz_, t) as Kilometers,
|
|
100
|
+
);
|
|
101
|
+
const vel = new Vector3D(
|
|
102
|
+
this.evaluate(this.cxd_, t) as KilometersPerSecond,
|
|
103
|
+
this.evaluate(this.cyd_, t) as KilometersPerSecond,
|
|
104
|
+
this.evaluate(this.czd_, t) as KilometersPerSecond,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
return { position: pos, velocity: vel };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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, EpochWindow, J2000 } from 'ootk-core';
|
|
19
|
+
import { ChebyshevCoefficients } from './ChebyshevCoefficients';
|
|
20
|
+
import { StateInterpolator } from './StateInterpolator';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Compressed Chebyshev ephemeris interpolator.
|
|
24
|
+
*
|
|
25
|
+
* The ChebyshevInterpolator sacrifices state accuracy in order to gain
|
|
26
|
+
* speed and memory requirements, so you can store many ephemerides in RAM
|
|
27
|
+
* and interpolate through them quickly.
|
|
28
|
+
*
|
|
29
|
+
* Using more coefficients per revolution during lossy compression results
|
|
30
|
+
* in increased accuracy and decreased performance.
|
|
31
|
+
*/
|
|
32
|
+
export class ChebyshevInterpolator extends StateInterpolator {
|
|
33
|
+
private _coefficients: ChebyshevCoefficients[];
|
|
34
|
+
|
|
35
|
+
constructor(coefficients: ChebyshevCoefficients[]) {
|
|
36
|
+
super();
|
|
37
|
+
this._coefficients = coefficients;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private _calcSizeBytes(): number {
|
|
41
|
+
let output = 0;
|
|
42
|
+
|
|
43
|
+
for (const coeffs of this._coefficients) {
|
|
44
|
+
output += coeffs.sizeBytes;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return output;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get sizeBytes(): number {
|
|
51
|
+
return this._calcSizeBytes();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interpolate(epoch: EpochUTC): J2000 | null {
|
|
55
|
+
if (!this.inWindow(epoch)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const coeffs = this._matchCoefficients(epoch.posix);
|
|
59
|
+
const { position: pos, velocity: vel } = coeffs.interpolate(epoch.posix);
|
|
60
|
+
|
|
61
|
+
return new J2000(epoch, pos, vel);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
window(): EpochWindow {
|
|
65
|
+
return new EpochWindow(
|
|
66
|
+
new EpochUTC(this._coefficients[0].a),
|
|
67
|
+
new EpochUTC(this._coefficients[this._coefficients.length - 1].b),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private _matchCoefficients(posix: number): ChebyshevCoefficients {
|
|
72
|
+
let left = 0;
|
|
73
|
+
let right = this._coefficients.length;
|
|
74
|
+
|
|
75
|
+
while (left < right) {
|
|
76
|
+
const middle = (left + right) >> 1;
|
|
77
|
+
|
|
78
|
+
if (this._coefficients[middle].b < posix) {
|
|
79
|
+
left = middle + 1;
|
|
80
|
+
} else {
|
|
81
|
+
right = middle;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return this._coefficients[left];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { Kilometers, KilometersPerSecond, Seconds, Vector3D } from 'ootk-core';
|
|
19
|
+
|
|
20
|
+
// / Container for cubic spline data.
|
|
21
|
+
export class CubicSpline {
|
|
22
|
+
// / Create a new [CubicSpline] object.
|
|
23
|
+
constructor(
|
|
24
|
+
public t0: Seconds,
|
|
25
|
+
public p0: Vector3D,
|
|
26
|
+
public m0: Vector3D,
|
|
27
|
+
public t1: Seconds,
|
|
28
|
+
public p1: Vector3D,
|
|
29
|
+
public m1: Vector3D,
|
|
30
|
+
) {
|
|
31
|
+
// Nothing to do here.
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// / Interpolate position at the provided time [t] _(POSIX seconds)_.
|
|
35
|
+
private position_(t: Seconds): Vector3D<Kilometers> {
|
|
36
|
+
const t2 = t * t;
|
|
37
|
+
const t3 = t2 * t;
|
|
38
|
+
const r0 = this.p0.scale(2 * t3 - 3 * t2 + 1);
|
|
39
|
+
const v0 = this.m0.scale((t3 - 2 * t2 + t) * (this.t1 - this.t0));
|
|
40
|
+
const r1 = this.p1.scale(-2 * t3 + 3 * t2);
|
|
41
|
+
const v1 = this.m1.scale((t3 - t2) * (this.t1 - this.t0));
|
|
42
|
+
|
|
43
|
+
return r0.add(v0).add(r1).add(v1) as Vector3D<Kilometers>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// / Interpolate velocity at the provided time [t] _(POSIX seconds)_.
|
|
47
|
+
private velocity_(t: Seconds): Vector3D<KilometersPerSecond> {
|
|
48
|
+
const t2 = t * t;
|
|
49
|
+
const r0 = this.p0.scale(6 * t2 - 6 * t);
|
|
50
|
+
const v0 = this.m0.scale((3 * t2 - 4 * t + 1) * (this.t1 - this.t0));
|
|
51
|
+
const r1 = this.p1.scale(-6 * t2 + 6 * t);
|
|
52
|
+
const v1 = this.m1.scale((3 * t2 - 2 * t) * (this.t1 - this.t0));
|
|
53
|
+
|
|
54
|
+
return r0
|
|
55
|
+
.add(v0)
|
|
56
|
+
.add(r1)
|
|
57
|
+
.add(v1)
|
|
58
|
+
.scale(1 / (this.t1 - this.t0)) as Vector3D<KilometersPerSecond>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Interpolates the position and velocity at a given time.
|
|
63
|
+
* (km) and velocity (km/s) vectors at the provided time.
|
|
64
|
+
* @param t The time value to interpolate at _(POSIX seconds)_.
|
|
65
|
+
* @returns An array containing the interpolated position and velocity as Vector3D objects.
|
|
66
|
+
*/
|
|
67
|
+
interpolate(t: Seconds): Vector3D[] {
|
|
68
|
+
const n = (t - this.t0) / (this.t1 - this.t0) as Seconds;
|
|
69
|
+
|
|
70
|
+
return [this.position_(n), this.velocity_(n)];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -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, EpochWindow, J2000, Kilometers, KilometersPerSecond, Vector3D } from 'ootk-core';
|
|
19
|
+
import { CubicSpline } from './CubicSpline';
|
|
20
|
+
import { StateInterpolator } from './StateInterpolator';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Cubic spline ephemeris interpolator.
|
|
24
|
+
*
|
|
25
|
+
* The [CubicSplineInterpolator] is a very fast and accurate interpolator
|
|
26
|
+
* at the expense of memory due to the cached spline pairs used in the
|
|
27
|
+
* interpolation operation. Accuracy is significantly impacted when using
|
|
28
|
+
* sparse ephemerides.
|
|
29
|
+
*/
|
|
30
|
+
export class CubicSplineInterpolator extends StateInterpolator {
|
|
31
|
+
constructor(private _splines: CubicSpline[]) {
|
|
32
|
+
super();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static fromEphemeris(ephemeris: J2000[]): CubicSplineInterpolator {
|
|
36
|
+
const splines: CubicSpline[] = [];
|
|
37
|
+
|
|
38
|
+
for (let i = 0; i < ephemeris.length - 1; i++) {
|
|
39
|
+
const e0 = ephemeris[i];
|
|
40
|
+
const t0 = e0.epoch.posix;
|
|
41
|
+
const p0 = e0.position;
|
|
42
|
+
const m0 = e0.velocity;
|
|
43
|
+
const e1 = ephemeris[i + 1];
|
|
44
|
+
const t1 = e1.epoch.posix;
|
|
45
|
+
const p1 = e1.position;
|
|
46
|
+
const m1 = e1.velocity;
|
|
47
|
+
|
|
48
|
+
splines.push(new CubicSpline(t0, p0, m0, t1, p1, m1));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return new CubicSplineInterpolator(splines);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get sizeBytes(): number {
|
|
55
|
+
return (64 * 14 * this._splines.length) / 8;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private matchSpline_(posix: number): CubicSpline {
|
|
59
|
+
let left = 0;
|
|
60
|
+
let right = this._splines.length;
|
|
61
|
+
|
|
62
|
+
while (left < right) {
|
|
63
|
+
const middle = (left + right) >> 1;
|
|
64
|
+
|
|
65
|
+
if (this._splines[middle].t1 < posix) {
|
|
66
|
+
left = middle + 1;
|
|
67
|
+
} else {
|
|
68
|
+
right = middle;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return this._splines[left];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interpolate(epoch: EpochUTC): J2000 | null {
|
|
76
|
+
if (!this.inWindow(epoch)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const posix = epoch.posix;
|
|
80
|
+
const splineVecs = this
|
|
81
|
+
.matchSpline_(posix)
|
|
82
|
+
.interpolate(posix) as [Vector3D<Kilometers>, Vector3D<KilometersPerSecond>];
|
|
83
|
+
|
|
84
|
+
return new J2000(epoch, splineVecs[0], splineVecs[1]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
window(): EpochWindow {
|
|
88
|
+
return new EpochWindow(new EpochUTC(this._splines[0].t0), new EpochUTC(this._splines[this._splines.length - 1].t1));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
|
|
21
|
+
import { Interpolator } from './Interpolator';
|
|
22
|
+
|
|
23
|
+
// / Base class for arbitrary field interpolators.
|
|
24
|
+
export abstract class FieldInterpolator extends Interpolator {
|
|
25
|
+
Float64List?: Float64Array;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Interpolate field values at the provided [epoch].
|
|
29
|
+
* @param final Final state vector.
|
|
30
|
+
* @param EpochUTC Epoch of the final state vector.
|
|
31
|
+
* @param epoch Epoch to interpolate field values at.
|
|
32
|
+
* @throws [Error] if the interpolator is not initialized.
|
|
33
|
+
*/
|
|
34
|
+
interpolate(final: unknown, EpochUTC: unknown, epoch: unknown) {
|
|
35
|
+
throw new Error('Method not implemented.');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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, EpochWindow, Seconds } from 'ootk-core';
|
|
19
|
+
|
|
20
|
+
// / Interpolator base class.
|
|
21
|
+
export abstract class Interpolator {
|
|
22
|
+
// Return the start and end epoch covered by this interpolator.
|
|
23
|
+
abstract window(): EpochWindow;
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Return `true` if the provided [epoch] is within this interpolator's
|
|
27
|
+
* cached value range.
|
|
28
|
+
*/
|
|
29
|
+
inWindow(epoch: EpochUTC): boolean {
|
|
30
|
+
const start = this.window().start;
|
|
31
|
+
const stop = this.window().end;
|
|
32
|
+
|
|
33
|
+
return start <= epoch && epoch <= stop;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* Calculate the start/stop epoch between this and another [Interpolator].
|
|
38
|
+
*
|
|
39
|
+
* Returns `null` if there is no overlap between interpolators.
|
|
40
|
+
*/
|
|
41
|
+
overlap(interpolator: Interpolator): EpochWindow | null {
|
|
42
|
+
const x1 = this.window().start;
|
|
43
|
+
const x2 = this.window().end;
|
|
44
|
+
const y1 = interpolator.window().start;
|
|
45
|
+
const y2 = interpolator.window().end;
|
|
46
|
+
|
|
47
|
+
if (x1 <= y2 && y1 <= x2) {
|
|
48
|
+
const e1 = new EpochUTC(Math.max(x1.posix, y1.posix) as Seconds);
|
|
49
|
+
const e2 = new EpochUTC(Math.min(x2.posix, y2.posix) as Seconds);
|
|
50
|
+
|
|
51
|
+
return new EpochWindow(e1, e2);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|