UNPKG

5.18 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.Elements = undefined;
7
8var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
9 * @copyright 2013 Sonia Keys
10 * @copyright 2016 commenthol
11 * @license MIT
12 * @module parabolic
13 */
14/**
15 * Parabolic: Chapter 34, Parabolic Motion.
16 */
17
18
19var _base = require('./base');
20
21var _base2 = _interopRequireDefault(_base);
22
23function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
25function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
27/**
28 * Elements holds parabolic elements needed for computing true anomaly and distance.
29 */
30var Elements = exports.Elements = function () {
31 /**
32 * @param {Number} timeP - time of perihelion, T
33 * @param {Number} pDis - perihelion distance, q
34 */
35 function Elements(timeP, pDis) {
36 _classCallCheck(this, Elements);
37
38 this.timeP = timeP;
39 this.pDis = pDis;
40 }
41
42 /**
43 * AnomalyDistance returns true anomaly and distance of a body in a parabolic orbit of the Sun.
44 *
45 * @param {Number} jde - Julian ephemeris day
46 * @returns {Object} {ano, dist}
47 * {Number} ano - True anomaly ν in radians.
48 * {Number} dist - Distance r returned in AU.
49 */
50
51
52 _createClass(Elements, [{
53 key: 'anomalyDistance',
54 value: function anomalyDistance(jde) {
55 var W = 3 * _base2.default.K / Math.SQRT2 * (jde - this.timeP) / this.pDis / Math.sqrt(this.pDis);
56 var G = W * 0.5;
57 var Y = Math.cbrt(G + Math.sqrt(G * G + 1));
58 var s = Y - 1 / Y;
59 var ν = 2 * Math.atan(s);
60 var r = this.pDis * (1 + s * s);
61 return {
62 ano: ν,
63 dist: r
64 };
65 }
66 }]);
67
68 return Elements;
69}();
70
71exports.default = {
72 Elements: Elements
73};
\No newline at end of file