1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | import base from './base';
|
12 | import nutation from './nutation';
|
13 | import solar from './solar';
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | export function ephemeris(jd, earth) {
|
26 |
|
27 | var θ = (jd - 2398220) * 2 * Math.PI / 25.38;
|
28 | var I = 7.25 * Math.PI / 180;
|
29 | var K = 73.6667 * Math.PI / 180 + 1.3958333 * Math.PI / 180 * (jd - 2396758) / base.JulianCentury;
|
30 |
|
31 | var solarPos = solar.trueVSOP87(earth, jd);
|
32 | var L = solarPos.lon;
|
33 | var R = solarPos.range;
|
34 |
|
35 | var _nutation$nutation = nutation.nutation(jd),
|
36 | Δψ = _nutation$nutation[0],
|
37 | Δε = _nutation$nutation[1];
|
38 |
|
39 | var ε0 = nutation.meanObliquity(jd);
|
40 | var ε = ε0 + Δε;
|
41 | var λ = L - 20.4898 / 3600 * Math.PI / 180 / R;
|
42 | var λp = λ + Δψ;
|
43 |
|
44 | var _base$sincos = base.sincos(λ - K),
|
45 | sλK = _base$sincos[0],
|
46 | cλK = _base$sincos[1];
|
47 |
|
48 | var _base$sincos2 = base.sincos(I),
|
49 | sI = _base$sincos2[0],
|
50 | cI = _base$sincos2[1];
|
51 |
|
52 | var tx = -Math.cos(λp) * Math.tan(ε);
|
53 | var ty = -cλK * Math.tan(I);
|
54 | var P = Math.atan(tx) + Math.atan(ty);
|
55 | var B0 = Math.asin(sλK * sI);
|
56 | var η = Math.atan2(-sλK * cI, -cλK);
|
57 | var L0 = base.pmod(η - θ, 2 * Math.PI);
|
58 | return [P, B0, L0];
|
59 | }
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | export function cycle(c) {
|
69 |
|
70 | var jde = 2398140.227 + 27.2752316 * c;
|
71 | var m = 281.96 * Math.PI / 180 + 26.882476 * Math.PI / 180 * c;
|
72 |
|
73 | var _base$sincos3 = base.sincos(2 * m),
|
74 | s2m = _base$sincos3[0],
|
75 | c2m = _base$sincos3[1];
|
76 |
|
77 | return jde + 0.1454 * Math.sin(m) - 0.0085 * s2m - 0.0141 * c2m;
|
78 | }
|
79 |
|
80 | export default {
|
81 | ephemeris: ephemeris,
|
82 | cycle: cycle
|
83 | }; |
\ | No newline at end of file |