UNPKG

1.45 kBJavaScriptView Raw
1function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
3/**
4 * @copyright 2013 Sonia Keys
5 * @copyright 2016 commenthol
6 * @license MIT
7 * @module parabolic
8 */
9/**
10 * Parabolic: Chapter 34, Parabolic Motion.
11 */
12import base from './base';
13
14/**
15 * Elements holds parabolic elements needed for computing true anomaly and distance.
16 */
17export var Elements = function () {
18 /**
19 * @param {Number} timeP - time of perihelion, T
20 * @param {Number} pDis - perihelion distance, q
21 */
22 function Elements(timeP, pDis) {
23 _classCallCheck(this, Elements);
24
25 this.timeP = timeP;
26 this.pDis = pDis;
27 }
28
29 /**
30 * AnomalyDistance returns true anomaly and distance of a body in a parabolic orbit of the Sun.
31 *
32 * @param {Number} jde - Julian ephemeris day
33 * @returns {Object} {ano, dist}
34 * {Number} ano - True anomaly ν in radians.
35 * {Number} dist - Distance r returned in AU.
36 */
37
38
39 Elements.prototype.anomalyDistance = function anomalyDistance(jde) {
40 var W = 3 * base.K / Math.SQRT2 * (jde - this.timeP) / this.pDis / Math.sqrt(this.pDis);
41 var G = W * 0.5;
42 var Y = Math.cbrt(G + Math.sqrt(G * G + 1));
43 var s = Y - 1 / Y;
44 var ν = 2 * Math.atan(s);
45 var r = this.pDis * (1 + s * s);
46 return {
47 ano: ν,
48 dist: r
49 };
50 };
51
52 return Elements;
53}();
54
55export default {
56 Elements: Elements
57};
\No newline at end of file