ootk 7.0.1 → 7.0.3
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/dist/main.cjs +43 -27
- package/dist/main.d.cts +4 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +43 -27
- package/package.json +4 -1
package/dist/main.cjs
CHANGED
|
@@ -638,20 +638,14 @@ var spaceObjTypeStrMap_ = {
|
|
|
638
638
|
};
|
|
639
639
|
var spaceObjType2Str = (spaceObjType) => spaceObjTypeStrMap_[spaceObjType] || "Unknown";
|
|
640
640
|
var dopplerFactor = (location, position, velocity) => {
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
y: velocity.y - angularVelocityOfEarth * location.x,
|
|
650
|
-
z: velocity.z
|
|
651
|
-
};
|
|
652
|
-
const rangeRate = (range.x * rangeVel.x + range.y * rangeVel.y + range.z * rangeVel.z) / distance;
|
|
653
|
-
const dopplerFactor2 = 1 - rangeRate / cKmPerSec;
|
|
654
|
-
return dopplerFactor2;
|
|
641
|
+
const rangeX = position.x - location.x;
|
|
642
|
+
const rangeY = position.y - location.y;
|
|
643
|
+
const rangeZ = position.z - location.z;
|
|
644
|
+
const distance = Math.sqrt(rangeX * rangeX + rangeY * rangeY + rangeZ * rangeZ);
|
|
645
|
+
const rangeVelX = velocity.x + angularVelocityOfEarth * location.y;
|
|
646
|
+
const rangeVelY = velocity.y - angularVelocityOfEarth * location.x;
|
|
647
|
+
const rangeRate = (rangeX * rangeVelX + rangeY * rangeVelY + rangeZ * velocity.z) / distance;
|
|
648
|
+
return 1 - rangeRate / cKmPerSec;
|
|
655
649
|
};
|
|
656
650
|
function createVec(start, stop, step) {
|
|
657
651
|
const array = [];
|
|
@@ -6155,17 +6149,21 @@ function lla2eci(lla, gmst) {
|
|
|
6155
6149
|
function lla2sez(lla, ecef) {
|
|
6156
6150
|
const lon = lla.lon;
|
|
6157
6151
|
const lat = lla.lat;
|
|
6152
|
+
const sinLat = Math.sin(lat);
|
|
6153
|
+
const cosLat = Math.cos(lat);
|
|
6154
|
+
const sinLon = Math.sin(lon);
|
|
6155
|
+
const cosLon = Math.cos(lon);
|
|
6158
6156
|
const observerEcef = llaRad2ecef({
|
|
6159
6157
|
lat,
|
|
6160
6158
|
lon,
|
|
6161
|
-
alt:
|
|
6159
|
+
alt: lla.alt
|
|
6162
6160
|
});
|
|
6163
6161
|
const rx = ecef.x - observerEcef.x;
|
|
6164
6162
|
const ry = ecef.y - observerEcef.y;
|
|
6165
6163
|
const rz = ecef.z - observerEcef.z;
|
|
6166
|
-
const south =
|
|
6167
|
-
const east = -
|
|
6168
|
-
const zenith =
|
|
6164
|
+
const south = sinLat * cosLon * rx + sinLat * sinLon * ry - cosLat * rz;
|
|
6165
|
+
const east = -sinLon * rx + cosLon * ry;
|
|
6166
|
+
const zenith = cosLat * cosLon * rx + cosLat * sinLon * ry + sinLat * rz;
|
|
6169
6167
|
return { s: south, e: east, z: zenith };
|
|
6170
6168
|
}
|
|
6171
6169
|
function rae2sez(rae) {
|
|
@@ -17302,7 +17300,11 @@ var Satellite = class _Satellite extends SpaceObject {
|
|
|
17302
17300
|
*/
|
|
17303
17301
|
rae(observer, date, j, gmst) {
|
|
17304
17302
|
date ??= /* @__PURE__ */ new Date();
|
|
17305
|
-
gmst
|
|
17303
|
+
if (typeof j !== "number" || typeof gmst !== "number") {
|
|
17304
|
+
const timeVariables = _Satellite.calculateTimeVariables_(date, this.satrec, j, gmst);
|
|
17305
|
+
j = timeVariables.j;
|
|
17306
|
+
gmst = timeVariables.gmst;
|
|
17307
|
+
}
|
|
17306
17308
|
const eci = this.eci(date, j, gmst);
|
|
17307
17309
|
if (!eci) {
|
|
17308
17310
|
return null;
|
|
@@ -17928,18 +17930,32 @@ var Satellite = class _Satellite extends SpaceObject {
|
|
|
17928
17930
|
* @returns Time variables
|
|
17929
17931
|
*/
|
|
17930
17932
|
static calculateTimeVariables_(date, satrec, j, gmst) {
|
|
17931
|
-
j
|
|
17932
|
-
date.
|
|
17933
|
-
|
|
17934
|
-
|
|
17935
|
-
|
|
17936
|
-
|
|
17937
|
-
|
|
17938
|
-
|
|
17933
|
+
if (typeof j !== "number") {
|
|
17934
|
+
const ms = date.getTime();
|
|
17935
|
+
if (_Satellite.timeVariablesCacheMs_ !== ms) {
|
|
17936
|
+
const jNew = jday(
|
|
17937
|
+
date.getUTCFullYear(),
|
|
17938
|
+
date.getUTCMonth() + 1,
|
|
17939
|
+
date.getUTCDate(),
|
|
17940
|
+
date.getUTCHours(),
|
|
17941
|
+
date.getUTCMinutes(),
|
|
17942
|
+
date.getUTCSeconds()
|
|
17943
|
+
) + date.getUTCMilliseconds() * MILLISECONDS_TO_DAYS;
|
|
17944
|
+
_Satellite.timeVariablesCacheMs_ = ms;
|
|
17945
|
+
_Satellite.timeVariablesCacheJ_ = jNew;
|
|
17946
|
+
_Satellite.timeVariablesCacheGmst_ = Sgp4.gstime(jNew);
|
|
17947
|
+
}
|
|
17948
|
+
j = _Satellite.timeVariablesCacheJ_;
|
|
17949
|
+
gmst ??= _Satellite.timeVariablesCacheGmst_;
|
|
17950
|
+
}
|
|
17939
17951
|
gmst ??= Sgp4.gstime(j);
|
|
17940
17952
|
const m = satrec ? (j - satrec.jdsatepoch) * MINUTES_PER_DAY : null;
|
|
17941
17953
|
return { gmst, m, j };
|
|
17942
17954
|
}
|
|
17955
|
+
/** Single-entry memo for calculateTimeVariables_, keyed on Date.getTime() */
|
|
17956
|
+
static timeVariablesCacheMs_ = null;
|
|
17957
|
+
static timeVariablesCacheJ_ = 0;
|
|
17958
|
+
static timeVariablesCacheGmst_ = 0;
|
|
17943
17959
|
};
|
|
17944
17960
|
|
|
17945
17961
|
// src/objects/Star.ts
|
package/dist/main.d.cts
CHANGED
|
@@ -5294,6 +5294,10 @@ declare class Satellite extends SpaceObject {
|
|
|
5294
5294
|
* @returns Time variables
|
|
5295
5295
|
*/
|
|
5296
5296
|
private static calculateTimeVariables_;
|
|
5297
|
+
/** Single-entry memo for calculateTimeVariables_, keyed on Date.getTime() */
|
|
5298
|
+
private static timeVariablesCacheMs_;
|
|
5299
|
+
private static timeVariablesCacheJ_;
|
|
5300
|
+
private static timeVariablesCacheGmst_;
|
|
5297
5301
|
}
|
|
5298
5302
|
|
|
5299
5303
|
/**
|
package/dist/main.d.ts
CHANGED
|
@@ -5294,6 +5294,10 @@ declare class Satellite extends SpaceObject {
|
|
|
5294
5294
|
* @returns Time variables
|
|
5295
5295
|
*/
|
|
5296
5296
|
private static calculateTimeVariables_;
|
|
5297
|
+
/** Single-entry memo for calculateTimeVariables_, keyed on Date.getTime() */
|
|
5298
|
+
private static timeVariablesCacheMs_;
|
|
5299
|
+
private static timeVariablesCacheJ_;
|
|
5300
|
+
private static timeVariablesCacheGmst_;
|
|
5297
5301
|
}
|
|
5298
5302
|
|
|
5299
5303
|
/**
|
package/dist/main.js
CHANGED
|
@@ -636,20 +636,14 @@ var spaceObjTypeStrMap_ = {
|
|
|
636
636
|
};
|
|
637
637
|
var spaceObjType2Str = (spaceObjType) => spaceObjTypeStrMap_[spaceObjType] || "Unknown";
|
|
638
638
|
var dopplerFactor = (location, position, velocity) => {
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
y: velocity.y - angularVelocityOfEarth * location.x,
|
|
648
|
-
z: velocity.z
|
|
649
|
-
};
|
|
650
|
-
const rangeRate = (range.x * rangeVel.x + range.y * rangeVel.y + range.z * rangeVel.z) / distance;
|
|
651
|
-
const dopplerFactor2 = 1 - rangeRate / cKmPerSec;
|
|
652
|
-
return dopplerFactor2;
|
|
639
|
+
const rangeX = position.x - location.x;
|
|
640
|
+
const rangeY = position.y - location.y;
|
|
641
|
+
const rangeZ = position.z - location.z;
|
|
642
|
+
const distance = Math.sqrt(rangeX * rangeX + rangeY * rangeY + rangeZ * rangeZ);
|
|
643
|
+
const rangeVelX = velocity.x + angularVelocityOfEarth * location.y;
|
|
644
|
+
const rangeVelY = velocity.y - angularVelocityOfEarth * location.x;
|
|
645
|
+
const rangeRate = (rangeX * rangeVelX + rangeY * rangeVelY + rangeZ * velocity.z) / distance;
|
|
646
|
+
return 1 - rangeRate / cKmPerSec;
|
|
653
647
|
};
|
|
654
648
|
function createVec(start, stop, step) {
|
|
655
649
|
const array = [];
|
|
@@ -6153,17 +6147,21 @@ function lla2eci(lla, gmst) {
|
|
|
6153
6147
|
function lla2sez(lla, ecef) {
|
|
6154
6148
|
const lon = lla.lon;
|
|
6155
6149
|
const lat = lla.lat;
|
|
6150
|
+
const sinLat = Math.sin(lat);
|
|
6151
|
+
const cosLat = Math.cos(lat);
|
|
6152
|
+
const sinLon = Math.sin(lon);
|
|
6153
|
+
const cosLon = Math.cos(lon);
|
|
6156
6154
|
const observerEcef = llaRad2ecef({
|
|
6157
6155
|
lat,
|
|
6158
6156
|
lon,
|
|
6159
|
-
alt:
|
|
6157
|
+
alt: lla.alt
|
|
6160
6158
|
});
|
|
6161
6159
|
const rx = ecef.x - observerEcef.x;
|
|
6162
6160
|
const ry = ecef.y - observerEcef.y;
|
|
6163
6161
|
const rz = ecef.z - observerEcef.z;
|
|
6164
|
-
const south =
|
|
6165
|
-
const east = -
|
|
6166
|
-
const zenith =
|
|
6162
|
+
const south = sinLat * cosLon * rx + sinLat * sinLon * ry - cosLat * rz;
|
|
6163
|
+
const east = -sinLon * rx + cosLon * ry;
|
|
6164
|
+
const zenith = cosLat * cosLon * rx + cosLat * sinLon * ry + sinLat * rz;
|
|
6167
6165
|
return { s: south, e: east, z: zenith };
|
|
6168
6166
|
}
|
|
6169
6167
|
function rae2sez(rae) {
|
|
@@ -17300,7 +17298,11 @@ var Satellite = class _Satellite extends SpaceObject {
|
|
|
17300
17298
|
*/
|
|
17301
17299
|
rae(observer, date, j, gmst) {
|
|
17302
17300
|
date ??= /* @__PURE__ */ new Date();
|
|
17303
|
-
gmst
|
|
17301
|
+
if (typeof j !== "number" || typeof gmst !== "number") {
|
|
17302
|
+
const timeVariables = _Satellite.calculateTimeVariables_(date, this.satrec, j, gmst);
|
|
17303
|
+
j = timeVariables.j;
|
|
17304
|
+
gmst = timeVariables.gmst;
|
|
17305
|
+
}
|
|
17304
17306
|
const eci = this.eci(date, j, gmst);
|
|
17305
17307
|
if (!eci) {
|
|
17306
17308
|
return null;
|
|
@@ -17926,18 +17928,32 @@ var Satellite = class _Satellite extends SpaceObject {
|
|
|
17926
17928
|
* @returns Time variables
|
|
17927
17929
|
*/
|
|
17928
17930
|
static calculateTimeVariables_(date, satrec, j, gmst) {
|
|
17929
|
-
j
|
|
17930
|
-
date.
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
17934
|
-
|
|
17935
|
-
|
|
17936
|
-
|
|
17931
|
+
if (typeof j !== "number") {
|
|
17932
|
+
const ms = date.getTime();
|
|
17933
|
+
if (_Satellite.timeVariablesCacheMs_ !== ms) {
|
|
17934
|
+
const jNew = jday(
|
|
17935
|
+
date.getUTCFullYear(),
|
|
17936
|
+
date.getUTCMonth() + 1,
|
|
17937
|
+
date.getUTCDate(),
|
|
17938
|
+
date.getUTCHours(),
|
|
17939
|
+
date.getUTCMinutes(),
|
|
17940
|
+
date.getUTCSeconds()
|
|
17941
|
+
) + date.getUTCMilliseconds() * MILLISECONDS_TO_DAYS;
|
|
17942
|
+
_Satellite.timeVariablesCacheMs_ = ms;
|
|
17943
|
+
_Satellite.timeVariablesCacheJ_ = jNew;
|
|
17944
|
+
_Satellite.timeVariablesCacheGmst_ = Sgp4.gstime(jNew);
|
|
17945
|
+
}
|
|
17946
|
+
j = _Satellite.timeVariablesCacheJ_;
|
|
17947
|
+
gmst ??= _Satellite.timeVariablesCacheGmst_;
|
|
17948
|
+
}
|
|
17937
17949
|
gmst ??= Sgp4.gstime(j);
|
|
17938
17950
|
const m = satrec ? (j - satrec.jdsatepoch) * MINUTES_PER_DAY : null;
|
|
17939
17951
|
return { gmst, m, j };
|
|
17940
17952
|
}
|
|
17953
|
+
/** Single-entry memo for calculateTimeVariables_, keyed on Date.getTime() */
|
|
17954
|
+
static timeVariablesCacheMs_ = null;
|
|
17955
|
+
static timeVariablesCacheJ_ = 0;
|
|
17956
|
+
static timeVariablesCacheGmst_ = 0;
|
|
17941
17957
|
};
|
|
17942
17958
|
|
|
17943
17959
|
// src/objects/Star.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ootk",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Orbital Object Toolkit including Multiple Propagators, Initial Orbit Determination, and Maneuver Calculations.",
|
|
6
6
|
"exports": {
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"scripts": {
|
|
22
|
+
"bench": "npm run build && node benchmark/run.mjs",
|
|
23
|
+
"bench:only": "node benchmark/run.mjs",
|
|
22
24
|
"build": "tsup",
|
|
23
25
|
"clean": "node ./scripts/cleanup.mjs",
|
|
24
26
|
"circular": "node scripts/check-circular.mjs",
|
|
@@ -71,6 +73,7 @@
|
|
|
71
73
|
"eslint": "^9.39.1",
|
|
72
74
|
"husky": "^9.1.7",
|
|
73
75
|
"madge": "^8.0.0",
|
|
76
|
+
"satellite.js": "^7.0.1",
|
|
74
77
|
"semantic-release": "^25.0.5",
|
|
75
78
|
"ts-node": "^10.9.2",
|
|
76
79
|
"tsup": "^8.5.1",
|