1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /**
|
8 | * @copyright 2013 Sonia Keys
|
9 | * @copyright 2016 commenthol
|
10 | * @license MIT
|
11 | * @module illum
|
12 | */
|
13 | /**
|
14 | * Illum: Chapter 41, Illuminated Fraction of the Disk and Magnitude of a Planet.
|
15 | *
|
16 | * Also see functions `illuminated` and `limb` in package base. While this
|
17 | * chapter title includes "illumnated fraction," the function for computing
|
18 | * illuminated fraction given a phase angle is `base.illuminated`.
|
19 | * `base.limb` is the function mentioned at the bottom of p. 283.0
|
20 | */
|
21 |
|
22 | exports.phaseAngle = phaseAngle;
|
23 | exports.fraction = fraction;
|
24 | exports.phaseAngle2 = phaseAngle2;
|
25 | exports.phaseAngle3 = phaseAngle3;
|
26 | exports.fractionVenus = fractionVenus;
|
27 | exports.mercury = mercury;
|
28 | exports.venus = venus;
|
29 | exports.mars = mars;
|
30 | exports.jupiter = jupiter;
|
31 | exports.saturn = saturn;
|
32 | exports.uranus = uranus;
|
33 | exports.neptune = neptune;
|
34 | exports.mercury84 = mercury84;
|
35 | exports.venus84 = venus84;
|
36 | exports.mars84 = mars84;
|
37 | exports.jupiter84 = jupiter84;
|
38 | exports.saturn84 = saturn84;
|
39 | exports.uranus84 = uranus84;
|
40 | exports.neptune84 = neptune84;
|
41 | exports.pluto84 = pluto84;
|
42 |
|
43 | var _base = require('./base');
|
44 |
|
45 | var _base2 = _interopRequireDefault(_base);
|
46 |
|
47 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
48 |
|
49 | /**
|
50 | * PhaseAngle computes the phase angle of a planet.
|
51 | *
|
52 | * Argument r is planet's distance to Sun, Δ its distance to Earth, and R
|
53 | * the distance from Sun to Earth. All distances in AU.
|
54 | *
|
55 | * Result in radians.
|
56 | */
|
57 | function phaseAngle(r, Δ, R) {
|
58 | // (r, Δ, R float64) float64
|
59 | return Math.acos((r * r + Δ * Δ - R * R) / (2 * r * Δ));
|
60 | }
|
61 |
|
62 | /**
|
63 | * Fraction computes the illuminated fraction of the disk of a planet.
|
64 | *
|
65 | * Argument r is planet's distance to Sun, Δ its distance to Earth, and R
|
66 | * the distance from Sun to Earth. All distances in AU.
|
67 | */
|
68 | function fraction(r, Δ, R) {
|
69 | // (r, Δ, R float64) float64
|
70 | // (41.2) p. 283
|
71 | var s = r + Δ;
|
72 | return (s * s - R * R) / (4 * r * Δ);
|
73 | }
|
74 |
|
75 | /**
|
76 | * PhaseAngle2 computes the phase angle of a planet.
|
77 | *
|
78 | * Arguments L, B, R are heliocentric ecliptical coordinates of the planet.
|
79 | * L0, R0 are longitude and radius for Earth, Δ is distance from Earth to
|
80 | * the planet. All distances in AU, angles in radians.
|
81 | *
|
82 | * The phase angle result is in radians.
|
83 | */
|
84 | function phaseAngle2(L, B, R, L0, R0, Δ) {
|
85 | // (L, B, R, L0, R0, Δ float64) float64
|
86 | // (41.3) p. 283
|
87 | return Math.acos((R - R0 * Math.cos(B) * Math.cos(L - L0)) / Δ);
|
88 | }
|
89 |
|
90 | /**
|
91 | * PhaseAngle3 computes the phase angle of a planet.
|
92 | *
|
93 | * Arguments L, B are heliocentric ecliptical longitude and latitude of the
|
94 | * planet. x, y, z are cartesian coordinates of the planet, Δ is distance
|
95 | * from Earth to the planet. All distances in AU, angles in radians.
|
96 | *
|
97 | * The phase angle result is in radians.
|
98 | */
|
99 | function phaseAngle3(L, B, x, y, z, Δ) {
|
100 | // (L, B, x, y, z, Δ float64) float64
|
101 | // (41.4) p. 283
|
102 | var _base$sincos = _base2.default.sincos(L),
|
103 | _base$sincos2 = _slicedToArray(_base$sincos, 2),
|
104 | sL = _base$sincos2[0],
|
105 | cL = _base$sincos2[1];
|
106 |
|
107 | var _base$sincos3 = _base2.default.sincos(B),
|
108 | _base$sincos4 = _slicedToArray(_base$sincos3, 2),
|
109 | sB = _base$sincos4[0],
|
110 | cB = _base$sincos4[1];
|
111 |
|
112 | return Math.acos((x * cB * cL + y * cB * sL + z * sB) / Δ);
|
113 | }
|
114 |
|
115 | var p = Math.PI / 180;
|
116 |
|
117 | /**
|
118 | * FractionVenus computes an approximation of the illumanted fraction of Venus.
|
119 | */
|
120 | function fractionVenus(jde) {
|
121 | // (jde float64) float64
|
122 | var T = _base2.default.J2000Century(jde);
|
123 | var V = 261.51 * p + 22518.443 * p * T;
|
124 | var M = 177.53 * p + 35999.05 * p * T;
|
125 | var N = 50.42 * p + 58517.811 * p * T;
|
126 | var W = V + 1.91 * p * Math.sin(M) + 0.78 * p * Math.sin(N);
|
127 | var Δ = Math.sqrt(1.52321 + 1.44666 * Math.cos(W));
|
128 | var s = 0.72333 + Δ;
|
129 | return (s * s - 1) / 2.89332 / Δ;
|
130 | }
|
131 |
|
132 | /**
|
133 | * Mercury computes the visual magnitude of Mercury.
|
134 | *
|
135 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
136 | * and i the phase angle in radians.
|
137 | */
|
138 | function mercury(r, Δ, i) {
|
139 | // (r, Δ, i float64) float64
|
140 | var s = i - 50 * p;
|
141 | return 1.16 + 5 * Math.log10(r * Δ) + 0.02838 / p * s + 0.0001023 / p / p * s * s;
|
142 | }
|
143 |
|
144 | /**
|
145 | * Venus computes the visual magnitude of Venus.
|
146 | *
|
147 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
148 | * and i the phase angle in radians.
|
149 | */
|
150 | function venus(r, Δ, i) {
|
151 | // (r, Δ, i float64) float64
|
152 | return -4 + 5 * Math.log10(r * Δ) + (0.01322 / p + 0.0000004247 / p / p / p * i * i) * i;
|
153 | }
|
154 |
|
155 | /**
|
156 | * Mars computes the visual magnitude of Mars.
|
157 | *
|
158 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
159 | * and i the phase angle in radians.
|
160 | */
|
161 | function mars(r, Δ, i) {
|
162 | // (r, Δ, i float64) float64
|
163 | return -1.3 + 5 * Math.log10(r * Δ) + 0.01486 / p * i;
|
164 | }
|
165 |
|
166 | /**
|
167 | * Jupiter computes the visual magnitude of Jupiter.
|
168 | *
|
169 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
170 | */
|
171 | function jupiter(r, Δ) {
|
172 | // (r, Δ float64) float64
|
173 | return -8.93 + 5 * Math.log10(r * Δ);
|
174 | }
|
175 |
|
176 | /**
|
177 | * Saturn computes the visual magnitude of Saturn.
|
178 | *
|
179 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
180 | * B is the Saturnicentric latitude of the Earth referred to the plane of
|
181 | * Saturn's ring. ΔU is the difference between the Saturnicentric longitudes
|
182 | * of the Sun and the Earth, measured in the plane of the ring.
|
183 | * You can use saturndisk.Disk() to obtain B and ΔU.
|
184 | */
|
185 | function saturn(r, Δ, B, ΔU) {
|
186 | // (r, Δ, B, ΔU float64) float64
|
187 | var s = Math.sin(Math.abs(B));
|
188 | return -8.68 + 5 * Math.log10(r * Δ) + 0.044 / p * Math.abs(ΔU) - 2.6 * s + 1.25 * s * s;
|
189 | }
|
190 |
|
191 | /**
|
192 | * Uranus computes the visual magnitude of Uranus.
|
193 | *
|
194 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
195 | */
|
196 | function uranus(r, Δ) {
|
197 | // (r, Δ float64) float64
|
198 | return -6.85 + 5 * Math.log10(r * Δ);
|
199 | }
|
200 |
|
201 | /**
|
202 | * Neptune computes the visual magnitude of Neptune.
|
203 | *
|
204 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
205 | */
|
206 | function neptune(r, Δ) {
|
207 | // (r, Δ float64) float64
|
208 | return -7.05 + 5 * Math.log10(r * Δ);
|
209 | }
|
210 |
|
211 | /**
|
212 | * Mercury84 computes the visual magnitude of Mercury.
|
213 | *
|
214 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
215 | *
|
216 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
217 | * and i the phase angle in radians.
|
218 | */
|
219 | function mercury84(r, Δ, i) {
|
220 | // (r, Δ, i float64) float64
|
221 | return _base2.default.horner(i, -0.42 + 5 * Math.log10(r * Δ), 0.038 / p, -0.000273 / p / p, 0.000002 / p / p / p);
|
222 | }
|
223 |
|
224 | /**
|
225 | * Venus84 computes the visual magnitude of Venus.
|
226 | *
|
227 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
228 | *
|
229 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
230 | * and i the phase angle in radians.
|
231 | */
|
232 | function venus84(r, Δ, i) {
|
233 | // (r, Δ, i float64) float64
|
234 | return _base2.default.horner(i, -4.4 + 5 * Math.log10(r * Δ), 0.0009 / p, -0.000239 / p / p, 0.00000065 / p / p / p);
|
235 | }
|
236 |
|
237 | /**
|
238 | * Mars84 computes the visual magnitude of Mars.
|
239 | *
|
240 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
241 | *
|
242 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
243 | * and i the phase angle in radians.
|
244 | */
|
245 | function mars84(r, Δ, i) {
|
246 | // (r, Δ, i float64) float64
|
247 | return -1.52 + 5 * Math.log10(r * Δ) + 0.016 / p * i;
|
248 | }
|
249 |
|
250 | /**
|
251 | * Jupiter84 computes the visual magnitude of Jupiter.
|
252 | *
|
253 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
254 | *
|
255 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth,
|
256 | * and i the phase angle in radians.
|
257 | */
|
258 | function jupiter84(r, Δ, i) {
|
259 | // (r, Δ, i float64) float64
|
260 | return -9.4 + 5 * Math.log10(r * Δ) + 0.005 / p * i;
|
261 | }
|
262 |
|
263 | /**
|
264 | * Saturn84 computes the visual magnitude of Saturn.
|
265 | *
|
266 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
267 | *
|
268 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
269 | * B is the Saturnicentric latitude of the Earth referred to the plane of
|
270 | * Saturn's ring. ΔU is the difference between the Saturnicentric longitudes
|
271 | * of the Sun and the Earth, measured in the plane of the ring.
|
272 | */
|
273 | function saturn84(r, Δ, B, ΔU) {
|
274 | // (r, Δ, B, ΔU float64) float64
|
275 | var s = Math.sin(Math.abs(B));
|
276 | return -8.88 + 5 * Math.log10(r * Δ) + 0.044 / p * Math.abs(ΔU) - 2.6 * s + 1.25 * s * s;
|
277 | }
|
278 |
|
279 | /**
|
280 | * Uranus84 computes the visual magnitude of Uranus.
|
281 | *
|
282 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
283 | *
|
284 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
285 | */
|
286 | function uranus84(r, Δ) {
|
287 | // (r, Δ float64) float64
|
288 | return -7.19 + 5 * Math.log10(r * Δ);
|
289 | }
|
290 |
|
291 | /**
|
292 | * Neptune84 computes the visual magnitude of Neptune.
|
293 | *
|
294 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
295 | *
|
296 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
297 | */
|
298 | function neptune84(r, Δ) {
|
299 | // (r, Δ float64) float64
|
300 | return -6.87 + 5 * Math.log10(r * Δ);
|
301 | }
|
302 |
|
303 | /**
|
304 | * Pluto84 computes the visual magnitude of Pluto.
|
305 | *
|
306 | * The formula is that adopted in "Astronomical Almanac" in 1984.0
|
307 | *
|
308 | * Argument r is the planet's distance from the Sun, Δ the distance from Earth.
|
309 | */
|
310 | function pluto84(r, Δ) {
|
311 | // (r, Δ float64) float64
|
312 | return -1 + 5 * Math.log10(r * Δ);
|
313 | }
|
314 |
|
315 | exports.default = {
|
316 | phaseAngle: phaseAngle,
|
317 | fraction: fraction,
|
318 | phaseAngle2: phaseAngle2,
|
319 | phaseAngle3: phaseAngle3,
|
320 | fractionVenus: fractionVenus,
|
321 | mercury: mercury,
|
322 | venus: venus,
|
323 | mars: mars,
|
324 | jupiter: jupiter,
|
325 | saturn: saturn,
|
326 | uranus: uranus,
|
327 | neptune: neptune,
|
328 | mercury84: mercury84,
|
329 | venus84: venus84,
|
330 | mars84: mars84,
|
331 | jupiter84: jupiter84,
|
332 | saturn84: saturn84,
|
333 | uranus84: uranus84,
|
334 | neptune84: neptune84,
|
335 | pluto84: pluto84
|
336 | }; |
\ | No newline at end of file |