astronomy-bundle
Version:
Bundle for astronomical calculations such as position of moon, sun and planets, sunrise, sunset or solar eclipses. Most of the calculations are based on Jean Meeus 'Astronomical Algorithms' book and the VSOP87 theory.
51 lines (50 loc) • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEquationOfCenter = exports.getApparentLongitude = exports.getTrueLongitude = exports.getMeanLongitude = exports.getTrueAnomaly = exports.getMeanAnomaly = void 0;
const angleCalc_1 = require("../../utils/angleCalc");
function getMeanAnomaly(T) {
const M = 357.5291092
+ 35999.0502909 * T
- 0.0001536 * Math.pow(T, 2)
+ Math.pow(T, 3) / 2449000;
return (0, angleCalc_1.normalizeAngle)(M);
}
exports.getMeanAnomaly = getMeanAnomaly;
function getTrueAnomaly(T) {
const M = getMeanAnomaly(T);
const C = getEquationOfCenter(T);
return M + C;
}
exports.getTrueAnomaly = getTrueAnomaly;
function getMeanLongitude(T) {
const t = T / 10;
const L0 = 280.4664567
+ 360007.6982779 * t
+ 0.03042028 * Math.pow(t, 2)
+ Math.pow(t, 3) / 49931
- Math.pow(t, 4) / 15300
+ Math.pow(t, 5) / 2000000;
return (0, angleCalc_1.normalizeAngle)(L0);
}
exports.getMeanLongitude = getMeanLongitude;
function getTrueLongitude(T) {
const L0 = getMeanLongitude(T);
const C = getEquationOfCenter(T);
return L0 + C;
}
exports.getTrueLongitude = getTrueLongitude;
function getApparentLongitude(T) {
const o = getTrueLongitude(T);
const omega = 125.04 - 1934.136 * T;
const omegaRad = (0, angleCalc_1.deg2rad)(omega);
return o - 0.00569 - 0.00478 * Math.sin(omegaRad);
}
exports.getApparentLongitude = getApparentLongitude;
function getEquationOfCenter(T) {
const M = getMeanAnomaly(T);
let C = (1.914602 - 0.004817 * T - 0.000014 * Math.pow(T, 2)) * Math.sin((0, angleCalc_1.deg2rad)(M));
C += (0.019993 - 0.000101 * T) * Math.sin(2 * (0, angleCalc_1.deg2rad)(M));
C += 0.000289 * Math.sin(3 * (0, angleCalc_1.deg2rad)(M));
return C;
}
exports.getEquationOfCenter = getEquationOfCenter;