django-vue3-admin-web/node_modules/astronomia/lib/parabolic.cjs
2025-10-20 21:21:14 +08:00

55 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var base = require('./base.cjs');
/**
* @copyright 2013 Sonia Keys
* @copyright 2016 commenthol
* @license MIT
* @module parabolic
*/
/**
* Elements holds parabolic elements needed for computing true anomaly and distance.
*/
class Elements {
/**
* @param {Number} timeP - time of perihelion, T
* @param {Number} pDis - perihelion distance, q
*/
constructor (timeP, pDis) {
this.timeP = timeP;
this.pDis = pDis;
}
/**
* AnomalyDistance returns true anomaly and distance of a body in a parabolic orbit of the Sun.
*
* @param {Number} jde - Julian ephemeris day
* @returns {Object} {ano, dist}
* {Number} ano - True anomaly ν in radians.
* {Number} dist - Distance r returned in AU.
*/
anomalyDistance (jde) {
const W = 3 * base["default"].K / Math.SQRT2 * (jde - this.timeP) / this.pDis / Math.sqrt(this.pDis);
const G = W * 0.5;
const Y = Math.cbrt(G + Math.sqrt(G * G + 1));
const s = Y - 1 / Y;
const ν = 2 * Math.atan(s);
const r = this.pDis * (1 + s * s);
return {
ano: ν,
dist: r
}
}
}
var parabolic = {
Elements
};
exports.Elements = Elements;
exports["default"] = parabolic;