ootk 1.2.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/{asc → .asc}/asconfig.json +0 -0
  2. package/{asc → .asc}/assembly/index.ts +0 -0
  3. package/{asc → .asc}/ex/asconfig.json +0 -0
  4. package/{asc → .asc}/ex/assembly/index.ts +0 -0
  5. package/{asc → .asc}/ex/index.html +0 -0
  6. package/{asc → .asc}/ex/package.json +0 -0
  7. package/{asc → .asc}/ex/tests/index.js +0 -0
  8. package/{asc → .asc}/package.json +0 -0
  9. package/{asc → .asc}/tests/index.js +0 -0
  10. package/.eslintrc.json +5 -5
  11. package/LICENSE.MD +299 -21
  12. package/README.md +17 -22
  13. package/dist/ootk.d.ts +16 -23
  14. package/dist/ootk.js +2 -1
  15. package/dist/ootk.js.LICENSE.txt +77 -0
  16. package/lib/objects/base-object.d.ts +40 -0
  17. package/lib/objects/base-object.js +109 -0
  18. package/lib/objects/base-object.js.map +1 -0
  19. package/lib/objects/detailed-sat.d.ts +66 -0
  20. package/lib/objects/detailed-sat.js +149 -0
  21. package/lib/objects/detailed-sat.js.map +1 -0
  22. package/lib/objects/index.d.ts +4 -0
  23. package/lib/objects/index.js +5 -0
  24. package/lib/objects/index.js.map +1 -0
  25. package/lib/objects/sat.d.ts +88 -0
  26. package/lib/objects/sat.js +141 -0
  27. package/lib/objects/sat.js.map +1 -0
  28. package/lib/objects/sensor.d.ts +40 -0
  29. package/lib/objects/sensor.js +88 -0
  30. package/lib/objects/sensor.js.map +1 -0
  31. package/lib/objects/space-object.d.ts +38 -0
  32. package/lib/objects/space-object.js +60 -0
  33. package/lib/objects/space-object.js.map +1 -0
  34. package/lib/objects/star.d.ts +46 -0
  35. package/lib/objects/star.js +91 -0
  36. package/lib/objects/star.js.map +1 -0
  37. package/lib/ootk.d.ts +16 -23
  38. package/lib/ootk.js +16 -23
  39. package/lib/ootk.js.map +1 -1
  40. package/{dist → lib/sgp4}/sgp4.d.ts +14 -21
  41. package/lib/{sgp4.js → sgp4/sgp4.js} +35 -27
  42. package/lib/sgp4/sgp4.js.map +1 -0
  43. package/lib/{utils/TleFormatData.d.ts → tle/tle-format-data.d.ts} +0 -0
  44. package/lib/{utils/TleFormatData.js → tle/tle-format-data.js} +1 -1
  45. package/lib/tle/tle-format-data.js.map +1 -0
  46. package/{dist → lib/tle}/tle.d.ts +12 -16
  47. package/lib/{tle.js → tle/tle.js} +13 -17
  48. package/lib/tle/tle.js.map +1 -0
  49. package/lib/{transforms.d.ts → transforms/transforms.d.ts} +12 -16
  50. package/lib/{transforms.js → transforms/transforms.js} +12 -16
  51. package/lib/transforms/transforms.js.map +1 -0
  52. package/{dist → lib/types}/types.d.ts +68 -0
  53. package/lib/types/types.js +34 -0
  54. package/lib/types/types.js.map +1 -0
  55. package/lib/utils/constants.d.ts +13 -16
  56. package/lib/utils/constants.js +13 -16
  57. package/lib/utils/constants.js.map +1 -1
  58. package/lib/utils/moon-math.d.ts +104 -0
  59. package/lib/utils/moon-math.js +387 -0
  60. package/lib/utils/moon-math.js.map +1 -0
  61. package/lib/utils/sun-math.d.ts +230 -0
  62. package/lib/utils/sun-math.js +421 -0
  63. package/lib/utils/sun-math.js.map +1 -0
  64. package/lib/utils/utils.d.ts +36 -0
  65. package/lib/{utils.js → utils/utils.js} +18 -18
  66. package/lib/utils/utils.js.map +1 -0
  67. package/package.json +2 -1
  68. package/dist/sat.d.ts +0 -51
  69. package/dist/transforms.d.ts +0 -59
  70. package/dist/utils.d.ts +0 -36
  71. package/lib/sat.d.ts +0 -51
  72. package/lib/sat.js +0 -81
  73. package/lib/sat.js.map +0 -1
  74. package/lib/sgp4.d.ts +0 -89
  75. package/lib/sgp4.js.map +0 -1
  76. package/lib/tle.d.ts +0 -378
  77. package/lib/tle.js.map +0 -1
  78. package/lib/transforms.js.map +0 -1
  79. package/lib/types.d.ts +0 -204
  80. package/lib/types.js +0 -2
  81. package/lib/types.js.map +0 -1
  82. package/lib/utils/TleFormatData.js.map +0 -1
  83. package/lib/utils.d.ts +0 -36
  84. package/lib/utils.js.map +0 -1
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @author Theodore Kruczek.
3
+ * @description Orbital Object ToolKit (OOTK) is a collection of tools for working
4
+ * with satellites and other orbital objects.
5
+ *
6
+ * @file The Utils module.
7
+ *
8
+ * @license AGPL-3.0-or-later
9
+ * @Copyright (c) 2020-2022 Theodore Kruczek
10
+ *
11
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
12
+ * terms of the GNU Affero General Public License as published by the Free Software
13
+ * Foundation, either version 3 of the License, or (at your option) any later version.
14
+ *
15
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
16
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ * See the GNU Affero General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public License along with
20
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import * as Types from '../types/types';
23
+ import { MoonMath } from './moon-math';
24
+ import { SunMath } from './sun-math';
25
+ declare class Utils {
26
+ static Types: typeof Types;
27
+ static distance(pos1: Types.EciVec3, pos2: Types.EciVec3): Types.Kilometer;
28
+ private static sign;
29
+ static dopplerFactor(location: Types.EciVec3, position: Types.EciVec3, velocity: Types.EciVec3): Types.Kilometer;
30
+ static createVec(start: number, stop: number, step: number): number[];
31
+ static jday: (year?: number, mon?: number, day?: number, hr?: number, minute?: number, sec?: number) => number;
32
+ static roundToNDecimalPlaces(value: number, places: number): number;
33
+ static SunMath: typeof SunMath;
34
+ static MoonMath: typeof MoonMath;
35
+ }
36
+ export { Utils };
@@ -5,26 +5,24 @@
5
5
  *
6
6
  * @file The Utils module.
7
7
  *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
8
+ * @license AGPL-3.0-or-later
9
+ * @Copyright (c) 2020-2022 Theodore Kruczek
14
10
  *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
11
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
12
+ * terms of the GNU Affero General Public License as published by the Free Software
13
+ * Foundation, either version 3 of the License, or (at your option) any later version.
17
14
  *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
15
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
16
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ * See the GNU Affero General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public License along with
20
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
25
21
  */
26
- import * as Types from './types';
27
- import { MILLISECONDS_PER_DAY } from './utils/constants';
22
+ import * as Types from '../types/types';
23
+ import { DAY_TO_MS } from './constants';
24
+ import { MoonMath } from './moon-math';
25
+ import { SunMath } from './sun-math';
28
26
  var Utils = /** @class */ (function () {
29
27
  function Utils() {
30
28
  }
@@ -66,7 +64,7 @@ var Utils = /** @class */ (function () {
66
64
  var now = new Date();
67
65
  var jDayStart = new Date(now.getUTCFullYear(), 0, 0);
68
66
  var jDayDiff = now.getDate() - jDayStart.getDate();
69
- return Math.floor(jDayDiff / MILLISECONDS_PER_DAY);
67
+ return Math.floor(jDayDiff / DAY_TO_MS);
70
68
  }
71
69
  return (367.0 * year -
72
70
  Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) +
@@ -75,6 +73,8 @@ var Utils = /** @class */ (function () {
75
73
  1721013.5 +
76
74
  ((sec / 60.0 + minute) / 60.0 + hr) / 24.0);
77
75
  };
76
+ Utils.SunMath = SunMath;
77
+ Utils.MoonMath = MoonMath;
78
78
  return Utils;
79
79
  }());
80
80
  export { Utils };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;IAAA;IAuEA,CAAC;IApEe,cAAQ,GAAtB,UAAuB,IAAmB,EAAE,IAAmB;QAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,SAAA,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAI,CAAC,CAAA,GAAG,SAAA,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAI,CAAC,CAAA,GAAG,SAAA,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAI,CAAC,CAAA,CAAC,CAAC;IAC7F,CAAC;IAIa,mBAAa,GAA3B,UACE,QAAuB,EACvB,QAAuB,EACvB,QAAuB;QAEvB,IAAM,OAAO,GAAG,WAAW,CAAC;QAC5B,IAAM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,GAAG,IAAI,CAC3C,CAAC;IACJ,CAAC,CAAC;IAMY,aAAO,GAAG,OAAO,CAAC;IAClB,cAAQ,GAAG,QAAQ,CAAC;IACpC,YAAC;CAAA,AAvED,IAuEC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ootk",
3
- "version": "1.2.0",
3
+ "version": "1.5.0",
4
4
  "description": "Orbital Object Toolkit including SGP4 Propagator and Coordinate Transforms",
5
5
  "main": "dist/ootk.js",
6
6
  "scripts": {
@@ -68,6 +68,7 @@
68
68
  "eslint": "^7.9.0",
69
69
  "jest": "^26.4.2",
70
70
  "node-fetch": "^2.6.7",
71
+ "prettier": "^2.7.1",
71
72
  "typescript": "^4.1.3",
72
73
  "webpack": "^5.11.1",
73
74
  "webpack-cli": "^4.10.0"
package/dist/sat.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import { EcfVec3, EciVec3, LlaVec3, SatelliteRecord, StateVector, TleLine1, TleLine2 } from './types';
2
- export declare class Sat {
3
- satNum: number;
4
- satrec: SatelliteRecord;
5
- options: any;
6
- intlDes: string;
7
- epochYear: number;
8
- epochDay: number;
9
- meanMoDev1: number;
10
- meanMoDev2: number;
11
- bstar: number;
12
- inclination: number;
13
- raan: number;
14
- eccentricity: number;
15
- argOfPerigee: number;
16
- meanAnomaly: number;
17
- meanMotion: number;
18
- period: number;
19
- constructor(tle1: TleLine1, tle2: TleLine2, options: any);
20
- /**
21
- * Calculates position and velocity in ECI coordinates at a given time.
22
- * @param {Date} date Date to calculate the state vector for
23
- * @returns {StateVector} State vector for the given date
24
- */
25
- getStateVec(date: Date): StateVector;
26
- /**
27
- * Calculates ECI position at a given time.
28
- * @param {Date} date Date to calculate
29
- * @returns {EciVec3} ECI position vector
30
- */
31
- getEci(date: Date): EciVec3;
32
- /**
33
- * Calculates ECF position at a given time.
34
- * @param {Date} date Date to calculate
35
- * @returns {EcfVec3} ECF position vector
36
- */
37
- getEcf(date: Date): EcfVec3;
38
- /**
39
- * Calculates LLA position at a given time.
40
- * @param {Date} date Date to calculate
41
- * @returns {LlaVec3} LLA position vector
42
- */
43
- getLla(date: Date): LlaVec3;
44
- /**
45
- * Calculates the time variables for a given date relative to the TLE epoch.
46
- * @param {Date} date Date to calculate
47
- * @param {SatelliteRecord} satrec Satellite orbital information
48
- * @returns {{m: number, gmst: GreenwichMeanSiderealTime, j: number}} Time variables
49
- */
50
- private static calculateTimeVariables;
51
- }
@@ -1,59 +0,0 @@
1
- /**
2
- * @author Theodore Kruczek.
3
- * @description Orbital Object ToolKit (OOTK) is a collection of tools for working
4
- * with satellites and other orbital objects.
5
- *
6
- * @file The Transforms module contains a collection of conversions not contained
7
- * in the original SGP4 library such as ECI to ECF and ECF to RAE. This was based
8
- * on some of the functions in satellite.js.
9
- *
10
- * Permission is hereby granted, free of charge, to any person obtaining a copy
11
- * of this software and associated documentation files (the "Software"), to deal
12
- * in the Software without restriction, including without limitation the rights
13
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- * copies of the Software, and to permit persons to whom the Software is
15
- * furnished to do so, subject to the following conditions:
16
- *
17
- * The above copyright notice and this permission notice shall be included in all
18
- * copies or substantial portions of the Software.
19
- *
20
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- * SOFTWARE.
27
- */
28
- import { Degrees, EcfVec3, EciVec3, LlaVec3, Radians, RaeVec3, SezVec3 } from './types';
29
- declare class Transforms {
30
- static getDegLat(radians: Radians): Degrees;
31
- static getDegLon(radians: Radians): Degrees;
32
- static getRadLat(degrees: Degrees): Radians;
33
- static getRadLon(degrees: Degrees): Radians;
34
- static rad2deg(radians: Radians): Degrees;
35
- static deg2rad(degrees: Degrees): Radians;
36
- static ecf2eci(ecf: EcfVec3, gmst: number): EciVec3;
37
- static ecf2rae(lla: LlaVec3, ecf: EcfVec3): RaeVec3;
38
- /**
39
- * EciToGeodetic converts eci coordinates to lla coordinates
40
- * @param {vec3} eci takes xyz coordinates
41
- * @param {number} gmst takes a number in gmst time
42
- * @returns {array} array containing lla coordinates
43
- */
44
- static eci2lla(eci: EciVec3, gmst: number): LlaVec3;
45
- static eci2ecf(eci: EciVec3, gmst: number): EcfVec3;
46
- static lla2ecf(lla: LlaVec3): EcfVec3;
47
- static lla2sez(lla: LlaVec3, ecf: EcfVec3): SezVec3;
48
- static rae2sez(rae: RaeVec3): SezVec3;
49
- static rae2ecf(rae: RaeVec3, lla: LlaVec3): EcfVec3;
50
- /**
51
- * @param {Object} sez Containing SEZ coordinates
52
- * @param {Number} sez.s Positive horizontal vector S due south.
53
- * @param {Number} sez.e Positive horizontal vector E due east.
54
- * @param {Number} sez.z Vector Z normal to the surface of the earth (up).
55
- * @returns {Object} Rng, Az, El array
56
- */
57
- static sez2rae(sez: SezVec3): RaeVec3;
58
- }
59
- export { Transforms };
package/dist/utils.d.ts DELETED
@@ -1,36 +0,0 @@
1
- /**
2
- * @author Theodore Kruczek.
3
- * @description Orbital Object ToolKit (OOTK) is a collection of tools for working
4
- * with satellites and other orbital objects.
5
- *
6
- * @file The Utils module.
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- */
26
- import * as Types from './types';
27
- declare class Utils {
28
- static Types: typeof Types;
29
- static distance(pos1: Types.EciVec3, pos2: Types.EciVec3): Types.Kilometer;
30
- private static sign;
31
- static dopplerFactor(location: Types.EciVec3, position: Types.EciVec3, velocity: Types.EciVec3): Types.Kilometer;
32
- static createVec(start: number, stop: number, step: number): number[];
33
- static jday: (year?: number, mon?: number, day?: number, hr?: number, minute?: number, sec?: number) => number;
34
- static roundToNDecimalPlaces(value: number, places: number): number;
35
- }
36
- export { Utils };
package/lib/sat.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import { EcfVec3, EciVec3, LlaVec3, SatelliteRecord, StateVector, TleLine1, TleLine2 } from './types';
2
- export declare class Sat {
3
- satNum: number;
4
- satrec: SatelliteRecord;
5
- options: any;
6
- intlDes: string;
7
- epochYear: number;
8
- epochDay: number;
9
- meanMoDev1: number;
10
- meanMoDev2: number;
11
- bstar: number;
12
- inclination: number;
13
- raan: number;
14
- eccentricity: number;
15
- argOfPerigee: number;
16
- meanAnomaly: number;
17
- meanMotion: number;
18
- period: number;
19
- constructor(tle1: TleLine1, tle2: TleLine2, options: any);
20
- /**
21
- * Calculates position and velocity in ECI coordinates at a given time.
22
- * @param {Date} date Date to calculate the state vector for
23
- * @returns {StateVector} State vector for the given date
24
- */
25
- getStateVec(date: Date): StateVector;
26
- /**
27
- * Calculates ECI position at a given time.
28
- * @param {Date} date Date to calculate
29
- * @returns {EciVec3} ECI position vector
30
- */
31
- getEci(date: Date): EciVec3;
32
- /**
33
- * Calculates ECF position at a given time.
34
- * @param {Date} date Date to calculate
35
- * @returns {EcfVec3} ECF position vector
36
- */
37
- getEcf(date: Date): EcfVec3;
38
- /**
39
- * Calculates LLA position at a given time.
40
- * @param {Date} date Date to calculate
41
- * @returns {LlaVec3} LLA position vector
42
- */
43
- getLla(date: Date): LlaVec3;
44
- /**
45
- * Calculates the time variables for a given date relative to the TLE epoch.
46
- * @param {Date} date Date to calculate
47
- * @param {SatelliteRecord} satrec Satellite orbital information
48
- * @returns {{m: number, gmst: GreenwichMeanSiderealTime, j: number}} Time variables
49
- */
50
- private static calculateTimeVariables;
51
- }
package/lib/sat.js DELETED
@@ -1,81 +0,0 @@
1
- import { MILLISECONDS_PER_DAY, MINUTES_PER_DAY } from './utils/constants';
2
- import { Sgp4 } from './sgp4';
3
- import { Tle } from './tle';
4
- import { Transforms } from './transforms';
5
- import { Utils } from './utils';
6
- var Sat = /** @class */ (function () {
7
- function Sat(tle1, tle2, options) {
8
- var tleData = Tle.parseTle(tle1, tle2);
9
- this.satNum = tleData.satNum;
10
- this.intlDes = tleData.intlDes;
11
- this.epochYear = tleData.epochYear;
12
- this.epochDay = tleData.epochDay;
13
- this.meanMoDev1 = tleData.meanMoDev1;
14
- this.meanMoDev2 = tleData.meanMoDev2;
15
- this.bstar = tleData.bstar;
16
- this.inclination = tleData.inclination;
17
- this.raan = tleData.raan;
18
- this.eccentricity = tleData.eccentricity;
19
- this.argOfPerigee = tleData.argOfPerigee;
20
- this.meanAnomaly = tleData.meanAnomaly;
21
- this.meanMotion = tleData.meanMotion;
22
- this.period = 1440 / this.meanMotion;
23
- this.satrec = Sgp4.createSatrec(tle1, tle2);
24
- this.options = options;
25
- }
26
- /**
27
- * Calculates position and velocity in ECI coordinates at a given time.
28
- * @param {Date} date Date to calculate the state vector for
29
- * @returns {StateVector} State vector for the given date
30
- */
31
- Sat.prototype.getStateVec = function (date) {
32
- var m = Sat.calculateTimeVariables(date, this.satrec).m;
33
- return Sgp4.propagate(this.satrec, m);
34
- };
35
- /**
36
- * Calculates ECI position at a given time.
37
- * @param {Date} date Date to calculate
38
- * @returns {EciVec3} ECI position vector
39
- */
40
- Sat.prototype.getEci = function (date) {
41
- var m = Sat.calculateTimeVariables(date, this.satrec).m;
42
- var eci = Sgp4.propagate(this.satrec, m).position;
43
- return eci ? eci : { x: 0, y: 0, z: 0 };
44
- };
45
- /**
46
- * Calculates ECF position at a given time.
47
- * @param {Date} date Date to calculate
48
- * @returns {EcfVec3} ECF position vector
49
- */
50
- Sat.prototype.getEcf = function (date) {
51
- var _a = Sat.calculateTimeVariables(date, this.satrec), m = _a.m, gmst = _a.gmst;
52
- var eci = Sgp4.propagate(this.satrec, m).position || { x: 0, y: 0, z: 0 };
53
- return Transforms.eci2ecf(eci, gmst);
54
- };
55
- /**
56
- * Calculates LLA position at a given time.
57
- * @param {Date} date Date to calculate
58
- * @returns {LlaVec3} LLA position vector
59
- */
60
- Sat.prototype.getLla = function (date) {
61
- var _a = Sat.calculateTimeVariables(date, this.satrec), m = _a.m, gmst = _a.gmst;
62
- var eci = Sgp4.propagate(this.satrec, m).position || { x: 0, y: 0, z: 0 };
63
- return Transforms.eci2lla(eci, gmst);
64
- };
65
- /**
66
- * Calculates the time variables for a given date relative to the TLE epoch.
67
- * @param {Date} date Date to calculate
68
- * @param {SatelliteRecord} satrec Satellite orbital information
69
- * @returns {{m: number, gmst: GreenwichMeanSiderealTime, j: number}} Time variables
70
- */
71
- Sat.calculateTimeVariables = function (date, satrec) {
72
- var j = Utils.jday(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()) +
73
- date.getUTCMilliseconds() * MILLISECONDS_PER_DAY;
74
- var gmst = Sgp4.gstime(j);
75
- var m = satrec ? (j - satrec.jdsatepoch) * MINUTES_PER_DAY : null;
76
- return { gmst: gmst, m: m, j: j };
77
- };
78
- return Sat;
79
- }());
80
- export { Sat };
81
- //# sourceMappingURL=sat.js.map
package/lib/sat.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sat.js","sourceRoot":"","sources":["../src/sat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC;IAiCE,aAAY,IAAc,EAAE,IAAc,EAAE,OAAO;QACjD,IAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CA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MAAA,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC;IACxB,CAAC;IACH,UAAC;AAAD,CAAC,AAhID,IAgIC"}
package/lib/sgp4.d.ts DELETED
@@ -1,89 +0,0 @@
1
- /**
2
- * @author Theodore Kruczek.
3
- * @description Orbital Object ToolKit (OOTK) is a collection of tools for working
4
- * with satellites and other orbital objects.
5
- *
6
- * @file The Sgp4 module contains a TypeScript port of the 2020 version of
7
- * sgp4unit.cpp from "Fundamentals of Astrodynamics and Applications" by David
8
- * Vallado. All of the original comments and notes are inserted in the code below
9
- * in order provide context to the functions and clarify any adjustments made for
10
- * TypeScript/JavaScript compatibility.
11
- *
12
- * @copyright MIT License.
13
- * Copyright (c) 2020-2021 Theodore Kruczek
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy
16
- * of this software and associated documentation files (the "Software"), to deal
17
- * in the Software without restriction, including without limitation the rights
18
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- * copies of the Software, and to permit persons to whom the Software is
20
- * furnished to do so, subject to the following conditions:
21
- *
22
- * The above copyright notice and this permission notice shall be included in all
23
- * copies or substantial portions of the Software.
24
- *
25
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- */
33
- import { SatelliteRecord, StateVector, Vec3Flat } from './types';
34
- declare class Sgp4 {
35
- private static dpper;
36
- private static dscom;
37
- private static dsinit;
38
- private static dspace;
39
- private static initl;
40
- private static sgp4init;
41
- static propagate(satrec: SatelliteRecord, tsince: number): StateVector;
42
- private static getgravconst;
43
- static createSatrec(tleLine1: string, tleLine2: string, whichconst?: string, opsmode?: string): SatelliteRecord;
44
- static gstime(jdut1: number): number;
45
- static sgn(x: number): number;
46
- static mag(x: Vec3Flat): number;
47
- static cross(vec1: Vec3Flat, vec2: Vec3Flat): Vec3Flat;
48
- static dot(x: Vec3Flat, y: Vec3Flat): number;
49
- static angle(vec1: Vec3Flat, vec2: Vec3Flat): number;
50
- static asinh(xval: number): number;
51
- static newtonnu(ecc: number, nu: number): {
52
- e0: number;
53
- m: number;
54
- };
55
- static sinh(x: number): number;
56
- static rv2coe(r: Vec3Flat, v: Vec3Flat, mus: number): {
57
- p: number;
58
- a: number;
59
- ecc: number;
60
- incl: number;
61
- omega: number;
62
- argp: number;
63
- nu: number;
64
- m: number;
65
- arglat: number;
66
- truelon: number;
67
- lonper: number;
68
- };
69
- static jday(year: number, mon: number, day: number, hr: number, minute: number, sec: number): {
70
- jd: number;
71
- jdFrac: number;
72
- };
73
- static days2mdhms(year: number, days: number): {
74
- mon: number;
75
- day: number;
76
- hr: number;
77
- minute: number;
78
- sec: number;
79
- };
80
- static invjday(jd: number, jdfrac: number): {
81
- year: number;
82
- mon: number;
83
- day: number;
84
- hr: number;
85
- minute: number;
86
- sec: number;
87
- };
88
- }
89
- export { Sgp4 };