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.
44 lines (43 loc) • 1.89 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const time_1 = require("../../time");
const librationCalc_1 = require("../calculations/librationCalc");
class LunarX {
constructor(toi) {
this.toi = toi;
this.coords = { lon: 1.25, lat: -25 };
}
getStartTime() {
return __awaiter(this, void 0, void 0, function* () {
const T = (yield this.getTMax()) - 1.5 / 24 / 36525;
return time_1.createTimeOfInterest.fromJulianCenturiesJ2000(T);
});
}
getMaximum() {
return __awaiter(this, void 0, void 0, function* () {
const T = yield this.getTMax();
return time_1.createTimeOfInterest.fromJulianCenturiesJ2000(T);
});
}
getEndTime() {
return __awaiter(this, void 0, void 0, function* () {
const T = (yield this.getTMax()) + 1.5 / 24 / 36525;
return time_1.createTimeOfInterest.fromJulianCenturiesJ2000(T);
});
}
getTMax() {
return __awaiter(this, void 0, void 0, function* () {
return yield (0, librationCalc_1.getSunrise)(this.coords, this.toi.T);
});
}
}
exports.default = LunarX;