UNPKG

3.43 kBJavaScriptView Raw
1var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2
3function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
5/**
6 * @copyright 2013 Sonia Keys
7 * @copyright 2016 commenthol
8 * @license MIT
9 * @module elementequinox
10 */
11/**
12 * Elementequinox: Chapter 24, Reduction of Ecliptical Elements
13 * from one Equinox to another one.
14 *
15 * See package precess for the method EclipticPrecessor.ReduceElements and
16 * associated example. The method is described in this chapter but located
17 * in package precess so that it can be a method of EclipticPrecessor.
18 */
19
20import base from './base';
21
22/**
23 * Elements are the orbital elements of a solar system object which change
24 * from one equinox to another.
25 *
26 * @param {Number} inc - inclination
27 * @param {Number} node - longitude of ascending node (Ω)
28 * @param {Number} peri - argument of perihelion (ω)
29 */
30export var Elements = function Elements(inc, node, peri) {
31 _classCallCheck(this, Elements);
32
33 if ((typeof inc === 'undefined' ? 'undefined' : _typeof(inc)) === 'object') {
34 node = inc.pode;
35 peri = inc.peri;
36 inc = inc.inc;
37 }
38 this.inc = inc || 0;
39 this.node = node || 0;
40 this.peri = peri || 0;
41};
42
43// (24.4) p. 161
44var S = 0.0001139788;
45var C = 0.9999999935;
46/**
47 * ReduceB1950ToJ2000 reduces orbital elements of a solar system body from
48 * equinox B1950 to J2000.
49 *
50 * @param {Elements} eFrom
51 * @returns {Elements} eTo
52 */
53export function reduceB1950ToJ2000(eFrom) {
54 var W = eFrom.node - 174.298782 * Math.PI / 180;
55
56 var _base$sincos = base.sincos(eFrom.inc),
57 si = _base$sincos[0],
58 ci = _base$sincos[1];
59
60 var _base$sincos2 = base.sincos(W),
61 sW = _base$sincos2[0],
62 cW = _base$sincos2[1];
63
64 var A = si * sW;
65 var B = C * si * cW - S * ci;
66 var eTo = new Elements();
67 eTo.inc = Math.asin(Math.hypot(A, B));
68 eTo.node = base.pmod(174.997194 * Math.PI / 180 + Math.atan2(A, B), 2 * Math.PI);
69 eTo.peri = base.pmod(eFrom.peri + Math.atan2(-S * sW, C * si - S * ci * cW), 2 * Math.PI);
70 return eTo;
71}
72
73var Lp = 4.50001688 * Math.PI / 180;
74var L = 5.19856209 * Math.PI / 180;
75var J = 0.00651966 * Math.PI / 180;
76
77/**
78 * ReduceB1950ToJ2000 reduces orbital elements of a solar system body from
79 * equinox B1950 in the FK4 system to equinox J2000 in the FK5 system.
80 *
81 * @param {Elements} eFrom
82 * @returns {Elements} eTo
83 */
84export function reduceB1950FK4ToJ2000FK5(eFrom) {
85 var W = L + eFrom.node;
86
87 var _base$sincos3 = base.sincos(eFrom.inc),
88 si = _base$sincos3[0],
89 ci = _base$sincos3[1];
90
91 var _base$sincos4 = base.sincos(J),
92 sJ = _base$sincos4[0],
93 cJ = _base$sincos4[1];
94
95 var _base$sincos5 = base.sincos(W),
96 sW = _base$sincos5[0],
97 cW = _base$sincos5[1];
98
99 var eTo = new Elements();
100 eTo.inc = Math.acos(ci * cJ - si * sJ * cW);
101 eTo.node = base.pmod(Math.atan2(si * sW, ci * sJ + si * cJ * cW) - Lp, 2 * Math.PI);
102 eTo.peri = base.pmod(eFrom.peri + Math.atan2(sJ * sW, si * cJ + ci * sJ * cW), 2 * Math.PI);
103 return eTo;
104}
105
106export default {
107 Elements: Elements,
108 reduceB1950ToJ2000: reduceB1950ToJ2000,
109 reduceB1950FK4ToJ2000FK5: reduceB1950FK4ToJ2000FK5
110};
\No newline at end of file