UNPKG

5.61 kBJavaScriptView Raw
1/**
2 * @copyright 2013 Sonia Keys
3 * @copyright 2016 commenthol
4 * @license MIT
5 * @module pluto
6 */
7/**
8 * Pluto: Chapter 37, Pluto.
9 */
10
11import base from './base';
12import elliptic from './elliptic';
13
14/**
15 * Heliocentric returns J2000 heliocentric coordinates of Pluto.
16 *
17 * Results l, b are solar longitude and latitude in radians.
18 * Result r is distance in AU.
19 */
20export function heliocentric(jde) {
21 var l = 0;
22 var b = 0;
23 var r = 0;
24 var T = base.J2000Century(jde);
25 var J = 34.35 + 3034.9057 * T;
26 var S = 50.08 + 1222.1138 * T;
27 var P = 238.96 + 144.96 * T;
28 for (var i in t37) {
29 var t = t37[i];
30
31 var _base$sincos = base.sincos((t.i * J + t.j * S + t.k * P) * Math.PI / 180),
32 sα = _base$sincos[0],
33 cα = _base$sincos[1];
34
35 l += t.lA * sα + t.lB * cα;
36 b += t.bA * sα + t.bB * cα;
37 r += t.rA * sα + t.rB * cα;
38 }
39 l = (l + 238.958116 + 144.96 * T) * Math.PI / 180;
40 b = (b - 3.908239) * Math.PI / 180;
41 r += 40.7241346;
42 return { lon: l, lat: b, range: r };
43}
44
45/**
46 * Astrometric returns J2000 astrometric coordinates of Pluto.
47 */
48export function astrometric(jde, earth) {
49 var sε = base.SOblJ2000;
50 var cε = base.COblJ2000;
51 var f = function f(jde) {
52 var x = void 0,
53 y = void 0,
54 z = void 0;
55
56 var _heliocentric = heliocentric(jde),
57 lon = _heliocentric.lon,
58 lat = _heliocentric.lat,
59 range = _heliocentric.range;
60
61 var _base$sincos2 = base.sincos(lon),
62 sl = _base$sincos2[0],
63 cl = _base$sincos2[1];
64
65 var _base$sincos3 = base.sincos(lat),
66 sb = _base$sincos3[0],
67 cb = _base$sincos3[1];
68 // (37.1) p. 264
69
70
71 x = range * cl * cb;
72 y = range * (sl * cb * cε - sb * sε);
73 z = range * (sl * cb * sε + sb * cε);
74 return { x: x, y: y, z: z };
75 };
76 var c = elliptic.astrometricJ2000(f, jde, earth); // eslint-disable-line no-unused-vars
77 return new base.Coord(c.ra, c.dec);
78}
79
80function Pt(i, j, k, lA, lB, bA, bB, rA, rB) {
81 this.i = i;
82 this.j = j;
83 this.k = k;
84 this.lA = lA;
85 this.lB = lB;
86 this.bA = bA;
87 this.bB = bB;
88 this.rA = rA;
89 this.rB = rB;
90}
91
92var t37 = [new Pt(0, 0, 1, -19.799805, 19.850055, -5.452852, -14.974862, 6.6865439, 6.8951812), new Pt(0, 0, 2, 0.897144, -4.954829, 3.527812, 1.67279, -1.1827535, -0.0332538), new Pt(0, 0, 3, 0.611149, 1.211027, -1.050748, 0.327647, 0.1593179, -0.143889), new Pt(0, 0, 4, -0.341243, -0.189585, 0.17869, -0.292153, -0.0018444, 0.048322), new Pt(0, 0, 5, 0.129287, -0.034992, 0.01865, 0.10034, -0.0065977, -0.0085431), new Pt(0, 0, 6, -0.038164, 0.030893, -0.030697, -0.025823, 0.0031174, -0.0006032), new Pt(0, 1, -1, 0.020442, -0.009987, 0.004878, 0.011248, -0.0005794, 0.0022161), new Pt(0, 1, 0, -0.004063, -0.005071, 0.000226, -0.000064, 0.0004601, 0.0004032), new Pt(0, 1, 1, -0.006016, -0.003336, 0.00203, -0.000836, -0.0001729, 0.0000234), new Pt(0, 1, 2, -0.003956, 0.003039, 0.000069, -0.000604, -0.0000415, 0.0000702), new Pt(0, 1, 3, -0.000667, 0.003572, -0.000247, -0.000567, 0.0000239, 0.0000723), new Pt(0, 2, -2, 0.001276, 0.000501, -0.000057, 0.000001, 0.0000067, -0.0000067), new Pt(0, 2, -1, 0.001152, -0.000917, -0.000122, 0.000175, 0.0001034, -0.0000451), new Pt(0, 2, 0, 0.00063, -0.001277, -0.000049, -0.000164, -0.0000129, 0.0000504), new Pt(1, -1, 0, 0.002571, -0.000459, -0.000197, 0.000199, 0.000048, -0.0000231), new Pt(1, -1, 1, 0.000899, -0.001449, -0.000025, 0.000217, 0.0000002, -0.0000441), new Pt(1, 0, -3, -0.001016, 0.001043, 0.000589, -0.000248, -0.0003359, 0.0000265), new Pt(1, 0, -2, -0.002343, -0.001012, -0.000269, 0.000711, 0.0007856, -0.0007832), new Pt(1, 0, -1, 0.007042, 0.000788, 0.000185, 0.000193, 0.0000036, 0.0045763), new Pt(1, 0, 0, 0.001199, -0.000338, 0.000315, 0.000807, 0.0008663, 0.0008547), new Pt(1, 0, 1, 0.000418, -0.000067, -0.00013, -0.000043, -0.0000809, -0.0000769), new Pt(1, 0, 2, 0.00012, -0.000274, 0.000005, 0.000003, 0.0000263, -0.0000144), new Pt(1, 0, 3, -0.00006, -0.000159, 0.000002, 0.000017, -0.0000126, 0.0000032), new Pt(1, 0, 4, -0.000082, -0.000029, 0.000002, 0.000005, -0.0000035, -0.0000016), new Pt(1, 1, -3, -0.000036, -0.000029, 0.000002, 0.000003, -0.0000019, -0.0000004), new Pt(1, 1, -2, -0.00004, 0.000007, 0.000003, 0.000001, -0.0000015, 0.0000008), new Pt(1, 1, -1, -0.000014, 0.000022, 0.000002, -0.000001, -0.0000004, 0.0000012), new Pt(1, 1, 0, 0.000004, 0.000013, 0.000001, -0.000001, 0.0000005, 0.0000006), new Pt(1, 1, 1, 0.000005, 0.000002, 0, -0.000001, 0.0000003, 0.0000001), new Pt(1, 1, 3, -0.000001, 0, 0, 0, 0.0000006, -0.0000002), new Pt(2, 0, -6, 0.000002, 0, 0, -0.000002, 0.0000002, 0.0000002), new Pt(2, 0, -5, -0.000004, 0.000005, 0.000002, 0.000002, -0.0000002, -0.0000002), new Pt(2, 0, -4, 0.000004, -0.000007, -0.000007, 0, 0.0000014, 0.0000013), new Pt(2, 0, -3, 0.000014, 0.000024, 0.00001, -0.000008, -0.0000063, 0.0000013), new Pt(2, 0, -2, -0.000049, -0.000034, -0.000003, 0.00002, 0.0000136, -0.0000236), new Pt(2, 0, -1, 0.000163, -0.000048, 0.000006, 0.000005, 0.0000273, 0.0001065), new Pt(2, 0, 0, 0.000009, -0.000024, 0.000014, 0.000017, 0.0000251, 0.0000149), new Pt(2, 0, 1, -0.000004, 0.000001, -0.000002, 0, -0.0000025, -0.0000009), new Pt(2, 0, 2, -0.000003, 0.000001, 0, 0, 0.0000009, -0.0000002), new Pt(2, 0, 3, 0.000001, 0.000003, 0, 0, -0.0000008, 0.0000007), new Pt(3, 0, -2, -0.000003, -0.000001, 0, 0.000001, 0.0000002, -0.000001), new Pt(3, 0, -1, 0.000005, -0.000003, 0, 0, 0.0000019, 0.0000035), new Pt(3, 0, 0, 0, 0, 0.000001, 0, 0.000001, 0.0000003)];
93
94export default {
95 heliocentric: heliocentric,
96 astrometric: astrometric
97};
\No newline at end of file