57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
|
/*!
|
||
|
* satellite-js v5.0.0
|
||
|
* (c) 2013 Shashwat Kandadai and UCSC
|
||
|
* https://github.com/shashwatak/satellite-js
|
||
|
* License: MIT
|
||
|
*/
|
||
|
|
||
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports["default"] = gstime;
|
||
|
var _constants = require("../constants");
|
||
|
var _ext = require("../ext");
|
||
|
/* -----------------------------------------------------------------------------
|
||
|
*
|
||
|
* function gstime
|
||
|
*
|
||
|
* this function finds the greenwich sidereal time.
|
||
|
*
|
||
|
* author : david vallado 719-573-2600 1 mar 2001
|
||
|
*
|
||
|
* inputs description range / units
|
||
|
* jdut1 - julian date in ut1 days from 4713 bc
|
||
|
*
|
||
|
* outputs :
|
||
|
* gstime - greenwich sidereal time 0 to 2pi rad
|
||
|
*
|
||
|
* locals :
|
||
|
* temp - temporary variable for doubles rad
|
||
|
* tut1 - julian centuries from the
|
||
|
* jan 1, 2000 12 h epoch (ut1)
|
||
|
*
|
||
|
* coupling :
|
||
|
* none
|
||
|
*
|
||
|
* references :
|
||
|
* vallado 2004, 191, eq 3-45
|
||
|
* --------------------------------------------------------------------------- */
|
||
|
function gstimeInternal(jdut1) {
|
||
|
var tut1 = (jdut1 - 2451545.0) / 36525.0;
|
||
|
var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; // # sec
|
||
|
temp = temp * _constants.deg2rad / 240.0 % _constants.twoPi; // 360/86400 = 1/240, to deg, to rad
|
||
|
|
||
|
// ------------------------ check quadrants ---------------------
|
||
|
if (temp < 0.0) {
|
||
|
temp += _constants.twoPi;
|
||
|
}
|
||
|
return temp;
|
||
|
}
|
||
|
function gstime() {
|
||
|
if ((arguments.length <= 0 ? undefined : arguments[0]) instanceof Date || arguments.length > 1) {
|
||
|
return gstimeInternal(_ext.jday.apply(void 0, arguments));
|
||
|
}
|
||
|
return gstimeInternal.apply(void 0, arguments);
|
||
|
}
|