ootk 3.0.0 → 4.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +10 -10
- package/CHANGELOG.md +122 -0
- package/README.md +27 -40
- package/lib/coordinate/Hill.d.ts +50 -0
- package/lib/coordinate/Hill.js +214 -0
- package/lib/coordinate/Hill.js.map +1 -0
- package/lib/coordinate/index.d.ts +1 -0
- package/lib/coordinate/index.js +2 -0
- package/lib/coordinate/index.js.map +1 -0
- package/lib/covariance/CovarianceSample.d.ts +44 -0
- package/lib/covariance/CovarianceSample.js +146 -0
- package/lib/covariance/CovarianceSample.js.map +1 -0
- package/lib/covariance/StateCovariance.d.ts +41 -0
- package/lib/covariance/StateCovariance.js +62 -0
- package/lib/covariance/StateCovariance.js.map +1 -0
- package/lib/force/AtmosphericDrag.d.ts +32 -0
- package/lib/force/AtmosphericDrag.js +66 -0
- package/lib/force/AtmosphericDrag.js.map +1 -0
- package/lib/force/EarthGravity.d.ts +28 -0
- package/lib/force/EarthGravity.js +115 -0
- package/lib/force/EarthGravity.js.map +1 -0
- package/{dist/ootk.d.ts → lib/force/Force.d.ts} +10 -10
- package/lib/force/Force.js +30 -0
- package/lib/force/Force.js.map +1 -0
- package/lib/force/ForceModel.d.ts +38 -0
- package/lib/force/ForceModel.js +71 -0
- package/lib/force/ForceModel.js.map +1 -0
- package/lib/force/Gravity.d.ts +41 -0
- package/lib/force/Gravity.js +48 -0
- package/lib/force/Gravity.js.map +1 -0
- package/lib/force/SolarRadiationPressure.d.ts +27 -0
- package/lib/force/SolarRadiationPressure.js +42 -0
- package/lib/force/SolarRadiationPressure.js.map +1 -0
- package/lib/force/ThirdBodyGravity.d.ts +27 -0
- package/lib/force/ThirdBodyGravity.js +56 -0
- package/lib/force/ThirdBodyGravity.js.map +1 -0
- package/lib/force/Thrust.d.ts +35 -0
- package/lib/force/Thrust.js +53 -0
- package/lib/force/Thrust.js.map +1 -0
- package/lib/interpolator/ChebyshevCoefficients.d.ts +54 -0
- package/lib/interpolator/ChebyshevCoefficients.js +90 -0
- package/lib/interpolator/ChebyshevCoefficients.js.map +1 -0
- package/lib/interpolator/ChebyshevInterpolator.d.ts +39 -0
- package/lib/interpolator/ChebyshevInterpolator.js +71 -0
- package/lib/interpolator/ChebyshevInterpolator.js.map +1 -0
- package/lib/interpolator/CubicSpline.d.ts +36 -0
- package/lib/interpolator/CubicSpline.js +64 -0
- package/lib/interpolator/CubicSpline.js.map +1 -0
- package/lib/interpolator/CubicSplineInterpolator.d.ts +37 -0
- package/lib/interpolator/CubicSplineInterpolator.js +78 -0
- package/lib/interpolator/CubicSplineInterpolator.js.map +1 -0
- package/lib/interpolator/FieldInterpolator.d.ts +26 -0
- package/lib/interpolator/FieldInterpolator.js +31 -0
- package/lib/interpolator/FieldInterpolator.js.map +1 -0
- package/lib/interpolator/Interpolator.d.ts +23 -0
- package/lib/interpolator/Interpolator.js +48 -0
- package/lib/interpolator/Interpolator.js.map +1 -0
- package/lib/interpolator/LagrangeInterpolator.d.ts +42 -0
- package/lib/interpolator/LagrangeInterpolator.js +156 -0
- package/lib/interpolator/LagrangeInterpolator.js.map +1 -0
- package/lib/interpolator/StateInterpolator.d.ts +29 -0
- package/lib/interpolator/StateInterpolator.js +37 -0
- package/lib/interpolator/StateInterpolator.js.map +1 -0
- package/lib/interpolator/VerletBlendInterpolator.d.ts +44 -0
- package/lib/interpolator/VerletBlendInterpolator.js +115 -0
- package/lib/interpolator/VerletBlendInterpolator.js.map +1 -0
- package/lib/maneuver/TwoBurnOrbitTransfer.d.ts +43 -0
- package/lib/maneuver/TwoBurnOrbitTransfer.js +62 -0
- package/lib/maneuver/TwoBurnOrbitTransfer.js.map +1 -0
- package/lib/maneuver/Waypoint.d.ts +66 -0
- package/lib/maneuver/Waypoint.js +152 -0
- package/lib/maneuver/Waypoint.js.map +1 -0
- package/lib/objects/DetailedSatellite.d.ts +94 -0
- package/lib/objects/DetailedSatellite.js +140 -0
- package/lib/objects/DetailedSatellite.js.map +1 -0
- package/lib/objects/DetailedSensor.d.ts +43 -0
- package/lib/objects/DetailedSensor.js +45 -0
- package/lib/objects/DetailedSensor.js.map +1 -0
- package/{dist/objects/space-object.d.ts → lib/objects/LandObject.d.ts} +19 -21
- package/lib/objects/LandObject.js +28 -0
- package/lib/objects/LandObject.js.map +1 -0
- package/lib/objects/Marker.d.ts +21 -0
- package/lib/objects/Marker.js +25 -0
- package/lib/objects/Marker.js.map +1 -0
- package/lib/objects/index.d.ts +5 -4
- package/lib/objects/index.js +5 -4
- package/lib/objects/index.js.map +1 -1
- package/lib/observation/Observation.d.ts +51 -0
- package/lib/observation/Observation.js +71 -0
- package/lib/observation/Observation.js.map +1 -0
- package/lib/observation/ObservationOptical.d.ts +47 -0
- package/lib/observation/ObservationOptical.js +101 -0
- package/lib/observation/ObservationOptical.js.map +1 -0
- package/lib/observation/ObservationRadar.d.ts +43 -0
- package/lib/observation/ObservationRadar.js +90 -0
- package/lib/observation/ObservationRadar.js.map +1 -0
- package/lib/observation/ObservationUtils.d.ts +21 -0
- package/lib/observation/ObservationUtils.js +33 -0
- package/lib/observation/ObservationUtils.js.map +1 -0
- package/lib/observation/PropagatorPairs.d.ts +31 -0
- package/lib/observation/PropagatorPairs.js +40 -0
- package/lib/observation/PropagatorPairs.js.map +1 -0
- package/lib/ootk.d.ts +10 -8
- package/lib/ootk.js +10 -8
- package/lib/ootk.js.map +1 -1
- package/lib/operations/BoxMuller.d.ts +41 -0
- package/lib/operations/BoxMuller.js +66 -0
- package/lib/operations/BoxMuller.js.map +1 -0
- package/lib/operations/EulerAngles.d.ts +50 -0
- package/lib/operations/EulerAngles.js +111 -0
- package/lib/operations/EulerAngles.js.map +1 -0
- package/lib/operations/Quaternion.d.ts +57 -0
- package/lib/operations/Quaternion.js +164 -0
- package/lib/operations/Quaternion.js.map +1 -0
- package/lib/operations/RandomGaussianSource.d.ts +25 -0
- package/lib/operations/RandomGaussianSource.js +43 -0
- package/lib/operations/RandomGaussianSource.js.map +1 -0
- package/lib/operations/index.d.ts +4 -0
- package/lib/operations/index.js +5 -0
- package/lib/operations/index.js.map +1 -0
- package/lib/optimize/ChebyshevCompressor.d.ts +31 -0
- package/lib/optimize/ChebyshevCompressor.js +80 -0
- package/lib/optimize/ChebyshevCompressor.js.map +1 -0
- package/lib/optimize/DownhillSimplex.d.ts +50 -0
- package/lib/optimize/DownhillSimplex.js +168 -0
- package/lib/optimize/DownhillSimplex.js.map +1 -0
- package/lib/optimize/GoldenSection.d.ts +33 -0
- package/lib/optimize/GoldenSection.js +49 -0
- package/lib/optimize/GoldenSection.js.map +1 -0
- package/lib/optimize/PolynomialRegression.d.ts +37 -0
- package/lib/optimize/PolynomialRegression.js +66 -0
- package/lib/optimize/PolynomialRegression.js.map +1 -0
- package/lib/optimize/PolynomicalRegressionResult.d.ts +28 -0
- package/lib/optimize/PolynomicalRegressionResult.js +32 -0
- package/lib/optimize/PolynomicalRegressionResult.js.map +1 -0
- package/lib/optimize/SimpleLinearRegression.d.ts +41 -0
- package/lib/optimize/SimpleLinearRegression.js +107 -0
- package/lib/optimize/SimpleLinearRegression.js.map +1 -0
- package/lib/optimize/SimplexEntry.d.ts +33 -0
- package/lib/optimize/SimplexEntry.js +39 -0
- package/lib/optimize/SimplexEntry.js.map +1 -0
- package/lib/orbit_determination/BatchLeastSquaresOD.d.ts +54 -0
- package/lib/orbit_determination/BatchLeastSquaresOD.js +118 -0
- package/lib/orbit_determination/BatchLeastSquaresOD.js.map +1 -0
- package/lib/orbit_determination/BatchLeastSquaresResult.d.ts +29 -0
- package/lib/orbit_determination/BatchLeastSquaresResult.js +31 -0
- package/lib/orbit_determination/BatchLeastSquaresResult.js.map +1 -0
- package/lib/orbit_determination/GibbsIOD.d.ts +33 -0
- package/lib/orbit_determination/GibbsIOD.js +70 -0
- package/lib/orbit_determination/GibbsIOD.js.map +1 -0
- package/lib/orbit_determination/GoodingIOD.d.ts +52 -0
- package/lib/orbit_determination/GoodingIOD.js +244 -0
- package/lib/orbit_determination/GoodingIOD.js.map +1 -0
- package/lib/{objects/space-object.d.ts → orbit_determination/HerrickGibbsIOD.d.ts} +17 -22
- package/lib/orbit_determination/HerrickGibbsIOD.js +49 -0
- package/lib/orbit_determination/HerrickGibbsIOD.js.map +1 -0
- package/lib/orbit_determination/LambertIOD.d.ts +46 -0
- package/lib/orbit_determination/LambertIOD.js +199 -0
- package/lib/orbit_determination/LambertIOD.js.map +1 -0
- package/lib/orbit_determination/ModifiedGoodingIOD.d.ts +41 -0
- package/lib/orbit_determination/ModifiedGoodingIOD.js +82 -0
- package/lib/orbit_determination/ModifiedGoodingIOD.js.map +1 -0
- package/lib/propagator/DormandPrince54Propagator.d.ts +29 -0
- package/lib/propagator/DormandPrince54Propagator.js +68 -0
- package/lib/propagator/DormandPrince54Propagator.js.map +1 -0
- package/lib/propagator/KeplerPropagator.d.ts +36 -0
- package/lib/propagator/KeplerPropagator.js +81 -0
- package/lib/propagator/KeplerPropagator.js.map +1 -0
- package/lib/propagator/Propagator.d.ts +35 -0
- package/lib/propagator/Propagator.js +163 -0
- package/lib/propagator/Propagator.js.map +1 -0
- package/lib/propagator/RkCheckpoint.d.ts +23 -0
- package/lib/propagator/RkCheckpoint.js +26 -0
- package/lib/propagator/RkCheckpoint.js.map +1 -0
- package/lib/propagator/RkResult.d.ts +24 -0
- package/lib/propagator/RkResult.js +28 -0
- package/lib/propagator/RkResult.js.map +1 -0
- package/lib/propagator/RungeKutta4Propagator.d.ts +46 -0
- package/lib/propagator/RungeKutta4Propagator.js +132 -0
- package/lib/propagator/RungeKutta4Propagator.js.map +1 -0
- package/lib/propagator/RungeKutta89Propagator.d.ts +29 -0
- package/lib/propagator/RungeKutta89Propagator.js +130 -0
- package/lib/propagator/RungeKutta89Propagator.js.map +1 -0
- package/lib/propagator/RungeKuttaAdaptive.d.ts +52 -0
- package/lib/propagator/RungeKuttaAdaptive.js +152 -0
- package/lib/propagator/RungeKuttaAdaptive.js.map +1 -0
- package/lib/propagator/Sgp4Propagator.d.ts +35 -0
- package/lib/propagator/Sgp4Propagator.js +55 -0
- package/lib/propagator/Sgp4Propagator.js.map +1 -0
- package/lib/smoothing/ExponentialSmoothing.d.ts +24 -0
- package/lib/smoothing/ExponentialSmoothing.js +82 -0
- package/lib/smoothing/ExponentialSmoothing.js.map +1 -0
- package/lib/types/types.d.ts +65 -584
- package/lib/types/types.js +21 -33
- package/lib/types/types.js.map +1 -1
- package/package.json +16 -14
- 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/index.d.ts +0 -4
- 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/transforms/transforms.d.ts +0 -94
- package/dist/types/types.d.ts +0 -605
- 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/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.d.ts +0 -66
- package/lib/objects/detailed-sat.js +0 -149
- package/lib/objects/detailed-sat.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/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/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,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Random, Vector } from 'ootk-core';
|
|
19
|
+
export declare class BoxMuller {
|
|
20
|
+
private _index;
|
|
21
|
+
private _cache;
|
|
22
|
+
mu: number;
|
|
23
|
+
sigma: number;
|
|
24
|
+
rand: Random;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new [BoxMuller] object with mean [mu], standard deviation
|
|
27
|
+
* [sigma], and [seed] number.
|
|
28
|
+
*/
|
|
29
|
+
constructor(mu: number, sigma: number, seed?: number);
|
|
30
|
+
_generate(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Generate a gaussian number, with mean [mu] and standard
|
|
33
|
+
* deviation [sigma].
|
|
34
|
+
*/
|
|
35
|
+
nextGauss(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Generate a [Vector] of gaussian numbers, with mean [mu] and standard
|
|
38
|
+
* deviation [sigma].
|
|
39
|
+
*/
|
|
40
|
+
gaussVector(n: number): Vector;
|
|
41
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Random, TAU, Vector } from 'ootk-core';
|
|
19
|
+
// / Box-Muller random Gaussian number generator.
|
|
20
|
+
export class BoxMuller {
|
|
21
|
+
/**
|
|
22
|
+
* Create a new [BoxMuller] object with mean [mu], standard deviation
|
|
23
|
+
* [sigma], and [seed] number.
|
|
24
|
+
*/
|
|
25
|
+
constructor(mu, sigma, seed = 0) {
|
|
26
|
+
this._index = 0;
|
|
27
|
+
this._cache = new Float64Array(2);
|
|
28
|
+
this.mu = mu;
|
|
29
|
+
this.sigma = sigma;
|
|
30
|
+
this.rand = new Random(seed);
|
|
31
|
+
this._generate();
|
|
32
|
+
}
|
|
33
|
+
// / Refill the cache with random Gaussian numbers.
|
|
34
|
+
_generate() {
|
|
35
|
+
this._index = 0;
|
|
36
|
+
const u1 = this.rand.nextFloat();
|
|
37
|
+
const u2 = this.rand.nextFloat();
|
|
38
|
+
const mag = this.sigma * Math.sqrt(-2.0 * Math.log(u1));
|
|
39
|
+
this._cache[0] = mag * Math.cos(TAU * u2) + this.mu;
|
|
40
|
+
this._cache[1] = mag * Math.sin(TAU * u2) + this.mu;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Generate a gaussian number, with mean [mu] and standard
|
|
44
|
+
* deviation [sigma].
|
|
45
|
+
*/
|
|
46
|
+
nextGauss() {
|
|
47
|
+
if (this._index > 1) {
|
|
48
|
+
this._generate();
|
|
49
|
+
}
|
|
50
|
+
const result = this._cache[this._index];
|
|
51
|
+
this._index++;
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate a [Vector] of gaussian numbers, with mean [mu] and standard
|
|
56
|
+
* deviation [sigma].
|
|
57
|
+
*/
|
|
58
|
+
gaussVector(n) {
|
|
59
|
+
const result = new Float64Array(n);
|
|
60
|
+
for (let i = 0; i < n; i++) {
|
|
61
|
+
result[i] = this.nextGauss();
|
|
62
|
+
}
|
|
63
|
+
return new Vector(result);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=BoxMuller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoxMuller.js","sourceRoot":"","sources":["../../src/operations/BoxMuller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEhD,iDAAiD;AACjD,MAAM,OAAO,SAAS;IAUpB;;;OAGG;IACH,YAAY,EAAU,EAAE,KAAa,EAAE,IAAI,GAAG,CAAC;QAbvC,WAAM,GAAG,CAAC,CAAC;QACX,WAAM,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;QAanC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,mDAAmD;IACnD,SAAS;QACP,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,EAAE,CAAC;QAEd,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,CAAS;QACnB,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;QAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;SAC9B;QAED,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Matrix, Vector3D } from 'ootk-core';
|
|
19
|
+
export declare class EulerAngles {
|
|
20
|
+
roll: number;
|
|
21
|
+
pitch: number;
|
|
22
|
+
yaw: number;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new [EulerAngles] object from [roll], [pitch], and [yaw]
|
|
25
|
+
* angles _(rad)_.
|
|
26
|
+
*/
|
|
27
|
+
constructor(roll: number, pitch: number, yaw: number);
|
|
28
|
+
/**
|
|
29
|
+
* Create a new [EulerAngles] object from [roll], [pitch], and [yaw]
|
|
30
|
+
* angles _(deg)_.
|
|
31
|
+
*/
|
|
32
|
+
static fromDegrees(rollDeg: number, pitchDeg: number, yawDeg: number): EulerAngles;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new [EulerAngles] object from 3-2-1 ordered direction cosine
|
|
35
|
+
* matrix [c].
|
|
36
|
+
*/
|
|
37
|
+
static fromDcm321(c: Matrix): EulerAngles;
|
|
38
|
+
get rollDegrees(): number;
|
|
39
|
+
get pitchDegrees(): number;
|
|
40
|
+
get yawDegrees(): number;
|
|
41
|
+
get phi(): number;
|
|
42
|
+
get theta(): number;
|
|
43
|
+
get psi(): number;
|
|
44
|
+
get phiDegrees(): number;
|
|
45
|
+
get thetaDegrees(): number;
|
|
46
|
+
get psiDegrees(): number;
|
|
47
|
+
toString(precision?: number): string;
|
|
48
|
+
dcm321(): Matrix;
|
|
49
|
+
rotateVector321(v: Vector3D): Vector3D;
|
|
50
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { DEG2RAD, Matrix, RAD2DEG } from 'ootk-core';
|
|
19
|
+
// / Class containing Euler angles.
|
|
20
|
+
export class EulerAngles {
|
|
21
|
+
/**
|
|
22
|
+
* Create a new [EulerAngles] object from [roll], [pitch], and [yaw]
|
|
23
|
+
* angles _(rad)_.
|
|
24
|
+
*/
|
|
25
|
+
constructor(roll, pitch, yaw) {
|
|
26
|
+
this.roll = roll;
|
|
27
|
+
this.pitch = pitch;
|
|
28
|
+
this.yaw = yaw;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a new [EulerAngles] object from [roll], [pitch], and [yaw]
|
|
32
|
+
* angles _(deg)_.
|
|
33
|
+
*/
|
|
34
|
+
static fromDegrees(rollDeg, pitchDeg, yawDeg) {
|
|
35
|
+
const roll = rollDeg * DEG2RAD;
|
|
36
|
+
const pitch = pitchDeg * DEG2RAD;
|
|
37
|
+
const yaw = yawDeg * DEG2RAD;
|
|
38
|
+
return new EulerAngles(roll, pitch, yaw);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a new [EulerAngles] object from 3-2-1 ordered direction cosine
|
|
42
|
+
* matrix [c].
|
|
43
|
+
*/
|
|
44
|
+
static fromDcm321(c) {
|
|
45
|
+
const roll = Math.atan(c[1][2] / c[2][2]);
|
|
46
|
+
const pitch = -Math.asin(c[0][2]);
|
|
47
|
+
const yaw = Math.atan(c[0][1] / c[0][0]);
|
|
48
|
+
return new EulerAngles(roll, pitch, yaw);
|
|
49
|
+
}
|
|
50
|
+
// / Roll component _(deg)_.
|
|
51
|
+
get rollDegrees() {
|
|
52
|
+
return this.roll * RAD2DEG;
|
|
53
|
+
}
|
|
54
|
+
// / Pitch component _(deg)_.
|
|
55
|
+
get pitchDegrees() {
|
|
56
|
+
return this.pitch * RAD2DEG;
|
|
57
|
+
}
|
|
58
|
+
// / Yaw component _(deg)_.
|
|
59
|
+
get yawDegrees() {
|
|
60
|
+
return this.yaw * RAD2DEG;
|
|
61
|
+
}
|
|
62
|
+
// / Roll component alias _(rad)_.
|
|
63
|
+
get phi() {
|
|
64
|
+
return this.roll;
|
|
65
|
+
}
|
|
66
|
+
// / Pitch component alias _(rad)_.
|
|
67
|
+
get theta() {
|
|
68
|
+
return this.pitch;
|
|
69
|
+
}
|
|
70
|
+
// / Yaw component alias _(rad)_.
|
|
71
|
+
get psi() {
|
|
72
|
+
return this.yaw;
|
|
73
|
+
}
|
|
74
|
+
// / Roll component alias _(deg)_.
|
|
75
|
+
get phiDegrees() {
|
|
76
|
+
return this.phi * RAD2DEG;
|
|
77
|
+
}
|
|
78
|
+
// / Pitch component alias _(deg)_.
|
|
79
|
+
get thetaDegrees() {
|
|
80
|
+
return this.theta * RAD2DEG;
|
|
81
|
+
}
|
|
82
|
+
// / Yaw component alias _(deg)_.
|
|
83
|
+
get psiDegrees() {
|
|
84
|
+
return this.psi * RAD2DEG;
|
|
85
|
+
}
|
|
86
|
+
toString(precision = 6) {
|
|
87
|
+
const rollStr = this.rollDegrees.toFixed(precision);
|
|
88
|
+
const pitchStr = this.pitchDegrees.toFixed(precision);
|
|
89
|
+
const yawStr = this.yawDegrees.toFixed(precision);
|
|
90
|
+
return `Euler(roll: ${rollStr}°, pitch: ${pitchStr}°, yaw: ${yawStr}°)`;
|
|
91
|
+
}
|
|
92
|
+
// / Convert this to a 3-2-1 ordered direction cosine [Matrix].
|
|
93
|
+
dcm321() {
|
|
94
|
+
const sPhi = Math.sin(this.phi);
|
|
95
|
+
const cPhi = Math.cos(this.phi);
|
|
96
|
+
const sTheta = Math.sin(this.theta);
|
|
97
|
+
const cTheta = Math.cos(this.theta);
|
|
98
|
+
const sPsi = Math.sin(this.psi);
|
|
99
|
+
const cPsi = Math.cos(this.psi);
|
|
100
|
+
return new Matrix([
|
|
101
|
+
[cTheta * cPsi, cTheta * sPsi, -sTheta],
|
|
102
|
+
[sPhi * sTheta * cPsi - cPhi * sPsi, sPhi * sTheta * sPsi + cPhi * cPsi, sPhi * cTheta],
|
|
103
|
+
[cPhi * sTheta * cPsi + sPhi * sPsi, cPhi * sTheta * sPsi - sPhi * cPsi, cPhi * cTheta],
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
// / Perform a 3-2-1 ordered rotation on provided vector [v].
|
|
107
|
+
rotateVector321(v) {
|
|
108
|
+
return this.dcm321().multiplyVector3D(v);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=EulerAngles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EulerAngles.js","sourceRoot":"","sources":["../../src/operations/EulerAngles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAY,MAAM,WAAW,CAAC;AAE/D,mCAAmC;AACnC,MAAM,OAAO,WAAW;IAUtB;;;OAGG;IACH,YAAY,IAAY,EAAE,KAAa,EAAE,GAAW;QAClD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,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AM,CAAC;YAChB,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC;YACvC,CAAC,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;YACvF,CAAC,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;SACxF,CAAC,CAAC;IACL,CAAC;IAED,6DAA6D;IAC7D,eAAe,CAAC,CAAW;QACzB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Matrix, Vector, Vector3D } from 'ootk-core';
|
|
19
|
+
export declare class Quaternion {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
z: number;
|
|
23
|
+
w: number;
|
|
24
|
+
constructor(x: number, y: number, z: number, w: number);
|
|
25
|
+
static zero: Quaternion;
|
|
26
|
+
static one: Quaternion;
|
|
27
|
+
static xAxis: Quaternion;
|
|
28
|
+
static yAxis: Quaternion;
|
|
29
|
+
static zAxis: Quaternion;
|
|
30
|
+
toString(precision?: number): string;
|
|
31
|
+
positivePolar(): Quaternion;
|
|
32
|
+
magnitudeSquared(): number;
|
|
33
|
+
magnitude(): number;
|
|
34
|
+
scale(n: number): Quaternion;
|
|
35
|
+
negate(): Quaternion;
|
|
36
|
+
normalize(): Quaternion;
|
|
37
|
+
conjugate(): Quaternion;
|
|
38
|
+
inverse(): Quaternion;
|
|
39
|
+
add(q: Quaternion): Quaternion;
|
|
40
|
+
subtract(q: Quaternion): Quaternion;
|
|
41
|
+
addReal(n: number): Quaternion;
|
|
42
|
+
multiply(q: Quaternion): Quaternion;
|
|
43
|
+
dot(q: Quaternion): number;
|
|
44
|
+
rotateVector(v: Vector): Vector;
|
|
45
|
+
rotateVector3D(v: Vector3D): Vector3D;
|
|
46
|
+
lerp(q: Quaternion, t: number): Quaternion;
|
|
47
|
+
slerp(q: Quaternion, t: number): Quaternion;
|
|
48
|
+
toVector3D(): Vector3D;
|
|
49
|
+
angle(q: Quaternion): number;
|
|
50
|
+
geodesicAngle(q: Quaternion): number;
|
|
51
|
+
distance(q: Quaternion): number;
|
|
52
|
+
delta(qTo: Quaternion): Quaternion;
|
|
53
|
+
toDirectionCosineMatrix(): Matrix;
|
|
54
|
+
toRotationMatrix(): Matrix;
|
|
55
|
+
vectorAngle(observer: Vector3D, target: Vector3D, forward: Vector3D): number;
|
|
56
|
+
kinematics(angularVelocity: Vector3D): Quaternion;
|
|
57
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Matrix, Vector, Vector3D, wrapAngle } from 'ootk-core';
|
|
19
|
+
export class Quaternion {
|
|
20
|
+
constructor(x, y, z, w) {
|
|
21
|
+
this.x = x;
|
|
22
|
+
this.y = y;
|
|
23
|
+
this.z = z;
|
|
24
|
+
this.w = w;
|
|
25
|
+
}
|
|
26
|
+
toString(precision = 8) {
|
|
27
|
+
const xStr = this.x.toFixed(precision);
|
|
28
|
+
const yStr = this.y.toFixed(precision);
|
|
29
|
+
const zStr = this.z.toFixed(precision);
|
|
30
|
+
const wStr = this.w.toFixed(precision);
|
|
31
|
+
return `Q(x: ${xStr}, y: ${yStr}, z: ${zStr}, w: ${wStr})`;
|
|
32
|
+
}
|
|
33
|
+
positivePolar() {
|
|
34
|
+
return this.w >= 0 ? this.normalize() : this.negate().normalize();
|
|
35
|
+
}
|
|
36
|
+
magnitudeSquared() {
|
|
37
|
+
return this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z;
|
|
38
|
+
}
|
|
39
|
+
magnitude() {
|
|
40
|
+
return Math.sqrt(this.magnitudeSquared());
|
|
41
|
+
}
|
|
42
|
+
scale(n) {
|
|
43
|
+
return new Quaternion(n * this.x, n * this.y, n * this.z, n * this.w);
|
|
44
|
+
}
|
|
45
|
+
negate() {
|
|
46
|
+
return this.scale(-1);
|
|
47
|
+
}
|
|
48
|
+
normalize() {
|
|
49
|
+
const m = this.magnitude();
|
|
50
|
+
if (m === 0) {
|
|
51
|
+
return Quaternion.zero;
|
|
52
|
+
}
|
|
53
|
+
return this.scale(1 / m);
|
|
54
|
+
}
|
|
55
|
+
conjugate() {
|
|
56
|
+
return new Quaternion(-this.x, -this.y, -this.z, this.w);
|
|
57
|
+
}
|
|
58
|
+
inverse() {
|
|
59
|
+
return this.conjugate().scale(1 / this.magnitudeSquared());
|
|
60
|
+
}
|
|
61
|
+
add(q) {
|
|
62
|
+
return new Quaternion(this.x + q.x, this.y + q.y, this.z + q.z, this.w + q.w);
|
|
63
|
+
}
|
|
64
|
+
subtract(q) {
|
|
65
|
+
return new Quaternion(this.x - q.x, this.y - q.y, this.z - q.z, this.w - q.w);
|
|
66
|
+
}
|
|
67
|
+
addReal(n) {
|
|
68
|
+
return new Quaternion(this.x, this.y, this.z, this.w + n);
|
|
69
|
+
}
|
|
70
|
+
multiply(q) {
|
|
71
|
+
const mx = this.w * q.x + this.x * q.w + this.y * q.z - this.z * q.y;
|
|
72
|
+
const my = this.w * q.y - this.x * q.z + this.y * q.w + this.z * q.x;
|
|
73
|
+
const mz = this.w * q.z + this.x * q.y - this.y * q.x + this.z * q.w;
|
|
74
|
+
const mw = this.w * q.w - this.x * q.x - this.y * q.y - this.z * q.z;
|
|
75
|
+
return new Quaternion(mx, my, mz, mw);
|
|
76
|
+
}
|
|
77
|
+
dot(q) {
|
|
78
|
+
return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w;
|
|
79
|
+
}
|
|
80
|
+
rotateVector(v) {
|
|
81
|
+
const q = this.multiply(new Quaternion(v.x, v.y, v.z, 0)).multiply(this.conjugate());
|
|
82
|
+
return new Vector([q.x, q.y, q.z]);
|
|
83
|
+
}
|
|
84
|
+
rotateVector3D(v) {
|
|
85
|
+
const q = this.multiply(new Quaternion(v.x, v.y, v.z, 0)).multiply(this.conjugate());
|
|
86
|
+
return new Vector3D(q.x, q.y, q.z);
|
|
87
|
+
}
|
|
88
|
+
lerp(q, t) {
|
|
89
|
+
const f = 1.0 - t;
|
|
90
|
+
return new Quaternion(f * this.x + t * q.x, f * this.y + t * q.y, f * this.z + t * q.z, f * this.w + t * q.w).positivePolar();
|
|
91
|
+
}
|
|
92
|
+
slerp(q, t) {
|
|
93
|
+
let qp = q;
|
|
94
|
+
let dotP = this.dot(qp);
|
|
95
|
+
if (dotP < 0) {
|
|
96
|
+
dotP = -dotP;
|
|
97
|
+
qp = qp.negate();
|
|
98
|
+
}
|
|
99
|
+
if (dotP > 0.9995) {
|
|
100
|
+
return this.lerp(qp, t);
|
|
101
|
+
}
|
|
102
|
+
const theta = Math.acos(dotP);
|
|
103
|
+
const sinTheta = Math.sin(theta);
|
|
104
|
+
const f1 = Math.sin((1.0 - t) * theta) / sinTheta;
|
|
105
|
+
const f2 = Math.sin(t * theta) / sinTheta;
|
|
106
|
+
return new Quaternion(f1 * this.x + f2 * qp.x, f1 * this.y + f2 * qp.y, f1 * this.z + f2 * qp.z, f1 * this.w + f2 * qp.w).positivePolar();
|
|
107
|
+
}
|
|
108
|
+
toVector3D() {
|
|
109
|
+
return new Vector3D(this.x, this.y, this.z);
|
|
110
|
+
}
|
|
111
|
+
angle(q) {
|
|
112
|
+
const c = this.multiply(q.conjugate()).normalize();
|
|
113
|
+
return 2 * Math.atan2(c.toVector3D().magnitude(), c.w);
|
|
114
|
+
}
|
|
115
|
+
geodesicAngle(q) {
|
|
116
|
+
const p = this.dot(q);
|
|
117
|
+
return wrapAngle(Math.acos(2 * p * p - 1.0));
|
|
118
|
+
}
|
|
119
|
+
distance(q) {
|
|
120
|
+
const m01 = this.subtract(q).magnitude();
|
|
121
|
+
const p01 = this.add(q).magnitude();
|
|
122
|
+
return m01 < p01 ? m01 : p01;
|
|
123
|
+
}
|
|
124
|
+
delta(qTo) {
|
|
125
|
+
return this.inverse().multiply(qTo);
|
|
126
|
+
}
|
|
127
|
+
toDirectionCosineMatrix() {
|
|
128
|
+
const w2 = this.w * this.w;
|
|
129
|
+
const x2 = this.x * this.x;
|
|
130
|
+
const y2 = this.y * this.y;
|
|
131
|
+
const z2 = this.z * this.z;
|
|
132
|
+
const m = [
|
|
133
|
+
[w2 + x2 - y2 - z2, 2.0 * (this.x * this.y + this.z * this.w), 2.0 * (this.x * this.z - this.y * this.w)],
|
|
134
|
+
[2.0 * (this.x * this.y - this.z * this.w), w2 - x2 + y2 - z2, 2.0 * (this.y * this.z + this.x * this.w)],
|
|
135
|
+
[2.0 * (this.x * this.z + this.y * this.w), 2.0 * (this.y * this.z - this.x * this.w), w2 - x2 - y2 + z2],
|
|
136
|
+
];
|
|
137
|
+
return new Matrix(m);
|
|
138
|
+
}
|
|
139
|
+
toRotationMatrix() {
|
|
140
|
+
return this.toDirectionCosineMatrix().transpose();
|
|
141
|
+
}
|
|
142
|
+
vectorAngle(observer, target, forward) {
|
|
143
|
+
const delta = target.subtract(observer);
|
|
144
|
+
const transform = this.toDirectionCosineMatrix().multiplyVector3D(delta);
|
|
145
|
+
return forward.angle(transform);
|
|
146
|
+
}
|
|
147
|
+
kinematics(angularVelocity) {
|
|
148
|
+
const wPrime = new Vector([0, angularVelocity[0], angularVelocity[1], angularVelocity[2]]);
|
|
149
|
+
const qMat = new Matrix([
|
|
150
|
+
[this.x, this.w, -this.z, this.y],
|
|
151
|
+
[this.y, this.z, this.w, -this.x],
|
|
152
|
+
[this.z, -this.y, this.x, this.w],
|
|
153
|
+
[this.w, -this.x, -this.y, -this.z],
|
|
154
|
+
]);
|
|
155
|
+
const result = qMat.multiplyVector(wPrime).scale(0.5);
|
|
156
|
+
return new Quaternion(result[0], result[1], result[2], result[3]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
Quaternion.zero = new Quaternion(0, 0, 0, 0);
|
|
160
|
+
Quaternion.one = new Quaternion(0, 0, 0, 1);
|
|
161
|
+
Quaternion.xAxis = new Quaternion(1, 0, 0, 0);
|
|
162
|
+
Quaternion.yAxis = new Quaternion(0, 1, 0, 0);
|
|
163
|
+
Quaternion.zAxis = new Quaternion(0, 0, 1, 0);
|
|
164
|
+
//# sourceMappingURL=Quaternion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Quaternion.js","sourceRoot":"","sources":["../../src/operations/Quaternion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEhE,MAAM,OAAO,UAAU;IAMrB,YAAY,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;QACpD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAQD,QAAQ,CAAC,SAAS,GAAG,CAAC;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEvC,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,GAAG,CAAC;IAC7D,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,C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AAE,IAAI,CAAC,CAAC,CAAC;YACjC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACpC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEtD,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;;AA5LM,eAAI,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClC,cAAG,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,gBAAK,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC,gBAAK,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC,gBAAK,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Vector, Vector3D } from 'ootk-core';
|
|
19
|
+
export declare class RandomGaussianSource {
|
|
20
|
+
private _boxMuller;
|
|
21
|
+
constructor(seed?: number);
|
|
22
|
+
nextGauss(): number;
|
|
23
|
+
gaussVector(n: number): Vector;
|
|
24
|
+
gaussSphere(radius?: number): Vector3D;
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { Vector } from 'ootk-core';
|
|
19
|
+
import { BoxMuller } from './BoxMuller';
|
|
20
|
+
export class RandomGaussianSource {
|
|
21
|
+
constructor(seed = 0) {
|
|
22
|
+
this._boxMuller = new BoxMuller(0, 1, seed);
|
|
23
|
+
}
|
|
24
|
+
nextGauss() {
|
|
25
|
+
return this._boxMuller.nextGauss();
|
|
26
|
+
}
|
|
27
|
+
gaussVector(n) {
|
|
28
|
+
if (n < 1) {
|
|
29
|
+
throw new Error('n must be greater than 0');
|
|
30
|
+
}
|
|
31
|
+
const result = new Vector([this.nextGauss()]);
|
|
32
|
+
for (let i = 0; i < n; i++) {
|
|
33
|
+
if (i > 0) {
|
|
34
|
+
result.add(new Vector[this.nextGauss()]());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
gaussSphere(radius = 1.0) {
|
|
40
|
+
return this.gaussVector(3).toVector3D(0).normalize().scale(radius);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=RandomGaussianSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RandomGaussianSource.js","sourceRoot":"","sources":["../../src/operations/RandomGaussianSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAY,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,oBAAoB;IAG/B,YAAY,IAAI,GAAG,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,WAAW,CAAC,CAAS;QACnB,IAAI,CAAC,GAAG,CAAC,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;SAC7C;QAED,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAE9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,MAAM,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;aAC5C;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,MAAM,GAAG,GAAG;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author @thkruz Theodore Kruczek
|
|
3
|
+
*
|
|
4
|
+
* @license AGPL-3.0-or-later
|
|
5
|
+
* @Copyright (c) 2020-2024 Theodore Kruczek
|
|
6
|
+
*
|
|
7
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
9
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
12
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
* See the GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
16
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { StateInterpolator } from '../interpolator/StateInterpolator';
|
|
19
|
+
import { ChebyshevInterpolator } from './../interpolator/ChebyshevInterpolator';
|
|
20
|
+
export declare class ChebyshevCompressor {
|
|
21
|
+
private _interpolator;
|
|
22
|
+
constructor(_interpolator: StateInterpolator);
|
|
23
|
+
private static _cosPi;
|
|
24
|
+
private _fitCoefficient;
|
|
25
|
+
private _fitWindow;
|
|
26
|
+
/**
|
|
27
|
+
* Compress this object's interpolater, using the provided coefficients
|
|
28
|
+
* per revolution [cpr].
|
|
29
|
+
*/
|
|
30
|
+
compress(cpr?: number): ChebyshevInterpolator;
|
|
31
|
+
}
|