ootk 1.0.4 → 1.0.6

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 (44) hide show
  1. package/CHANGELOG.md +19 -33
  2. package/LICENSE.MD +21 -21
  3. package/README.md +128 -128
  4. package/asc/asconfig.json +22 -0
  5. package/asc/assembly/index.ts +1143 -0
  6. package/asc/ex/asconfig.json +22 -0
  7. package/asc/ex/assembly/index.ts +5 -0
  8. package/asc/ex/index.html +10 -0
  9. package/asc/ex/package.json +19 -0
  10. package/asc/ex/tests/index.js +4 -0
  11. package/asc/package.json +19 -0
  12. package/asc/tests/index.js +4 -0
  13. package/dist/ootk.js +1 -3850
  14. package/lib/ootk.d.ts +3 -4
  15. package/lib/ootk.js +3 -4
  16. package/lib/ootk.js.map +1 -1
  17. package/lib/{ootk-sgp4.d.ts → sgp4.d.ts} +6 -140
  18. package/lib/{ootk-sgp4.js → sgp4.js} +545 -555
  19. package/lib/sgp4.js.map +1 -0
  20. package/lib/transforms.d.ts +58 -0
  21. package/lib/{ootk-transforms.js → transforms.js} +3 -4
  22. package/lib/transforms.js.map +1 -0
  23. package/lib/{ootk-utils.d.ts → utils/constants.d.ts} +6 -11
  24. package/lib/utils/constants.js +31 -0
  25. package/lib/utils/constants.js.map +1 -0
  26. package/lib/utils/types.d.ts +164 -0
  27. package/lib/utils/types.js +2 -0
  28. package/lib/utils/types.js.map +1 -0
  29. package/lib/utils.d.ts +33 -0
  30. package/lib/{ootk-utils.js → utils.js} +12 -6
  31. package/lib/utils.js.map +1 -0
  32. package/package.json +15 -16
  33. package/sandbox.html +8 -0
  34. package/dist/ootk-sgp4.js +0 -3471
  35. package/dist/ootk-sgp4.min.js +0 -34
  36. package/dist/ootk-transforms.js +0 -340
  37. package/dist/ootk-transforms.min.js +0 -1
  38. package/dist/ootk-utils.js +0 -149
  39. package/dist/ootk-utils.min.js +0 -1
  40. package/dist/ootk.min.js +0 -60
  41. package/lib/ootk-sgp4.js.map +0 -1
  42. package/lib/ootk-transforms.d.ts +0 -141
  43. package/lib/ootk-transforms.js.map +0 -1
  44. package/lib/ootk-utils.js.map +0 -1
@@ -30,6 +30,7 @@
30
30
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
31
  * SOFTWARE.
32
32
  */
33
+ import { DEG2RAD, PI, TAU, temp4, x2o3 } from './utils/constants';
33
34
  /* ----------------------------------------------------------------
34
35
  *
35
36
  * sgp4unit.cpp
@@ -86,47 +87,6 @@
86
87
  * 80 norad
87
88
  * original baseline
88
89
  * ---------------------------------------------------------------- */
89
- var PI = Math.PI;
90
- var TAU = PI * 2;
91
- var DEG2RAD = PI / 180.0;
92
- var x2o3 = 2.0 / 3.0;
93
- var xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
94
- var zes = 0.01675;
95
- var zel = 0.0549;
96
- var c1ss = 2.9864797e-6;
97
- var c1l = 4.7968065e-7;
98
- var zsinis = 0.39785416;
99
- var zcosis = 0.91744867;
100
- var zcosgs = 0.1945905;
101
- var zsings = -0.98088458;
102
- var q22 = 1.7891679e-6;
103
- var q31 = 2.1460748e-6;
104
- var q33 = 2.2123015e-7;
105
- var root22 = 1.7891679e-6;
106
- var root44 = 7.3636953e-9;
107
- var root54 = 2.1765803e-9;
108
- var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
109
- var root32 = 3.7393792e-7;
110
- var root52 = 1.1428639e-7;
111
- var znl = 1.5835218e-4;
112
- var zns = 1.19459e-5;
113
- var temp4 = 1.5e-12;
114
- var fasx2 = 0.13130908;
115
- var fasx4 = 2.8843198;
116
- var fasx6 = 0.37448087;
117
- var g22 = 5.7686396;
118
- var g32 = 0.95240898;
119
- var g44 = 1.8014998;
120
- var g52 = 1.050833;
121
- var g54 = 4.4108898;
122
- var stepp = 720.0;
123
- var stepn = -720.0;
124
- var step2 = 259200.0;
125
- /**
126
- * Ootk code is run synchronously and often on super tight loops, so lets reuse the variables as much as possible.
127
- */
128
- // prettier-ignore
129
- var axnl, aynl, xl, u, ktr, vkmpersec, ecose, esine, el2, pl, rl, rdotl, rvdotl, betal, sinu, cosu, sin2u, coseo1, sineo1, cosip, sinip, cosisq, delm, delomg, eo1, argpm, argpp, su, t3, t4, tc, tem5, temp, tempa, tempe, templ, inclm, mm, nm, nodem, xincp, xlm, mp, nodep, xmdf, argpdf, nodedf, t2, delmtemp, em, dspaceOptions, dspaceResult, am, ep, cosim, sinim, dpperResult, dpperParameters, method, ts70, ds70, c1, tfrac, thgr70, fk5r, c1p2p, dndt, ft, delt, xndt, xldot, xnddt, x2omi, xomi, x2li, theta, tut1, snodm, cnodm, sinomm, cosomm, betasq, rtemsq, peo, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, cc, x1, x2, x3, x4, x5, x6, x7, x8, zcosg, zsing, zcosh, zsinh, zcosi, zsini, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33, s1, s2, s3, s4, s5, s6, s7, z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33, f220, f221, f311, f321, f322, f330, f441, f442, f522, f523, f542, f543, g200, g201, g211, g300, g310, g322, g410, g422, g520, g521, g532, g533, sini2, temp1, xno2, ainv2, aonv, cos2u, mrt, temp2, xnode, xinc, mvt, rvdot, sinsu, cossu, snod, cnod, cosi, sini, xmx, xmy, ux, uy, uz, vx, vy, vz, r, v, year, satrec, dsinitResult, dsinitOptions, ao, mon, day, hr, minute, sec, ss, qzms24temp, qzms2ttemp, initlOptions, initlResult, cosio, delmotemp, dscomOptions, dscomResult, dpperOptions, sinio, qzms2t, con42, cosio2, lmonth, dayofyr, inttemp, i, eccsq, omeosq, rteosq, ak, d1, adel, po, ses, sis, sls, sghs, shs, sel, sil, sll, con41, ainv, posq, rp, sghl, shll, PInco, plo, pho, ctem, zcosil, zsinhl, stem, zsingl, zsinil, gam, zy, pgho, zcoshl, xnoi, zcosgl, zmol, zmos, se2, se3, si2, si3, sl2, sl3, sl4, sgh2, xnodce, sh3, sgh4, sh2, ee2, e3, xi2, xi3, xl2, xl3, xl4, sgh3, xgh2, xgh3, xgh4, xh2, xh3, sgs, emo, emsqo, eoc, alfdp, betdp, cosop, sinop, dalf, dbet, dls, f2, f3, pe, pgh, ph, PInc, sinzf, xls, xnoh, zf, zm, cc1sq, cc2, cc3, coef, coef1, cosio4, emsq, eeta, etasq, perige, PInvsq, psisq, qzms24, sfour, temp3, tsi, xPIdot, xhdot1, leadingChar, gsto, lsflg, j2, j3, j3oj2, j4, xke, mus, radiusearthkm, tumin;
130
90
  var Sgp4 = /** @class */ (function () {
131
91
  function Sgp4() {
132
92
  }
@@ -199,28 +159,28 @@ var Sgp4 = /** @class */ (function () {
199
159
  Sgp4.dpper = function (satrec, options) {
200
160
  var e3 = satrec.e3, ee2 = satrec.ee2, peo = satrec.peo, pgho = satrec.pgho, pho = satrec.pho, PInco = satrec.PInco, plo = satrec.plo, se2 = satrec.se2, se3 = satrec.se3, sgh2 = satrec.sgh2, sgh3 = satrec.sgh3, sgh4 = satrec.sgh4, sh2 = satrec.sh2, sh3 = satrec.sh3, si2 = satrec.si2, si3 = satrec.si3, sl2 = satrec.sl2, sl3 = satrec.sl3, sl4 = satrec.sl4, t = satrec.t, xgh2 = satrec.xgh2, xgh3 = satrec.xgh3, xgh4 = satrec.xgh4, xh2 = satrec.xh2, xh3 = satrec.xh3, xi2 = satrec.xi2, xi3 = satrec.xi3, xl2 = satrec.xl2, xl3 = satrec.xl3, xl4 = satrec.xl4, zmol = satrec.zmol, zmos = satrec.zmos;
201
161
  var ep = options.ep, inclp = options.inclp, nodep = options.nodep, argpp = options.argpp, mp = options.mp;
202
- var _a = options.opsmode, opsmode = _a === void 0 ? i : _a, init = options.init;
162
+ var _a = options.opsmode, opsmode = _a === void 0 ? 'i' : _a, init = options.init;
203
163
  // ---------------------- constants -----------------------------
204
- /** Ootk -- Declared outside the class at the top */
205
- // zns = 1.19459e-5;
206
- // zes = 0.01675;
207
- // znl = 1.5835218e-4;
208
- // zel = 0.0549;
164
+ /** Ootk -- Some variables imported from outside the class at the top */
165
+ var zns = 1.19459e-5;
166
+ var zes = 0.01675;
167
+ var znl = 1.5835218e-4;
168
+ var zel = 0.0549;
209
169
  // --------------- calculate time varying periodics -----------
210
- zm = zmos + zns * t;
170
+ var zm = zmos + zns * t;
211
171
  // be sure that the initial call has time set to zero
212
172
  if (init === 'y') {
213
173
  zm = zmos;
214
174
  }
215
- zf = zm + 2.0 * zes * Math.sin(zm);
216
- sinzf = Math.sin(zf);
217
- f2 = 0.5 * sinzf * sinzf - 0.25;
218
- f3 = -0.5 * sinzf * Math.cos(zf);
219
- ses = se2 * f2 + se3 * f3;
220
- sis = si2 * f2 + si3 * f3;
221
- sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
222
- sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
223
- shs = sh2 * f2 + sh3 * f3;
175
+ var zf = zm + 2.0 * zes * Math.sin(zm);
176
+ var sinzf = Math.sin(zf);
177
+ var f2 = 0.5 * sinzf * sinzf - 0.25;
178
+ var f3 = -0.5 * sinzf * Math.cos(zf);
179
+ var ses = se2 * f2 + se3 * f3;
180
+ var sis = si2 * f2 + si3 * f3;
181
+ var sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
182
+ var sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
183
+ var shs = sh2 * f2 + sh3 * f3;
224
184
  zm = zmol + znl * t;
225
185
  if (init === 'y') {
226
186
  zm = zmol;
@@ -229,16 +189,16 @@ var Sgp4 = /** @class */ (function () {
229
189
  sinzf = Math.sin(zf);
230
190
  f2 = 0.5 * sinzf * sinzf - 0.25;
231
191
  f3 = -0.5 * sinzf * Math.cos(zf);
232
- sel = ee2 * f2 + e3 * f3;
233
- sil = xi2 * f2 + xi3 * f3;
234
- sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
235
- sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
236
- shll = xh2 * f2 + xh3 * f3;
237
- pe = ses + sel;
238
- PInc = sis + sil;
239
- pl = sls + sll;
240
- pgh = sghs + sghl;
241
- ph = shs + shll;
192
+ var sel = ee2 * f2 + e3 * f3;
193
+ var sil = xi2 * f2 + xi3 * f3;
194
+ var sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
195
+ var sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
196
+ var shll = xh2 * f2 + xh3 * f3;
197
+ var pe = ses + sel;
198
+ var PInc = sis + sil;
199
+ var pl = sls + sll;
200
+ var pgh = sghs + sghl;
201
+ var ph = shs + shll;
242
202
  if (init === 'n') {
243
203
  pe -= peo;
244
204
  PInc -= PInco;
@@ -247,8 +207,8 @@ var Sgp4 = /** @class */ (function () {
247
207
  ph -= pho;
248
208
  inclp += PInc;
249
209
  ep += pe;
250
- sinip = Math.sin(inclp);
251
- cosip = Math.cos(inclp);
210
+ var sinip = Math.sin(inclp);
211
+ var cosip = Math.cos(inclp);
252
212
  /* ----------------- apply periodics directly ------------ */
253
213
  // sgp4fix for lyddane choice
254
214
  // strn3 used original inclination - this is technically feasible
@@ -267,12 +227,12 @@ var Sgp4 = /** @class */ (function () {
267
227
  }
268
228
  else {
269
229
  // ---- apply periodics with lyddane modification ----
270
- sinop = Math.sin(nodep);
271
- cosop = Math.cos(nodep);
272
- alfdp = sinip * sinop;
273
- betdp = sinip * cosop;
274
- dalf = ph * cosop + PInc * cosip * sinop;
275
- dbet = -ph * sinop + PInc * cosip * cosop;
230
+ var sinop = Math.sin(nodep);
231
+ var cosop = Math.cos(nodep);
232
+ var alfdp = sinip * sinop;
233
+ var betdp = sinip * cosop;
234
+ var dalf = ph * cosop + PInc * cosip * sinop;
235
+ var dbet = -ph * sinop + PInc * cosip * cosop;
276
236
  alfdp += dalf;
277
237
  betdp += dbet;
278
238
  nodep %= TAU;
@@ -282,10 +242,10 @@ var Sgp4 = /** @class */ (function () {
282
242
  if (nodep < 0.0 && opsmode === 'a') {
283
243
  nodep += TAU;
284
244
  }
285
- xls = mp + argpp + cosip * nodep;
286
- dls = pl + pgh - PInc * nodep * sinip;
245
+ var xls = mp + argpp + cosip * nodep;
246
+ var dls = pl + pgh - PInc * nodep * sinip;
287
247
  xls += dls;
288
- xnoh = nodep;
248
+ var xnoh = nodep;
289
249
  nodep = Math.atan2(alfdp, betdp);
290
250
  // sgp4fix for afspc written intrinsic functions
291
251
  // nodep used without a trigonometric function ahead
@@ -384,77 +344,78 @@ var Sgp4 = /** @class */ (function () {
384
344
  Sgp4.dscom = function (options) {
385
345
  var epoch = options.epoch, ep = options.ep, argpp = options.argpp, tc = options.tc, inclp = options.inclp, nodep = options.nodep, np = options.np;
386
346
  // -------------------------- constants -------------------------
387
- /** Ootk -- These are declared outside the class at the top of the file */
388
- // zes = 0.01675;
389
- // zel = 0.0549;
390
- // c1ss = 2.9864797e-6;
391
- // c1l = 4.7968065e-7;
392
- // zsinis = 0.39785416;
393
- // zcosis = 0.91744867;
394
- // zcosgs = 0.1945905;
395
- // zsings = -0.98088458;
396
- // TAU = 2.0 * Math.PI;
347
+ /** Ootk -- Some variables imported from outside the class at the top */
348
+ var zes = 0.01675;
349
+ var zel = 0.0549;
350
+ var c1ss = 2.9864797e-6;
351
+ var c1l = 4.7968065e-7;
352
+ var zsinis = 0.39785416;
353
+ var zcosis = 0.91744867;
354
+ var zcosgs = 0.1945905;
355
+ var zsings = -0.98088458;
356
+ var TAU = 2.0 * Math.PI;
397
357
  // --------------------- local variables ------------------------
398
- nm = np;
399
- em = ep;
400
- snodm = Math.sin(nodep);
401
- cnodm = Math.cos(nodep);
402
- sinomm = Math.sin(argpp);
403
- cosomm = Math.cos(argpp);
404
- sinim = Math.sin(inclp);
405
- cosim = Math.cos(inclp);
406
- emsq = em * em;
407
- betasq = 1.0 - emsq;
408
- rtemsq = Math.sqrt(betasq);
358
+ var s1, s2, s3, s4, s5, s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33, z31, z32, z33, z1, z2, z3, z11, z12, z13, z21, z22, z23;
359
+ var nm = np;
360
+ var em = ep;
361
+ var snodm = Math.sin(nodep);
362
+ var cnodm = Math.cos(nodep);
363
+ var sinomm = Math.sin(argpp);
364
+ var cosomm = Math.cos(argpp);
365
+ var sinim = Math.sin(inclp);
366
+ var cosim = Math.cos(inclp);
367
+ var emsq = em * em;
368
+ var betasq = 1.0 - emsq;
369
+ var rtemsq = Math.sqrt(betasq);
409
370
  // ----------------- initialize lunar solar terms ---------------
410
- peo = 0.0;
411
- PInco = 0.0;
412
- plo = 0.0;
413
- pgho = 0.0;
414
- pho = 0.0;
415
- day = epoch + 18261.5 + tc / 1440.0;
416
- xnodce = (4.523602 - 9.2422029e-4 * day) % TAU;
417
- stem = Math.sin(xnodce);
418
- ctem = Math.cos(xnodce);
419
- zcosil = 0.91375164 - 0.03568096 * ctem;
420
- zsinil = Math.sqrt(1.0 - zcosil * zcosil);
421
- zsinhl = (0.089683511 * stem) / zsinil;
422
- zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl);
423
- gam = 5.8351514 + 0.001944368 * day;
371
+ var peo = 0.0;
372
+ var PInco = 0.0;
373
+ var plo = 0.0;
374
+ var pgho = 0.0;
375
+ var pho = 0.0;
376
+ var day = epoch + 18261.5 + tc / 1440.0;
377
+ var xnodce = (4.523602 - 9.2422029e-4 * day) % TAU;
378
+ var stem = Math.sin(xnodce);
379
+ var ctem = Math.cos(xnodce);
380
+ var zcosil = 0.91375164 - 0.03568096 * ctem;
381
+ var zsinil = Math.sqrt(1.0 - zcosil * zcosil);
382
+ var zsinhl = (0.089683511 * stem) / zsinil;
383
+ var zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl);
384
+ var gam = 5.8351514 + 0.001944368 * day;
424
385
  var zx = (0.39785416 * stem) / zsinil;
425
- zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
386
+ var zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
426
387
  zx = Math.atan2(zx, zy);
427
388
  zx += gam - xnodce;
428
- zcosgl = Math.cos(zx);
429
- zsingl = Math.sin(zx);
389
+ var zcosgl = Math.cos(zx);
390
+ var zsingl = Math.sin(zx);
430
391
  // ------------------------- do solar terms ---------------------
431
- zcosg = zcosgs;
432
- zsing = zsings;
433
- zcosi = zcosis;
434
- zsini = zsinis;
435
- zcosh = cnodm;
436
- zsinh = snodm;
437
- cc = c1ss;
438
- xnoi = 1.0 / nm;
439
- for (lsflg = 1; lsflg <= 2; lsflg++) {
440
- a1 = zcosg * zcosh + zsing * zcosi * zsinh;
441
- a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
442
- a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
443
- a8 = zsing * zsini;
444
- a9 = zsing * zsinh + zcosg * zcosi * zcosh;
445
- a10 = zcosg * zsini;
446
- a2 = cosim * a7 + sinim * a8;
447
- a4 = cosim * a9 + sinim * a10;
448
- a5 = -sinim * a7 + cosim * a8;
449
- a6 = -sinim * a9 + cosim * a10;
450
- x1 = a1 * cosomm + a2 * sinomm;
451
- x2 = a3 * cosomm + a4 * sinomm;
452
- x3 = -a1 * sinomm + a2 * cosomm;
453
- x4 = -a3 * sinomm + a4 * cosomm;
454
- x5 = a5 * sinomm;
455
- x6 = a6 * sinomm;
456
- x7 = a5 * cosomm;
457
- x8 = a6 * cosomm;
392
+ var zcosg = zcosgs;
393
+ var zsing = zsings;
394
+ var zcosi = zcosis;
395
+ var zsini = zsinis;
396
+ var zcosh = cnodm;
397
+ var zsinh = snodm;
398
+ var cc = c1ss;
399
+ var xnoi = 1.0 / nm;
400
+ for (var lsflg = 1; lsflg <= 2; lsflg++) {
401
+ var a1 = zcosg * zcosh + zsing * zcosi * zsinh;
402
+ var a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
403
+ var a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
404
+ var a8 = zsing * zsini;
405
+ var a9 = zsing * zsinh + zcosg * zcosi * zcosh;
406
+ var a10 = zcosg * zsini;
407
+ var a2 = cosim * a7 + sinim * a8;
408
+ var a4 = cosim * a9 + sinim * a10;
409
+ var a5 = -sinim * a7 + cosim * a8;
410
+ var a6 = -sinim * a9 + cosim * a10;
411
+ var x1 = a1 * cosomm + a2 * sinomm;
412
+ var x2 = a3 * cosomm + a4 * sinomm;
413
+ var x3 = -a1 * sinomm + a2 * cosomm;
414
+ var x4 = -a3 * sinomm + a4 * cosomm;
415
+ var x5 = a5 * sinomm;
416
+ var x6 = a6 * sinomm;
417
+ var x7 = a5 * cosomm;
418
+ var x8 = a6 * cosomm;
458
419
  z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
459
420
  z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
460
421
  z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
@@ -462,13 +423,10 @@ var Sgp4 = /** @class */ (function () {
462
423
  z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
463
424
  z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
464
425
  z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
465
- z12 =
466
- -6.0 * (a1 * a6 + a3 * a5) +
467
- emsq * (-24.0 * (x2 * x7 + x1 * x8) + -6.0 * (x3 * x6 + x4 * x5));
426
+ z12 = -6.0 * (a1 * a6 + a3 * a5) + emsq * (-24.0 * (x2 * x7 + x1 * x8) + -6.0 * (x3 * x6 + x4 * x5));
468
427
  z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
469
428
  z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
470
- z22 =
471
- 6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
429
+ z22 = 6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
472
430
  z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
473
431
  z1 = z1 + z1 + betasq * z31;
474
432
  z2 = z2 + z2 + betasq * z32;
@@ -510,34 +468,34 @@ var Sgp4 = /** @class */ (function () {
510
468
  cc = c1l;
511
469
  }
512
470
  }
513
- zmol = (4.7199672 + (0.2299715 * day - gam)) % TAU;
514
- zmos = (6.2565837 + 0.017201977 * day) % TAU;
471
+ var zmol = (4.7199672 + (0.2299715 * day - gam)) % TAU;
472
+ var zmos = (6.2565837 + 0.017201977 * day) % TAU;
515
473
  // ------------------------ do solar terms ----------------------
516
- se2 = 2.0 * ss1 * ss6;
517
- se3 = 2.0 * ss1 * ss7;
518
- si2 = 2.0 * ss2 * sz12;
519
- si3 = 2.0 * ss2 * (sz13 - sz11);
520
- sl2 = -2.0 * ss3 * sz2;
521
- sl3 = -2.0 * ss3 * (sz3 - sz1);
522
- sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
523
- sgh2 = 2.0 * ss4 * sz32;
524
- sgh3 = 2.0 * ss4 * (sz33 - sz31);
525
- sgh4 = -18.0 * ss4 * zes;
526
- sh2 = -2.0 * ss2 * sz22;
527
- sh3 = -2.0 * ss2 * (sz23 - sz21);
474
+ var se2 = 2.0 * ss1 * ss6;
475
+ var se3 = 2.0 * ss1 * ss7;
476
+ var si2 = 2.0 * ss2 * sz12;
477
+ var si3 = 2.0 * ss2 * (sz13 - sz11);
478
+ var sl2 = -2.0 * ss3 * sz2;
479
+ var sl3 = -2.0 * ss3 * (sz3 - sz1);
480
+ var sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
481
+ var sgh2 = 2.0 * ss4 * sz32;
482
+ var sgh3 = 2.0 * ss4 * (sz33 - sz31);
483
+ var sgh4 = -18.0 * ss4 * zes;
484
+ var sh2 = -2.0 * ss2 * sz22;
485
+ var sh3 = -2.0 * ss2 * (sz23 - sz21);
528
486
  // ------------------------ do lunar terms ----------------------
529
- ee2 = 2.0 * s1 * s6;
530
- e3 = 2.0 * s1 * s7;
531
- xi2 = 2.0 * s2 * z12;
532
- xi3 = 2.0 * s2 * (z13 - z11);
533
- xl2 = -2.0 * s3 * z2;
534
- xl3 = -2.0 * s3 * (z3 - z1);
535
- xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
536
- xgh2 = 2.0 * s4 * z32;
537
- xgh3 = 2.0 * s4 * (z33 - z31);
538
- xgh4 = -18.0 * s4 * zel;
539
- xh2 = -2.0 * s2 * z22;
540
- xh3 = -2.0 * s2 * (z23 - z21);
487
+ var ee2 = 2.0 * s1 * s6;
488
+ var e3 = 2.0 * s1 * s7;
489
+ var xi2 = 2.0 * s2 * z12;
490
+ var xi3 = 2.0 * s2 * (z13 - z11);
491
+ var xl2 = -2.0 * s3 * z2;
492
+ var xl3 = -2.0 * s3 * (z3 - z1);
493
+ var xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
494
+ var xgh2 = 2.0 * s4 * z32;
495
+ var xgh3 = 2.0 * s4 * (z33 - z31);
496
+ var xgh4 = -18.0 * s4 * zel;
497
+ var xh2 = -2.0 * s2 * z22;
498
+ var xh3 = -2.0 * s2 * (z23 - z21);
541
499
  return {
542
500
  snodm: snodm,
543
501
  cnodm: cnodm,
@@ -708,19 +666,19 @@ var Sgp4 = /** @class */ (function () {
708
666
  xke = options.xke, cosim = options.cosim, argpo = options.argpo, s1 = options.s1, s2 = options.s2, s3 = options.s3, s4 = options.s4, s5 = options.s5, sinim = options.sinim, ss1 = options.ss1, ss2 = options.ss2, ss3 = options.ss3, ss4 = options.ss4, ss5 = options.ss5, sz1 = options.sz1, sz3 = options.sz3, sz11 = options.sz11, sz13 = options.sz13, sz21 = options.sz21, sz23 = options.sz23, sz31 = options.sz31, sz33 = options.sz33, t = options.t, tc = options.tc, gsto = options.gsto, mo = options.mo, mdot = options.mdot, no = options.no, nodeo = options.nodeo, nodedot = options.nodedot, xPIdot = options.xPIdot, z1 = options.z1, z3 = options.z3, z11 = options.z11, z13 = options.z13, z21 = options.z21, z23 = options.z23, z31 = options.z31, z33 = options.z33, ecco = options.ecco, eccsq = options.eccsq;
709
667
  var emsq = options.emsq, em = options.em, argpm = options.argpm, inclm = options.inclm, mm = options.mm, nm = options.nm, nodem = options.nodem, irez = options.irez, atime = options.atime, d2201 = options.d2201, d2211 = options.d2211, d3210 = options.d3210, d3222 = options.d3222, d4410 = options.d4410, d4422 = options.d4422, d5220 = options.d5220, d5232 = options.d5232, d5421 = options.d5421, d5433 = options.d5433, dedt = options.dedt, didt = options.didt, dmdt = options.dmdt, dnodt = options.dnodt, domdt = options.domdt, del1 = options.del1, del2 = options.del2, del3 = options.del3, xfact = options.xfact, xlamo = options.xlamo, xli = options.xli, xni = options.xni;
710
668
  /* --------------------- local variables ------------------------ */
711
- /** Ootk -- these are declared at the top instead */
712
- // q22 = 1.7891679e-6;
713
- // q31 = 2.1460748e-6;
714
- // q33 = 2.2123015e-7;
715
- // root22 = 1.7891679e-6;
716
- // root44 = 7.3636953e-9;
717
- // root54 = 2.1765803e-9;
718
- // rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
719
- // root32 = 3.7393792e-7;
720
- // root52 = 1.1428639e-7;
721
- // x2o3 = 2.0 / 3.0;
722
- // znl = 1.5835218e-4;
723
- // zns = 1.19459e-5;
669
+ /** Ootk -- Some variables imported from outside the class at the top */
670
+ var q22 = 1.7891679e-6;
671
+ var q31 = 2.1460748e-6;
672
+ var q33 = 2.2123015e-7;
673
+ var root22 = 1.7891679e-6;
674
+ var root44 = 7.3636953e-9;
675
+ var root54 = 2.1765803e-9;
676
+ var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
677
+ var root32 = 3.7393792e-7;
678
+ var root52 = 1.1428639e-7;
679
+ var x2o3 = 2.0 / 3.0;
680
+ var znl = 1.5835218e-4;
681
+ var zns = 1.19459e-5;
724
682
  // sgp4fix identify constants and allow alternate values
725
683
  // just xke is used here so pass it in rather than have multiple calls
726
684
  // getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
@@ -733,10 +691,10 @@ var Sgp4 = /** @class */ (function () {
733
691
  irez = 2;
734
692
  }
735
693
  // ------------------------ do solar terms -------------------
736
- ses = ss1 * zns * ss5;
737
- sis = ss2 * zns * (sz11 + sz13);
738
- sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
739
- sghs = ss4 * zns * (sz31 + sz33 - 6.0);
694
+ var ses = ss1 * zns * ss5;
695
+ var sis = ss2 * zns * (sz11 + sz13);
696
+ var sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
697
+ var sghs = ss4 * zns * (sz31 + sz33 - 6.0);
740
698
  var shs = -zns * ss2 * (sz21 + sz23);
741
699
  // sgp4fix for 180 deg incl
742
700
  if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
@@ -745,12 +703,12 @@ var Sgp4 = /** @class */ (function () {
745
703
  if (sinim !== 0.0) {
746
704
  shs /= sinim;
747
705
  }
748
- sgs = sghs - cosim * shs;
706
+ var sgs = sghs - cosim * shs;
749
707
  // ------------------------- do lunar terms ------------------
750
708
  dedt = ses + s1 * znl * s5;
751
709
  didt = sis + s2 * znl * (z11 + z13);
752
710
  dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
753
- sghl = s4 * znl * (z31 + z33 - 6.0);
711
+ var sghl = s4 * znl * (z31 + z33 - 6.0);
754
712
  var shll = -znl * s2 * (z21 + z23);
755
713
  // sgp4fix for 180 deg incl
756
714
  if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
@@ -763,8 +721,8 @@ var Sgp4 = /** @class */ (function () {
763
721
  dnodt += shll / sinim;
764
722
  }
765
723
  // ----------- calculate deep space resonance effects --------
766
- dndt = 0.0;
767
- theta = (gsto + tc * rptim) % TAU;
724
+ var dndt = 0.0;
725
+ var theta = (gsto + tc * rptim) % TAU;
768
726
  em += dedt * t;
769
727
  inclm += didt * t;
770
728
  argpm += domdt * t;
@@ -780,16 +738,17 @@ var Sgp4 = /** @class */ (function () {
780
738
  // }
781
739
  // -------------- initialize the resonance terms -------------
782
740
  if (irez !== 0) {
783
- aonv = Math.pow((nm / xke), x2o3);
741
+ var aonv = Math.pow((nm / xke), x2o3);
784
742
  // ---------- geopotential resonance for 12 hour orbits ------
785
743
  if (irez === 2) {
786
- cosisq = cosim * cosim;
787
- emo = em;
744
+ var cosisq = cosim * cosim;
745
+ var emo = em;
788
746
  em = ecco;
789
- emsqo = emsq;
747
+ var emsqo = emsq;
790
748
  emsq = eccsq;
791
- eoc = em * emsq;
792
- g201 = -0.306 - (em - 0.64) * 0.44;
749
+ var eoc = em * emsq;
750
+ var g201 = -0.306 - (em - 0.64) * 0.44;
751
+ var g211 = void 0, g310 = void 0, g322 = void 0, g410 = void 0, g422 = void 0, g520 = void 0, g533 = void 0, g521 = void 0, g532 = void 0;
793
752
  if (em <= 0.65) {
794
753
  g211 = 3.616 - 13.247 * em + 16.29 * emsq;
795
754
  g310 = -19.302 + 117.39 * em - 228.419 * emsq + 156.591 * eoc;
@@ -821,30 +780,21 @@ var Sgp4 = /** @class */ (function () {
821
780
  g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
822
781
  g532 = -40023.88 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
823
782
  }
824
- sini2 = sinim * sinim;
825
- f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
826
- f221 = 1.5 * sini2;
827
- f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
828
- f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
829
- f441 = 35.0 * sini2 * f220;
830
- f442 = 39.375 * sini2 * sini2;
831
- f522 =
832
- 9.84375 *
833
- sinim *
834
- (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) +
835
- 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
836
- f523 =
837
- sinim *
838
- (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) +
839
- 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
840
- f542 =
841
- 29.53125 * sinim * (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
842
- f543 =
843
- 29.53125 * sinim * (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
844
- xno2 = nm * nm;
845
- ainv2 = aonv * aonv;
846
- temp1 = 3.0 * xno2 * ainv2;
847
- temp = temp1 * root22;
783
+ var sini2 = sinim * sinim;
784
+ var f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
785
+ var f221 = 1.5 * sini2;
786
+ var f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
787
+ var f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
788
+ var f441 = 35.0 * sini2 * f220;
789
+ var f442 = 39.375 * sini2 * sini2;
790
+ var f522 = 9.84375 * sinim * (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) + 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
791
+ var f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) + 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
792
+ var f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
793
+ var f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
794
+ var xno2 = nm * nm;
795
+ var ainv2 = aonv * aonv;
796
+ var temp1 = 3.0 * xno2 * ainv2;
797
+ var temp = temp1 * root22;
848
798
  d2201 = temp * f220 * g201;
849
799
  d2211 = temp * f221 * g211;
850
800
  temp1 *= aonv;
@@ -869,12 +819,12 @@ var Sgp4 = /** @class */ (function () {
869
819
  }
870
820
  // ---------------- synchronous resonance terms --------------
871
821
  if (irez === 1) {
872
- g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
873
- g310 = 1.0 + 2.0 * emsq;
874
- g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
875
- f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
876
- f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
877
- f330 = 1.0 + cosim;
822
+ var g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
823
+ var g310 = 1.0 + 2.0 * emsq;
824
+ var g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
825
+ var f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
826
+ var f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
827
+ var f330 = 1.0 + cosim;
878
828
  f330 *= 1.875 * f330 * f330;
879
829
  del1 = 3.0 * nm * nm * aonv * aonv;
880
830
  del2 = 2.0 * del1 * f220 * g200 * q22;
@@ -995,25 +945,23 @@ var Sgp4 = /** @class */ (function () {
995
945
  * hoots, schumacher and glover 2004
996
946
  * vallado, crawford, hujsak, kelso 2006
997
947
  ----------------------------------------------------------------------------*/
998
- Sgp4.dspace = function (options) {
999
- var irez = options.irez, d2201 = options.d2201, d2211 = options.d2211, d3210 = options.d3210, d3222 = options.d3222, d4410 = options.d4410, d4422 = options.d4422, d5220 = options.d5220, d5232 = options.d5232, d5421 = options.d5421, d5433 = options.d5433, dedt = options.dedt, del1 = options.del1, del2 = options.del2, del3 = options.del3, didt = options.didt, dmdt = options.dmdt, dnodt = options.dnodt, domdt = options.domdt, argpo = options.argpo, argpdot = options.argpdot, t = options.t, tc = options.tc, gsto = options.gsto, xfact = options.xfact, xlamo = options.xlamo, no = options.no;
1000
- var atime = options.atime, em = options.em, argpm = options.argpm, inclm = options.inclm, xli = options.xli, mm = options.mm, xni = options.xni, nodem = options.nodem, nm = options.nm;
1001
- /** Ootk -- Declared at the top of the file instead */
1002
- // fasx2 = 0.13130908;
1003
- // fasx4 = 2.8843198;
1004
- // fasx6 = 0.37448087;
1005
- // g22 = 5.7686396;
1006
- // g32 = 0.95240898;
1007
- // g44 = 1.8014998;
1008
- // g52 = 1.050833;
1009
- // g54 = 4.4108898;
1010
- // rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
1011
- // stepp = 720.0;
1012
- // stepn = -720.0;
1013
- // step2 = 259200.0;
948
+ Sgp4.dspace = function (irez, d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433, dedt, del1, del2, del3, didt, dmdt, dnodt, domdt, argpo, argpdot, t, tc, gsto, xfact, xlamo, no, atime, em, argpm, inclm, xli, mm, xni, nodem, nm) {
949
+ /** Ootk -- Some variables imported from outside the class at the top */
950
+ var fasx2 = 0.13130908;
951
+ var fasx4 = 2.8843198;
952
+ var fasx6 = 0.37448087;
953
+ var g22 = 5.7686396;
954
+ var g32 = 0.95240898;
955
+ var g44 = 1.8014998;
956
+ var g52 = 1.050833;
957
+ var g54 = 4.4108898;
958
+ var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
959
+ var stepp = 720.0;
960
+ var stepn = -720.0;
961
+ var step2 = 259200.0;
1014
962
  // ----------- calculate deep space resonance effects -----------
1015
- dndt = 0.0;
1016
- theta = (gsto + tc * rptim) % TAU;
963
+ var dndt = 0.0;
964
+ var theta = (gsto + tc * rptim) % TAU;
1017
965
  em += dedt * t;
1018
966
  inclm += didt * t;
1019
967
  argpm += domdt * t;
@@ -1042,26 +990,22 @@ var Sgp4 = /** @class */ (function () {
1042
990
  xli = xlamo;
1043
991
  }
1044
992
  // sgp4fix move check outside loop
993
+ var delt = void 0;
1045
994
  if (t > 0.0) {
1046
995
  delt = stepp;
1047
996
  }
1048
997
  else {
1049
998
  delt = stepn;
1050
999
  }
1000
+ var xndt = void 0, xldot = void 0, xnddt = void 0, xomi = void 0, x2omi = void 0, x2li = void 0, ft = void 0;
1051
1001
  var iretn = 381; // added for do loop
1052
1002
  while (iretn === 381) {
1053
1003
  // ------------------- dot terms calculated -------------
1054
1004
  // ----------- near - synchronous resonance terms -------
1055
1005
  if (irez !== 2) {
1056
- xndt =
1057
- del1 * Math.sin(xli - fasx2) +
1058
- del2 * Math.sin(2.0 * (xli - fasx4)) +
1059
- del3 * Math.sin(3.0 * (xli - fasx6));
1006
+ xndt = del1 * Math.sin(xli - fasx2) + del2 * Math.sin(2.0 * (xli - fasx4)) + del3 * Math.sin(3.0 * (xli - fasx6));
1060
1007
  xldot = xni + xfact;
1061
- xnddt =
1062
- del1 * Math.cos(xli - fasx2) +
1063
- 2.0 * del2 * Math.cos(2.0 * (xli - fasx4)) +
1064
- 3.0 * del3 * Math.cos(3.0 * (xli - fasx6));
1008
+ xnddt = del1 * Math.cos(xli - fasx2) + 2.0 * del2 * Math.cos(2.0 * (xli - fasx4)) + 3.0 * del3 * Math.cos(3.0 * (xli - fasx6));
1065
1009
  xnddt *= xldot;
1066
1010
  }
1067
1011
  else {
@@ -1111,7 +1055,7 @@ var Sgp4 = /** @class */ (function () {
1111
1055
  }
1112
1056
  } // while iretn = 381
1113
1057
  nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
1114
- xl = xli + xldot * ft + xndt * ft * ft * 0.5;
1058
+ var xl = xli + xldot * ft + xndt * ft * ft * 0.5;
1115
1059
  if (irez !== 1) {
1116
1060
  mm = xl - 2.0 * nodem + 2.0 * theta;
1117
1061
  dndt = nm - no;
@@ -1122,18 +1066,7 @@ var Sgp4 = /** @class */ (function () {
1122
1066
  }
1123
1067
  nm = no + dndt;
1124
1068
  }
1125
- return {
1126
- atime: atime,
1127
- em: em,
1128
- argpm: argpm,
1129
- inclm: inclm,
1130
- xli: xli,
1131
- mm: mm,
1132
- xni: xni,
1133
- nodem: nodem,
1134
- dndt: dndt,
1135
- nm: nm,
1136
- };
1069
+ return [em, argpm, inclm, mm, nodem, nm];
1137
1070
  }; // dspace
1138
1071
  /*-----------------------------------------------------------------------------
1139
1072
  *
@@ -1195,50 +1128,51 @@ var Sgp4 = /** @class */ (function () {
1195
1128
  var opsmode = options.opsmode, ecco = options.ecco, epoch = options.epoch, inclo = options.inclo, xke = options.xke, j2 = options.j2;
1196
1129
  var no = options.no;
1197
1130
  /* --------------------- local variables ------------------------ */
1198
- /** Ootk -- Declared at the top of the file */
1131
+ var PI = Math.PI;
1132
+ var TAU = PI * 2;
1133
+ var x2o3 = 2.0 / 3.0;
1199
1134
  // sgp4fix use old way of finding gst
1200
- /** Ootk -- Declared at the top of the file */
1135
+ /** Ootk -- Some variables imported from outside the class at the top */
1201
1136
  // ----------------------- earth constants ---------------------
1202
1137
  // sgp4fix identify constants and allow alternate values
1203
1138
  // only xke and j2 are used here so pass them in directly
1204
1139
  // getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 )
1205
1140
  // ------------- calculate auxillary epoch quantities ----------
1206
- eccsq = ecco * ecco;
1207
- omeosq = 1.0 - eccsq;
1208
- rteosq = Math.sqrt(omeosq);
1209
- cosio = Math.cos(inclo);
1210
- cosio2 = cosio * cosio;
1141
+ var eccsq = ecco * ecco;
1142
+ var omeosq = 1.0 - eccsq;
1143
+ var rteosq = Math.sqrt(omeosq);
1144
+ var cosio = Math.cos(inclo);
1145
+ var cosio2 = cosio * cosio;
1211
1146
  // ------------------ un-kozai the mean motion -----------------
1212
- ak = Math.pow((xke / no), x2o3);
1213
- d1 = (0.75 * j2 * (3.0 * cosio2 - 1.0)) / (rteosq * omeosq);
1147
+ var ak = Math.pow((xke / no), x2o3);
1148
+ var d1 = (0.75 * j2 * (3.0 * cosio2 - 1.0)) / (rteosq * omeosq);
1214
1149
  var delPrime = d1 / (ak * ak);
1215
- adel =
1216
- ak *
1217
- (1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + (134.0 * delPrime * delPrime) / 81.0));
1150
+ var adel = ak * (1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + (134.0 * delPrime * delPrime) / 81.0));
1218
1151
  delPrime = d1 / (adel * adel);
1219
1152
  no = no / (1.0 + delPrime);
1220
- ao = Math.pow((xke / no), x2o3);
1221
- sinio = Math.sin(inclo);
1222
- po = ao * omeosq;
1223
- con42 = 1.0 - 5.0 * cosio2;
1224
- con41 = -con42 - cosio2 - cosio2;
1225
- ainv = 1.0 / ao;
1226
- posq = po * po;
1227
- rp = ao * (1.0 - ecco);
1228
- method = 'n';
1153
+ var ao = Math.pow((xke / no), x2o3);
1154
+ var sinio = Math.sin(inclo);
1155
+ var po = ao * omeosq;
1156
+ var con42 = 1.0 - 5.0 * cosio2;
1157
+ var con41 = -con42 - cosio2 - cosio2;
1158
+ var ainv = 1.0 / ao;
1159
+ var posq = po * po;
1160
+ var rp = ao * (1.0 - ecco);
1161
+ var method = 'n';
1229
1162
  // sgp4fix modern approach to finding sidereal time
1230
1163
  /** Ootk -- Continue allowing AFSPC mode for SGP4 Validation */
1164
+ var gsto;
1231
1165
  if (opsmode == 'a') {
1232
1166
  // sgp4fix use old way of finding gst
1233
1167
  // count integer number of days from 0 jan 1970
1234
- ts70 = epoch - 7305.0;
1235
- ds70 = Math.floor(ts70 + 1.0e-8);
1236
- tfrac = ts70 - ds70;
1168
+ var ts70 = epoch - 7305.0;
1169
+ var ds70 = Math.floor(ts70 + 1.0e-8);
1170
+ var tfrac = ts70 - ds70;
1237
1171
  // find greenwich location at epoch
1238
- c1 = 1.72027916940703639e-2;
1239
- thgr70 = 1.7321343856509374;
1240
- fk5r = 5.07551419432269442e-15;
1241
- c1p2p = c1 + TAU;
1172
+ var c1 = 1.72027916940703639e-2;
1173
+ var thgr70 = 1.7321343856509374;
1174
+ var fk5r = 5.07551419432269442e-15;
1175
+ var c1p2p = c1 + TAU;
1242
1176
  gsto = (thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r) % TAU;
1243
1177
  /* istanbul ignore next | This is no longer possible*/
1244
1178
  if (gsto < 0.0) {
@@ -1349,14 +1283,11 @@ var Sgp4 = /** @class */ (function () {
1349
1283
  ----------------------------------------------------------------------------*/
1350
1284
  Sgp4.sgp4init = function (satrec, options) {
1351
1285
  /* eslint-disable no-param-reassign */
1352
- var _a = options.whichconst, whichconst = _a === void 0 ? 'wgs72' : _a, _b = options.opsmode, opsmode = _b === void 0 ? i : _b, _c = options.satn, satn = _c === void 0 ? satrec.satnum : _c, epoch = options.epoch, xbstar = options.xbstar, xecco = options.xecco, xargpo = options.xargpo, xinclo = options.xinclo, xndot = options.xndot, xnddot = options.xnddot, xmo = options.xmo, xno = options.xno, xnodeo = options.xnodeo;
1353
- /* --------------------- local variables ------------------------ */
1354
- /** Ootk -- Declared at the top of the file */
1286
+ var _a = options.whichconst, whichconst = _a === void 0 ? 'wgs72' : _a, _b = options.opsmode, opsmode = _b === void 0 ? 'i' : _b, _c = options.satn, satn = _c === void 0 ? satrec.satnum : _c, epoch = options.epoch, xbstar = options.xbstar, xecco = options.xecco, xargpo = options.xargpo, xinclo = options.xinclo, xndot = options.xndot, xnddot = options.xnddot, xmo = options.xmo, xno = options.xno, xnodeo = options.xnodeo;
1355
1287
  /* ------------------------ initialization --------------------- */
1356
1288
  // sgp4fix divisor for divide by zero check on inclination
1357
1289
  // the old check used 1.0 + Math.cos(PI-1.0e-9), but then compared it to
1358
1290
  // 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
1359
- // temp4 = 1.5e-12;
1360
1291
  // ----------- set all near earth variables to zero ------------
1361
1292
  satrec.isimp = 0;
1362
1293
  satrec.method = 'n';
@@ -1454,6 +1385,10 @@ var Sgp4 = /** @class */ (function () {
1454
1385
  satrec.j3 = gravResults.j3;
1455
1386
  satrec.j4 = gravResults.j4;
1456
1387
  satrec.j3oj2 = gravResults.j3oj2;
1388
+ var j2 = gravResults.j2;
1389
+ var j4 = gravResults.j4;
1390
+ var xke = gravResults.xke;
1391
+ var j3oj2 = gravResults.j3oj2;
1457
1392
  //-------------------------------------------------------------------------
1458
1393
  satrec.error = 0;
1459
1394
  satrec.operationmode = opsmode;
@@ -1462,8 +1397,8 @@ var Sgp4 = /** @class */ (function () {
1462
1397
  * Ex. A2525 = 102525
1463
1398
  * Ex. Z1234 = 351234
1464
1399
  */
1465
- leadingChar = satn.split('')[0].toLowerCase(); // Using uppercase will break the -96 math.
1466
- if (isNaN(leadingChar)) {
1400
+ var leadingChar = satn.split('')[0].toLowerCase(); // Using uppercase will break the -96 math.
1401
+ if (isNaN(parseInt(leadingChar))) {
1467
1402
  satrec.satnum = parseInt(leadingChar.charCodeAt(0) - 96 + 9 + satrec.satnum.slice(1, 5)).toString();
1468
1403
  }
1469
1404
  else {
@@ -1489,14 +1424,14 @@ var Sgp4 = /** @class */ (function () {
1489
1424
  // ------------------------ earth constants -----------------------
1490
1425
  // sgp4fix identify constants and allow alternate values
1491
1426
  // getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
1492
- ss = 78.0 / satrec.radiusearthkm + 1.0;
1427
+ var ss = 78.0 / satrec.radiusearthkm + 1.0;
1493
1428
  // sgp4fix use multiply for speed instead of pow
1494
- qzms2ttemp = (120.0 - 78.0) / satrec.radiusearthkm;
1495
- qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
1429
+ var qzms2ttemp = (120.0 - 78.0) / satrec.radiusearthkm;
1430
+ var qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
1496
1431
  satrec.init = 'y';
1497
1432
  satrec.t = 0.0;
1498
1433
  // sgp4fix remove satn as it is not needed in initl
1499
- initlOptions = {
1434
+ var initlOptions = {
1500
1435
  ecco: satrec.ecco,
1501
1436
  epoch: epoch,
1502
1437
  inclo: satrec.inclo,
@@ -1506,7 +1441,7 @@ var Sgp4 = /** @class */ (function () {
1506
1441
  xke: satrec.xke,
1507
1442
  j2: satrec.j2,
1508
1443
  };
1509
- initlResult = Sgp4.initl(initlOptions);
1444
+ var initlResult = Sgp4.initl(initlOptions);
1510
1445
  var ao = initlResult.ao, con42 = initlResult.con42, cosio = initlResult.cosio, cosio2 = initlResult.cosio2, eccsq = initlResult.eccsq, omeosq = initlResult.omeosq, posq = initlResult.posq, rp = initlResult.rp, rteosq = initlResult.rteosq, sinio = initlResult.sinio;
1511
1446
  satrec.no = initlResult.no;
1512
1447
  satrec.con41 = initlResult.con41;
@@ -1528,9 +1463,9 @@ var Sgp4 = /** @class */ (function () {
1528
1463
  if (rp < 220.0 / satrec.radiusearthkm + 1.0) {
1529
1464
  satrec.isimp = 1;
1530
1465
  }
1531
- sfour = ss;
1532
- qzms24 = qzms2t;
1533
- perige = (rp - 1.0) * satrec.radiusearthkm;
1466
+ var sfour = ss;
1467
+ var qzms24 = qzms2t;
1468
+ var perige = (rp - 1.0) * satrec.radiusearthkm;
1534
1469
  // - for perigees below 156 km, s and qoms2t are altered -
1535
1470
  if (perige < 156.0) {
1536
1471
  sfour = perige - 78.0;
@@ -1538,25 +1473,21 @@ var Sgp4 = /** @class */ (function () {
1538
1473
  sfour = 20.0;
1539
1474
  }
1540
1475
  // sgp4fix use multiply for speed instead of pow
1541
- qzms24temp = (120.0 - sfour) / satrec.radiusearthkm;
1476
+ var qzms24temp = (120.0 - sfour) / satrec.radiusearthkm;
1542
1477
  qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
1543
1478
  sfour = sfour / satrec.radiusearthkm + 1.0;
1544
1479
  }
1545
- PInvsq = 1.0 / posq;
1546
- tsi = 1.0 / (ao - sfour);
1480
+ var PInvsq = 1.0 / posq;
1481
+ var tsi = 1.0 / (ao - sfour);
1547
1482
  satrec.eta = ao * satrec.ecco * tsi;
1548
- etasq = satrec.eta * satrec.eta;
1549
- eeta = satrec.ecco * satrec.eta;
1550
- psisq = Math.abs(1.0 - etasq);
1551
- coef = qzms24 * Math.pow(tsi, 4.0);
1552
- coef1 = coef / Math.pow(psisq, 3.5);
1553
- cc2 =
1554
- coef1 *
1555
- satrec.no *
1556
- (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) +
1557
- ((0.375 * j2 * tsi) / psisq) * satrec.con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
1483
+ var etasq = satrec.eta * satrec.eta;
1484
+ var eeta = satrec.ecco * satrec.eta;
1485
+ var psisq = Math.abs(1.0 - etasq);
1486
+ var coef = qzms24 * Math.pow(tsi, 4.0);
1487
+ var coef1 = coef / Math.pow(psisq, 3.5);
1488
+ var cc2 = coef1 * satrec.no * (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) + ((0.375 * j2 * tsi) / psisq) * satrec.con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
1558
1489
  satrec.cc1 = satrec.bstar * cc2;
1559
- cc3 = 0.0;
1490
+ var cc3 = 0.0;
1560
1491
  if (satrec.ecco > 1.0e-4) {
1561
1492
  cc3 = (-2.0 * coef * tsi * j3oj2 * satrec.no * sinio) / satrec.ecco;
1562
1493
  }
@@ -1570,28 +1501,17 @@ var Sgp4 = /** @class */ (function () {
1570
1501
  (satrec.eta * (2.0 + 0.5 * etasq) +
1571
1502
  satrec.ecco * (0.5 + 2.0 * etasq) -
1572
1503
  ((j2 * tsi) / (ao * psisq)) *
1573
- (-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) +
1574
- 0.75 *
1575
- satrec.x1mth2 *
1576
- (2.0 * etasq - eeta * (1.0 + etasq)) *
1577
- Math.cos(2.0 * satrec.argpo)));
1504
+ (-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) + 0.75 * satrec.x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) * Math.cos(2.0 * satrec.argpo)));
1578
1505
  satrec.cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
1579
- cosio4 = cosio2 * cosio2;
1580
- temp1 = 1.5 * j2 * PInvsq * satrec.no;
1581
- temp2 = 0.5 * temp1 * j2 * PInvsq;
1582
- temp3 = -0.46875 * j4 * PInvsq * PInvsq * satrec.no;
1583
- satrec.mdot =
1584
- satrec.no +
1585
- 0.5 * temp1 * rteosq * satrec.con41 +
1586
- 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
1587
- satrec.argpdot =
1588
- -0.5 * temp1 * con42 +
1589
- 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
1590
- temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
1591
- xhdot1 = -temp1 * cosio;
1592
- satrec.nodedot =
1593
- xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
1594
- xPIdot = satrec.argpdot + satrec.nodedot;
1506
+ var cosio4 = cosio2 * cosio2;
1507
+ var temp1 = 1.5 * j2 * PInvsq * satrec.no;
1508
+ var temp2 = 0.5 * temp1 * j2 * PInvsq;
1509
+ var temp3 = -0.46875 * j4 * PInvsq * PInvsq * satrec.no;
1510
+ satrec.mdot = satrec.no + 0.5 * temp1 * rteosq * satrec.con41 + 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
1511
+ satrec.argpdot = -0.5 * temp1 * con42 + 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) + temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
1512
+ var xhdot1 = -temp1 * cosio;
1513
+ satrec.nodedot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
1514
+ var xPIdot = satrec.argpdot + satrec.nodedot;
1595
1515
  satrec.omgcof = satrec.bstar * cc3 * Math.cos(satrec.argpo);
1596
1516
  satrec.xmcof = 0.0;
1597
1517
  if (satrec.ecco > 1.0e-4) {
@@ -1608,7 +1528,7 @@ var Sgp4 = /** @class */ (function () {
1608
1528
  }
1609
1529
  satrec.aycof = -0.5 * j3oj2 * sinio;
1610
1530
  // sgp4fix use multiply for speed instead of pow
1611
- delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
1531
+ var delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
1612
1532
  satrec.delmo = delmotemp * delmotemp * delmotemp;
1613
1533
  satrec.sinmao = Math.sin(satrec.mo);
1614
1534
  satrec.x7thm1 = 7.0 * cosio2 - 1.0;
@@ -1616,9 +1536,9 @@ var Sgp4 = /** @class */ (function () {
1616
1536
  if (TAU / satrec.no >= 225.0) {
1617
1537
  satrec.method = 'd';
1618
1538
  satrec.isimp = 1;
1619
- tc = 0.0;
1620
- inclm = satrec.inclo;
1621
- dscomOptions = {
1539
+ var tc = 0.0;
1540
+ var inclm = satrec.inclo;
1541
+ var dscomOptions = {
1622
1542
  epoch: epoch,
1623
1543
  ep: satrec.ecco,
1624
1544
  argpp: satrec.argpo,
@@ -1658,7 +1578,7 @@ var Sgp4 = /** @class */ (function () {
1658
1578
  zmol: satrec.zmol,
1659
1579
  zmos: satrec.zmos,
1660
1580
  };
1661
- dscomResult = Sgp4.dscom(dscomOptions);
1581
+ var dscomResult = Sgp4.dscom(dscomOptions);
1662
1582
  satrec.e3 = dscomResult.e3;
1663
1583
  satrec.ee2 = dscomResult.ee2;
1664
1584
  satrec.peo = dscomResult.peo;
@@ -1678,7 +1598,7 @@ var Sgp4 = /** @class */ (function () {
1678
1598
  satrec.sl2 = dscomResult.sl2;
1679
1599
  satrec.sl3 = dscomResult.sl3;
1680
1600
  satrec.sl4 = dscomResult.sl4;
1681
- var sinim_1 = dscomResult.sinim, cosim_1 = dscomResult.cosim, em_1 = dscomResult.em, emsq_1 = dscomResult.emsq, s1_1 = dscomResult.s1, s2_1 = dscomResult.s2, s3_1 = dscomResult.s3, s4_1 = dscomResult.s4, s5_1 = dscomResult.s5, ss1_1 = dscomResult.ss1, ss2_1 = dscomResult.ss2, ss3_1 = dscomResult.ss3, ss4_1 = dscomResult.ss4, ss5_1 = dscomResult.ss5, sz1_1 = dscomResult.sz1, sz3_1 = dscomResult.sz3, sz11_1 = dscomResult.sz11, sz13_1 = dscomResult.sz13, sz21_1 = dscomResult.sz21, sz23_1 = dscomResult.sz23, sz31_1 = dscomResult.sz31, sz33_1 = dscomResult.sz33;
1601
+ var sinim = dscomResult.sinim, cosim = dscomResult.cosim, em = dscomResult.em, emsq = dscomResult.emsq, s1 = dscomResult.s1, s2 = dscomResult.s2, s3 = dscomResult.s3, s4 = dscomResult.s4, s5 = dscomResult.s5, ss1 = dscomResult.ss1, ss2 = dscomResult.ss2, ss3 = dscomResult.ss3, ss4 = dscomResult.ss4, ss5 = dscomResult.ss5, sz1 = dscomResult.sz1, sz3 = dscomResult.sz3, sz11 = dscomResult.sz11, sz13 = dscomResult.sz13, sz21 = dscomResult.sz21, sz23 = dscomResult.sz23, sz31 = dscomResult.sz31, sz33 = dscomResult.sz33;
1682
1602
  satrec.xgh2 = dscomResult.xgh2;
1683
1603
  satrec.xgh3 = dscomResult.xgh3;
1684
1604
  satrec.xgh4 = dscomResult.xgh4;
@@ -1691,8 +1611,8 @@ var Sgp4 = /** @class */ (function () {
1691
1611
  satrec.xl4 = dscomResult.xl4;
1692
1612
  satrec.zmol = dscomResult.zmol;
1693
1613
  satrec.zmos = dscomResult.zmos;
1694
- (nm = dscomResult.nm, z1 = dscomResult.z1, z3 = dscomResult.z3, z11 = dscomResult.z11, z13 = dscomResult.z13, z21 = dscomResult.z21, z23 = dscomResult.z23, z31 = dscomResult.z31, z33 = dscomResult.z33);
1695
- dpperOptions = {
1614
+ var nm = dscomResult.nm, z1 = dscomResult.z1, z3 = dscomResult.z3, z11 = dscomResult.z11, z13 = dscomResult.z13, z21 = dscomResult.z21, z23 = dscomResult.z23, z31 = dscomResult.z31, z33 = dscomResult.z33;
1615
+ var dpperOptions = {
1696
1616
  inclo: inclm,
1697
1617
  init: satrec.init,
1698
1618
  ep: satrec.ecco,
@@ -1702,39 +1622,39 @@ var Sgp4 = /** @class */ (function () {
1702
1622
  mp: satrec.mo,
1703
1623
  opsmode: satrec.operationmode,
1704
1624
  };
1705
- dpperResult = Sgp4.dpper(satrec, dpperOptions);
1625
+ var dpperResult = Sgp4.dpper(satrec, dpperOptions);
1706
1626
  satrec.ecco = dpperResult.ep;
1707
1627
  satrec.inclo = dpperResult.inclp;
1708
1628
  satrec.nodeo = dpperResult.nodep;
1709
1629
  satrec.argpo = dpperResult.argpp;
1710
1630
  satrec.mo = dpperResult.mp;
1711
- argpm = 0.0;
1712
- nodem = 0.0;
1713
- mm = 0.0;
1714
- dsinitOptions = {
1631
+ var argpm = 0.0;
1632
+ var nodem = 0.0;
1633
+ var mm = 0.0;
1634
+ var dsinitOptions = {
1715
1635
  xke: xke,
1716
- cosim: cosim_1,
1717
- emsq: emsq_1,
1636
+ cosim: cosim,
1637
+ emsq: emsq,
1718
1638
  argpo: satrec.argpo,
1719
- s1: s1_1,
1720
- s2: s2_1,
1721
- s3: s3_1,
1722
- s4: s4_1,
1723
- s5: s5_1,
1724
- sinim: sinim_1,
1725
- ss1: ss1_1,
1726
- ss2: ss2_1,
1727
- ss3: ss3_1,
1728
- ss4: ss4_1,
1729
- ss5: ss5_1,
1730
- sz1: sz1_1,
1731
- sz3: sz3_1,
1732
- sz11: sz11_1,
1733
- sz13: sz13_1,
1734
- sz21: sz21_1,
1735
- sz23: sz23_1,
1736
- sz31: sz31_1,
1737
- sz33: sz33_1,
1639
+ s1: s1,
1640
+ s2: s2,
1641
+ s3: s3,
1642
+ s4: s4,
1643
+ s5: s5,
1644
+ sinim: sinim,
1645
+ ss1: ss1,
1646
+ ss2: ss2,
1647
+ ss3: ss3,
1648
+ ss4: ss4,
1649
+ ss5: ss5,
1650
+ sz1: sz1,
1651
+ sz3: sz3,
1652
+ sz11: sz11,
1653
+ sz13: sz13,
1654
+ sz21: sz21,
1655
+ sz23: sz23,
1656
+ sz31: sz31,
1657
+ sz33: sz33,
1738
1658
  t: satrec.t,
1739
1659
  tc: tc,
1740
1660
  gsto: satrec.gsto,
@@ -1754,7 +1674,7 @@ var Sgp4 = /** @class */ (function () {
1754
1674
  z33: z33,
1755
1675
  ecco: satrec.ecco,
1756
1676
  eccsq: eccsq,
1757
- em: em_1,
1677
+ em: em,
1758
1678
  argpm: argpm,
1759
1679
  inclm: inclm,
1760
1680
  mm: mm,
@@ -1785,7 +1705,7 @@ var Sgp4 = /** @class */ (function () {
1785
1705
  xli: satrec.xli,
1786
1706
  xni: satrec.xni,
1787
1707
  };
1788
- dsinitResult = Sgp4.dsinit(dsinitOptions);
1708
+ var dsinitResult = Sgp4.dsinit(dsinitOptions);
1789
1709
  satrec.irez = dsinitResult.irez;
1790
1710
  satrec.atime = dsinitResult.atime;
1791
1711
  satrec.d2201 = dsinitResult.d2201;
@@ -1813,19 +1733,14 @@ var Sgp4 = /** @class */ (function () {
1813
1733
  }
1814
1734
  // ----------- set variables if not deep space -----------
1815
1735
  if (satrec.isimp !== 1) {
1816
- cc1sq = satrec.cc1 * satrec.cc1;
1736
+ var cc1sq = satrec.cc1 * satrec.cc1;
1817
1737
  satrec.d2 = 4.0 * ao * tsi * cc1sq;
1818
- temp = (satrec.d2 * tsi * satrec.cc1) / 3.0;
1738
+ var temp = (satrec.d2 * tsi * satrec.cc1) / 3.0;
1819
1739
  satrec.d3 = (17.0 * ao + sfour) * temp;
1820
1740
  satrec.d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.cc1;
1821
1741
  satrec.t3cof = satrec.d2 + 2.0 * cc1sq;
1822
1742
  satrec.t4cof = 0.25 * (3.0 * satrec.d3 + satrec.cc1 * (12.0 * satrec.d2 + 10.0 * cc1sq));
1823
- satrec.t5cof =
1824
- 0.2 *
1825
- (3.0 * satrec.d4 +
1826
- 12.0 * satrec.cc1 * satrec.d3 +
1827
- 6.0 * satrec.d2 * satrec.d2 +
1828
- 15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
1743
+ satrec.t5cof = 0.2 * (3.0 * satrec.d4 + 12.0 * satrec.cc1 * satrec.d3 + 6.0 * satrec.d2 * satrec.d2 + 15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
1829
1744
  } // if omeosq = 0 ...
1830
1745
  /* finally propogate to zero epoch to initialize all others. */
1831
1746
  // sgp4fix take out check to let satellites process until they are actually below earth surface
@@ -1927,84 +1842,45 @@ var Sgp4 = /** @class */ (function () {
1927
1842
  // sgp4fix divisor for divide by zero check on inclination
1928
1843
  // the old check used 1.0 + cos(PI-1.0e-9), but then compared it to
1929
1844
  // 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
1930
- /** Ootk -- Declared at the top of the page */
1931
- // temp4 = 1.5e-12;
1932
1845
  // sgp4fix identify constants and allow alternate values
1933
1846
  // getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
1934
- vkmpersec = (satrec.radiusearthkm * satrec.xke) / 60.0;
1847
+ var xke = satrec.xke, j2 = satrec.j2, j3oj2 = satrec.j3oj2;
1848
+ var vkmpersec = (satrec.radiusearthkm * satrec.xke) / 60.0;
1935
1849
  // --------------------- clear sgp4 error flag -----------------
1936
1850
  satrec.t = tsince;
1937
1851
  satrec.error = 0;
1938
1852
  // ------- update for secular gravity and atmospheric drag -----
1939
- xmdf = satrec.mo + satrec.mdot * satrec.t;
1940
- argpdf = satrec.argpo + satrec.argpdot * satrec.t;
1941
- nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
1942
- argpm = argpdf;
1943
- mm = xmdf;
1944
- t2 = satrec.t * satrec.t;
1945
- nodem = nodedf + satrec.nodecf * t2;
1946
- tempa = 1.0 - satrec.cc1 * satrec.t;
1947
- tempe = satrec.bstar * satrec.cc4 * satrec.t;
1948
- templ = satrec.t2cof * t2;
1853
+ var xmdf = satrec.mo + satrec.mdot * satrec.t;
1854
+ var argpdf = satrec.argpo + satrec.argpdot * satrec.t;
1855
+ var nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
1856
+ var argpm = argpdf;
1857
+ var mm = xmdf;
1858
+ var t2 = satrec.t * satrec.t;
1859
+ var nodem = nodedf + satrec.nodecf * t2;
1860
+ var tempa = 1.0 - satrec.cc1 * satrec.t;
1861
+ var tempe = satrec.bstar * satrec.cc4 * satrec.t;
1862
+ var templ = satrec.t2cof * t2;
1949
1863
  if (satrec.isimp !== 1) {
1950
- delomg = satrec.omgcof * satrec.t;
1864
+ var delomg = satrec.omgcof * satrec.t;
1951
1865
  // sgp4fix use mutliply for speed instead of pow
1952
- delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
1953
- delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
1954
- temp = delomg + delm;
1955
- mm = xmdf + temp;
1956
- argpm = argpdf - temp;
1957
- t3 = t2 * satrec.t;
1958
- t4 = t3 * satrec.t;
1866
+ var delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
1867
+ var delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
1868
+ var temp_1 = delomg + delm;
1869
+ mm = xmdf + temp_1;
1870
+ argpm = argpdf - temp_1;
1871
+ var t3 = t2 * satrec.t;
1872
+ var t4 = t3 * satrec.t;
1959
1873
  tempa = tempa - satrec.d2 * t2 - satrec.d3 * t3 - satrec.d4 * t4;
1960
1874
  tempe += satrec.bstar * satrec.cc5 * (Math.sin(mm) - satrec.sinmao);
1961
1875
  templ = templ + satrec.t3cof * t3 + t4 * (satrec.t4cof + satrec.t * satrec.t5cof);
1962
1876
  }
1963
- nm = satrec.no;
1964
- em = satrec.ecco;
1965
- inclm = satrec.inclo;
1877
+ var nm = satrec.no;
1878
+ var em = satrec.ecco;
1879
+ var inclm = satrec.inclo;
1966
1880
  if (satrec.method === 'd') {
1967
- tc = satrec.t;
1968
- dspaceOptions = {
1969
- irez: satrec.irez,
1970
- d2201: satrec.d2201,
1971
- d2211: satrec.d2211,
1972
- d3210: satrec.d3210,
1973
- d3222: satrec.d3222,
1974
- d4410: satrec.d4410,
1975
- d4422: satrec.d4422,
1976
- d5220: satrec.d5220,
1977
- d5232: satrec.d5232,
1978
- d5421: satrec.d5421,
1979
- d5433: satrec.d5433,
1980
- dedt: satrec.dedt,
1981
- del1: satrec.del1,
1982
- del2: satrec.del2,
1983
- del3: satrec.del3,
1984
- didt: satrec.didt,
1985
- dmdt: satrec.dmdt,
1986
- dnodt: satrec.dnodt,
1987
- domdt: satrec.domdt,
1988
- argpo: satrec.argpo,
1989
- argpdot: satrec.argpdot,
1990
- t: satrec.t,
1991
- tc: tc,
1992
- gsto: satrec.gsto,
1993
- xfact: satrec.xfact,
1994
- xlamo: satrec.xlamo,
1995
- no: satrec.no,
1996
- atime: satrec.atime,
1997
- em: em,
1998
- argpm: argpm,
1999
- inclm: inclm,
2000
- xli: satrec.xli,
2001
- mm: mm,
2002
- xni: satrec.xni,
2003
- nodem: nodem,
2004
- nm: nm,
2005
- };
2006
- dspaceResult = Sgp4.dspace(dspaceOptions);
2007
- (em = dspaceResult.em, argpm = dspaceResult.argpm, inclm = dspaceResult.inclm, mm = dspaceResult.mm, nodem = dspaceResult.nodem, nm = dspaceResult.nm);
1881
+ var tc = satrec.t;
1882
+ var dspaceResult = Sgp4.dspace(satrec.irez, satrec.d2201, satrec.d2211, satrec.d3210, satrec.d3222, satrec.d4410, satrec.d4422, satrec.d5220, satrec.d5232, satrec.d5421, satrec.d5433, satrec.dedt, satrec.del1, satrec.del2, satrec.del3, satrec.didt, satrec.dmdt, satrec.dnodt, satrec.domdt, satrec.argpo, satrec.argpdot, satrec.t, tc, satrec.gsto, satrec.xfact, satrec.xlamo, satrec.no, satrec.atime, em, argpm, inclm, satrec.xli, mm, satrec.xni, nodem, nm);
1883
+ em = dspaceResult[0], argpm = dspaceResult[1], inclm = dspaceResult[2], mm = dspaceResult[3], nodem = dspaceResult[4], nm = dspaceResult[5];
2008
1884
  } // if methjod = d
2009
1885
  if (nm <= 0.0) {
2010
1886
  // printf("// error nm %f\n", nm);
@@ -2012,7 +1888,7 @@ var Sgp4 = /** @class */ (function () {
2012
1888
  // sgp4fix add return
2013
1889
  return { position: false, velocity: false };
2014
1890
  }
2015
- am = Math.pow((xke / nm), x2o3) * tempa * tempa;
1891
+ var am = Math.pow((xke / nm), x2o3) * tempa * tempa;
2016
1892
  nm = xke / Math.pow(am, 1.5);
2017
1893
  em -= tempe;
2018
1894
  // fix tolerance for error recognition
@@ -2030,32 +1906,33 @@ var Sgp4 = /** @class */ (function () {
2030
1906
  em = 1.0e-6;
2031
1907
  }
2032
1908
  mm += satrec.no * templ;
2033
- xlm = mm + argpm + nodem;
1909
+ var xlm = mm + argpm + nodem;
2034
1910
  nodem %= TAU;
2035
1911
  argpm %= TAU;
2036
1912
  xlm %= TAU;
2037
1913
  mm = (xlm - argpm - nodem) % TAU;
2038
1914
  // sgp4fix recover singly averaged mean elements
2039
- satrec.am = am;
2040
- satrec.em = em;
2041
- satrec.im = inclm;
2042
- satrec.Om = nodem;
2043
- satrec.om = argpm;
2044
- satrec.mm = mm;
2045
- satrec.nm = nm;
1915
+ // TODO: Skip these?
1916
+ // satrec.am = am;
1917
+ // satrec.em = em;
1918
+ // satrec.im = inclm;
1919
+ // satrec.Om = nodem;
1920
+ // satrec.om = argpm;
1921
+ // satrec.mm = mm;
1922
+ // satrec.nm = nm;
2046
1923
  // ----------------- compute extra mean quantities -------------
2047
- sinim = Math.sin(inclm);
2048
- cosim = Math.cos(inclm);
1924
+ var sinim = Math.sin(inclm);
1925
+ var cosim = Math.cos(inclm);
2049
1926
  // -------------------- add lunar-solar periodics --------------
2050
- ep = em;
2051
- xincp = inclm;
2052
- argpp = argpm;
2053
- nodep = nodem;
2054
- mp = mm;
2055
- sinip = sinim;
2056
- cosip = cosim;
1927
+ var ep = em;
1928
+ var xincp = inclm;
1929
+ var argpp = argpm;
1930
+ var nodep = nodem;
1931
+ var mp = mm;
1932
+ var sinip = sinim;
1933
+ var cosip = cosim;
2057
1934
  if (satrec.method === 'd') {
2058
- dpperParameters = {
1935
+ var dpperParameters = {
2059
1936
  inclo: satrec.inclo,
2060
1937
  init: 'n',
2061
1938
  ep: ep,
@@ -2065,7 +1942,7 @@ var Sgp4 = /** @class */ (function () {
2065
1942
  mp: mp,
2066
1943
  opsmode: satrec.operationmode,
2067
1944
  };
2068
- dpperResult = Sgp4.dpper(satrec, dpperParameters);
1945
+ var dpperResult = Sgp4.dpper(satrec, dpperParameters);
2069
1946
  (ep = dpperResult.ep, nodep = dpperResult.nodep, argpp = dpperResult.argpp, mp = dpperResult.mp);
2070
1947
  xincp = dpperResult.inclp;
2071
1948
  if (xincp < 0.0) {
@@ -2094,17 +1971,18 @@ var Sgp4 = /** @class */ (function () {
2094
1971
  satrec.xlcof = (-0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip)) / temp4;
2095
1972
  }
2096
1973
  }
2097
- axnl = ep * Math.cos(argpp);
2098
- temp = 1.0 / (am * (1.0 - ep * ep));
2099
- aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
2100
- xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
1974
+ var axnl = ep * Math.cos(argpp);
1975
+ var temp = 1.0 / (am * (1.0 - ep * ep));
1976
+ var aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
1977
+ var xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
2101
1978
  // --------------------- solve kepler's equation ---------------
2102
- u = (xl - nodep) % TAU;
2103
- eo1 = u;
2104
- tem5 = 9999.9;
2105
- ktr = 1;
1979
+ var u = (xl - nodep) % TAU;
1980
+ var eo1 = u;
1981
+ var tem5 = 9999.9;
1982
+ var ktr = 1;
2106
1983
  // sgp4fix for kepler iteration
2107
1984
  // the following iteration needs better limits on corrections
1985
+ var sineo1, coseo1;
2108
1986
  while (Math.abs(tem5) >= 1.0e-12 && ktr <= 10) {
2109
1987
  sineo1 = Math.sin(eo1);
2110
1988
  coseo1 = Math.cos(eo1);
@@ -2122,37 +2000,37 @@ var Sgp4 = /** @class */ (function () {
2122
2000
  ktr += 1;
2123
2001
  }
2124
2002
  // ------------- short period preliminary quantities -----------
2125
- ecose = axnl * coseo1 + aynl * sineo1;
2126
- esine = axnl * sineo1 - aynl * coseo1;
2127
- el2 = axnl * axnl + aynl * aynl;
2128
- pl = am * (1.0 - el2);
2003
+ var ecose = axnl * coseo1 + aynl * sineo1;
2004
+ var esine = axnl * sineo1 - aynl * coseo1;
2005
+ var el2 = axnl * axnl + aynl * aynl;
2006
+ var pl = am * (1.0 - el2);
2129
2007
  if (pl < 0.0) {
2130
2008
  // printf("// error pl %f\n", pl);
2131
2009
  satrec.error = 4;
2132
2010
  // sgp4fix add return
2133
2011
  return { position: false, velocity: false };
2134
2012
  }
2135
- rl = am * (1.0 - ecose);
2136
- rdotl = (Math.sqrt(am) * esine) / rl;
2137
- rvdotl = Math.sqrt(pl) / rl;
2138
- betal = Math.sqrt(1.0 - el2);
2013
+ var rl = am * (1.0 - ecose);
2014
+ var rdotl = (Math.sqrt(am) * esine) / rl;
2015
+ var rvdotl = Math.sqrt(pl) / rl;
2016
+ var betal = Math.sqrt(1.0 - el2);
2139
2017
  temp = esine / (1.0 + betal);
2140
- sinu = (am / rl) * (sineo1 - aynl - axnl * temp);
2141
- cosu = (am / rl) * (coseo1 - axnl + aynl * temp);
2142
- su = Math.atan2(sinu, cosu);
2143
- sin2u = (cosu + cosu) * sinu;
2144
- cos2u = 1.0 - 2.0 * sinu * sinu;
2018
+ var sinu = (am / rl) * (sineo1 - aynl - axnl * temp);
2019
+ var cosu = (am / rl) * (coseo1 - axnl + aynl * temp);
2020
+ var su = Math.atan2(sinu, cosu);
2021
+ var sin2u = (cosu + cosu) * sinu;
2022
+ var cos2u = 1.0 - 2.0 * sinu * sinu;
2145
2023
  temp = 1.0 / pl;
2146
- temp1 = 0.5 * j2 * temp;
2147
- temp2 = temp1 * temp;
2024
+ var temp1 = 0.5 * j2 * temp;
2025
+ var temp2 = temp1 * temp;
2148
2026
  // -------------- update for short period periodics ------------
2149
2027
  if (satrec.method === 'd') {
2150
- cosisq = cosip * cosip;
2028
+ var cosisq = cosip * cosip;
2151
2029
  satrec.con41 = 3.0 * cosisq - 1.0;
2152
2030
  satrec.x1mth2 = 1.0 - cosisq;
2153
2031
  satrec.x7thm1 = 7.0 * cosisq - 1.0;
2154
2032
  }
2155
- mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
2033
+ var mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
2156
2034
  /** Moved this up to reduce unnecessary computation if you are going to return false anyway */
2157
2035
  // sgp4fix for decaying satellites
2158
2036
  if (mrt < 1.0) {
@@ -2164,32 +2042,32 @@ var Sgp4 = /** @class */ (function () {
2164
2042
  };
2165
2043
  }
2166
2044
  su -= 0.25 * temp2 * satrec.x7thm1 * sin2u;
2167
- xnode = nodep + 1.5 * temp2 * cosip * sin2u;
2168
- xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
2169
- mvt = rdotl - (nm * temp1 * satrec.x1mth2 * sin2u) / xke;
2170
- rvdot = rvdotl + (nm * temp1 * (satrec.x1mth2 * cos2u + 1.5 * satrec.con41)) / xke;
2045
+ var xnode = nodep + 1.5 * temp2 * cosip * sin2u;
2046
+ var xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
2047
+ var mvt = rdotl - (nm * temp1 * satrec.x1mth2 * sin2u) / xke;
2048
+ var rvdot = rvdotl + (nm * temp1 * (satrec.x1mth2 * cos2u + 1.5 * satrec.con41)) / xke;
2171
2049
  // --------------------- orientation vectors -------------------
2172
- sinsu = Math.sin(su);
2173
- cossu = Math.cos(su);
2174
- snod = Math.sin(xnode);
2175
- cnod = Math.cos(xnode);
2176
- sini = Math.sin(xinc);
2177
- cosi = Math.cos(xinc);
2178
- xmx = -snod * cosi;
2179
- xmy = cnod * cosi;
2180
- ux = xmx * sinsu + cnod * cossu;
2181
- uy = xmy * sinsu + snod * cossu;
2182
- uz = sini * sinsu;
2183
- vx = xmx * cossu - cnod * sinsu;
2184
- vy = xmy * cossu - snod * sinsu;
2185
- vz = sini * cossu;
2050
+ var sinsu = Math.sin(su);
2051
+ var cossu = Math.cos(su);
2052
+ var snod = Math.sin(xnode);
2053
+ var cnod = Math.cos(xnode);
2054
+ var sini = Math.sin(xinc);
2055
+ var cosi = Math.cos(xinc);
2056
+ var xmx = -snod * cosi;
2057
+ var xmy = cnod * cosi;
2058
+ var ux = xmx * sinsu + cnod * cossu;
2059
+ var uy = xmy * sinsu + snod * cossu;
2060
+ var uz = sini * sinsu;
2061
+ var vx = xmx * cossu - cnod * sinsu;
2062
+ var vy = xmy * cossu - snod * sinsu;
2063
+ var vz = sini * cossu;
2186
2064
  // --------- position and velocity (in km and km/sec) ----------
2187
- r = {
2065
+ var r = {
2188
2066
  x: mrt * ux * satrec.radiusearthkm,
2189
2067
  y: mrt * uy * satrec.radiusearthkm,
2190
2068
  z: mrt * uz * satrec.radiusearthkm,
2191
2069
  };
2192
- v = {
2070
+ var v = {
2193
2071
  x: (mvt * ux + rvdot * vx) * vkmpersec,
2194
2072
  y: (mvt * uy + rvdot * vy) * vkmpersec,
2195
2073
  z: (mvt * uz + rvdot * vz) * vkmpersec,
@@ -2229,6 +2107,7 @@ var Sgp4 = /** @class */ (function () {
2229
2107
  * vallado, crawford, hujsak, kelso 2006
2230
2108
  --------------------------------------------------------------------------- */
2231
2109
  Sgp4.getgravconst = function (whichconst) {
2110
+ var tumin, mus, radiusearthkm, xke, j2, j3, j4, j3oj2;
2232
2111
  switch (whichconst) {
2233
2112
  // -- wgs-72 low precision str#3 constants --
2234
2113
  case 'wgs72old':
@@ -2264,7 +2143,7 @@ var Sgp4 = /** @class */ (function () {
2264
2143
  j3oj2 = j3 / j2;
2265
2144
  break;
2266
2145
  default:
2267
- throw new Error("unknown gravity option " + whichconst);
2146
+ throw new Error("unknown gravity option ".concat(whichconst));
2268
2147
  }
2269
2148
  return {
2270
2149
  tumin: tumin,
@@ -2319,22 +2198,140 @@ var Sgp4 = /** @class */ (function () {
2319
2198
  Sgp4.createSatrec = function (tleLine1, tleLine2, whichconst, opsmode) {
2320
2199
  if (whichconst === void 0) { whichconst = 'wgs72'; }
2321
2200
  if (opsmode === void 0) { opsmode = 'i'; }
2322
- // xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
2323
- year = 0;
2324
- satrec = {};
2201
+ var year = 0;
2202
+ var satrec = {
2203
+ a: null,
2204
+ am: null,
2205
+ alta: null,
2206
+ altp: null,
2207
+ argpdot: null,
2208
+ argpo: null,
2209
+ aycof: null,
2210
+ bstar: null,
2211
+ cc1: null,
2212
+ cc4: null,
2213
+ cc5: null,
2214
+ con41: null,
2215
+ d2: null,
2216
+ d3: null,
2217
+ d4: null,
2218
+ d5232: null,
2219
+ d5421: null,
2220
+ d5433: null,
2221
+ dedt: null,
2222
+ delmo: null,
2223
+ del1: null,
2224
+ ecco: null,
2225
+ em: null,
2226
+ epochdays: null,
2227
+ epochyr: null,
2228
+ error: null,
2229
+ eta: null,
2230
+ gsto: null,
2231
+ im: null,
2232
+ inclo: null,
2233
+ init: null,
2234
+ isimp: null,
2235
+ jdsatepoch: null,
2236
+ mdot: null,
2237
+ method: null,
2238
+ mo: null,
2239
+ mm: null,
2240
+ nddot: null,
2241
+ ndot: null,
2242
+ no: null,
2243
+ nodecf: null,
2244
+ nodedot: null,
2245
+ nodeo: null,
2246
+ om: null,
2247
+ Om: null,
2248
+ omgcof: null,
2249
+ operationmode: null,
2250
+ satnum: null,
2251
+ sinmao: null,
2252
+ t: null,
2253
+ t2cof: null,
2254
+ t3cof: null,
2255
+ t4cof: null,
2256
+ t5cof: null,
2257
+ x1mth2: null,
2258
+ x7thm1: null,
2259
+ xlcof: null,
2260
+ xmcof: null,
2261
+ xfact: null,
2262
+ xlamo: null,
2263
+ xli: null,
2264
+ xgh4: null,
2265
+ xgh3: null,
2266
+ xh2: null,
2267
+ xi2: null,
2268
+ xi3: null,
2269
+ xl2: null,
2270
+ xl3: null,
2271
+ xl4: null,
2272
+ zmol: null,
2273
+ zmos: null,
2274
+ dmdt: null,
2275
+ dnodt: null,
2276
+ domdt: null,
2277
+ e3: null,
2278
+ ee2: null,
2279
+ peo: null,
2280
+ pgho: null,
2281
+ pho: null,
2282
+ PInco: null,
2283
+ plo: null,
2284
+ se2: null,
2285
+ se3: null,
2286
+ sgh2: null,
2287
+ sgh3: null,
2288
+ sgh4: null,
2289
+ sh2: null,
2290
+ sh3: null,
2291
+ si2: null,
2292
+ si3: null,
2293
+ sl2: null,
2294
+ sl3: null,
2295
+ sl4: null,
2296
+ xgh2: null,
2297
+ xh3: null,
2298
+ tumin: null,
2299
+ radiusearthkm: null,
2300
+ irez: null,
2301
+ d3210: null,
2302
+ d3222: null,
2303
+ d4410: null,
2304
+ d4422: null,
2305
+ d5220: null,
2306
+ del2: null,
2307
+ del3: null,
2308
+ didt: null,
2309
+ atime: null,
2310
+ j2: null,
2311
+ j3: null,
2312
+ j4: null,
2313
+ mus: null,
2314
+ xke: null,
2315
+ j3oj2: null,
2316
+ xni: null,
2317
+ d2201: null,
2318
+ d2211: null,
2319
+ nm: null,
2320
+ };
2325
2321
  // sgp4fix no longer needed
2326
2322
  // getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
2323
+ var xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
2327
2324
  satrec.error = 0;
2328
2325
  satrec.satnum = tleLine1.substring(2, 7);
2329
2326
  satrec.epochyr = parseInt(tleLine1.substring(18, 20));
2330
2327
  satrec.epochdays = parseFloat(tleLine1.substring(20, 32));
2331
2328
  satrec.ndot = parseFloat(tleLine1.substring(33, 43));
2332
- satrec.nddot = parseFloat(tleLine1.substring(44, 45) + "." + tleLine1.substring(45, 50) + "E" + tleLine1.substring(50, 52));
2333
- satrec.bstar = parseFloat(tleLine1.substring(53, 54) + "." + tleLine1.substring(54, 59) + "E" + tleLine1.substring(59, 61));
2329
+ satrec.nddot = parseFloat("".concat(tleLine1.substring(44, 45), ".").concat(tleLine1.substring(45, 50), "E").concat(tleLine1.substring(50, 52)));
2330
+ satrec.bstar = parseFloat("".concat(tleLine1.substring(53, 54), ".").concat(tleLine1.substring(54, 59), "E").concat(tleLine1.substring(59, 61)));
2334
2331
  // satrec.satnum = tleLine2.substring(2, 7);
2335
2332
  satrec.inclo = parseFloat(tleLine2.substring(8, 16));
2336
2333
  satrec.nodeo = parseFloat(tleLine2.substring(17, 25));
2337
- satrec.ecco = parseFloat("." + tleLine2.substring(26, 33));
2334
+ satrec.ecco = parseFloat(".".concat(tleLine2.substring(26, 33)));
2338
2335
  satrec.argpo = parseFloat(tleLine2.substring(34, 42));
2339
2336
  satrec.mo = parseFloat(tleLine2.substring(43, 51));
2340
2337
  satrec.no = parseFloat(tleLine2.substring(52, 63));
@@ -2416,11 +2413,8 @@ var Sgp4 = /** @class */ (function () {
2416
2413
  * vallado 2004, 191, eq 3-45
2417
2414
  * --------------------------------------------------------------------------- */
2418
2415
  Sgp4.gstime = function (jdut1) {
2419
- tut1 = (jdut1 - 2451545.0) / 36525.0;
2420
- var temp = -6.2e-6 * tut1 * tut1 * tut1 +
2421
- 0.093104 * tut1 * tut1 +
2422
- (876600.0 * 3600 + 8640184.812866) * tut1 +
2423
- 67310.54841; // sec
2416
+ var tut1 = (jdut1 - 2451545.0) / 36525.0;
2417
+ var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; // sec
2424
2418
  temp = ((temp * DEG2RAD) / 240.0) % TAU; // 360/86400 = 1/240, to deg, to rad
2425
2419
  // ------------------------ check quadrants ---------------------
2426
2420
  if (temp < 0.0) {
@@ -2540,7 +2534,7 @@ var Sgp4 = /** @class */ (function () {
2540
2534
  var magv1 = Sgp4.mag(vec1);
2541
2535
  var magv2 = Sgp4.mag(vec2);
2542
2536
  if (magv1 * magv2 > small * small) {
2543
- temp = Sgp4.dot(vec1, vec2) / (magv1 * magv2);
2537
+ var temp = Sgp4.dot(vec1, vec2) / (magv1 * magv2);
2544
2538
  if (Math.abs(temp) > 1.0)
2545
2539
  temp = Sgp4.sgn(temp) * 1.0;
2546
2540
  return Math.acos(temp);
@@ -2747,7 +2741,7 @@ var Sgp4 = /** @class */ (function () {
2747
2741
  nbar[1] = hbar[0];
2748
2742
  nbar[2] = 0.0;
2749
2743
  magn = Sgp4.mag(nbar);
2750
- c1 = magv * magv - mus / magr;
2744
+ var c1 = magv * magv - mus / magr;
2751
2745
  rdotv = Sgp4.dot(r, v);
2752
2746
  for (i = 0; i <= 2; i++)
2753
2747
  ebar[i] = (c1 * r[i] - rdotv * v[i]) / mus;
@@ -2783,7 +2777,7 @@ var Sgp4 = /** @class */ (function () {
2783
2777
  }
2784
2778
  // ---------- find right ascension of the ascending node ------------
2785
2779
  if (magn > small) {
2786
- temp = nbar[0] / magn;
2780
+ var temp = nbar[0] / magn;
2787
2781
  if (Math.abs(temp) > 1.0)
2788
2782
  temp = Sgp4.sgn(temp);
2789
2783
  omega = Math.acos(temp);
@@ -2818,7 +2812,7 @@ var Sgp4 = /** @class */ (function () {
2818
2812
  else
2819
2813
  arglat = unknown;
2820
2814
  if (ecc > small && typeorbit == 4) {
2821
- temp = ebar[0] / ecc;
2815
+ var temp = ebar[0] / ecc;
2822
2816
  if (Math.abs(temp) > 1.0)
2823
2817
  temp = Sgp4.sgn(temp);
2824
2818
  lonper = Math.acos(temp);
@@ -2831,7 +2825,7 @@ var Sgp4 = /** @class */ (function () {
2831
2825
  lonper = unknown;
2832
2826
  // -------- find true longitude - circular equatorial ------
2833
2827
  if (magr > small && typeorbit == 2) {
2834
- temp = r[0] / magr;
2828
+ var temp = r[0] / magr;
2835
2829
  if (Math.abs(temp) > 1.0)
2836
2830
  temp = Sgp4.sgn(temp);
2837
2831
  truelon = Math.acos(temp);
@@ -2908,11 +2902,7 @@ var Sgp4 = /** @class */ (function () {
2908
2902
  *
2909
2903
  * --------------------------------------------------------------------------- */
2910
2904
  Sgp4.jday = function (year, mon, day, hr, minute, sec) {
2911
- var jd = 367.0 * year -
2912
- Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) +
2913
- Math.floor((275 * mon) / 9.0) +
2914
- day +
2915
- 1721013.5; // use - 678987.0 to go to mjd directly
2905
+ var jd = 367.0 * year - Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) + Math.floor((275 * mon) / 9.0) + day + 1721013.5; // use - 678987.0 to go to mjd directly
2916
2906
  var jdFrac = (sec + minute * 60.0 + hr * 3600.0) / 86400.0;
2917
2907
  // check that the day and fractional day are correct
2918
2908
  if (Math.abs(jdFrac) > 1.0) {
@@ -2960,26 +2950,26 @@ var Sgp4 = /** @class */ (function () {
2960
2950
  * none.
2961
2951
  * --------------------------------------------------------------------------- */
2962
2952
  Sgp4.days2mdhms = function (year, days) {
2963
- lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2964
- dayofyr = Math.floor(days);
2953
+ var lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2954
+ var dayofyr = Math.floor(days);
2965
2955
  // ----------------- find month and day of month ----------------
2966
2956
  /** Ootk -- Incorporated in the above declaration */
2967
2957
  // if ((year % 4) == 0)
2968
2958
  // lmonth[2] = 29;
2969
- i = 1;
2970
- inttemp = 0;
2959
+ var i = 1;
2960
+ var inttemp = 0;
2971
2961
  while (dayofyr > inttemp + lmonth[i - 1] && i < 12) {
2972
2962
  inttemp += lmonth[i - 1];
2973
2963
  i += 1;
2974
2964
  }
2975
- mon = i;
2976
- day = dayofyr - inttemp;
2965
+ var mon = i;
2966
+ var day = dayofyr - inttemp;
2977
2967
  // ----------------- find hours minutes and seconds -------------
2978
- temp = (days - dayofyr) * 24.0;
2979
- hr = Math.floor(temp);
2968
+ var temp = (days - dayofyr) * 24.0;
2969
+ var hr = Math.floor(temp);
2980
2970
  temp = (temp - hr) * 60.0;
2981
- minute = Math.floor(temp);
2982
- sec = (temp - minute) * 60.0;
2971
+ var minute = Math.floor(temp);
2972
+ var sec = (temp - minute) * 60.0;
2983
2973
  return {
2984
2974
  mon: mon,
2985
2975
  day: day,
@@ -3045,7 +3035,7 @@ var Sgp4 = /** @class */ (function () {
3045
3035
  /* --------------- find year and days of the year --------------- */
3046
3036
  var temp = jd - 2415019.5;
3047
3037
  var tu = temp / 365.25;
3048
- year = 1900 + Math.floor(tu);
3038
+ var year = 1900 + Math.floor(tu);
3049
3039
  leapyrs = Math.floor((year - 1901) * 0.25);
3050
3040
  days = Math.floor(temp - ((year - 1900) * 365.0 + leapyrs));
3051
3041
  /* ------------ check for case of beginning of a year ----------- */
@@ -3068,4 +3058,4 @@ var Sgp4 = /** @class */ (function () {
3068
3058
  return Sgp4;
3069
3059
  }());
3070
3060
  export { Sgp4 };
3071
- //# sourceMappingURL=ootk-sgp4.js.map
3061
+ //# sourceMappingURL=sgp4.js.map