From 945e70a98f65995a059228bee607080c16277683 Mon Sep 17 00:00:00 2001 From: Don Cross Date: Tue, 7 Dec 2021 15:31:54 -0500 Subject: [PATCH] Fixed #106 - Calculate rotation axis of Sun, Moon, and planets. --- README.md | 2 +- demo/browser/astronomy.browser.js | 52 +++++- demo/nodejs/astronomy.js | 52 +++++- demo/nodejs/calendar/astronomy.ts | 62 ++++++- demo/python/astronomy.py | 60 +++++- generate/ctest.c | 8 +- generate/dotnet/csharp_test/csharp_test.cs | 7 +- generate/template/astronomy.cs | 62 ++++++- generate/template/astronomy.py | 60 +++++- generate/template/astronomy.ts | 62 ++++++- generate/test.js | 7 +- generate/test.py | 7 +- source/csharp/README.md | 2 +- source/csharp/astronomy.cs | 62 ++++++- source/js/README.md | 2 +- source/js/astronomy.browser.js | 52 +++++- source/js/astronomy.browser.min.js | 204 +++++++++++---------- source/js/astronomy.d.ts | 2 +- source/js/astronomy.js | 52 +++++- source/js/astronomy.min.js | 34 ++-- source/js/astronomy.ts | 62 ++++++- source/js/esm/astronomy.js | 52 +++++- source/python/README.md | 2 +- source/python/astronomy.py | 60 +++++- 24 files changed, 866 insertions(+), 161 deletions(-) diff --git a/README.md b/README.md index fded6bf4..d8907ddd 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ of complexity. So I decided to create Astronomy Engine with the following engine - Support JavaScript, C, C#, and Python with the same algorithms, and verify them to produce identical results. - No external dependencies! The code must not require anything outside the standard library for each language. -- Minified JavaScript code less than 120K. (The current size is 104157 bytes.) +- Minified JavaScript code less than 120K. (The current size is 105186 bytes.) - Accuracy always within 1 arcminute of results from NOVAS. - It would be well documented, relatively easy to use, and support a wide variety of common use cases. diff --git a/demo/browser/astronomy.browser.js b/demo/browser/astronomy.browser.js index 197fa12f..99595a21 100644 --- a/demo/browser/astronomy.browser.js +++ b/demo/browser/astronomy.browser.js @@ -1632,7 +1632,7 @@ function Libration(date) { const mlat = moon.geo_eclip_lat; const dist_km = moon.distance_au * exports.KM_PER_AU; // Inclination angle - const I = exports.DEG2RAD * 1.54242; + const I = exports.DEG2RAD * 1.543; // Moon's argument of latitude in radians. const f = exports.DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233 * t - 0.0036539 * t2 - t3 / 3526000 + t4 / 863310000); // Moon's ascending node's mean longitude in radians. @@ -8093,7 +8093,7 @@ function EarthRotationAxis(time) { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date @@ -8130,6 +8130,54 @@ function RotationAxis(body, date) { break; case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + const E1 = exports.DEG2RAD * (125.045 - 0.0529921 * d); + const E2 = exports.DEG2RAD * (250.089 - 0.1059842 * d); + const E3 = exports.DEG2RAD * (260.008 + 13.0120009 * d); + const E4 = exports.DEG2RAD * (176.625 + 13.3407154 * d); + const E5 = exports.DEG2RAD * (357.529 + 0.9856003 * d); + const E6 = exports.DEG2RAD * (311.589 + 26.4057084 * d); + const E7 = exports.DEG2RAD * (134.963 + 13.0649930 * d); + const E8 = exports.DEG2RAD * (276.617 + 0.3287146 * d); + const E9 = exports.DEG2RAD * (34.226 + 1.7484877 * d); + const E10 = exports.DEG2RAD * (15.134 - 0.1589763 * d); + const E11 = exports.DEG2RAD * (119.743 + 0.0036096 * d); + const E12 = exports.DEG2RAD * (239.961 + 0.1643573 * d); + const E13 = exports.DEG2RAD * (25.053 + 12.9590088 * d); + ra = (269.9949 + 0.0031 * T + - 3.8787 * Math.sin(E1) + - 0.1204 * Math.sin(E2) + + 0.0700 * Math.sin(E3) + - 0.0172 * Math.sin(E4) + + 0.0072 * Math.sin(E6) + - 0.0052 * Math.sin(E10) + + 0.0043 * Math.sin(E13)); + dec = (66.5392 + 0.0130 * T + + 1.5419 * Math.cos(E1) + + 0.0239 * Math.cos(E2) + - 0.0278 * Math.cos(E3) + + 0.0068 * Math.cos(E4) + - 0.0029 * Math.cos(E6) + + 0.0009 * Math.cos(E7) + + 0.0008 * Math.cos(E10) + - 0.0009 * Math.cos(E13)); + w = (38.3213 + (13.17635815 - 1.4e-12 * d) * d + + 3.5610 * Math.sin(E1) + + 0.1208 * Math.sin(E2) + - 0.0642 * Math.sin(E3) + + 0.0158 * Math.sin(E4) + + 0.0252 * Math.sin(E5) + - 0.0066 * Math.sin(E6) + - 0.0047 * Math.sin(E7) + - 0.0046 * Math.sin(E8) + + 0.0028 * Math.sin(E9) + + 0.0052 * Math.sin(E10) + + 0.0040 * Math.sin(E11) + + 0.0019 * Math.sin(E12) + - 0.0044 * Math.sin(E13)); + break; case Body.Mars: ra = (317.269202 - 0.10927547 * T + 0.000068 * Math.sin(exports.DEG2RAD * (198.991226 + 19139.4819985 * T)) diff --git a/demo/nodejs/astronomy.js b/demo/nodejs/astronomy.js index 23080d5c..9b3b3236 100644 --- a/demo/nodejs/astronomy.js +++ b/demo/nodejs/astronomy.js @@ -1631,7 +1631,7 @@ function Libration(date) { const mlat = moon.geo_eclip_lat; const dist_km = moon.distance_au * exports.KM_PER_AU; // Inclination angle - const I = exports.DEG2RAD * 1.54242; + const I = exports.DEG2RAD * 1.543; // Moon's argument of latitude in radians. const f = exports.DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233 * t - 0.0036539 * t2 - t3 / 3526000 + t4 / 863310000); // Moon's ascending node's mean longitude in radians. @@ -8092,7 +8092,7 @@ function EarthRotationAxis(time) { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date @@ -8129,6 +8129,54 @@ function RotationAxis(body, date) { break; case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + const E1 = exports.DEG2RAD * (125.045 - 0.0529921 * d); + const E2 = exports.DEG2RAD * (250.089 - 0.1059842 * d); + const E3 = exports.DEG2RAD * (260.008 + 13.0120009 * d); + const E4 = exports.DEG2RAD * (176.625 + 13.3407154 * d); + const E5 = exports.DEG2RAD * (357.529 + 0.9856003 * d); + const E6 = exports.DEG2RAD * (311.589 + 26.4057084 * d); + const E7 = exports.DEG2RAD * (134.963 + 13.0649930 * d); + const E8 = exports.DEG2RAD * (276.617 + 0.3287146 * d); + const E9 = exports.DEG2RAD * (34.226 + 1.7484877 * d); + const E10 = exports.DEG2RAD * (15.134 - 0.1589763 * d); + const E11 = exports.DEG2RAD * (119.743 + 0.0036096 * d); + const E12 = exports.DEG2RAD * (239.961 + 0.1643573 * d); + const E13 = exports.DEG2RAD * (25.053 + 12.9590088 * d); + ra = (269.9949 + 0.0031 * T + - 3.8787 * Math.sin(E1) + - 0.1204 * Math.sin(E2) + + 0.0700 * Math.sin(E3) + - 0.0172 * Math.sin(E4) + + 0.0072 * Math.sin(E6) + - 0.0052 * Math.sin(E10) + + 0.0043 * Math.sin(E13)); + dec = (66.5392 + 0.0130 * T + + 1.5419 * Math.cos(E1) + + 0.0239 * Math.cos(E2) + - 0.0278 * Math.cos(E3) + + 0.0068 * Math.cos(E4) + - 0.0029 * Math.cos(E6) + + 0.0009 * Math.cos(E7) + + 0.0008 * Math.cos(E10) + - 0.0009 * Math.cos(E13)); + w = (38.3213 + (13.17635815 - 1.4e-12 * d) * d + + 3.5610 * Math.sin(E1) + + 0.1208 * Math.sin(E2) + - 0.0642 * Math.sin(E3) + + 0.0158 * Math.sin(E4) + + 0.0252 * Math.sin(E5) + - 0.0066 * Math.sin(E6) + - 0.0047 * Math.sin(E7) + - 0.0046 * Math.sin(E8) + + 0.0028 * Math.sin(E9) + + 0.0052 * Math.sin(E10) + + 0.0040 * Math.sin(E11) + + 0.0019 * Math.sin(E12) + - 0.0044 * Math.sin(E13)); + break; case Body.Mars: ra = (317.269202 - 0.10927547 * T + 0.000068 * Math.sin(exports.DEG2RAD * (198.991226 + 19139.4819985 * T)) diff --git a/demo/nodejs/calendar/astronomy.ts b/demo/nodejs/calendar/astronomy.ts index 7f5c8539..4e4a2b1a 100644 --- a/demo/nodejs/calendar/astronomy.ts +++ b/demo/nodejs/calendar/astronomy.ts @@ -1737,7 +1737,7 @@ export function Libration(date: FlexibleDateTime): LibrationInfo { const dist_km = moon.distance_au * KM_PER_AU; // Inclination angle - const I = DEG2RAD * 1.54242; + const I = DEG2RAD * 1.543; // Moon's argument of latitude in radians. const f = DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233*t - 0.0036539*t2 - t3/3526000 + t4/863310000); @@ -8398,7 +8398,7 @@ function EarthRotationAxis(time: AstroTime): AxisInfo { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date @@ -8444,6 +8444,64 @@ export function RotationAxis(body: Body, date: FlexibleDateTime): AxisInfo case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + const E1 = DEG2RAD * (125.045 - 0.0529921*d); + const E2 = DEG2RAD * (250.089 - 0.1059842*d); + const E3 = DEG2RAD * (260.008 + 13.0120009*d); + const E4 = DEG2RAD * (176.625 + 13.3407154*d); + const E5 = DEG2RAD * (357.529 + 0.9856003*d); + const E6 = DEG2RAD * (311.589 + 26.4057084*d); + const E7 = DEG2RAD * (134.963 + 13.0649930*d); + const E8 = DEG2RAD * (276.617 + 0.3287146*d); + const E9 = DEG2RAD * (34.226 + 1.7484877*d); + const E10 = DEG2RAD * (15.134 - 0.1589763*d); + const E11 = DEG2RAD * (119.743 + 0.0036096*d); + const E12 = DEG2RAD * (239.961 + 0.1643573*d); + const E13 = DEG2RAD * (25.053 + 12.9590088*d); + + ra = ( + 269.9949 + 0.0031*T + - 3.8787*Math.sin(E1) + - 0.1204*Math.sin(E2) + + 0.0700*Math.sin(E3) + - 0.0172*Math.sin(E4) + + 0.0072*Math.sin(E6) + - 0.0052*Math.sin(E10) + + 0.0043*Math.sin(E13) + ); + + dec = ( + 66.5392 + 0.0130*T + + 1.5419*Math.cos(E1) + + 0.0239*Math.cos(E2) + - 0.0278*Math.cos(E3) + + 0.0068*Math.cos(E4) + - 0.0029*Math.cos(E6) + + 0.0009*Math.cos(E7) + + 0.0008*Math.cos(E10) + - 0.0009*Math.cos(E13) + ); + + w = ( + 38.3213 + (13.17635815 - 1.4e-12*d)*d + + 3.5610*Math.sin(E1) + + 0.1208*Math.sin(E2) + - 0.0642*Math.sin(E3) + + 0.0158*Math.sin(E4) + + 0.0252*Math.sin(E5) + - 0.0066*Math.sin(E6) + - 0.0047*Math.sin(E7) + - 0.0046*Math.sin(E8) + + 0.0028*Math.sin(E9) + + 0.0052*Math.sin(E10) + + 0.0040*Math.sin(E11) + + 0.0019*Math.sin(E12) + - 0.0044*Math.sin(E13) + ); + break; + case Body.Mars: ra = ( 317.269202 - 0.10927547*T diff --git a/demo/python/astronomy.py b/demo/python/astronomy.py index de9c8dd5..808aa25e 100644 --- a/demo/python/astronomy.py +++ b/demo/python/astronomy.py @@ -8840,7 +8840,7 @@ def Libration(time): diam_deg = 2.0 * math.degrees(math.atan(_MOON_MEAN_RADIUS_KM / math.sqrt(dist_km*dist_km - _MOON_MEAN_RADIUS_KM*_MOON_MEAN_RADIUS_KM))) # Inclination angle - I = math.radians(1.54242) + I = math.radians(1.543) # Moon's argument of latitude in radians. f = math.radians(_NormalizeLongitude(93.2720950 + 483202.0175233*t - 0.0036539*t2 - t3/3526000 + t4/863310000)) @@ -9008,7 +9008,7 @@ def RotationAxis(body, time): Parameters: body : Body One of the following values: - `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. time : Time @@ -9043,6 +9043,62 @@ def RotationAxis(body, time): w = 160.20 - (1.4813688 * d) elif body == Body.Earth: return _EarthRotationAxis(time) + elif body == Body.Moon: + # See page 8, Table 2 in: + # https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + E1 = math.radians(125.045 - 0.0529921*d) + E2 = math.radians(250.089 - 0.1059842*d) + E3 = math.radians(260.008 + 13.0120009*d) + E4 = math.radians(176.625 + 13.3407154*d) + E5 = math.radians(357.529 + 0.9856003*d) + E6 = math.radians(311.589 + 26.4057084*d) + E7 = math.radians(134.963 + 13.0649930*d) + E8 = math.radians(276.617 + 0.3287146*d) + E9 = math.radians(34.226 + 1.7484877*d) + E10 = math.radians(15.134 - 0.1589763*d) + E11 = math.radians(119.743 + 0.0036096*d) + E12 = math.radians(239.961 + 0.1643573*d) + E13 = math.radians(25.053 + 12.9590088*d) + + ra = ( + 269.9949 + 0.0031*T + - 3.8787*math.sin(E1) + - 0.1204*math.sin(E2) + + 0.0700*math.sin(E3) + - 0.0172*math.sin(E4) + + 0.0072*math.sin(E6) + - 0.0052*math.sin(E10) + + 0.0043*math.sin(E13) + ) + + dec = ( + 66.5392 + 0.0130*T + + 1.5419*math.cos(E1) + + 0.0239*math.cos(E2) + - 0.0278*math.cos(E3) + + 0.0068*math.cos(E4) + - 0.0029*math.cos(E6) + + 0.0009*math.cos(E7) + + 0.0008*math.cos(E10) + - 0.0009*math.cos(E13) + ) + + w = ( + 38.3213 + (13.17635815 - 1.4e-12*d)*d + + 3.5610*math.sin(E1) + + 0.1208*math.sin(E2) + - 0.0642*math.sin(E3) + + 0.0158*math.sin(E4) + + 0.0252*math.sin(E5) + - 0.0066*math.sin(E6) + - 0.0047*math.sin(E7) + - 0.0046*math.sin(E8) + + 0.0028*math.sin(E9) + + 0.0052*math.sin(E10) + + 0.0040*math.sin(E11) + + 0.0019*math.sin(E12) + - 0.0044*math.sin(E13) + ) elif body == Body.Mars: ra = ( 317.269202 - 0.10927547*T diff --git a/generate/ctest.c b/generate/ctest.c index eae76e95..bfc20880 100644 --- a/generate/ctest.c +++ b/generate/ctest.c @@ -4842,13 +4842,13 @@ static int Libration(const char *filename, int *ndata, double *var_lon, double * if (diff_diam > max_diff_diam) max_diff_diam = diff_diam; - if (diff_elon > 0.133) + if (diff_elon > 0.1304) FAIL("C Libration(%s line %d): EXCESSIVE diff_elon = %0.4lf arcmin\n", filename, lnum, diff_elon); - if (diff_elat > 1.666) + if (diff_elat > 1.6476) FAIL("C Libration(%s line %d): EXCESSIVE diff_elat = %0.4lf arcmin\n", filename, lnum, diff_elat); - if (diff_distance > 54.4) + if (diff_distance > 54.377) FAIL("C Libration(%s line %d): EXCESSIVE diff_distance = %0.3lf km\n", filename, lnum, diff_distance); /* Update sum-of-squared-errors. */ @@ -5076,7 +5076,7 @@ static int AxisTest(void) CHECK(AxisTestBody(BODY_URANUS, "axis/Uranus.txt", 0.0)); CHECK(AxisTestBody(BODY_NEPTUNE, "axis/Neptune.txt", 0.000462)); CHECK(AxisTestBody(BODY_PLUTO, "axis/Pluto.txt", 0.0)); - printf("C AxisBody: PASS\n"); + printf("C AxisTest: PASS\n"); fail: return error; } diff --git a/generate/dotnet/csharp_test/csharp_test.cs b/generate/dotnet/csharp_test/csharp_test.cs index 5e27e426..53fc79c4 100644 --- a/generate/dotnet/csharp_test/csharp_test.cs +++ b/generate/dotnet/csharp_test/csharp_test.cs @@ -3155,19 +3155,19 @@ namespace csharp_test if (diff_diam > max_diff_diam) max_diff_diam = diff_diam; - if (diff_elon > 0.133) + if (diff_elon > 0.1304) { Console.WriteLine($"C# Libration({filename} line {lnum}): EXCESSIVE diff_elon = {diff_elon} arcmin"); return 1; } - if (diff_elat > 1.666) + if (diff_elat > 1.6476) { Console.WriteLine($"C# Libration({filename} line {lnum}): EXCESSIVE diff_elat = {diff_elat} arcmin"); return 1; } - if (diff_distance > 54.4) + if (diff_distance > 54.377) { Console.WriteLine($"C# Libration({filename} line {lnum}): EXCESSIVE diff_distance = {diff_distance} km"); return 1; @@ -3194,6 +3194,7 @@ namespace csharp_test if (0 != AxisTestBody(Body.Mercury, "../../axis/Mercury.txt", 0.074340)) return 1; if (0 != AxisTestBody(Body.Venus, "../../axis/Venus.txt", 0.0)) return 1; if (0 != AxisTestBody(Body.Earth, "../../axis/Earth.txt", 0.000591)) return 1; + if (0 != AxisTestBody(Body.Moon, "../../axis/Moon.txt", 0.264845)) return 1; if (0 != AxisTestBody(Body.Mars, "../../axis/Mars.txt", 0.075323)) return 1; if (0 != AxisTestBody(Body.Jupiter, "../../axis/Jupiter.txt", 0.000324)) return 1; if (0 != AxisTestBody(Body.Saturn, "../../axis/Saturn.txt", 0.000304)) return 1; diff --git a/generate/template/astronomy.cs b/generate/template/astronomy.cs index e730b8ab..059d9acd 100644 --- a/generate/template/astronomy.cs +++ b/generate/template/astronomy.cs @@ -3573,7 +3573,7 @@ $ASTRO_IAU_DATA() lib.diam_deg = (2.0 * RAD2DEG) * Math.Atan(MOON_MEAN_RADIUS_KM / Math.Sqrt(lib.dist_km*lib.dist_km - MOON_MEAN_RADIUS_KM*MOON_MEAN_RADIUS_KM)); // Inclination angle - const double I = DEG2RAD * 1.54242; + const double I = DEG2RAD * 1.543; // Moon's argument of latitude in radians. double f = DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233*t - 0.0036539*t2 - t3/3526000 + t4/863310000); @@ -7570,7 +7570,7 @@ $ASTRO_IAU_DATA() /// /// /// One of the following values: - /// `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + /// `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, /// `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. /// /// The time at which to calculate the body's rotation axis. @@ -7612,6 +7612,64 @@ $ASTRO_IAU_DATA() case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + double E1 = DEG2RAD * (125.045 - 0.0529921*d); + double E2 = DEG2RAD * (250.089 - 0.1059842*d); + double E3 = DEG2RAD * (260.008 + 13.0120009*d); + double E4 = DEG2RAD * (176.625 + 13.3407154*d); + double E5 = DEG2RAD * (357.529 + 0.9856003*d); + double E6 = DEG2RAD * (311.589 + 26.4057084*d); + double E7 = DEG2RAD * (134.963 + 13.0649930*d); + double E8 = DEG2RAD * (276.617 + 0.3287146*d); + double E9 = DEG2RAD * (34.226 + 1.7484877*d); + double E10 = DEG2RAD * (15.134 - 0.1589763*d); + double E11 = DEG2RAD * (119.743 + 0.0036096*d); + double E12 = DEG2RAD * (239.961 + 0.1643573*d); + double E13 = DEG2RAD * (25.053 + 12.9590088*d); + + ra = ( + 269.9949 + 0.0031*T + - 3.8787*Math.Sin(E1) + - 0.1204*Math.Sin(E2) + + 0.0700*Math.Sin(E3) + - 0.0172*Math.Sin(E4) + + 0.0072*Math.Sin(E6) + - 0.0052*Math.Sin(E10) + + 0.0043*Math.Sin(E13) + ); + + dec = ( + 66.5392 + 0.0130*T + + 1.5419*Math.Cos(E1) + + 0.0239*Math.Cos(E2) + - 0.0278*Math.Cos(E3) + + 0.0068*Math.Cos(E4) + - 0.0029*Math.Cos(E6) + + 0.0009*Math.Cos(E7) + + 0.0008*Math.Cos(E10) + - 0.0009*Math.Cos(E13) + ); + + w = ( + 38.3213 + (13.17635815 - 1.4e-12*d)*d + + 3.5610*Math.Sin(E1) + + 0.1208*Math.Sin(E2) + - 0.0642*Math.Sin(E3) + + 0.0158*Math.Sin(E4) + + 0.0252*Math.Sin(E5) + - 0.0066*Math.Sin(E6) + - 0.0047*Math.Sin(E7) + - 0.0046*Math.Sin(E8) + + 0.0028*Math.Sin(E9) + + 0.0052*Math.Sin(E10) + + 0.0040*Math.Sin(E11) + + 0.0019*Math.Sin(E12) + - 0.0044*Math.Sin(E13) + ); + break; + case Body.Mars: ra = ( 317.269202 - 0.10927547*T diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index bc127331..73c098d9 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -6347,7 +6347,7 @@ def Libration(time): diam_deg = 2.0 * math.degrees(math.atan(_MOON_MEAN_RADIUS_KM / math.sqrt(dist_km*dist_km - _MOON_MEAN_RADIUS_KM*_MOON_MEAN_RADIUS_KM))) # Inclination angle - I = math.radians(1.54242) + I = math.radians(1.543) # Moon's argument of latitude in radians. f = math.radians(_NormalizeLongitude(93.2720950 + 483202.0175233*t - 0.0036539*t2 - t3/3526000 + t4/863310000)) @@ -6515,7 +6515,7 @@ def RotationAxis(body, time): Parameters: body : Body One of the following values: - `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. time : Time @@ -6550,6 +6550,62 @@ def RotationAxis(body, time): w = 160.20 - (1.4813688 * d) elif body == Body.Earth: return _EarthRotationAxis(time) + elif body == Body.Moon: + # See page 8, Table 2 in: + # https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + E1 = math.radians(125.045 - 0.0529921*d) + E2 = math.radians(250.089 - 0.1059842*d) + E3 = math.radians(260.008 + 13.0120009*d) + E4 = math.radians(176.625 + 13.3407154*d) + E5 = math.radians(357.529 + 0.9856003*d) + E6 = math.radians(311.589 + 26.4057084*d) + E7 = math.radians(134.963 + 13.0649930*d) + E8 = math.radians(276.617 + 0.3287146*d) + E9 = math.radians(34.226 + 1.7484877*d) + E10 = math.radians(15.134 - 0.1589763*d) + E11 = math.radians(119.743 + 0.0036096*d) + E12 = math.radians(239.961 + 0.1643573*d) + E13 = math.radians(25.053 + 12.9590088*d) + + ra = ( + 269.9949 + 0.0031*T + - 3.8787*math.sin(E1) + - 0.1204*math.sin(E2) + + 0.0700*math.sin(E3) + - 0.0172*math.sin(E4) + + 0.0072*math.sin(E6) + - 0.0052*math.sin(E10) + + 0.0043*math.sin(E13) + ) + + dec = ( + 66.5392 + 0.0130*T + + 1.5419*math.cos(E1) + + 0.0239*math.cos(E2) + - 0.0278*math.cos(E3) + + 0.0068*math.cos(E4) + - 0.0029*math.cos(E6) + + 0.0009*math.cos(E7) + + 0.0008*math.cos(E10) + - 0.0009*math.cos(E13) + ) + + w = ( + 38.3213 + (13.17635815 - 1.4e-12*d)*d + + 3.5610*math.sin(E1) + + 0.1208*math.sin(E2) + - 0.0642*math.sin(E3) + + 0.0158*math.sin(E4) + + 0.0252*math.sin(E5) + - 0.0066*math.sin(E6) + - 0.0047*math.sin(E7) + - 0.0046*math.sin(E8) + + 0.0028*math.sin(E9) + + 0.0052*math.sin(E10) + + 0.0040*math.sin(E11) + + 0.0019*math.sin(E12) + - 0.0044*math.sin(E13) + ) elif body == Body.Mars: ra = ( 317.269202 - 0.10927547*T diff --git a/generate/template/astronomy.ts b/generate/template/astronomy.ts index f64caab2..1a4e1798 100644 --- a/generate/template/astronomy.ts +++ b/generate/template/astronomy.ts @@ -926,7 +926,7 @@ export function Libration(date: FlexibleDateTime): LibrationInfo { const dist_km = moon.distance_au * KM_PER_AU; // Inclination angle - const I = DEG2RAD * 1.54242; + const I = DEG2RAD * 1.543; // Moon's argument of latitude in radians. const f = DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233*t - 0.0036539*t2 - t3/3526000 + t4/863310000); @@ -6941,7 +6941,7 @@ function EarthRotationAxis(time: AstroTime): AxisInfo { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date @@ -6987,6 +6987,64 @@ export function RotationAxis(body: Body, date: FlexibleDateTime): AxisInfo case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + const E1 = DEG2RAD * (125.045 - 0.0529921*d); + const E2 = DEG2RAD * (250.089 - 0.1059842*d); + const E3 = DEG2RAD * (260.008 + 13.0120009*d); + const E4 = DEG2RAD * (176.625 + 13.3407154*d); + const E5 = DEG2RAD * (357.529 + 0.9856003*d); + const E6 = DEG2RAD * (311.589 + 26.4057084*d); + const E7 = DEG2RAD * (134.963 + 13.0649930*d); + const E8 = DEG2RAD * (276.617 + 0.3287146*d); + const E9 = DEG2RAD * (34.226 + 1.7484877*d); + const E10 = DEG2RAD * (15.134 - 0.1589763*d); + const E11 = DEG2RAD * (119.743 + 0.0036096*d); + const E12 = DEG2RAD * (239.961 + 0.1643573*d); + const E13 = DEG2RAD * (25.053 + 12.9590088*d); + + ra = ( + 269.9949 + 0.0031*T + - 3.8787*Math.sin(E1) + - 0.1204*Math.sin(E2) + + 0.0700*Math.sin(E3) + - 0.0172*Math.sin(E4) + + 0.0072*Math.sin(E6) + - 0.0052*Math.sin(E10) + + 0.0043*Math.sin(E13) + ); + + dec = ( + 66.5392 + 0.0130*T + + 1.5419*Math.cos(E1) + + 0.0239*Math.cos(E2) + - 0.0278*Math.cos(E3) + + 0.0068*Math.cos(E4) + - 0.0029*Math.cos(E6) + + 0.0009*Math.cos(E7) + + 0.0008*Math.cos(E10) + - 0.0009*Math.cos(E13) + ); + + w = ( + 38.3213 + (13.17635815 - 1.4e-12*d)*d + + 3.5610*Math.sin(E1) + + 0.1208*Math.sin(E2) + - 0.0642*Math.sin(E3) + + 0.0158*Math.sin(E4) + + 0.0252*Math.sin(E5) + - 0.0066*Math.sin(E6) + - 0.0047*Math.sin(E7) + - 0.0046*Math.sin(E8) + + 0.0028*Math.sin(E9) + + 0.0052*Math.sin(E10) + + 0.0040*Math.sin(E11) + + 0.0019*Math.sin(E12) + - 0.0044*Math.sin(E13) + ); + break; + case Body.Mars: ra = ( 317.269202 - 0.10927547*T diff --git a/generate/test.js b/generate/test.js index 70fb745f..bf06b7b5 100644 --- a/generate/test.js +++ b/generate/test.js @@ -2460,17 +2460,17 @@ function Libration(filename) { if (diff_diam > max_diff_diam) max_diff_diam = diff_diam; - if (diff_elon > 0.133) { + if (diff_elon > 0.1304) { console.error(`JS Libration(${filename} line ${lnum}): EXCESSIVE diff_elon = ${diff_elon} arcmin`); return 1; } - if (diff_elat > 1.666) { + if (diff_elat > 1.6476) { console.error(`JS Libration(${filename} line ${lnum}): EXCESSIVE diff_elat = ${diff_elat} arcmin`); return 1; } - if (diff_distance > 54.4) { + if (diff_distance > 54.377) { console.error(`JS Libration(${filename} line ${lnum}): EXCESSIVE diff_distance = ${diff_distance} km`); return 1; } @@ -2497,6 +2497,7 @@ function AxisTest() { if (0 !== AxisTestBody(Astronomy.Body.Mercury, "axis/Mercury.txt", 0.074340)) return 1; if (0 !== AxisTestBody(Astronomy.Body.Venus, "axis/Venus.txt", 0.0)) return 1; if (0 !== AxisTestBody(Astronomy.Body.Earth, "axis/Earth.txt", 0.000591)) return 1; + if (0 !== AxisTestBody(Astronomy.Body.Moon, "axis/Moon.txt", 0.264845)) return 1; if (0 !== AxisTestBody(Astronomy.Body.Mars, "axis/Mars.txt", 0.075323)) return 1; if (0 !== AxisTestBody(Astronomy.Body.Jupiter, "axis/Jupiter.txt", 0.000324)) return 1; if (0 !== AxisTestBody(Astronomy.Body.Saturn, "axis/Saturn.txt", 0.000304)) return 1; diff --git a/generate/test.py b/generate/test.py index b401aa57..61562777 100755 --- a/generate/test.py +++ b/generate/test.py @@ -2209,15 +2209,15 @@ def LibrationFile(filename): if diff_diam > max_diff_diam: max_diff_diam = diff_diam - if diff_elon > 0.133: + if diff_elon > 0.1304: print('PY LibrationFile({} line {}): EXCESSIVE diff_elon = {}'.format(filename, lnum, diff_elon)) return 1 - if diff_elat > 1.666: + if diff_elat > 1.6476: print('PY LibrationFile({} line {}): EXCESSIVE diff_elat = {}'.format(filename, lnum, diff_elat)) return 1 - if diff_distance > 54.4: + if diff_distance > 54.377: print('PY LibrationFile({} line {}): EXCESSIVE diff_distance = {}'.format(filename, lnum, diff_distance)) return 1 @@ -2243,6 +2243,7 @@ def Axis(): if AxisTestBody(astronomy.Body.Mercury, 'axis/Mercury.txt', 0.074340) : return 1 if AxisTestBody(astronomy.Body.Venus, 'axis/Venus.txt', 0.0) : return 1 if AxisTestBody(astronomy.Body.Earth, 'axis/Earth.txt', 0.000591) : return 1 + if AxisTestBody(astronomy.Body.Moon, 'axis/Moon.txt', 0.264845) : return 1 if AxisTestBody(astronomy.Body.Mars, 'axis/Mars.txt', 0.075323) : return 1 if AxisTestBody(astronomy.Body.Jupiter, 'axis/Jupiter.txt', 0.000324) : return 1 if AxisTestBody(astronomy.Body.Saturn, 'axis/Saturn.txt', 0.000304) : return 1 diff --git a/source/csharp/README.md b/source/csharp/README.md index 196467c6..17ee53c7 100644 --- a/source/csharp/README.md +++ b/source/csharp/README.md @@ -1320,7 +1320,7 @@ See [`AxisInfo`](#AxisInfo) for more detailed information. | Type | Parameter | Description | | --- | --- | --- | -| [`Body`](#Body) | `body` | One of the following values: `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. | +| [`Body`](#Body) | `body` | One of the following values: `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. | | [`AstroTime`](#AstroTime) | `time` | The time at which to calculate the body's rotation axis. | **Returns:** North pole orientation and body spin angle. diff --git a/source/csharp/astronomy.cs b/source/csharp/astronomy.cs index 59cefb21..15bef96e 100644 --- a/source/csharp/astronomy.cs +++ b/source/csharp/astronomy.cs @@ -4785,7 +4785,7 @@ namespace CosineKitty lib.diam_deg = (2.0 * RAD2DEG) * Math.Atan(MOON_MEAN_RADIUS_KM / Math.Sqrt(lib.dist_km*lib.dist_km - MOON_MEAN_RADIUS_KM*MOON_MEAN_RADIUS_KM)); // Inclination angle - const double I = DEG2RAD * 1.54242; + const double I = DEG2RAD * 1.543; // Moon's argument of latitude in radians. double f = DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233*t - 0.0036539*t2 - t3/3526000 + t4/863310000); @@ -8782,7 +8782,7 @@ namespace CosineKitty /// /// /// One of the following values: - /// `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + /// `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, /// `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. /// /// The time at which to calculate the body's rotation axis. @@ -8824,6 +8824,64 @@ namespace CosineKitty case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + double E1 = DEG2RAD * (125.045 - 0.0529921*d); + double E2 = DEG2RAD * (250.089 - 0.1059842*d); + double E3 = DEG2RAD * (260.008 + 13.0120009*d); + double E4 = DEG2RAD * (176.625 + 13.3407154*d); + double E5 = DEG2RAD * (357.529 + 0.9856003*d); + double E6 = DEG2RAD * (311.589 + 26.4057084*d); + double E7 = DEG2RAD * (134.963 + 13.0649930*d); + double E8 = DEG2RAD * (276.617 + 0.3287146*d); + double E9 = DEG2RAD * (34.226 + 1.7484877*d); + double E10 = DEG2RAD * (15.134 - 0.1589763*d); + double E11 = DEG2RAD * (119.743 + 0.0036096*d); + double E12 = DEG2RAD * (239.961 + 0.1643573*d); + double E13 = DEG2RAD * (25.053 + 12.9590088*d); + + ra = ( + 269.9949 + 0.0031*T + - 3.8787*Math.Sin(E1) + - 0.1204*Math.Sin(E2) + + 0.0700*Math.Sin(E3) + - 0.0172*Math.Sin(E4) + + 0.0072*Math.Sin(E6) + - 0.0052*Math.Sin(E10) + + 0.0043*Math.Sin(E13) + ); + + dec = ( + 66.5392 + 0.0130*T + + 1.5419*Math.Cos(E1) + + 0.0239*Math.Cos(E2) + - 0.0278*Math.Cos(E3) + + 0.0068*Math.Cos(E4) + - 0.0029*Math.Cos(E6) + + 0.0009*Math.Cos(E7) + + 0.0008*Math.Cos(E10) + - 0.0009*Math.Cos(E13) + ); + + w = ( + 38.3213 + (13.17635815 - 1.4e-12*d)*d + + 3.5610*Math.Sin(E1) + + 0.1208*Math.Sin(E2) + - 0.0642*Math.Sin(E3) + + 0.0158*Math.Sin(E4) + + 0.0252*Math.Sin(E5) + - 0.0066*Math.Sin(E6) + - 0.0047*Math.Sin(E7) + - 0.0046*Math.Sin(E8) + + 0.0028*Math.Sin(E9) + + 0.0052*Math.Sin(E10) + + 0.0040*Math.Sin(E11) + + 0.0019*Math.Sin(E12) + - 0.0044*Math.Sin(E13) + ); + break; + case Body.Mars: ra = ( 317.269202 - 0.10927547*T diff --git a/source/js/README.md b/source/js/README.md index 7bbd78d5..e4be2c45 100644 --- a/source/js/README.md +++ b/source/js/README.md @@ -2625,7 +2625,7 @@ See [AxisInfo](#AxisInfo) for more detailed information. | Param | Type | Description | | --- | --- | --- | -| body | [Body](#Body) | One of the following values: `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. | +| body | [Body](#Body) | One of the following values: `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. | | date | [FlexibleDateTime](#FlexibleDateTime) | The time at which to calculate the body's rotation axis. | diff --git a/source/js/astronomy.browser.js b/source/js/astronomy.browser.js index 197fa12f..99595a21 100644 --- a/source/js/astronomy.browser.js +++ b/source/js/astronomy.browser.js @@ -1632,7 +1632,7 @@ function Libration(date) { const mlat = moon.geo_eclip_lat; const dist_km = moon.distance_au * exports.KM_PER_AU; // Inclination angle - const I = exports.DEG2RAD * 1.54242; + const I = exports.DEG2RAD * 1.543; // Moon's argument of latitude in radians. const f = exports.DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233 * t - 0.0036539 * t2 - t3 / 3526000 + t4 / 863310000); // Moon's ascending node's mean longitude in radians. @@ -8093,7 +8093,7 @@ function EarthRotationAxis(time) { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date @@ -8130,6 +8130,54 @@ function RotationAxis(body, date) { break; case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + const E1 = exports.DEG2RAD * (125.045 - 0.0529921 * d); + const E2 = exports.DEG2RAD * (250.089 - 0.1059842 * d); + const E3 = exports.DEG2RAD * (260.008 + 13.0120009 * d); + const E4 = exports.DEG2RAD * (176.625 + 13.3407154 * d); + const E5 = exports.DEG2RAD * (357.529 + 0.9856003 * d); + const E6 = exports.DEG2RAD * (311.589 + 26.4057084 * d); + const E7 = exports.DEG2RAD * (134.963 + 13.0649930 * d); + const E8 = exports.DEG2RAD * (276.617 + 0.3287146 * d); + const E9 = exports.DEG2RAD * (34.226 + 1.7484877 * d); + const E10 = exports.DEG2RAD * (15.134 - 0.1589763 * d); + const E11 = exports.DEG2RAD * (119.743 + 0.0036096 * d); + const E12 = exports.DEG2RAD * (239.961 + 0.1643573 * d); + const E13 = exports.DEG2RAD * (25.053 + 12.9590088 * d); + ra = (269.9949 + 0.0031 * T + - 3.8787 * Math.sin(E1) + - 0.1204 * Math.sin(E2) + + 0.0700 * Math.sin(E3) + - 0.0172 * Math.sin(E4) + + 0.0072 * Math.sin(E6) + - 0.0052 * Math.sin(E10) + + 0.0043 * Math.sin(E13)); + dec = (66.5392 + 0.0130 * T + + 1.5419 * Math.cos(E1) + + 0.0239 * Math.cos(E2) + - 0.0278 * Math.cos(E3) + + 0.0068 * Math.cos(E4) + - 0.0029 * Math.cos(E6) + + 0.0009 * Math.cos(E7) + + 0.0008 * Math.cos(E10) + - 0.0009 * Math.cos(E13)); + w = (38.3213 + (13.17635815 - 1.4e-12 * d) * d + + 3.5610 * Math.sin(E1) + + 0.1208 * Math.sin(E2) + - 0.0642 * Math.sin(E3) + + 0.0158 * Math.sin(E4) + + 0.0252 * Math.sin(E5) + - 0.0066 * Math.sin(E6) + - 0.0047 * Math.sin(E7) + - 0.0046 * Math.sin(E8) + + 0.0028 * Math.sin(E9) + + 0.0052 * Math.sin(E10) + + 0.0040 * Math.sin(E11) + + 0.0019 * Math.sin(E12) + - 0.0044 * Math.sin(E13)); + break; case Body.Mars: ra = (317.269202 - 0.10927547 * T + 0.000068 * Math.sin(exports.DEG2RAD * (198.991226 + 19139.4819985 * T)) diff --git a/source/js/astronomy.browser.min.js b/source/js/astronomy.browser.min.js index a38f4ab9..c929a391 100644 --- a/source/js/astronomy.browser.min.js +++ b/source/js/astronomy.browser.min.js @@ -27,25 +27,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(r){return r.raw=r};$jscomp.createTemplateTagFirstArgWithRaw=function(r,t){r.raw=t;return r};$jscomp.arrayIteratorImpl=function(r){var t=0;return function(){return tMath.abs(c))throw"AngleBetween: first vector is too short.";var d=b.x*b.x+b.y*b.y+b.z*b.z;if(1E-8>Math.abs(d))throw"AngleBetween: second vector is too short.";a=(a.x*b.x+a.y*b.y+a.z*b.z)/Math.sqrt(c*d);return-1>=a?180:1<=a?0:e.RAD2DEG*Math.acos(a)}function N(a){var b=2E3+(a-14)/365.24217;if(-500>b)return a=(b-1820)/100,-20+32*a*a;if(500>b){a=b/100;b=a*a;var c=a*b;return 10583.6-1014.41*a+33.78311*b-5.952053*c-.1798452*b*b+.022174192*b*c+.0090316521*c*c}if(1600>b)return a=(b- 1E3)/100,b=a*a,c=a*b,1574.2-556.01*a+71.23472*b+.319781*c-.8503463*b*b-.005050998*b*c+.0083572073*c*c;if(1700>b)return a=b-1600,b=a*a,120-.9808*a-.01532*b+a*b/7129;if(1800>b)return a=b-1700,b=a*a,8.83+.1603*a-.0059285*b+1.3336E-4*a*b-b*b/1174E3;if(1860>b){a=b-1800;b=a*a;c=a*b;var d=b*b;return 13.72-.332447*a+.0068612*b+.0041116*c-3.7436E-4*d+1.21272E-5*b*c-1.699E-7*c*c+8.75E-10*c*d}if(1900>b)return a=b-1860,b=a*a,c=a*b,7.62+.5737*a-.251754*b+.01680668*c-4.473624E-4*b*b+b*c/233174;if(1920>b)return a= b-1900,b=a*a,-2.79+1.494119*a-.0598939*b+.0061966*a*b-1.97E-4*b*b;if(1941>b)return a=b-1920,b=a*a,21.2+.84493*a-.0761*b+.0020936*a*b;if(1961>b)return a=b-1950,b=a*a,29.07+.407*a-b/233+a*b/2547;if(1986>b)return a=b-1975,b=a*a,45.45+1.067*a-b/260-a*b/718;if(2005>b)return a=b-2E3,b=a*a,c=a*b,63.86+.3345*a-.060374*b+.0017275*c+6.51814E-4*b*b+2.373599E-5*b*c;if(2050>b)return a=b-2E3,62.92+.32217*a+.005589*a*a;if(2150>b)return a=(b-1820)/100,-20+32*a*a-.5628*(2150-b);a=(b-1820)/100;return-20+32*a*a}function Q(a){return a+ -Jb(a)/86400}function w(a){return a instanceof O?a:new O(a)}function xa(a){a=a.tt/36525;return(((((-4.34E-8*a-5.76E-7)*a+.0020034)*a-1.831E-4)*a-46.836769)*a+84381.406)/3600}function Qa(a){var b;if(!Ra||1E-6=D;++D)0!==y[D]&&h(H.x,H.y,c(x,y[D],D),c(C,y[D],D),function(ka,la){return H.x=ka,H.y=la});return H}function g(y, -D,K,W,H,ka,la,ib){H=k(H,ka,la,ib);p+=y*H.y;u+=D*H.y;ya+=K*H.x;da+=W*H.x}++e.CalcMoonCount;a=a.tt/36525;var m,n,p,u,x=b(-6,6,1,4),C=b(-6,6,1,4);var z=a*a;var ya=u=p=0;var da=3422.7;var ea=l(.19833+.05611*a);var X=l(.27869+.04508*a);var R=l(.16827-.36903*a);var V=l(.34734-5.37261*a);var za=l(.10498-5.37899*a);var Sa=l(.42681-.41855*a),Oc=l(.14943-5.37511*a);var Ta=.84*ea+.31*X+14.27*R+7.26*V+.28*za+.24*Sa;var kb=2.94*ea+.31*X+14.27*R+9.34*V+1.12*za+.83*Sa;var Ua=-6.4*ea-1.89*Sa;X=.21*ea+.31*X+14.27* -R-88.7*V-15.3*za+.24*Sa-1.86*Oc;R=Ta-Ua;ea=-3.332E-6*l(.59734-5.37261*a)-5.39E-7*l(.35498-5.37899*a)-6.4E-8*l(.39943-5.37511*a);Ta=P*M(.60643382+1336.85522467*a-3.13E-6*z)+Ta/Y;kb=P*M(.37489701+1325.55240982*a+2.565E-5*z)+kb/Y;Ua=P*M(.99312619+99.99735956*a-4.4E-7*z)+Ua/Y;X=P*M(.25909118+1342.2278298*a-8.92E-6*z)+X/Y;za=P*M(.82736186+1236.85308708*a-3.97E-6*z)+R/Y;for(m=1;4>=m;++m){switch(m){case 1:R=kb;z=4;V=1.000002208;break;case 2:R=Ua;z=3;V=.997504612-.002495388*a;break;case 3:R=X;z=4;V=1.000002708+ -139.978*ea;break;case 4:R=za;z=6;V=1;break;default:throw"Internal error: I = "+m;}d(0,m,1);d(1,m,Math.cos(R)*V);f(0,m,0);f(1,m,Math.sin(R)*V);for(n=2;n<=z;++n)h(c(x,n-1,m),c(C,n-1,m),c(x,1,m),c(C,1,m),function(y,D){return d(n,m,y),f(n,m,D)});for(n=1;n<=z;++n)d(-n,m,c(x,n,m)),f(-n,m,-c(C,n,m))}g(13.902,14.06,-.001,.2607,0,0,0,4);g(.403,-4.01,.394,.0023,0,0,0,3);g(2369.912,2373.36,.601,28.2333,0,0,0,2);g(-125.154,-112.79,-.725,-.9781,0,0,0,1);g(1.979,6.98,-.445,.0433,1,0,0,4);g(191.953,192.72,.029, +Jb(a)/86400}function w(a){return a instanceof O?a:new O(a)}function ya(a){a=a.tt/36525;return(((((-4.34E-8*a-5.76E-7)*a+.0020034)*a-1.831E-4)*a-46.836769)*a+84381.406)/3600}function Qa(a){var b;if(!Ra||1E-6=D;++D)0!==y[D]&&h(H.x,H.y,c(x,y[D],D),c(A,y[D],D),function(la,ma){return H.x=la,H.y=ma});return H}function g(y, +D,K,X,H,la,ma,ib){H=k(H,la,ma,ib);p+=y*H.y;t+=D*H.y;ea+=K*H.x;R+=X*H.x}++e.CalcMoonCount;a=a.tt/36525;var m,n,p,t,x=b(-6,6,1,4),A=b(-6,6,1,4);var z=a*a;var ea=t=p=0;var R=3422.7;var fa=l(.19833+.05611*a);var Y=l(.27869+.04508*a);var S=l(.16827-.36903*a);var W=l(.34734-5.37261*a);var za=l(.10498-5.37899*a);var Sa=l(.42681-.41855*a),Oc=l(.14943-5.37511*a);var Ta=.84*fa+.31*Y+14.27*S+7.26*W+.28*za+.24*Sa;var kb=2.94*fa+.31*Y+14.27*S+9.34*W+1.12*za+.83*Sa;var Ua=-6.4*fa-1.89*Sa;Y=.21*fa+.31*Y+14.27*S- +88.7*W-15.3*za+.24*Sa-1.86*Oc;S=Ta-Ua;fa=-3.332E-6*l(.59734-5.37261*a)-5.39E-7*l(.35498-5.37899*a)-6.4E-8*l(.39943-5.37511*a);Ta=P*M(.60643382+1336.85522467*a-3.13E-6*z)+Ta/Z;kb=P*M(.37489701+1325.55240982*a+2.565E-5*z)+kb/Z;Ua=P*M(.99312619+99.99735956*a-4.4E-7*z)+Ua/Z;Y=P*M(.25909118+1342.2278298*a-8.92E-6*z)+Y/Z;za=P*M(.82736186+1236.85308708*a-3.97E-6*z)+S/Z;for(m=1;4>=m;++m){switch(m){case 1:S=kb;z=4;W=1.000002208;break;case 2:S=Ua;z=3;W=.997504612-.002495388*a;break;case 3:S=Y;z=4;W=1.000002708+ +139.978*fa;break;case 4:S=za;z=6;W=1;break;default:throw"Internal error: I = "+m;}d(0,m,1);d(1,m,Math.cos(S)*W);f(0,m,0);f(1,m,Math.sin(S)*W);for(n=2;n<=z;++n)h(c(x,n-1,m),c(A,n-1,m),c(x,1,m),c(A,1,m),function(y,D){return d(n,m,y),f(n,m,D)});for(n=1;n<=z;++n)d(-n,m,c(x,n,m)),f(-n,m,-c(A,n,m))}g(13.902,14.06,-.001,.2607,0,0,0,4);g(.403,-4.01,.394,.0023,0,0,0,3);g(2369.912,2373.36,.601,28.2333,0,0,0,2);g(-125.154,-112.79,-.725,-.9781,0,0,0,1);g(1.979,6.98,-.445,.0433,1,0,0,4);g(191.953,192.72,.029, 3.0861,1,0,0,2);g(-8.466,-13.51,.455,-.1093,1,0,0,1);g(22639.5,22609.07,.079,186.5398,1,0,0,0);g(18.609,3.59,-.094,.0118,1,0,0,-1);g(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2);g(3.215,5.44,.192,-.0386,1,0,0,-3);g(-38.428,-38.64,.001,.6008,1,0,0,-4);g(-.393,-1.43,-.092,.0086,1,0,0,-6);g(-.289,-1.59,.123,-.0053,0,1,0,4);g(-24.42,-25.1,.04,-.3,0,1,0,2);g(18.023,17.93,.007,.1494,0,1,0,1);g(-668.146,-126.98,-1.302,-.3997,0,1,0,0);g(.56,.32,-.001,-.0037,0,1,0,-1);g(-165.145,-165.06,.054,1.9178,0,1,0,-2); g(-1.877,-6.46,-.416,.0339,0,1,0,-4);g(.213,1.02,-.074,.0054,2,0,0,4);g(14.387,14.78,-.017,.2833,2,0,0,2);g(-.586,-1.2,.054,-.01,2,0,0,1);g(769.016,767.96,.107,10.1657,2,0,0,0);g(1.75,2.01,-.018,.0155,2,0,0,-1);g(-211.656,-152.53,5.679,-.3039,2,0,0,-2);g(1.225,.91,-.03,-.0088,2,0,0,-3);g(-30.773,-34.07,-.308,.3722,2,0,0,-4);g(-.57,-1.4,-.074,.0109,2,0,0,-6);g(-2.921,-11.75,.787,-.0484,1,1,0,2);g(1.267,1.52,-.022,.0164,1,1,0,1);g(-109.673,-115.18,.461,-.949,1,1,0,0);g(-205.962,-182.36,2.056,1.4437, 1,1,0,-2);g(.233,.36,.012,-.0025,1,1,0,-3);g(-4.391,-9.66,-.471,.0673,1,1,0,-4);g(.283,1.53,-.111,.006,1,-1,0,4);g(14.577,31.7,-1.54,.2302,1,-1,0,2);g(147.687,138.76,.679,1.1528,1,-1,0,0);g(-1.089,.55,.021,0,1,-1,0,-1);g(28.475,23.59,-.443,-.2257,1,-1,0,-2);g(-.276,-.38,-.006,-.0036,1,-1,0,-3);g(.636,2.27,.146,-.0102,1,-1,0,-4);g(-.189,-1.68,.131,-.0028,0,2,0,2);g(-7.486,-.66,-.037,-.0086,0,2,0,0);g(-8.096,-16.35,-.74,.0918,0,2,0,-2);g(-5.741,-.04,0,-9E-4,0,0,2,2);g(.255,0,0,0,0,0,2,1);g(-411.608, @@ -53,62 +53,62 @@ g(-1.877,-6.46,-.416,.0339,0,1,0,-4);g(.213,1.02,-.074,.0054,2,0,0,4);g(14.387,1 g(9.703,11.67,-.151,.1268,2,-1,0,0);g(-.352,-.37,.001,-.0028,2,-1,0,-1);g(-2.494,-1.17,-.003,-.0017,2,-1,0,-2);g(.36,.2,-.012,-.0043,2,-1,0,-4);g(-1.167,-1.25,.008,-.0106,1,2,0,0);g(-7.412,-6.12,.117,.0484,1,2,0,-2);g(-.311,-.65,-.032,.0044,1,2,0,-4);g(.757,1.82,-.105,.0112,1,-2,0,2);g(2.58,2.32,.027,.0196,1,-2,0,0);g(2.533,2.4,-.014,-.0212,1,-2,0,-2);g(-.344,-.57,-.025,.0036,0,3,0,-2);g(-.992,-.02,0,0,1,0,2,2);g(-45.099,-.02,0,-.001,1,0,2,0);g(-.179,-9.52,0,-.0833,1,0,2,-2);g(-.301,-.33,0,.0014, 1,0,2,-4);g(-6.382,-3.37,0,-.0481,1,0,-2,2);g(39.528,85.13,0,-.7136,1,0,-2,0);g(9.366,.71,0,-.0112,1,0,-2,-2);g(.202,.02,0,0,1,0,-2,-4);g(.415,.1,0,.0013,0,1,2,0);g(-2.152,-2.26,0,-.0066,0,1,2,-2);g(-1.44,-1.3,0,.0014,0,1,-2,2);g(.384,-.04,0,0,0,1,-2,-2);g(1.938,3.6,-.145,.0401,4,0,0,0);g(-.952,-1.58,.052,-.013,4,0,0,-2);g(-.551,-.94,.032,-.0097,3,1,0,0);g(-.482,-.57,.005,-.0045,3,1,0,-2);g(.681,.96,-.026,.0115,3,-1,0,0);g(-.297,-.27,.002,-9E-4,2,2,0,-2);g(.254,.21,-.003,0,2,-2,0,-2);g(-.25,-.22, .004,.0014,1,3,0,-2);g(-3.996,0,0,4E-4,2,0,2,0);g(.557,-.75,0,-.009,2,0,2,-2);g(-.459,-.38,0,-.0053,2,0,-2,2);g(-1.298,.74,0,4E-4,2,0,-2,0);g(.538,1.14,0,-.0141,2,0,-2,-2);g(.263,.02,0,0,1,1,2,0);g(.426,.07,0,-6E-4,1,1,-2,-2);g(-.304,.03,0,3E-4,1,-1,2,0);g(-.372,-.19,0,-.0027,1,-1,-2,2);g(.418,0,0,0,0,0,4,0);g(-.33,-.04,0,0,3,0,2,0);z=-526.069*k(0,0,1,-2).y;z+=-3.352*k(0,0,1,-4).y;z+=44.297*k(1,0,1,-2).y;z+=-6*k(1,0,1,-4).y;z+=20.599*k(-1,0,1,0).y;z+=-30.598*k(-1,0,1,-2).y;z+=-24.649*k(-2,0,1,0).y; -z+=-2*k(-2,0,1,-2).y;z+=-22.571*k(0,1,1,-2).y;z+=10.985*k(0,-1,1,-2).y;p+=.82*l(.7736-62.5512*a)+.31*l(.0466-125.1025*a)+.35*l(.5785-25.1042*a)+.66*l(.4591+1335.8075*a)+.64*l(.313-91.568*a)+1.14*l(.148+1331.2898*a)+.21*l(.5918+1056.5859*a)+.44*l(.5784+1322.8595*a)+.24*l(.2275-5.7374*a)+.28*l(.2965+2.6929*a)+.33*l(.3132+6.3368*a);a=X+u/Y;a=(1.000002708+139.978*ea)*(18518.511+1.189+ya)*Math.sin(a)-6.24*Math.sin(3*a)+z;return{geo_eclip_lon:P*M((Ta+p/Y)/P),geo_eclip_lat:Math.PI/648E3*a,distance_au:Y* -Pc/(.999953253*da)}}function Nb(a,b){return[a.rot[0][0]*b[0]+a.rot[1][0]*b[1]+a.rot[2][0]*b[2],a.rot[0][1]*b[0]+a.rot[1][1]*b[1]+a.rot[2][1]*b[2],a.rot[0][2]*b[0]+a.rot[1][2]*b[1]+a.rot[2][2]*b[2]]}function Aa(a,b,c){b=Ba(b,c);return Nb(b,a)}function Ba(a,b){a=a.tt/36525;var c=84381.406,d=((((3.337E-7*a-4.67E-7)*a-.00772503)*a+.0512623)*a-.025754)*a+c;c*=4.84813681109536E-6;var f=((((-9.51E-8*a+1.32851E-4)*a-.00114045)*a-1.0790069)*a+5038.481507)*a*4.84813681109536E-6;d*=4.84813681109536E-6;var h= -((((-5.6E-8*a+1.70663E-4)*a-.00121197)*a-2.3814292)*a+10.556403)*a*4.84813681109536E-6;a=Math.sin(c);c=Math.cos(c);var l=Math.sin(-f);f=Math.cos(-f);var k=Math.sin(-d);d=Math.cos(-d);var g=Math.sin(h),m=Math.cos(h);h=m*f-l*g*d;var n=m*l*c+g*d*f*c-a*g*k,p=m*l*a+g*d*f*a+c*g*k,u=-g*f-l*m*d,x=-g*l*c+m*d*f*c-a*m*k;g=-g*l*a+m*d*f*a+c*m*k;l*=k;m=-k*f*c-a*d;a=-k*f*a+d*c;if(b===E.Into2000)return new J([[h,n,p],[u,x,g],[l,m,a]]);if(b===E.From2000)return new J([[h,u,l],[n,x,m],[p,g,a]]);throw"Invalid precess direction"; -}function Z(a){var b=a.tt/36525,c=15*Qa(a).ee;a=(.779057273264+.00273781191135448*a.ut+a.ut%1)%1*360;0>a&&(a+=360);b=((c+.014506+((((-3.68E-8*b-2.9956E-5)*b-4.4E-7)*b+1.3915817)*b+4612.156534)*b)/3600+a)%360/15;0>b&&(b+=24);return b}function lb(a,b){var c=a.latitude*e.DEG2RAD,d=Math.sin(c);c=Math.cos(c);var f=1/Math.sqrt(c*c+.9933056020041345*d*d),h=a.height/1E3,l=6378.1366*f+h;b=(15*b+a.longitude)*e.DEG2RAD;a=Math.sin(b);b=Math.cos(b);return{pos:[l*c*b/e.KM_PER_AU,l*c*a/e.KM_PER_AU,(6335.438815127603* -f+h)*d/e.KM_PER_AU],vel:[-7.292115E-5*l*c*a*86400/e.KM_PER_AU,7.292115E-5*l*c*b*86400/e.KM_PER_AU,0]}}function Va(a,b,c){b=Ca(b,c);return Nb(b,a)}function Ca(a,b){a=Qa(a);var c=a.mobl*e.DEG2RAD,d=a.tobl*e.DEG2RAD,f=4.84813681109536E-6*a.dpsi;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d),l=Math.sin(d);d=Math.cos(f);var k=Math.sin(f);f=-k*a;var g=-k*c,m=k*h,n=d*a*h+c*l,p=d*c*h-a*l;k*=l;var u=d*a*l-c*h;a=d*c*l+a*h;if(b===E.From2000)return new J([[d,m,k],[f,n,u],[g,p,a]]);if(b===E.Into2000)return new J([[d, -f,g],[m,n,p],[k,u,a]]);throw"Invalid precess direction";}function Wa(a,b,c){return c===E.Into2000?Aa(Va(a,b,c),b,c):Va(Aa(a,b,c),b,c)}function Ob(a,b){var c=Z(a);b=lb(b,c).pos;return Wa(b,a,E.Into2000)}function Qc(a){if(!(a instanceof Array)||3!==a.length)return!1;for(var b=0;3>b;++b){if(!(a[b]instanceof Array)||3!==a[b].length)return!1;for(var c=0;3>c;++c)if(!Number.isFinite(a[b][c]))return!1}return!0}function Pb(a,b){b=new B(a[0],a[1],a[2],b);var c=b.x*b.x+b.y*b.y,d=Math.sqrt(c+b.z*b.z);if(0=== -c){if(0===b.z)throw"Indeterminate sky coordinates";return new Xa(0,0>b.z?-90:90,d,b)}var f=e.RAD2HOUR*Math.atan2(b.y,b.x);0>f&&(f+=24);return new Xa(f,e.RAD2DEG*Math.atan2(a[2],Math.sqrt(c)),d,b)}function ma(a,b){var c=a*e.DEG2RAD;a=Math.cos(c);c=Math.sin(c);return[a*b[0]+c*b[1],a*b[1]-c*b[0],b[2]]}function Da(a,b,c,d,f){a=w(a);na(b);v(c);v(d);var h=Math.sin(b.latitude*e.DEG2RAD),l=Math.cos(b.latitude*e.DEG2RAD),k=Math.sin(b.longitude*e.DEG2RAD),g=Math.cos(b.longitude*e.DEG2RAD);b=Math.sin(d*e.DEG2RAD); -var m=Math.cos(d*e.DEG2RAD),n=Math.sin(c*e.HOUR2RAD),p=Math.cos(c*e.HOUR2RAD),u=[l*g,l*k,h];h=[-h*g,-h*k,l];k=[k,-g,0];l=-15*Z(a);a=ma(l,u);u=ma(l,h);k=ma(l,k);b=[m*p,m*n,b];n=b[0]*a[0]+b[1]*a[1]+b[2]*a[2];m=b[0]*u[0]+b[1]*u[1]+b[2]*u[2];u=b[0]*k[0]+b[1]*k[1]+b[2]*k[2];p=Math.sqrt(m*m+u*u);0m&&(m+=360)):m=0;n=e.RAD2DEG*Math.atan2(p,n);p=d;if(f&&(d=n,f=Ea(f,90-n),n-=f,0k;++k)f.push((b[k]-d*a[k])/u*c+a[k]*p);p=Math.sqrt(f[0]*f[0]+f[1]*f[1]);0c&&(c+=24)):c=0;p=e.RAD2DEG*Math.atan2(f[2],p)}return new Qb(m,90-n,c,p)}function na(a){if(!(a instanceof mb))throw"Not an instance of the Observer class: "+a;v(a.latitude);v(a.longitude);v(a.height);if(-90>a.latitude||90b&&(b+=360));h=e.RAD2DEG* -Math.atan2(c,h);a=new B(d,f,c,a.t);return new Tb(a,h,b)}function Ga(a){void 0===Ya&&(Ya=e.DEG2RAD*Qa(w(nb)).mobl,Ub=Math.cos(Ya),Vb=Math.sin(Ya));return Sb(a,Ub,Vb)}function U(a){a=w(a);var b=ca(a),c=b.distance_au*Math.cos(b.geo_eclip_lat);b=[c*Math.cos(b.geo_eclip_lon),c*Math.sin(b.geo_eclip_lon),b.distance_au*Math.sin(b.geo_eclip_lat)];var d=xa(a)*e.DEG2RAD;c=Math.cos(d);d=Math.sin(d);b=Aa([b[0],b[1]*c-b[2]*d,b[1]*d+b[2]*c],a,E.Into2000);return new B(b[0],b[1],b[2],a)}function Za(a){a=w(a);var b= -a.AddDays(-1E-5),c=a.AddDays(1E-5);b=U(b);c=U(c);return new L((b.x+c.x)/2,(b.y+c.y)/2,(b.z+c.z)/2,(c.x-b.x)/2E-5,(c.y-b.y)/2E-5,(c.z-b.z)/2E-5,a)}function ob(a){a=w(a);var b=Za(a);return new L(b.x/82.30056,b.y/82.30056,b.z/82.30056,b.vx/82.30056,b.vy/82.30056,b.vz/82.30056,a)}function fa(a,b,c){var d=1,f=0;a=$jscomp.makeIterator(a);for(var h=a.next();!h.done;h=a.next()){var l=0;h=$jscomp.makeIterator(h.value);for(var k=h.next();!k.done;k=h.next()){var g=$jscomp.makeIterator(k.value);k=g.next().value; +z+=-2*k(-2,0,1,-2).y;z+=-22.571*k(0,1,1,-2).y;z+=10.985*k(0,-1,1,-2).y;p+=.82*l(.7736-62.5512*a)+.31*l(.0466-125.1025*a)+.35*l(.5785-25.1042*a)+.66*l(.4591+1335.8075*a)+.64*l(.313-91.568*a)+1.14*l(.148+1331.2898*a)+.21*l(.5918+1056.5859*a)+.44*l(.5784+1322.8595*a)+.24*l(.2275-5.7374*a)+.28*l(.2965+2.6929*a)+.33*l(.3132+6.3368*a);a=Y+t/Z;a=(1.000002708+139.978*fa)*(18518.511+1.189+ea)*Math.sin(a)-6.24*Math.sin(3*a)+z;return{geo_eclip_lon:P*M((Ta+p/Z)/P),geo_eclip_lat:Math.PI/648E3*a,distance_au:Z* +Pc/(.999953253*R)}}function Nb(a,b){return[a.rot[0][0]*b[0]+a.rot[1][0]*b[1]+a.rot[2][0]*b[2],a.rot[0][1]*b[0]+a.rot[1][1]*b[1]+a.rot[2][1]*b[2],a.rot[0][2]*b[0]+a.rot[1][2]*b[1]+a.rot[2][2]*b[2]]}function Aa(a,b,c){b=Ba(b,c);return Nb(b,a)}function Ba(a,b){a=a.tt/36525;var c=84381.406,d=((((3.337E-7*a-4.67E-7)*a-.00772503)*a+.0512623)*a-.025754)*a+c;c*=4.84813681109536E-6;var f=((((-9.51E-8*a+1.32851E-4)*a-.00114045)*a-1.0790069)*a+5038.481507)*a*4.84813681109536E-6;d*=4.84813681109536E-6;var h= +((((-5.6E-8*a+1.70663E-4)*a-.00121197)*a-2.3814292)*a+10.556403)*a*4.84813681109536E-6;a=Math.sin(c);c=Math.cos(c);var l=Math.sin(-f);f=Math.cos(-f);var k=Math.sin(-d);d=Math.cos(-d);var g=Math.sin(h),m=Math.cos(h);h=m*f-l*g*d;var n=m*l*c+g*d*f*c-a*g*k,p=m*l*a+g*d*f*a+c*g*k,t=-g*f-l*m*d,x=-g*l*c+m*d*f*c-a*m*k;g=-g*l*a+m*d*f*a+c*m*k;l*=k;m=-k*f*c-a*d;a=-k*f*a+d*c;if(b===E.Into2000)return new J([[h,n,p],[t,x,g],[l,m,a]]);if(b===E.From2000)return new J([[h,t,l],[n,x,m],[p,g,a]]);throw"Invalid precess direction"; +}function aa(a){var b=a.tt/36525,c=15*Qa(a).ee;a=(.779057273264+.00273781191135448*a.ut+a.ut%1)%1*360;0>a&&(a+=360);b=((c+.014506+((((-3.68E-8*b-2.9956E-5)*b-4.4E-7)*b+1.3915817)*b+4612.156534)*b)/3600+a)%360/15;0>b&&(b+=24);return b}function lb(a,b){var c=a.latitude*e.DEG2RAD,d=Math.sin(c);c=Math.cos(c);var f=1/Math.sqrt(c*c+.9933056020041345*d*d),h=a.height/1E3,l=6378.1366*f+h;b=(15*b+a.longitude)*e.DEG2RAD;a=Math.sin(b);b=Math.cos(b);return{pos:[l*c*b/e.KM_PER_AU,l*c*a/e.KM_PER_AU,(6335.438815127603* +f+h)*d/e.KM_PER_AU],vel:[-7.292115E-5*l*c*a*86400/e.KM_PER_AU,7.292115E-5*l*c*b*86400/e.KM_PER_AU,0]}}function Va(a,b,c){b=Ca(b,c);return Nb(b,a)}function Ca(a,b){a=Qa(a);var c=a.mobl*e.DEG2RAD,d=a.tobl*e.DEG2RAD,f=4.84813681109536E-6*a.dpsi;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d),l=Math.sin(d);d=Math.cos(f);var k=Math.sin(f);f=-k*a;var g=-k*c,m=k*h,n=d*a*h+c*l,p=d*c*h-a*l;k*=l;var t=d*a*l-c*h;a=d*c*l+a*h;if(b===E.From2000)return new J([[d,m,k],[f,n,t],[g,p,a]]);if(b===E.Into2000)return new J([[d, +f,g],[m,n,p],[k,t,a]]);throw"Invalid precess direction";}function Wa(a,b,c){return c===E.Into2000?Aa(Va(a,b,c),b,c):Va(Aa(a,b,c),b,c)}function Ob(a,b){var c=aa(a);b=lb(b,c).pos;return Wa(b,a,E.Into2000)}function Qc(a){if(!(a instanceof Array)||3!==a.length)return!1;for(var b=0;3>b;++b){if(!(a[b]instanceof Array)||3!==a[b].length)return!1;for(var c=0;3>c;++c)if(!Number.isFinite(a[b][c]))return!1}return!0}function Pb(a,b){b=new C(a[0],a[1],a[2],b);var c=b.x*b.x+b.y*b.y,d=Math.sqrt(c+b.z*b.z);if(0=== +c){if(0===b.z)throw"Indeterminate sky coordinates";return new Xa(0,0>b.z?-90:90,d,b)}var f=e.RAD2HOUR*Math.atan2(b.y,b.x);0>f&&(f+=24);return new Xa(f,e.RAD2DEG*Math.atan2(a[2],Math.sqrt(c)),d,b)}function na(a,b){var c=a*e.DEG2RAD;a=Math.cos(c);c=Math.sin(c);return[a*b[0]+c*b[1],a*b[1]-c*b[0],b[2]]}function Da(a,b,c,d,f){a=w(a);oa(b);v(c);v(d);var h=Math.sin(b.latitude*e.DEG2RAD),l=Math.cos(b.latitude*e.DEG2RAD),k=Math.sin(b.longitude*e.DEG2RAD),g=Math.cos(b.longitude*e.DEG2RAD);b=Math.sin(d*e.DEG2RAD); +var m=Math.cos(d*e.DEG2RAD),n=Math.sin(c*e.HOUR2RAD),p=Math.cos(c*e.HOUR2RAD),t=[l*g,l*k,h];h=[-h*g,-h*k,l];k=[k,-g,0];l=-15*aa(a);a=na(l,t);t=na(l,h);k=na(l,k);b=[m*p,m*n,b];n=b[0]*a[0]+b[1]*a[1]+b[2]*a[2];m=b[0]*t[0]+b[1]*t[1]+b[2]*t[2];t=b[0]*k[0]+b[1]*k[1]+b[2]*k[2];p=Math.sqrt(m*m+t*t);0m&&(m+=360)):m=0;n=e.RAD2DEG*Math.atan2(p,n);p=d;if(f&&(d=n,f=Ea(f,90-n),n-=f,0k;++k)f.push((b[k]-d*a[k])/t*c+a[k]*p);p=Math.sqrt(f[0]*f[0]+f[1]*f[1]);0c&&(c+=24)):c=0;p=e.RAD2DEG*Math.atan2(f[2],p)}return new Qb(m,90-n,c,p)}function oa(a){if(!(a instanceof mb))throw"Not an instance of the Observer class: "+a;v(a.latitude);v(a.longitude);v(a.height);if(-90>a.latitude||90b&&(b+=360));h=e.RAD2DEG* +Math.atan2(c,h);a=new C(d,f,c,a.t);return new Tb(a,h,b)}function Ga(a){void 0===Ya&&(Ya=e.DEG2RAD*Qa(w(nb)).mobl,Ub=Math.cos(Ya),Vb=Math.sin(Ya));return Sb(a,Ub,Vb)}function V(a){a=w(a);var b=da(a),c=b.distance_au*Math.cos(b.geo_eclip_lat);b=[c*Math.cos(b.geo_eclip_lon),c*Math.sin(b.geo_eclip_lon),b.distance_au*Math.sin(b.geo_eclip_lat)];var d=ya(a)*e.DEG2RAD;c=Math.cos(d);d=Math.sin(d);b=Aa([b[0],b[1]*c-b[2]*d,b[1]*d+b[2]*c],a,E.Into2000);return new C(b[0],b[1],b[2],a)}function Za(a){a=w(a);var b= +a.AddDays(-1E-5),c=a.AddDays(1E-5);b=V(b);c=V(c);return new L((b.x+c.x)/2,(b.y+c.y)/2,(b.z+c.z)/2,(c.x-b.x)/2E-5,(c.y-b.y)/2E-5,(c.z-b.z)/2E-5,a)}function ob(a){a=w(a);var b=Za(a);return new L(b.x/82.30056,b.y/82.30056,b.z/82.30056,b.vx/82.30056,b.vy/82.30056,b.vz/82.30056,a)}function ha(a,b,c){var d=1,f=0;a=$jscomp.makeIterator(a);for(var h=a.next();!h.done;h=a.next()){var l=0;h=$jscomp.makeIterator(h.value);for(var k=h.next();!k.done;k=h.next()){var g=$jscomp.makeIterator(k.value);k=g.next().value; var m=g.next().value;g=g.next().value;l+=k*Math.cos(m+b*g)}l*=d;c&&(l%=P);f+=l;d*=b}return f}function pb(a,b){var c=1,d=0,f=0,h=0;a=$jscomp.makeIterator(a);for(var l=a.next();!l.done;l=a.next()){var k=0,g=0;l=$jscomp.makeIterator(l.value);for(var m=l.next();!m.done;m=l.next()){var n=$jscomp.makeIterator(m.value);m=n.next().value;var p=n.next().value;n=n.next().value;p+=b*n;k+=m*n*Math.sin(p);0a?0:a>=b?b-1:a}function sb(a){var b=$jscomp.makeIterator(a);a=b.next().value;var c=$jscomp.makeIterator(b.next().value);var d=c.next().value;var f=c.next().value;c=c.next().value;var h= -$jscomp.makeIterator(b.next().value);b=h.next().value;var l=h.next().value;h=h.next().value;d=new $a(a,new F(d,f,c),new F(b,l,h));a=new oa(d.tt);f=d.r.add(a.Sun.r);c=d.v.add(a.Sun.v);b=a.Acceleration(f);d=new Yb(d.tt,f,c,b);return new Zb(a,d)}function ac(a,b,c){a=sb(a);for(var d=Math.ceil((b-a.grav.tt)/c),f=0;fha[50][0])c=null;else{c=$b((c-d)/29200,50);if(!ub[c]){d=ub[c]=[];d[0]=sb(ha[c]).grav; -d[200]=sb(ha[c+1]).grav;var f,h=d[0].tt;for(f=1;200>f;++f)d[f]=rb(h+=146,d[f-1]).grav;h=d[200].tt;var l=[];l[200]=d[200];for(f=199;0k;++k){f=Ja(a,l);c?d=S(G.Earth,l):d||(d=S(G.Earth,b));f=new B(f.x-d.x,f.y-d.y,f.z-d.z,b);var g=b.AddDays(-f.Length()/e.C_AUDAY);h=Math.abs(g.tt-l.tt);if(1E-9>h)return f;l=g}throw"Light-travel time solver did not converge: dt="+h;}function pa(a,b){return new L(a.r.x,a.r.y,a.r.z,a.v.x,a.v.y,a.v.z,b)}function Rc(a,b,c,d,f){var h=(f+c)/2-d;c=(f-c)/2;if(0==h){if(0==c)return null;d=-d/c;if(-1>d||1=d)return null;f=Math.sqrt(d);d=(-c+f)/(2*h);f=(-c- -f)/(2*h);if(-1<=d&&1>=d){if(-1<=f&&1>=f)return null}else if(-1<=f&&1>=f)d=f;else return null}return{x:d,t:a+d*b,df_dt:(2*h*d+c)/b}}function I(a,b,c,d){var f=v(d&&d.dt_tolerance_seconds||1);f=Math.abs(f/86400);var h=d&&d.init_f1||a(b),l=d&&d.init_f2||a(c),k=NaN,g=0;d=d&&d.iter_limit||20;for(var m=!0;;){if(++g>d)throw"Excessive iteration in Search()";var n=new O(b.ut+.5*(c.ut-b.ut)),p=n.ut-b.ut;if(Math.abs(p)(p.ut-b.ut)*(p.ut-c.ut)&&0>(x.ut-b.ut)*(x.ut-c.ut))){u=a(p);var z=a(x);if(0>u&&0<=z){h=u;l=z;b=p;c=x;k=C;m=!1;continue}}}}if(0>h&&0<=k)c=n,l=k;else if(0>k&&0<=l)b=n,h=k;else return null}}function qa(a){for(;-180>=a;)a+=360;for(;180a;)a+=360;for(;360<=a;)a-=360;return a}function bc(a,b,c){v(a);v(c);b=w(b);c=b.AddDays(c);return I(function(d){d=Rb(d);return qa(d.elon- -a)},b,c)}function vb(a,b,c){if(a===q.Earth||b===q.Earth)throw"The Earth does not have a longitude as seen from itself.";c=w(c);a=aa(a,c,!1);a=Ga(a);b=aa(b,c,!1);b=Ga(b);return ra(a.elon-b.elon)}function sa(a,b){if(a==q.Earth)throw"The Earth does not have an angle as seen from itself.";var c=w(b);b=aa(q.Sun,c,!0);a=aa(a,c,!0);return T(b,a)}function ja(a,b){if(a===q.Sun)throw"Cannot calculate heliocentric longitude of the Sun.";a=Ja(a,b);return Ga(a).elon}function db(a,b){if(a===q.Earth)throw"The illumination of the Earth is not defined."; -var c=w(b),d=S(G.Earth,c);if(a===q.Sun){var f=new B(-d.x,-d.y,-d.z,c);b=new B(0,0,0,c);d=0}else a===q.Moon?(f=U(c),b=new B(d.x+f.x,d.y+f.y,d.z+f.z,c)):(b=Ja(a,b),f=new B(b.x-d.x,b.y-d.y,b.z-d.z,c)),d=T(f,b);var h=f.Length(),l=b.Length();if(a===q.Sun)var k=Sc+5*Math.log10(h);else if(a===q.Moon)a=d*e.DEG2RAD,k=a*a,a=-12.717+1.49*Math.abs(a)+.0431*k*k,k=a+=5*Math.log10(h/(385000.6/e.KM_PER_AU)*l);else if(a===q.Saturn){var g=d;a=Ga(f);k=28.06*e.DEG2RAD;var m=e.DEG2RAD*a.elat;a=Math.asin(Math.sin(m)*Math.cos(k)- +1.90919E-7*a[2],-4.79966E-7*a[0]+.917482137087*a[1]-.397776982902*a[2],.397776982902*a[1]+.917482137087*a[2])}function Wb(a,b,c){var d=c*Math.cos(b);return[d*Math.cos(a),d*Math.sin(a),c*Math.sin(b)]}function T(a,b){var c=b.tt/365250,d=ha(a[0],c,!0),f=ha(a[1],c,!1);a=ha(a[2],c,!1);d=Wb(d,f,a);return qb(d).ToAstroVector(b)}function Ha(a,b){var c=b/365250,d=ha(a[0],c,!0),f=ha(a[1],c,!1),h=ha(a[2],c,!1),l=pb(a[0],c),k=pb(a[1],c);c=pb(a[2],c);var g=Math.cos(d),m=Math.sin(d),n=Math.cos(f),p=Math.sin(f); +a=+(c*n*g)-h*p*g*k-h*n*m*l;l=+(c*n*m)-h*p*m*k+h*n*g*l;k=+(c*p)+h*n*k;d=Wb(d,f,h);f=[a/365250,l/365250,k/365250];d=qb(d);f=qb(f);return new $a(b,d,f)}function ab(a,b,c,d){d/=d+2.959122082855911E-4;b=T(G[c],b);a.x+=d*b.x;a.y+=d*b.y;a.z+=d*b.z}function bb(a,b,c,d){d/=d+2.959122082855911E-4;b=Ha(G[c],b);a.r.incr(b.r.mul(d));a.v.incr(b.v.mul(d));return b}function Ia(a,b,c){a=c.sub(a);c=a.quadrature();return a.mul(b/(c*Math.sqrt(c)))}function cb(a,b,c,d){return new F(b.x+a*(c.x+a*d.x/2),b.y+a*(c.y+a*d.y/ +2),b.z+a*(c.z+a*d.z/2))}function Xb(a,b,c){return new F(b.x+a*c.x,b.y+a*c.y,b.z+a*c.z)}function rb(a,b){var c=a-b.tt,d=new pa(a),f=cb(c,b.r,b.v,b.a),h=d.Acceleration(f).mean(b.a);f=cb(c,b.r,b.v,h);b=b.v.add(h.mul(c));c=d.Acceleration(f);a=new Yb(a,f,b,c);return new Zb(d,a)}function $b(a,b){a=Math.floor(a);return 0>a?0:a>=b?b-1:a}function sb(a){var b=$jscomp.makeIterator(a);a=b.next().value;var c=$jscomp.makeIterator(b.next().value);var d=c.next().value;var f=c.next().value;c=c.next().value;var h= +$jscomp.makeIterator(b.next().value);b=h.next().value;var l=h.next().value;h=h.next().value;d=new $a(a,new F(d,f,c),new F(b,l,h));a=new pa(d.tt);f=d.r.add(a.Sun.r);c=d.v.add(a.Sun.v);b=a.Acceleration(f);d=new Yb(d.tt,f,c,b);return new Zb(a,d)}function ac(a,b,c){a=sb(a);for(var d=Math.ceil((b-a.grav.tt)/c),f=0;fia[50][0])c=null;else{c=$b((c-d)/29200,50);if(!ub[c]){d=ub[c]=[];d[0]=sb(ia[c]).grav; +d[200]=sb(ia[c+1]).grav;var f,h=d[0].tt;for(f=1;200>f;++f)d[f]=rb(h+=146,d[f-1]).grav;h=d[200].tt;var l=[];l[200]=d[200];for(f=199;0k;++k){f=Ja(a,l);c?d=T(G.Earth,l):d||(d=T(G.Earth,b));f=new C(f.x-d.x,f.y-d.y,f.z-d.z,b);var g=b.AddDays(-f.Length()/e.C_AUDAY);h=Math.abs(g.tt-l.tt);if(1E-9>h)return f;l=g}throw"Light-travel time solver did not converge: dt="+h;}function qa(a,b){return new L(a.r.x,a.r.y,a.r.z,a.v.x,a.v.y,a.v.z,b)}function Rc(a,b,c,d,f){var h=(f+c)/2-d;c=(f-c)/2;if(0==h){if(0==c)return null;d=-d/c;if(-1>d||1=d)return null;f=Math.sqrt(d);d=(-c+f)/(2*h);f=(-c- +f)/(2*h);if(-1<=d&&1>=d){if(-1<=f&&1>=f)return null}else if(-1<=f&&1>=f)d=f;else return null}return{x:d,t:a+d*b,df_dt:(2*h*d+c)/b}}function I(a,b,c,d){var f=v(d&&d.dt_tolerance_seconds||1);f=Math.abs(f/86400);var h=d&&d.init_f1||a(b),l=d&&d.init_f2||a(c),k=NaN,g=0;d=d&&d.iter_limit||20;for(var m=!0;;){if(++g>d)throw"Excessive iteration in Search()";var n=new O(b.ut+.5*(c.ut-b.ut)),p=n.ut-b.ut;if(Math.abs(p)(p.ut-b.ut)*(p.ut-c.ut)&&0>(x.ut-b.ut)*(x.ut-c.ut))){t=a(p);var z=a(x);if(0>t&&0<=z){h=t;l=z;b=p;c=x;k=A;m=!1;continue}}}}if(0>h&&0<=k)c=n,l=k;else if(0>k&&0<=l)b=n,h=k;else return null}}function ra(a){for(;-180>=a;)a+=360;for(;180a;)a+=360;for(;360<=a;)a-=360;return a}function bc(a,b,c){v(a);v(c);b=w(b);c=b.AddDays(c);return I(function(d){d=Rb(d);return ra(d.elon- +a)},b,c)}function vb(a,b,c){if(a===q.Earth||b===q.Earth)throw"The Earth does not have a longitude as seen from itself.";c=w(c);a=ba(a,c,!1);a=Ga(a);b=ba(b,c,!1);b=Ga(b);return sa(a.elon-b.elon)}function ta(a,b){if(a==q.Earth)throw"The Earth does not have an angle as seen from itself.";var c=w(b);b=ba(q.Sun,c,!0);a=ba(a,c,!0);return U(b,a)}function ka(a,b){if(a===q.Sun)throw"Cannot calculate heliocentric longitude of the Sun.";a=Ja(a,b);return Ga(a).elon}function db(a,b){if(a===q.Earth)throw"The illumination of the Earth is not defined."; +var c=w(b),d=T(G.Earth,c);if(a===q.Sun){var f=new C(-d.x,-d.y,-d.z,c);b=new C(0,0,0,c);d=0}else a===q.Moon?(f=V(c),b=new C(d.x+f.x,d.y+f.y,d.z+f.z,c)):(b=Ja(a,b),f=new C(b.x-d.x,b.y-d.y,b.z-d.z,c)),d=U(f,b);var h=f.Length(),l=b.Length();if(a===q.Sun)var k=Sc+5*Math.log10(h);else if(a===q.Moon)a=d*e.DEG2RAD,k=a*a,a=-12.717+1.49*Math.abs(a)+.0431*k*k,k=a+=5*Math.log10(h/(385000.6/e.KM_PER_AU)*l);else if(a===q.Saturn){var g=d;a=Ga(f);k=28.06*e.DEG2RAD;var m=e.DEG2RAD*a.elat;a=Math.asin(Math.sin(m)*Math.cos(k)- Math.cos(m)*Math.sin(k)*Math.sin(e.DEG2RAD*a.elon-e.DEG2RAD*(169.51+3.82E-5*c.tt)));k=Math.sin(Math.abs(a));g=-9+.044*g+k*(-2.6+1.2*k)+5*Math.log10(l*h);a*=e.RAD2DEG;k=g;g=a}else{var n=m=k=0;switch(a){case q.Mercury:a=-.6;k=4.98;m=-4.88;n=3.02;break;case q.Venus:163.6>d?(a=-4.47,k=1.03,m=.57,n=.13):(a=.98,k=-1.02);break;case q.Mars:a=-1.52;k=1.6;break;case q.Jupiter:a=-9.4;k=.5;break;case q.Uranus:a=-7.19;k=.25;break;case q.Neptune:a=-6.87;break;case q.Pluto:a=-1;k=4;break;default:throw"VisualMagnitude: unsupported body "+ -a;}var p=d/100;k=a+p*(k+p*(m+p*n))+5*Math.log10(l*h)}return new cc(c,k,d,l,h,f,b,g)}function Ka(a){if(a===q.Earth)throw"The Earth does not have a synodic period as seen from itself.";if(a===q.Moon)return 29.530588;var b=ba[a];if(!b)throw"Not a valid planet name: "+a;a=ba.Earth.OrbitalPeriod;return Math.abs(a/(a/b.OrbitalPeriod-1))}function ta(a,b,c){function d(m){var n=ja(a,m);m=ja(q.Earth,m);return qa(h*(m-n)-b)}v(b);var f=ba[a];if(!f)throw"Cannot search relative longitude because body is not a planet: "+ -a;if(a===q.Earth)throw"Cannot search relative longitude for the Earth (it is always 0)";var h=f.OrbitalPeriod>ba.Earth.OrbitalPeriod?1:-1;f=Ka(a);c=w(c);var l=d(c);0k;++k){var g=-l/360*f;c=c.AddDays(g);if(1>86400*Math.abs(g))return c;g=l;l=d(c);30>Math.abs(g)&&g!==l&&(g/=g-l,.5g&&(f*=g))}throw"Relative longitude search failed to converge for "+a+" near "+c.toString()+" (error_angle = "+l+").";}function wb(a){return vb(q.Moon,q.Sun,a)}function La(a,b,c){function d(l){l= -wb(l);return qa(l-a)}v(a);v(c);b=w(b);var f=d(b);0c)return null;c=Math.min(c,h+1.5);f=b.AddDays(f);b=b.AddDays(c);return I(d,f,b)}function dc(a){var b=wb(a);b=(Math.floor(b/90)+1)%4;a=La(90*b,a,10);if(!a)throw"Cannot find moon quarter";return new ec(b,a)}function fc(a,b,c,d,f,h){na(b);v(f);if(0>=f)throw"Invalid value for limitDays: "+f;if(a===q.Earth)throw"Cannot find altitude event for the Earth.";if(1===c){c=12;var l=0}else if(-1===c)c=0,l=12;else throw"Invalid direction parameter "+ -c+" -- must be +1 or -1";d=w(d);var k=h(d);var g;if(0=k&&0=d.ut+f)return null;m=k.time;k=h(k.time);g=h(n.time)}}function Ma(a,b,c,d){na(b);d=w(d);var f=0;if(a===q.Earth)throw"Cannot search for hour angle of the Earth.";v(c);if(0>c||24<=c)throw"Invalid hour angle "+c;for(;;){++f;var h=Z(d),l=Fa(a,d,b,!0,!0); -h=(c+l.ra-b.longitude/15-h)%24;1===f?0>h&&(h+=24):-12>h?h+=24:123600*Math.abs(h))return a=Da(d,b,l.ra,l.dec,"normal"),new gc(d,a);d=d.AddDays(h/24*.9972695717592592)}}function hc(a,b){b=w(b);var c=vb(a,q.Sun,b);if(1805*f;++f){var h= -a.AddDays(5),l=b(h);if(0>=d*l){if(0>d||0l){a=I(c,a,h,{init_f1:-d,init_f2:-l});if(!a)throw"SearchLunarApsis INTERNAL ERROR: apogee search failed!";d=ca(a).distance_au;return new Na(a,1,d)}throw"SearchLunarApsis INTERNAL ERROR: cannot classify apsis event!";}a=h;d=l}throw"SearchLunarApsis INTERNAL ERROR: could not find apsis within 2 synodic months of start date."; -}function kc(a,b,c,d){for(var f=1===b?1:-1;;){d/=9;if(d<1/1440)return c=c.AddDays(d/2),a=ia(a,c),new Na(c,b,a);for(var h=-1,l=0,k=0;10>k;++k){var g=c.AddDays(k*d);g=f*ia(a,g);if(0==k||g>l)h=k,l=g}c=c.AddDays((h-1)*d);d*=2}}function Tc(a,b){var c=b.AddDays(-30/360*ba[a].OrbitalPeriod),d=b.AddDays(.75*ba[a].OrbitalPeriod),f=c,h=c,l=-1,k=-1;d=(d.ut-c.ut)/99;for(var g=0;100>g;++g){var m=c.AddDays(g*d),n=ia(a,m);0===g?k=l=n:(n>k&&(k=n,h=m),n=b.tt)return a.time.tt>=b.tt&&a.time.tt=b.tt)return a;throw"Internal error: failed to find Neptune apsis.";}function lc(a,b){function c(n){var p=n.AddDays(-5E-4);n=n.AddDays(5E-4);p=ia(a,p);return(ia(a,n)-p)/.001}function d(n){return-c(n)}if(a===q.Neptune||a===q.Pluto)return Tc(a,b);for(var f=ba[a].OrbitalPeriod,h=f/6,l=c(b),k=0;k*h<2*f;++k){var g=b.AddDays(h),m=c(g);if(0>=l*m){f=h=void 0;if(0>l||0m)h=d,f=1;else throw"Internal error with slopes in SearchPlanetApsis"; -b=I(h,b,g);if(!b)throw"Failed to find slope transition in planetary apsis search.";l=ia(a,b);return new Na(b,f,l)}b=g;l=m}throw"Internal error: should have found planetary apsis within 2 orbital periods.";}function ua(a){return new J([[a.rot[0][0],a.rot[1][0],a.rot[2][0]],[a.rot[0][1],a.rot[1][1],a.rot[2][1]],[a.rot[0][2],a.rot[1][2],a.rot[2][2]]])}function va(a,b){return new J([[b.rot[0][0]*a.rot[0][0]+b.rot[1][0]*a.rot[0][1]+b.rot[2][0]*a.rot[0][2],b.rot[0][1]*a.rot[0][0]+b.rot[1][1]*a.rot[0][1]+ +a;}var p=d/100;k=a+p*(k+p*(m+p*n))+5*Math.log10(l*h)}return new cc(c,k,d,l,h,f,b,g)}function Ka(a){if(a===q.Earth)throw"The Earth does not have a synodic period as seen from itself.";if(a===q.Moon)return 29.530588;var b=ca[a];if(!b)throw"Not a valid planet name: "+a;a=ca.Earth.OrbitalPeriod;return Math.abs(a/(a/b.OrbitalPeriod-1))}function ua(a,b,c){function d(m){var n=ka(a,m);m=ka(q.Earth,m);return ra(h*(m-n)-b)}v(b);var f=ca[a];if(!f)throw"Cannot search relative longitude because body is not a planet: "+ +a;if(a===q.Earth)throw"Cannot search relative longitude for the Earth (it is always 0)";var h=f.OrbitalPeriod>ca.Earth.OrbitalPeriod?1:-1;f=Ka(a);c=w(c);var l=d(c);0k;++k){var g=-l/360*f;c=c.AddDays(g);if(1>86400*Math.abs(g))return c;g=l;l=d(c);30>Math.abs(g)&&g!==l&&(g/=g-l,.5g&&(f*=g))}throw"Relative longitude search failed to converge for "+a+" near "+c.toString()+" (error_angle = "+l+").";}function wb(a){return vb(q.Moon,q.Sun,a)}function La(a,b,c){function d(l){l= +wb(l);return ra(l-a)}v(a);v(c);b=w(b);var f=d(b);0c)return null;c=Math.min(c,h+1.5);f=b.AddDays(f);b=b.AddDays(c);return I(d,f,b)}function dc(a){var b=wb(a);b=(Math.floor(b/90)+1)%4;a=La(90*b,a,10);if(!a)throw"Cannot find moon quarter";return new ec(b,a)}function fc(a,b,c,d,f,h){oa(b);v(f);if(0>=f)throw"Invalid value for limitDays: "+f;if(a===q.Earth)throw"Cannot find altitude event for the Earth.";if(1===c){c=12;var l=0}else if(-1===c)c=0,l=12;else throw"Invalid direction parameter "+ +c+" -- must be +1 or -1";d=w(d);var k=h(d);var g;if(0=k&&0=d.ut+f)return null;m=k.time;k=h(k.time);g=h(n.time)}}function Ma(a,b,c,d){oa(b);d=w(d);var f=0;if(a===q.Earth)throw"Cannot search for hour angle of the Earth.";v(c);if(0>c||24<=c)throw"Invalid hour angle "+c;for(;;){++f;var h=aa(d),l=Fa(a,d,b,!0,!0); +h=(c+l.ra-b.longitude/15-h)%24;1===f?0>h&&(h+=24):-12>h?h+=24:123600*Math.abs(h))return a=Da(d,b,l.ra,l.dec,"normal"),new gc(d,a);d=d.AddDays(h/24*.9972695717592592)}}function hc(a,b){b=w(b);var c=vb(a,q.Sun,b);if(1805*f;++f){var h= +a.AddDays(5),l=b(h);if(0>=d*l){if(0>d||0l){a=I(c,a,h,{init_f1:-d,init_f2:-l});if(!a)throw"SearchLunarApsis INTERNAL ERROR: apogee search failed!";d=da(a).distance_au;return new Na(a,1,d)}throw"SearchLunarApsis INTERNAL ERROR: cannot classify apsis event!";}a=h;d=l}throw"SearchLunarApsis INTERNAL ERROR: could not find apsis within 2 synodic months of start date."; +}function kc(a,b,c,d){for(var f=1===b?1:-1;;){d/=9;if(d<1/1440)return c=c.AddDays(d/2),a=ja(a,c),new Na(c,b,a);for(var h=-1,l=0,k=0;10>k;++k){var g=c.AddDays(k*d);g=f*ja(a,g);if(0==k||g>l)h=k,l=g}c=c.AddDays((h-1)*d);d*=2}}function Tc(a,b){var c=b.AddDays(-30/360*ca[a].OrbitalPeriod),d=b.AddDays(.75*ca[a].OrbitalPeriod),f=c,h=c,l=-1,k=-1;d=(d.ut-c.ut)/99;for(var g=0;100>g;++g){var m=c.AddDays(g*d),n=ja(a,m);0===g?k=l=n:(n>k&&(k=n,h=m),n=b.tt)return a.time.tt>=b.tt&&a.time.tt=b.tt)return a;throw"Internal error: failed to find Neptune apsis.";}function lc(a,b){function c(n){var p=n.AddDays(-5E-4);n=n.AddDays(5E-4);p=ja(a,p);return(ja(a,n)-p)/.001}function d(n){return-c(n)}if(a===q.Neptune||a===q.Pluto)return Tc(a,b);for(var f=ca[a].OrbitalPeriod,h=f/6,l=c(b),k=0;k*h<2*f;++k){var g=b.AddDays(h),m=c(g);if(0>=l*m){f=h=void 0;if(0>l||0m)h=d,f=1;else throw"Internal error with slopes in SearchPlanetApsis"; +b=I(h,b,g);if(!b)throw"Failed to find slope transition in planetary apsis search.";l=ja(a,b);return new Na(b,f,l)}b=g;l=m}throw"Internal error: should have found planetary apsis within 2 orbital periods.";}function va(a){return new J([[a.rot[0][0],a.rot[1][0],a.rot[2][0]],[a.rot[0][1],a.rot[1][1],a.rot[2][1]],[a.rot[0][2],a.rot[1][2],a.rot[2][2]]])}function wa(a,b){return new J([[b.rot[0][0]*a.rot[0][0]+b.rot[1][0]*a.rot[0][1]+b.rot[2][0]*a.rot[0][2],b.rot[0][1]*a.rot[0][0]+b.rot[1][1]*a.rot[0][1]+ b.rot[2][1]*a.rot[0][2],b.rot[0][2]*a.rot[0][0]+b.rot[1][2]*a.rot[0][1]+b.rot[2][2]*a.rot[0][2]],[b.rot[0][0]*a.rot[1][0]+b.rot[1][0]*a.rot[1][1]+b.rot[2][0]*a.rot[1][2],b.rot[0][1]*a.rot[1][0]+b.rot[1][1]*a.rot[1][1]+b.rot[2][1]*a.rot[1][2],b.rot[0][2]*a.rot[1][0]+b.rot[1][2]*a.rot[1][1]+b.rot[2][2]*a.rot[1][2]],[b.rot[0][0]*a.rot[2][0]+b.rot[1][0]*a.rot[2][1]+b.rot[2][0]*a.rot[2][2],b.rot[0][1]*a.rot[2][0]+b.rot[1][1]*a.rot[2][1]+b.rot[2][1]*a.rot[2][2],b.rot[0][2]*a.rot[2][0]+b.rot[1][2]*a.rot[2][1]+ -b.rot[2][2]*a.rot[2][2]]])}function xb(a,b){var c=a.lat*e.DEG2RAD,d=a.lon*e.DEG2RAD,f=a.dist*Math.cos(c);return new B(f*Math.cos(d),f*Math.sin(d),a.dist*Math.sin(c),b)}function yb(a){var b=zb(a);return new Xa(b.lon/15,b.lat,b.dist,a)}function zb(a){var b=a.x*a.x+a.y*a.y,c=Math.sqrt(b+a.z*a.z);if(0===b){if(0===a.z)throw"Zero-length vector not allowed.";var d=0;a=0>a.z?-90:90}else d=e.RAD2DEG*Math.atan2(a.y,a.x),0>d&&(d+=360),a=e.RAD2DEG*Math.atan2(a.z,Math.sqrt(b));return new eb(a,d,c)}function mc(a){a= -360-a;360<=a?a-=360:0>a&&(a+=360);return a}function Ea(a,b){v(b);if(-90>b||90c&&(c=-1);c=1.02/Math.tan((c+10.3/(c+5.11))*e.DEG2RAD)/60;"normal"===a&&-1>b&&(c*=(b+90)/89)}else{if(a)throw"Invalid refraction option: "+a;c=0}return c}function nc(a,b){if(-90>b||90Math.abs(d))return c-b;c-=d}}function Oa(a,b){return new B(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]* -b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,b.t)}function wa(a,b){return new L(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]*b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,a.rot[0][0]*b.vx+a.rot[1][0]*b.vy+a.rot[2][0]*b.vz,a.rot[0][1]*b.vx+a.rot[1][1]*b.vy+a.rot[2][1]*b.vz,a.rot[0][2]*b.vx+a.rot[1][2]*b.vy+a.rot[2][2]*b.vz,b.t)}function oc(){return new J([[1,0,0],[0,.9174821430670688,-.3977769691083922],[0,.3977769691083922, -.9174821430670688]])}function Ab(a){a=w(a);var b=Ba(a,E.From2000);a=Ca(a,E.From2000);return va(b,a)}function Bb(a){a=w(a);var b=Ca(a,E.Into2000);a=Ba(a,E.Into2000);return va(b,a)}function Cb(a,b){a=w(a);var c=Math.sin(b.latitude*e.DEG2RAD),d=Math.cos(b.latitude*e.DEG2RAD),f=Math.sin(b.longitude*e.DEG2RAD),h=Math.cos(b.longitude*e.DEG2RAD);b=[d*h,d*f,c];c=[-c*h,-c*f,d];f=[f,-h,0];a=-15*Z(a);b=ma(a,b);c=ma(a,c);a=ma(a,f);return new J([[c[0],a[0],b[0]],[c[1],a[1],b[1]],[c[2],a[2],b[2]]])}function pc(a, -b){a=Cb(a,b);return ua(a)}function qc(a,b){a=w(a);b=pc(a,b);a=Bb(a);return va(b,a)}function rc(a){a=Bb(a);var b=oc();return va(a,b)}function sc(a){a=rc(a);return ua(a)}function tc(a,b){a=w(a);var c=sc(a);a=Cb(a,b);return va(c,a)}function Pa(a,b,c,d){var f=(d.x*c.x+d.y*c.y+d.z*c.z)/(d.x*d.x+d.y*d.y+d.z*d.z),h=f*d.x-c.x,l=f*d.y-c.y,k=f*d.z-c.z;return new Uc(b,f,e.KM_PER_AU*Math.sqrt(h*h+l*l+k*k),695700-(1+f)*(695700-a),-695700+(1+f)*(695700+a),c,d)}function fb(a){var b=S(G.Earth,a),c=U(a);return Pa(6459, -a,c,b)}function uc(a){var b=S(G.Earth,a),c=U(a),d=new B(-c.x,-c.y,-c.z,c.t);c.x+=b.x;c.y+=b.y;c.z+=b.z;return Pa(1737.4,a,d,c)}function Db(a,b){var c=Ob(a,b);b=S(G.Earth,a);var d=U(a);c=new B(c[0]-d.x,c[1]-d.y,c[2]-d.z,a);d.x+=b.x;d.y+=b.y;d.z+=b.z;return Pa(1737.4,a,c,d)}function gb(a,b,c){a=aa(a,c,!1);var d=aa(q.Sun,c,!1),f=new B(a.x-d.x,a.y-d.y,a.z-d.z,c);d.x=-a.x;d.y=-a.y;d.z=-a.z;return Pa(b,c,d,f)}function Eb(a,b){var c=1/86400,d=b.AddDays(-c);b=b.AddDays(+c);d=a(d);return(a(b).r-d.r)/c}function Vc(a){var b= +b.rot[2][2]*a.rot[2][2]]])}function xb(a,b){var c=a.lat*e.DEG2RAD,d=a.lon*e.DEG2RAD,f=a.dist*Math.cos(c);return new C(f*Math.cos(d),f*Math.sin(d),a.dist*Math.sin(c),b)}function yb(a){var b=zb(a);return new Xa(b.lon/15,b.lat,b.dist,a)}function zb(a){var b=a.x*a.x+a.y*a.y,c=Math.sqrt(b+a.z*a.z);if(0===b){if(0===a.z)throw"Zero-length vector not allowed.";var d=0;a=0>a.z?-90:90}else d=e.RAD2DEG*Math.atan2(a.y,a.x),0>d&&(d+=360),a=e.RAD2DEG*Math.atan2(a.z,Math.sqrt(b));return new eb(a,d,c)}function mc(a){a= +360-a;360<=a?a-=360:0>a&&(a+=360);return a}function Ea(a,b){v(b);if(-90>b||90c&&(c=-1);c=1.02/Math.tan((c+10.3/(c+5.11))*e.DEG2RAD)/60;"normal"===a&&-1>b&&(c*=(b+90)/89)}else{if(a)throw"Invalid refraction option: "+a;c=0}return c}function nc(a,b){if(-90>b||90Math.abs(d))return c-b;c-=d}}function Oa(a,b){return new C(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]* +b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,b.t)}function xa(a,b){return new L(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]*b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,a.rot[0][0]*b.vx+a.rot[1][0]*b.vy+a.rot[2][0]*b.vz,a.rot[0][1]*b.vx+a.rot[1][1]*b.vy+a.rot[2][1]*b.vz,a.rot[0][2]*b.vx+a.rot[1][2]*b.vy+a.rot[2][2]*b.vz,b.t)}function oc(){return new J([[1,0,0],[0,.9174821430670688,-.3977769691083922],[0,.3977769691083922, +.9174821430670688]])}function Ab(a){a=w(a);var b=Ba(a,E.From2000);a=Ca(a,E.From2000);return wa(b,a)}function Bb(a){a=w(a);var b=Ca(a,E.Into2000);a=Ba(a,E.Into2000);return wa(b,a)}function Cb(a,b){a=w(a);var c=Math.sin(b.latitude*e.DEG2RAD),d=Math.cos(b.latitude*e.DEG2RAD),f=Math.sin(b.longitude*e.DEG2RAD),h=Math.cos(b.longitude*e.DEG2RAD);b=[d*h,d*f,c];c=[-c*h,-c*f,d];f=[f,-h,0];a=-15*aa(a);b=na(a,b);c=na(a,c);a=na(a,f);return new J([[c[0],a[0],b[0]],[c[1],a[1],b[1]],[c[2],a[2],b[2]]])}function pc(a, +b){a=Cb(a,b);return va(a)}function qc(a,b){a=w(a);b=pc(a,b);a=Bb(a);return wa(b,a)}function rc(a){a=Bb(a);var b=oc();return wa(a,b)}function sc(a){a=rc(a);return va(a)}function tc(a,b){a=w(a);var c=sc(a);a=Cb(a,b);return wa(c,a)}function Pa(a,b,c,d){var f=(d.x*c.x+d.y*c.y+d.z*c.z)/(d.x*d.x+d.y*d.y+d.z*d.z),h=f*d.x-c.x,l=f*d.y-c.y,k=f*d.z-c.z;return new Uc(b,f,e.KM_PER_AU*Math.sqrt(h*h+l*l+k*k),695700-(1+f)*(695700-a),-695700+(1+f)*(695700+a),c,d)}function fb(a){var b=T(G.Earth,a),c=V(a);return Pa(6459, +a,c,b)}function uc(a){var b=T(G.Earth,a),c=V(a),d=new C(-c.x,-c.y,-c.z,c.t);c.x+=b.x;c.y+=b.y;c.z+=b.z;return Pa(1737.4,a,d,c)}function Db(a,b){var c=Ob(a,b);b=T(G.Earth,a);var d=V(a);c=new C(c[0]-d.x,c[1]-d.y,c[2]-d.z,a);d.x+=b.x;d.y+=b.y;d.z+=b.z;return Pa(1737.4,a,c,d)}function gb(a,b,c){a=ba(a,c,!1);var d=ba(q.Sun,c,!1),f=new C(a.x-d.x,a.y-d.y,a.z-d.z,c);d.x=-a.x;d.y=-a.y;d.z=-a.z;return Pa(b,c,d,f)}function Eb(a,b){var c=1/86400,d=b.AddDays(-c);b=b.AddDays(+c);d=a(d);return(a(b).r-d.r)/c}function Vc(a){var b= a.AddDays(-.03);a=a.AddDays(.03);b=I(function(c){return Eb(fb,c)},b,a);if(!b)throw"Failed to find peak Earth shadow time.";return fb(b)}function Wc(a){var b=a.AddDays(-.03);a=a.AddDays(.03);b=I(function(c){return Eb(uc,c)},b,a);if(!b)throw"Failed to find peak Moon shadow time.";return uc(b)}function Xc(a,b,c){var d=c.AddDays(-1);c=c.AddDays(1);d=I(function(f){var h=1/86400,l=gb(a,b,f.AddDays(-h));return(gb(a,b,f.AddDays(+h)).r-l.r)/h},d,c);if(!d)throw"Failed to find peak planet shadow time.";return gb(a, -b,d)}function Yc(a,b){function c(h){return Db(h,b)}var d=a.AddDays(-.2),f=a.AddDays(.2);d=I(function(h){return Eb(c,h)},d,f);if(!d)throw"PeakLocalMoonShadow: search failure for search_center_time = "+a;return Db(d,b)}function Fb(a,b,c){var d=c/1440;c=a.AddDays(-d);d=a.AddDays(+d);c=I(function(f){return-(fb(f).r-b)},c,a);a=I(function(f){return+(fb(f).r-b)},a,d);if(!c||!a)throw"Failed to find shadow semiduration";return 720*(a.ut-c.ut)}function Gb(a){a=ca(a);return e.RAD2DEG*a.geo_eclip_lat}function vc(a){a= +b,d)}function Yc(a,b){function c(h){return Db(h,b)}var d=a.AddDays(-.2),f=a.AddDays(.2);d=I(function(h){return Eb(c,h)},d,f);if(!d)throw"PeakLocalMoonShadow: search failure for search_center_time = "+a;return Db(d,b)}function Fb(a,b,c){var d=c/1440;c=a.AddDays(-d);d=a.AddDays(+d);c=I(function(f){return-(fb(f).r-b)},c,a);a=I(function(f){return+(fb(f).r-b)},a,d);if(!c||!a)throw"Failed to find shadow semiduration";return 720*(a.ut-c.ut)}function Gb(a){a=da(a);return e.RAD2DEG*a.geo_eclip_lat}function vc(a){a= w(a);for(var b=0;12>b;++b){var c=La(180,a,40);if(!c)throw"Cannot find full moon.";a=Gb(c);if(1.8>Math.abs(a)&&(a=Vc(c),a.rb;++b){var c=La(0,a,40);if(!c)throw"Cannot find new moon";a=Gb(c); if(1.8>Math.abs(a)&&(a=Wc(c),a.r=d?d+=360:180a.r)throw"Unexpected shadow distance from geoid intersection = "+a.r;h=.014Math.abs(c)){var d=Yc(a,b);if(d.r=d?d+=360:180a.r)throw"Unexpected shadow distance from geoid intersection = "+a.r;h=.014Math.abs(c)){var d=Yc(a,b);if(d.rsa(a,d)&&(b=Xc(a,c,d),b.rta(a,d)&&(b=Xc(a,c,d),b.ra){c=0;var h=0=c;)c+=360;for(;180 -Math.abs(n))break;h-=n/(-42.69778487239616*((k-g)/l-g*k*-.006694397995865464/(-42.69778487239616*m))+d*f+a*b)}h*=e.RAD2DEG;l=6378.1366/l;d=Math.abs(f)>Math.abs(b)?d/f-.9933056020041345*l:a/b-l}return new mb(h,c,1E3*d)};e.ObserverGravity=function(a,b){a=Math.sin(a*e.DEG2RAD);a*=a;return 9.7803253359*(1+.00193185265241*a)/Math.sqrt(1-.00669437999013*a)*(1-(3.15704E-7-2.10269E-9*a)*b+7.37452E-14*b*b)};e.Ecliptic=Ga;e.GeoMoon=U;e.GeoMoonState=Za;e.GeoEmbState=ob;var ha=[[-73E4,[-26.1182072321076,-14.376168177825, -3.3844025152995],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.9749052021271,-.4485029529294,-12.7703515059887],[7.3458569351457E-4,.0022785014891658,4.8619778602049E-4]],[-671600,[14.7069307807442,44.2691105400275,9.3536984747716],[-.00210001479998,2.2295915939915E-4,7.0143443551414E-4]],[-642400,[-29.4410039299574,-6.4301615305696,6.8584810113048],[8.4495803960544E-4,-.0030783914758711,-.0012106305981192]],[-613200,[39.4443969462341,-6.5579897605705,-13.9137602964634], -[.0011480029005873,.0022400006880665,3.5168075922288E-4]],[-584E3,[20.2303809506997,43.2669666571891,7.3829660919234],[-.0019754081700585,5.3457141292226E-4,7.5929169129793E-4]],[-554800,[-30.65832536462,2.0938188745519,9.8805311380706],[6.1010603013347E-5,-.0031326500935382,-9.9346125151067E-4]],[-525600,[35.7377032516732,-12.5877060247644,-14.6778472475634],[.0015802939375649,.0021347678412429,1.9074436384343E-4]],[-496400,[25.4662951885462,41.3674783384167,5.2164768733816],[-.0018054401046468, -8.328308359951E-4,8.0260156912107E-4]],[-467200,[-29.847174904071,10.6364263130814,12.2979041801063],[-6.3257063052907E-4,-.0029969577578221,-7.4476074151596E-4]],[-438E3,[30.7746921076872,-18.2366370153037,-14.9455358798963],[.0020113162005465,.0019353827024189,-2.0937793168297E-6]],[-408800,[30.2431533240283,38.6562678885026,2.9385017502184],[-.0016052508674468,.0011183495337525,8.3333973416824E-4]],[-379600,[-27.2889847725327,18.643162147874,14.0236336233295],[-.0011856388898191,-.0027170609282181, --4.9015526126399E-4]],[-350400,[24.5196051967735,-23.2457560647266,-14.6268623673677],[.0024322321483154,.0016062008146048,-2.3369181613312E-4]],[-321200,[34.5052748058754,35.1253385869542,.5573614756374],[-.0013824391637782,.0013833397561817,8.4823598806262E-4]],[-292E3,[-23.2753639151193,25.8185142987694,15.0553815885983],[-.0016062295460975,-.0023395961498533,-2.4377362639479E-4]],[-262800,[17.0503847980918,-27.1803762901257,-13.6089633216945],[.0028175521080578,.0011358749093955,-4.9548725258825E-4]], -[-233600,[38.0936719102855,30.8805883833368,-1.8436880674133],[-.0011317697153459,.0016128814698472,8.4177586176055E-4]],[-204400,[-18.1978529308782,31.9328699343091,15.4382948262792],[-.0019117272501813,-.0019146495909842,-1.9657304369835E-5]],[-175200,[8.5289240399968,-29.6184222000484,-11.8054009942579],[.0031034370787005,5.139363329243E-4,-7.7293066202546E-4]],[-146E3,[40.9468572586403,25.9049735920209,-4.2563362404988],[-8.3652705194051E-4,.0018129497136404,8.156422827306E-4]],[-116800,[-12.3269588953252, -36.8818834462925,15.2171582587111],[-.0021166103705038,-.001481442003599,1.7401209844705E-4]],[-87600,[-.6332583759085,-30.0187597947092,-9.1719328749499],[.0032016994581737,-2.5279858672148E-4,-.0010411088271861]],[-58400,[42.9360484238833,20.3446855844523,-6.5880270079125],[-5.0525450073192E-4,.0019910074335507,7.7440196540269E-4]],[-29200,[-5.9759105529742,40.6118099584602,14.4701317236731],[-.0022184202156107,-.0010562361130164,3.3652250216211E-4]],[0,[-9.8753695807739,-27.9789262247367,-5.7537118247043], -[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.9588319861654,14.2141479732919,-8.8083062271628],[-1.4717608981871E-4,.0021404187242141,7.1486567806614E-4]],[58400,[.6781367635199,43.0944616393616,13.2432387807209],[-.0022358226110718,-6.3233636090933E-4,4.7664798895648E-4]],[87600,[-18.2826020968342,-23.3050395866603,-1.7666205080281],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.8733387445258,7.7007056172154,-10.8142736664251],[2.3174803055677E-4,.0022402163127924, -6.2988756452032E-4]],[146E3,[7.3929490279056,44.3826789515344,11.6295002148543],[-.002193281545383,-2.1751799585364E-4,5.9556516201114E-4]],[175200,[-24.9816902292606,-16.2040128514258,2.4664575442976],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.5301870395114,.8459355080215,-12.5549075276829],[6.5059779150669E-4,.0022725657282262,5.1133743202822E-4]],[233600,[13.9995264868224,44.4623630448942,9.6694184864653],[-.0021079296569252,1.7533423831993E-4,6.9128485798076E-4]],[262800, -[-29.1840248030306,-7.3712439957619,6.493275957928],[9.3581363109681E-4,-.0030610357109184,-.0012364201089345]],[292E3,[39.8319806717528,-6.0784057667647,-13.9098153586562],[.0011117769689167,.0022362097830152,3.6230548231153E-4]],[321200,[20.2949551084758,43.4171904202513,7.4500919859316],[-.0019742157451535,5.3102050468554E-4,7.5938408813008E-4]],[350400,[-30.6699923021597,2.3187435589549,9.973480913858],[4.5605107450676E-5,-.0031308219926928,-9.9066533301924E-4]],[379600,[35.626122155983,-12.8976475092243, --14.7775865084436],[.0016015684949743,.0021171931182284,1.8002516202204E-4]],[408800,[26.1331861485607,41.232139187599,5.0064013262205],[-.0017857704419579,8.6046232702817E-4,8.0614690298954E-4]],[438E3,[-29.5767402292299,11.8635359435865,12.6313230398719],[-7.2292830060955E-4,-.0029587820140709,-7.08242964503E-4]],[467200,[29.9108057873914,-19.1590192939999,-15.0133638651945],[.0020871080437997,.0018848372554514,-3.8528655083926E-5]],[496400,[31.3759574518189,38.0503727207625,2.4331383437537],[-.0015546055556611, -.0011699815465629,8.3565439266001E-4]],[525600,[-26.3600713369277,20.6625059049518,14.4146962589584],[-.0013142373118349,-.0026236647854842,-4.2542017598193E-4]],[554800,[22.599441488648,-24.5088798983064,-14.484045731468],[.0025454108304806,.0014917058755191,-3.0243665086079E-4]],[584E3,[35.8778640130144,33.8942263660709,-.2245246362769],[-.0012941245730845,.0014560427668319,8.4762160640137E-4]],[613200,[-21.5381497624167,28.2040682697607,15.3219737995345],[-.001731211740901,-.0021939631314577,-1.631691327518E-4]], +[[-2,0,2,2,2],[1383,0,-2,-594,0,-2]],[[-1,0,0,0,2],[1405,0,4,-610,0,2]],[[1,1,2,-2,2],[1290,0,0,-556,0,0]]],Ra;e.CalcMoonCount=0;var Ic=function(a,b,c,d,f,h){this.elat=a;this.elon=b;this.mlat=c;this.mlon=d;this.dist_km=f;this.diam_deg=h};e.LibrationInfo=Ic;e.Libration=function(a){var b=w(a);a=b.tt/36525;var c=a*a,d=c*a,f=c*c,h=da(b);b=h.geo_eclip_lon;var l=h.geo_eclip_lat;h=h.distance_au*e.KM_PER_AU;var k=1.543*e.DEG2RAD,g=e.DEG2RAD*sa(93.272095+483202.0175233*a-.0036539*c-d/3526E3+f/86331E4),m=e.DEG2RAD* +sa(125.0445479-1934.1362891*a+.0020754*c+d/467441-f/60616E3),n=e.DEG2RAD*sa(357.5291092+35999.0502909*a-1.536E-4*c+d/2449E4),p=e.DEG2RAD*sa(134.9633964+477198.8675055*a+.0087414*c+d/69699-f/14712E3);d=e.DEG2RAD*sa(297.8501921+445267.1114034*a-.0018819*c+d/545868-f/113065E3);c=1-.002516*a-7.4E-6*c;var t=b-m;f=Math.atan2(Math.sin(t)*Math.cos(l)*Math.cos(k)-Math.sin(l)*Math.sin(k),Math.cos(t)*Math.cos(l));var x=ra(e.RAD2DEG*(f-g));k=Math.asin(-Math.sin(t)*Math.cos(l)*Math.sin(k)-Math.sin(l)*Math.cos(k)); +t=-.02752*Math.cos(p)+-.02245*Math.sin(g)+.00684*Math.cos(p-2*g)+-.00293*Math.cos(2*g)+-8.5E-4*Math.cos(2*g-2*d)+-5.4E-4*Math.cos(p-2*d)+-2E-4*Math.sin(p+g)+-2E-4*Math.cos(p+2*g)+-2E-4*Math.cos(p-g)+1.4E-4*Math.cos(p+2*g-2*d);var A=-.02816*Math.sin(p)+.02244*Math.cos(g)+-.00682*Math.sin(p-2*g)+-.00279*Math.sin(2*g)+-8.3E-4*Math.sin(2*g-2*d)+6.9E-4*Math.sin(p-2*d)+4E-4*Math.cos(p+g)+-2.5E-4*Math.sin(2*p)+-2.3E-4*Math.sin(p+2*g)+2E-4*Math.cos(p-g)+1.9E-4*Math.sin(p-g)+1.3E-4*Math.sin(p+2*g-2*d)+-1E-4* +Math.cos(p-3*g);return new Ic(e.RAD2DEG*k+(A*Math.cos(f)-t*Math.sin(f)),x+(-(.0252*c*Math.sin(n)+.00473*Math.sin(2*p-2*g)+-.00467*Math.sin(p)+.00396*Math.sin(e.DEG2RAD*(119.75+131.849*a))+.00276*Math.sin(2*p-2*d)+.00196*Math.sin(m)+-.00183*Math.cos(p-g)+.00115*Math.sin(p-2*d)+-9.6E-4*Math.sin(p-d)+4.6E-4*Math.sin(2*g-2*d)+-3.9E-4*Math.sin(p-g)+-3.2E-4*Math.sin(p-n-d)+2.7E-4*Math.sin(2*p-n-2*d)+2.3E-4*Math.sin(e.DEG2RAD*(72.56+20.186*a))+-1.4E-4*Math.sin(2*d)+1.4E-4*Math.cos(2*p-2*g)+-1.2E-4*Math.sin(p- +2*g)+-1.2E-4*Math.sin(2*p)+1.1E-4*Math.sin(2*p-2*n-2*d))+(t*Math.cos(f)+A*Math.sin(f))*Math.tan(k)),l,b,h,2*e.RAD2DEG*Math.atan(1737.4/Math.sqrt(h*h-1737.4*1737.4)))};var C=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.t=d};C.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)};e.Vector=C;var L=function(a,b,c,d,f,h,l){this.x=a;this.y=b;this.z=c;this.vx=d;this.vy=f;this.vz=h;this.t=l};e.StateVector=L;var eb=function(a,b,c){this.lat=v(a);this.lon=v(b);this.dist= +v(c)};e.Spherical=eb;var Xa=function(a,b,c,d){this.ra=v(a);this.dec=v(b);this.dist=v(c);this.vec=d};e.EquatorialCoordinates=Xa;var J=function(a){this.rot=a};e.RotationMatrix=J;e.MakeRotation=function(a){if(!Qc(a))throw"Argument must be a [3][3] array of numbers";return new J(a)};var Qb=function(a,b,c,d){this.azimuth=v(a);this.altitude=v(b);this.ra=v(c);this.dec=v(d)};e.HorizontalCoordinates=Qb;var Tb=function(a,b,c){this.vec=a;this.elat=v(b);this.elon=v(c)};e.EclipticCoordinates=Tb;e.Horizon=Da;var mb= +function(a,b,c){this.latitude=a;this.longitude=b;this.height=c;oa(this)};e.Observer=mb;e.SunPosition=Rb;e.Equator=Fa;e.ObserverVector=function(a,b,c){a=w(a);var d=aa(a);b=lb(b,d).pos;c||(b=Wa(b,a,E.Into2000));return new C(b[0],b[1],b[2],a)};e.ObserverState=function(a,b,c){a=w(a);var d=aa(a);b=lb(b,d);b=new L(b.pos[0],b.pos[1],b.pos[2],b.vel[0],b.vel[1],b.vel[2],a);return c?b:(c=E.Into2000,c===E.Into2000?(d=Ca(a,c),b=xa(d,b),a=Ba(a,c),a=xa(a,b)):(d=Ba(a,c),b=xa(d,b),a=Ca(a,c),a=xa(a,b)),a)};e.VectorObserver= +function(a,b){var c=aa(a.t),d=[a.x,a.y,a.z];b||(d=Aa(d,a.t,E.From2000),d=Va(d,a.t,E.From2000));b=d[0]*e.KM_PER_AU;var f=d[1]*e.KM_PER_AU;d=d[2]*e.KM_PER_AU;a=Math.sqrt(b*b+f*f);if(1E-6>a){c=0;var h=0=c;)c+=360;for(;180Math.abs(n))break;h-= +n/(-42.69778487239616*((k-g)/l-g*k*-.006694397995865464/(-42.69778487239616*m))+d*f+a*b)}h*=e.RAD2DEG;l=6378.1366/l;d=Math.abs(f)>Math.abs(b)?d/f-.9933056020041345*l:a/b-l}return new mb(h,c,1E3*d)};e.ObserverGravity=function(a,b){a=Math.sin(a*e.DEG2RAD);a*=a;return 9.7803253359*(1+.00193185265241*a)/Math.sqrt(1-.00669437999013*a)*(1-(3.15704E-7-2.10269E-9*a)*b+7.37452E-14*b*b)};e.Ecliptic=Ga;e.GeoMoon=V;e.GeoMoonState=Za;e.GeoEmbState=ob;var ia=[[-73E4,[-26.1182072321076,-14.376168177825,3.3844025152995], +[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.9749052021271,-.4485029529294,-12.7703515059887],[7.3458569351457E-4,.0022785014891658,4.8619778602049E-4]],[-671600,[14.7069307807442,44.2691105400275,9.3536984747716],[-.00210001479998,2.2295915939915E-4,7.0143443551414E-4]],[-642400,[-29.4410039299574,-6.4301615305696,6.8584810113048],[8.4495803960544E-4,-.0030783914758711,-.0012106305981192]],[-613200,[39.4443969462341,-6.5579897605705,-13.9137602964634],[.0011480029005873, +.0022400006880665,3.5168075922288E-4]],[-584E3,[20.2303809506997,43.2669666571891,7.3829660919234],[-.0019754081700585,5.3457141292226E-4,7.5929169129793E-4]],[-554800,[-30.65832536462,2.0938188745519,9.8805311380706],[6.1010603013347E-5,-.0031326500935382,-9.9346125151067E-4]],[-525600,[35.7377032516732,-12.5877060247644,-14.6778472475634],[.0015802939375649,.0021347678412429,1.9074436384343E-4]],[-496400,[25.4662951885462,41.3674783384167,5.2164768733816],[-.0018054401046468,8.328308359951E-4,8.0260156912107E-4]], +[-467200,[-29.847174904071,10.6364263130814,12.2979041801063],[-6.3257063052907E-4,-.0029969577578221,-7.4476074151596E-4]],[-438E3,[30.7746921076872,-18.2366370153037,-14.9455358798963],[.0020113162005465,.0019353827024189,-2.0937793168297E-6]],[-408800,[30.2431533240283,38.6562678885026,2.9385017502184],[-.0016052508674468,.0011183495337525,8.3333973416824E-4]],[-379600,[-27.2889847725327,18.643162147874,14.0236336233295],[-.0011856388898191,-.0027170609282181,-4.9015526126399E-4]],[-350400,[24.5196051967735, +-23.2457560647266,-14.6268623673677],[.0024322321483154,.0016062008146048,-2.3369181613312E-4]],[-321200,[34.5052748058754,35.1253385869542,.5573614756374],[-.0013824391637782,.0013833397561817,8.4823598806262E-4]],[-292E3,[-23.2753639151193,25.8185142987694,15.0553815885983],[-.0016062295460975,-.0023395961498533,-2.4377362639479E-4]],[-262800,[17.0503847980918,-27.1803762901257,-13.6089633216945],[.0028175521080578,.0011358749093955,-4.9548725258825E-4]],[-233600,[38.0936719102855,30.8805883833368, +-1.8436880674133],[-.0011317697153459,.0016128814698472,8.4177586176055E-4]],[-204400,[-18.1978529308782,31.9328699343091,15.4382948262792],[-.0019117272501813,-.0019146495909842,-1.9657304369835E-5]],[-175200,[8.5289240399968,-29.6184222000484,-11.8054009942579],[.0031034370787005,5.139363329243E-4,-7.7293066202546E-4]],[-146E3,[40.9468572586403,25.9049735920209,-4.2563362404988],[-8.3652705194051E-4,.0018129497136404,8.156422827306E-4]],[-116800,[-12.3269588953252,36.8818834462925,15.2171582587111], +[-.0021166103705038,-.001481442003599,1.7401209844705E-4]],[-87600,[-.6332583759085,-30.0187597947092,-9.1719328749499],[.0032016994581737,-2.5279858672148E-4,-.0010411088271861]],[-58400,[42.9360484238833,20.3446855844523,-6.5880270079125],[-5.0525450073192E-4,.0019910074335507,7.7440196540269E-4]],[-29200,[-5.9759105529742,40.6118099584602,14.4701317236731],[-.0022184202156107,-.0010562361130164,3.3652250216211E-4]],[0,[-9.8753695807739,-27.9789262247367,-5.7537118247043],[.0030287533248818,-.0011276087003636, +-.0012651326732361]],[29200,[43.9588319861654,14.2141479732919,-8.8083062271628],[-1.4717608981871E-4,.0021404187242141,7.1486567806614E-4]],[58400,[.6781367635199,43.0944616393616,13.2432387807209],[-.0022358226110718,-6.3233636090933E-4,4.7664798895648E-4]],[87600,[-18.2826020968342,-23.3050395866603,-1.7666205080281],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.8733387445258,7.7007056172154,-10.8142736664251],[2.3174803055677E-4,.0022402163127924,6.2988756452032E-4]], +[146E3,[7.3929490279056,44.3826789515344,11.6295002148543],[-.002193281545383,-2.1751799585364E-4,5.9556516201114E-4]],[175200,[-24.9816902292606,-16.2040128514258,2.4664575442976],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.5301870395114,.8459355080215,-12.5549075276829],[6.5059779150669E-4,.0022725657282262,5.1133743202822E-4]],[233600,[13.9995264868224,44.4623630448942,9.6694184864653],[-.0021079296569252,1.7533423831993E-4,6.9128485798076E-4]],[262800,[-29.1840248030306, +-7.3712439957619,6.493275957928],[9.3581363109681E-4,-.0030610357109184,-.0012364201089345]],[292E3,[39.8319806717528,-6.0784057667647,-13.9098153586562],[.0011117769689167,.0022362097830152,3.6230548231153E-4]],[321200,[20.2949551084758,43.4171904202513,7.4500919859316],[-.0019742157451535,5.3102050468554E-4,7.5938408813008E-4]],[350400,[-30.6699923021597,2.3187435589549,9.973480913858],[4.5605107450676E-5,-.0031308219926928,-9.9066533301924E-4]],[379600,[35.626122155983,-12.8976475092243,-14.7775865084436], +[.0016015684949743,.0021171931182284,1.8002516202204E-4]],[408800,[26.1331861485607,41.232139187599,5.0064013262205],[-.0017857704419579,8.6046232702817E-4,8.0614690298954E-4]],[438E3,[-29.5767402292299,11.8635359435865,12.6313230398719],[-7.2292830060955E-4,-.0029587820140709,-7.08242964503E-4]],[467200,[29.9108057873914,-19.1590192939999,-15.0133638651945],[.0020871080437997,.0018848372554514,-3.8528655083926E-5]],[496400,[31.3759574518189,38.0503727207625,2.4331383437537],[-.0015546055556611,.0011699815465629, +8.3565439266001E-4]],[525600,[-26.3600713369277,20.6625059049518,14.4146962589584],[-.0013142373118349,-.0026236647854842,-4.2542017598193E-4]],[554800,[22.599441488648,-24.5088798983064,-14.484045731468],[.0025454108304806,.0014917058755191,-3.0243665086079E-4]],[584E3,[35.8778640130144,33.8942263660709,-.2245246362769],[-.0012941245730845,.0014560427668319,8.4762160640137E-4]],[613200,[-21.5381497624167,28.2040682697607,15.3219737995345],[-.001731211740901,-.0021939631314577,-1.631691327518E-4]], [642400,[13.9715213744146,-28.3399417647887,-13.0837928718857],[.0029334630526035,9.1860931752944E-4,-5.9939422488627E-4]],[671600,[39.5269420441426,28.9398973601104,-2.8727995275393],[-.0010068481658095,.001702113288809,8.3578230511981E-4]],[700800,[-15.5762007013935,34.3994129612753,15.466033737854],[-.0020098814612884,-.0017191109825989,7.0414782780416E-5]],[73E4,[4.2432528370899,-30.1182016908248,-10.7074412313491],[.0031725847067411,1.609846120227E-4,-9.0672150593868E-4]]],F=function(a,b,c){this.x= -a;this.y=b;this.z=c};F.prototype.ToAstroVector=function(a){return new B(this.x,this.y,this.z,a)};F.prototype.quadrature=function(){return this.x*this.x+this.y*this.y+this.z*this.z};F.prototype.add=function(a){return new F(this.x+a.x,this.y+a.y,this.z+a.z)};F.prototype.sub=function(a){return new F(this.x-a.x,this.y-a.y,this.z-a.z)};F.prototype.incr=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z};F.prototype.decr=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z};F.prototype.mul=function(a){return new F(a* -this.x,a*this.y,a*this.z)};F.prototype.div=function(a){return new F(this.x/a,this.y/a,this.z/a)};F.prototype.mean=function(a){return new F((this.x+a.x)/2,(this.y+a.y)/2,(this.z+a.z)/2)};var $a=function(a,b,c){this.tt=a;this.r=b;this.v=c},oa=function(a){var b=new $a(a,new F(0,0,0),new F(0,0,0));this.Jupiter=bb(b,a,q.Jupiter,2.825345909524226E-7);this.Saturn=bb(b,a,q.Saturn,8.459715185680659E-8);this.Uranus=bb(b,a,q.Uranus,1.292024916781969E-8);this.Neptune=bb(b,a,q.Neptune,1.524358900784276E-8);this.Jupiter.r.decr(b.r); -this.Jupiter.v.decr(b.v);this.Saturn.r.decr(b.r);this.Saturn.v.decr(b.v);this.Uranus.r.decr(b.r);this.Uranus.v.decr(b.v);this.Neptune.r.decr(b.r);this.Neptune.v.decr(b.v);this.Sun=new $a(a,b.r.mul(-1),b.v.mul(-1))};oa.prototype.Acceleration=function(a){var b=Ia(a,2.959122082855911E-4,this.Sun.r);b.incr(Ia(a,2.825345909524226E-7,this.Jupiter.r));b.incr(Ia(a,8.459715185680659E-8,this.Saturn.r));b.incr(Ia(a,1.292024916781969E-8,this.Uranus.r));b.incr(Ia(a,1.524358900784276E-8,this.Neptune.r));return b}; +a;this.y=b;this.z=c};F.prototype.ToAstroVector=function(a){return new C(this.x,this.y,this.z,a)};F.prototype.quadrature=function(){return this.x*this.x+this.y*this.y+this.z*this.z};F.prototype.add=function(a){return new F(this.x+a.x,this.y+a.y,this.z+a.z)};F.prototype.sub=function(a){return new F(this.x-a.x,this.y-a.y,this.z-a.z)};F.prototype.incr=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z};F.prototype.decr=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z};F.prototype.mul=function(a){return new F(a* +this.x,a*this.y,a*this.z)};F.prototype.div=function(a){return new F(this.x/a,this.y/a,this.z/a)};F.prototype.mean=function(a){return new F((this.x+a.x)/2,(this.y+a.y)/2,(this.z+a.z)/2)};var $a=function(a,b,c){this.tt=a;this.r=b;this.v=c},pa=function(a){var b=new $a(a,new F(0,0,0),new F(0,0,0));this.Jupiter=bb(b,a,q.Jupiter,2.825345909524226E-7);this.Saturn=bb(b,a,q.Saturn,8.459715185680659E-8);this.Uranus=bb(b,a,q.Uranus,1.292024916781969E-8);this.Neptune=bb(b,a,q.Neptune,1.524358900784276E-8);this.Jupiter.r.decr(b.r); +this.Jupiter.v.decr(b.v);this.Saturn.r.decr(b.r);this.Saturn.v.decr(b.v);this.Uranus.r.decr(b.r);this.Uranus.v.decr(b.v);this.Neptune.r.decr(b.r);this.Neptune.v.decr(b.v);this.Sun=new $a(a,b.r.mul(-1),b.v.mul(-1))};pa.prototype.Acceleration=function(a){var b=Ia(a,2.959122082855911E-4,this.Sun.r);b.incr(Ia(a,2.825345909524226E-7,this.Jupiter.r));b.incr(Ia(a,8.459715185680659E-8,this.Saturn.r));b.incr(Ia(a,1.292024916781969E-8,this.Uranus.r));b.incr(Ia(a,1.524358900784276E-8,this.Neptune.r));return b}; var Yb=function(a,b,c,d){this.tt=a;this.r=b;this.v=c;this.a=d},Zb=function(a,b){this.bary=a;this.grav=b},ub=[],bd=new J([[.9994327653386544,-.03367710746976414,0],[.030395942890628476,.902057912352809,.43054338854229507],[-.014499455966335291,-.43029916940910073,.902569881273754]]),cd=[{mu:2.82489428433814E-7,al:[1.446213296021224,3.5515522861824],a:[[.0028210960212903,0,0]],l:[[-1.925258348666E-4,4.9369589722645,.01358483658305],[-9.70803596076E-5,4.3188796477322,.01303413843243],[-8.988174165E-5, 1.9080016428617,.00305064867158],[-5.53101050262E-5,1.4936156681569,.01293892891155]],z:[[.0041510849668155,4.089939635545,-.01290686414666],[6.260521444113E-4,1.446188898627,3.5515522949802],[3.52747346169E-5,2.1256287034578,1.2727416567E-4]],zeta:[[3.142172466014E-4,2.7964219722923,-.002315096098],[9.04169207946E-5,1.0477061879627,-5.6920638196E-4]]},{mu:2.82483274392893E-7,al:[-.3735263437471362,1.76932271112347],a:[[.0044871037804314,0,0],[4.324367498E-7,1.819645606291,1.7822295777568]],l:[[8.576433172936E-4, 4.3188693178264,.01303413830805],[4.549582875086E-4,1.4936531751079,.01293892881962],[3.248939825174E-4,1.8196494533458,1.7822295777568],[-3.074250079334E-4,4.9377037005911,.01358483286724],[1.982386144784E-4,1.907986905476,.00305101212869],[1.834063551804E-4,2.1402853388529,.00145009789338],[-1.434383188452E-4,5.622214036663,.89111478887838],[-7.71939140944E-5,4.300272437235,2.6733443704266]],z:[[-.0093589104136341,4.0899396509039,-.01290686414666],[2.988994545555E-4,5.9097265185595,1.7693227079462], @@ -189,22 +189,22 @@ z:[[.0014289811307319,2.1256295942739,1.2727413029E-4],[7.71093122676E-4,5.58363 [7.66916975242E-5,6.2720114319755,1.3928364636651],[7.47056855106E-5,1.2995916202344,1.0034433456729]],z:[[.0073755808467977,5.5836071576084,3.206509914E-5],[2.065924169942E-4,5.9209831565786,.37648624194703],[1.589869764021E-4,.28744006242623,.8782079244252],[-1.561131605348E-4,2.1257397865089,1.2727441285E-4],[1.486043380971E-4,1.4462134301023,3.5515522949802],[6.35073108731E-5,5.9096803285954,1.7693227129285],[5.99351698525E-5,4.1125517584798,-2.7985797954589],[5.40660842731E-5,5.5390350845569, .00286834082283],[-4.89596900866E-5,4.6218149483338,-.62695712529519]],zeta:[[.0038422977898495,2.4133922085557,0],[.0022453891791894,5.9721736773277,-3.056125525E-5],[-2.604479450559E-4,3.3368746306409,-1.2491309972E-4],[3.3211214323E-5,5.5604137742337,.00290037688507]]}],Jc=function(a){this.moon=a};e.JupiterMoonsInfo=Jc;e.JupiterMoons=function(a){a=new O(a);for(var b=[],c=$jscomp.makeIterator(cd),d=c.next();!d.done;d=c.next()){var f=b,h=f.push;d=d.value;for(var l=a.tt+18262.5,k=[0,d.al[0]+l*d.al[1], 0,0,0,0],g=$jscomp.makeIterator(d.a),m=g.next();!m.done;m=g.next()){var n=$jscomp.makeIterator(m.value);m=n.next().value;var p=n.next().value;n=n.next().value;k[0]+=m*Math.cos(p+l*n)}g=$jscomp.makeIterator(d.l);for(m=g.next();!m.done;m=g.next())n=$jscomp.makeIterator(m.value),m=n.next().value,p=n.next().value,n=n.next().value,k[1]+=m*Math.sin(p+l*n);k[1]%=P;0>k[1]&&(k[1]+=P);g=$jscomp.makeIterator(d.z);for(m=g.next();!m.done;m=g.next())n=$jscomp.makeIterator(m.value),m=n.next().value,p=n.next().value, -n=n.next().value,p+=l*n,k[2]+=m*Math.cos(p),k[3]+=m*Math.sin(p);g=$jscomp.makeIterator(d.zeta);for(m=g.next();!m.done;m=g.next())n=$jscomp.makeIterator(m.value),m=n.next().value,p=n.next().value,n=n.next().value,p+=l*n,k[4]+=m*Math.cos(p),k[5]+=m*Math.sin(p);g=k[0];n=k[1];m=k[2];p=k[3];l=k[4];k=k[5];var u=Math.sqrt(d.mu/(g*g*g));d=n+m*Math.sin(n)-p*Math.cos(n);do{var x=Math.cos(d);var C=Math.sin(d);x=(n-d+m*C-p*x)/(1-m*x-p*C);d+=x}while(1E-12<=Math.abs(x));x=Math.cos(d);C=Math.sin(d);n=p*x-m*C;var z= --m*x-p*C,ya=1/(1+z),da=1/(1+Math.sqrt(1-m*m-p*p));d=g*(x-m-da*p*n);n=g*(C-p+da*m*n);p=u*ya*g*(-C-da*p*z);g=u*ya*g*(+x+da*m*z);m=2*Math.sqrt(1-l*l-k*k);u=1-2*k*k;x=1-2*l*l;C=2*k*l;d=new L(d*u+n*C,d*C+n*x,(l*n-d*k)*m,p*u+g*C,p*C+g*x,(l*g-p*k)*m,a);d=wa(bd,d);h.call(f,d)}return new Jc(b)};e.HelioVector=Ja;e.HelioDistance=ia;e.GeoVector=aa;e.BaryState=function(a,b){b=w(b);if(a===q.SSB)return new L(0,0,0,0,0,0,b);if(a===q.Pluto)return tb(b,!1);var c=new oa(b.tt);switch(a){case q.Sun:return pa(c.Sun,b); -case q.Jupiter:return pa(c.Jupiter,b);case q.Saturn:return pa(c.Saturn,b);case q.Uranus:return pa(c.Uranus,b);case q.Neptune:return pa(c.Neptune,b);case q.Moon:case q.EMB:var d=Ha(G[q.Earth],b.tt);a=a===q.Moon?Za(b):ob(b);return new L(a.x+c.Sun.r.x+d.r.x,a.y+c.Sun.r.y+d.r.y,a.z+c.Sun.r.z+d.r.z,a.vx+c.Sun.v.x+d.v.x,a.vy+c.Sun.v.y+d.v.y,a.vz+c.Sun.v.z+d.v.z,b)}if(a in G)return a=Ha(G[a],b.tt),new L(c.Sun.r.x+a.r.x,c.Sun.r.y+a.r.y,c.Sun.r.z+a.r.z,c.Sun.v.x+a.v.x,c.Sun.v.y+a.v.y,c.Sun.v.z+a.v.z,b);throw'BaryState: Unsupported body "'+ -a+'"';};e.HelioState=function(a,b){b=w(b);switch(a){case q.Sun:return new L(0,0,0,0,0,0,b);case q.SSB:return a=new oa(b.tt),new L(-a.Sun.r.x,-a.Sun.r.y,-a.Sun.r.z,-a.Sun.v.x,-a.Sun.v.y,-a.Sun.v.z,b);case q.Mercury:case q.Venus:case q.Earth:case q.Mars:case q.Jupiter:case q.Saturn:case q.Uranus:case q.Neptune:return a=Ha(G[a],b.tt),pa(a,b);case q.Pluto:return tb(b,!0);case q.Moon:case q.EMB:var c=Ha(G.Earth,b.tt);a=a==q.Moon?Za(b):ob(b);return new L(a.x+c.r.x,a.y+c.r.y,a.z+c.r.z,a.vx+c.v.x,a.vy+c.v.y, -a.vz+c.v.z,b);default:throw'HelioState: Unsupported body "'+a+'"';}};e.Search=I;e.SearchSunLongitude=bc;e.PairLongitude=vb;e.AngleFromSun=sa;e.EclipticLongitude=ja;var cc=function(a,b,c,d,f,h,l,k){this.time=a;this.mag=b;this.phase_angle=c;this.helio_dist=d;this.geo_dist=f;this.gc=h;this.hc=l;this.ring_tilt=k;this.phase_fraction=(1+Math.cos(e.DEG2RAD*c))/2};e.IlluminationInfo=cc;e.Illumination=db;e.SearchRelativeLongitude=ta;e.MoonPhase=wb;e.SearchMoonPhase=La;var ec=function(a,b){this.quarter=a;this.time= +n=n.next().value,p+=l*n,k[2]+=m*Math.cos(p),k[3]+=m*Math.sin(p);g=$jscomp.makeIterator(d.zeta);for(m=g.next();!m.done;m=g.next())n=$jscomp.makeIterator(m.value),m=n.next().value,p=n.next().value,n=n.next().value,p+=l*n,k[4]+=m*Math.cos(p),k[5]+=m*Math.sin(p);g=k[0];n=k[1];m=k[2];p=k[3];l=k[4];k=k[5];var t=Math.sqrt(d.mu/(g*g*g));d=n+m*Math.sin(n)-p*Math.cos(n);do{var x=Math.cos(d);var A=Math.sin(d);x=(n-d+m*A-p*x)/(1-m*x-p*A);d+=x}while(1E-12<=Math.abs(x));x=Math.cos(d);A=Math.sin(d);n=p*x-m*A;var z= +-m*x-p*A,ea=1/(1+z),R=1/(1+Math.sqrt(1-m*m-p*p));d=g*(x-m-R*p*n);n=g*(A-p+R*m*n);p=t*ea*g*(-A-R*p*z);g=t*ea*g*(+x+R*m*z);m=2*Math.sqrt(1-l*l-k*k);t=1-2*k*k;x=1-2*l*l;A=2*k*l;d=new L(d*t+n*A,d*A+n*x,(l*n-d*k)*m,p*t+g*A,p*A+g*x,(l*g-p*k)*m,a);d=xa(bd,d);h.call(f,d)}return new Jc(b)};e.HelioVector=Ja;e.HelioDistance=ja;e.GeoVector=ba;e.BaryState=function(a,b){b=w(b);if(a===q.SSB)return new L(0,0,0,0,0,0,b);if(a===q.Pluto)return tb(b,!1);var c=new pa(b.tt);switch(a){case q.Sun:return qa(c.Sun,b);case q.Jupiter:return qa(c.Jupiter, +b);case q.Saturn:return qa(c.Saturn,b);case q.Uranus:return qa(c.Uranus,b);case q.Neptune:return qa(c.Neptune,b);case q.Moon:case q.EMB:var d=Ha(G[q.Earth],b.tt);a=a===q.Moon?Za(b):ob(b);return new L(a.x+c.Sun.r.x+d.r.x,a.y+c.Sun.r.y+d.r.y,a.z+c.Sun.r.z+d.r.z,a.vx+c.Sun.v.x+d.v.x,a.vy+c.Sun.v.y+d.v.y,a.vz+c.Sun.v.z+d.v.z,b)}if(a in G)return a=Ha(G[a],b.tt),new L(c.Sun.r.x+a.r.x,c.Sun.r.y+a.r.y,c.Sun.r.z+a.r.z,c.Sun.v.x+a.v.x,c.Sun.v.y+a.v.y,c.Sun.v.z+a.v.z,b);throw'BaryState: Unsupported body "'+ +a+'"';};e.HelioState=function(a,b){b=w(b);switch(a){case q.Sun:return new L(0,0,0,0,0,0,b);case q.SSB:return a=new pa(b.tt),new L(-a.Sun.r.x,-a.Sun.r.y,-a.Sun.r.z,-a.Sun.v.x,-a.Sun.v.y,-a.Sun.v.z,b);case q.Mercury:case q.Venus:case q.Earth:case q.Mars:case q.Jupiter:case q.Saturn:case q.Uranus:case q.Neptune:return a=Ha(G[a],b.tt),qa(a,b);case q.Pluto:return tb(b,!0);case q.Moon:case q.EMB:var c=Ha(G.Earth,b.tt);a=a==q.Moon?Za(b):ob(b);return new L(a.x+c.r.x,a.y+c.r.y,a.z+c.r.z,a.vx+c.v.x,a.vy+c.v.y, +a.vz+c.v.z,b);default:throw'HelioState: Unsupported body "'+a+'"';}};e.Search=I;e.SearchSunLongitude=bc;e.PairLongitude=vb;e.AngleFromSun=ta;e.EclipticLongitude=ka;var cc=function(a,b,c,d,f,h,l,k){this.time=a;this.mag=b;this.phase_angle=c;this.helio_dist=d;this.geo_dist=f;this.gc=h;this.hc=l;this.ring_tilt=k;this.phase_fraction=(1+Math.cos(e.DEG2RAD*c))/2};e.IlluminationInfo=cc;e.Illumination=db;e.SearchRelativeLongitude=ua;e.MoonPhase=wb;e.SearchMoonPhase=La;var ec=function(a,b){this.quarter=a;this.time= b};e.MoonQuarter=ec;e.SearchMoonQuarter=dc;e.NextMoonQuarter=function(a){a=new Date(a.time.date.getTime()+5184E5);return dc(a)};e.SearchRiseSet=function(a,b,c,d,f){a:switch(a){case q.Sun:var h=Zc;break a;case q.Moon:h=$c;break a;default:h=0}return fc(a,b,c,d,f,function(l){var k=Fa(a,l,b,!0,!0);l=Da(l,b,k.ra,k.dec).altitude+h/k.dist*e.RAD2DEG+ad;return c*l})};e.SearchAltitude=function(a,b,c,d,f,h){if(!Number.isFinite(h)||-90>h||90=++f;){var h=ja(a,b),l=ja(q.Earth,b),k=qa(h-l),g=h=l=void 0;k>=-d.s1&&k<+d.s1?(g=0,l=+d.s1,h=+d.s2):k>=+d.s2||k<-d.s2?(g=0,l=-d.s2,h=-d.s1):0<=k?(g=-Ka(a)/4,l=+d.s1,h=+d.s2):(g=-Ka(a)/4,l=-d.s2,h=-d.s1);k=b.AddDays(g);l=ta(a,l,k);h=ta(a,h,l);k=c(l);if(0<=k)throw"SearchMaxElongation: internal error: m1 = "+k;g=c(h);if(0>=g)throw"SearchMaxElongation: internal error: m2 = "+g;k=I(c,l,h,{init_f1:k,init_f2:g,dt_tolerance_seconds:10});if(!k)throw"SearchMaxElongation: failed search iter "+ -f+" (t1="+l.toString()+", t2="+h.toString()+")";if(k.tt>=b.tt)return hc(a,k);b=h.AddDays(1)}throw"SearchMaxElongation: failed to find event after 2 tries.";};e.SearchPeakMagnitude=function(a,b){function c(g){var m=g.AddDays(-.005);g=g.AddDays(.005);m=db(a,m).mag;return(db(a,g).mag-m)/.01}if(a!==q.Venus)throw"SearchPeakMagnitude currently works for Venus only.";b=w(b);for(var d=0;2>=++d;){var f=ja(a,b),h=ja(q.Earth,b),l=qa(f-h),k=f=h=void 0;-10<=l&&10>l?(k=0,h=10,f=30):30<=l||-30>l?(k=0,h=-30,f=-10): -0<=l?(k=-Ka(a)/4,h=10,f=30):(k=-Ka(a)/4,h=-30,f=-10);l=b.AddDays(k);h=ta(a,h,l);f=ta(a,f,h);l=c(h);if(0<=l)throw"SearchPeakMagnitude: internal error: m1 = "+l;k=c(f);if(0>=k)throw"SearchPeakMagnitude: internal error: m2 = "+k;l=I(c,h,f,{init_f1:l,init_f2:k,dt_tolerance_seconds:10});if(!l)throw"SearchPeakMagnitude: failed search iter "+d+" (t1="+h.toString()+", t2="+f.toString()+")";if(l.tt>=b.tt)return db(a,l);b=f.AddDays(1)}throw"SearchPeakMagnitude: failed to find event after 2 tries.";};var Na= +a+" is neither a Date nor a safe integer.";var c=b(0,3,19),d=b(90,6,19),f=b(180,9,21),h=b(270,12,20);return new Kc(c,d,f,h)};var ic=function(a,b,c,d){this.time=a;this.visibility=b;this.elongation=c;this.ecliptic_separation=d};e.ElongationEvent=ic;e.Elongation=hc;e.SearchMaxElongation=function(a,b){function c(m){var n=m.AddDays(-.005);m=m.AddDays(.005);n=ta(a,n);m=ta(a,m);return(n-m)/.01}b=w(b);var d={Mercury:{s1:50,s2:85},Venus:{s1:40,s2:50}}[a];if(!d)throw"SearchMaxElongation works for Mercury and Venus only."; +for(var f=0;2>=++f;){var h=ka(a,b),l=ka(q.Earth,b),k=ra(h-l),g=h=l=void 0;k>=-d.s1&&k<+d.s1?(g=0,l=+d.s1,h=+d.s2):k>=+d.s2||k<-d.s2?(g=0,l=-d.s2,h=-d.s1):0<=k?(g=-Ka(a)/4,l=+d.s1,h=+d.s2):(g=-Ka(a)/4,l=-d.s2,h=-d.s1);k=b.AddDays(g);l=ua(a,l,k);h=ua(a,h,l);k=c(l);if(0<=k)throw"SearchMaxElongation: internal error: m1 = "+k;g=c(h);if(0>=g)throw"SearchMaxElongation: internal error: m2 = "+g;k=I(c,l,h,{init_f1:k,init_f2:g,dt_tolerance_seconds:10});if(!k)throw"SearchMaxElongation: failed search iter "+ +f+" (t1="+l.toString()+", t2="+h.toString()+")";if(k.tt>=b.tt)return hc(a,k);b=h.AddDays(1)}throw"SearchMaxElongation: failed to find event after 2 tries.";};e.SearchPeakMagnitude=function(a,b){function c(g){var m=g.AddDays(-.005);g=g.AddDays(.005);m=db(a,m).mag;return(db(a,g).mag-m)/.01}if(a!==q.Venus)throw"SearchPeakMagnitude currently works for Venus only.";b=w(b);for(var d=0;2>=++d;){var f=ka(a,b),h=ka(q.Earth,b),l=ra(f-h),k=f=h=void 0;-10<=l&&10>l?(k=0,h=10,f=30):30<=l||-30>l?(k=0,h=-30,f=-10): +0<=l?(k=-Ka(a)/4,h=10,f=30):(k=-Ka(a)/4,h=-30,f=-10);l=b.AddDays(k);h=ua(a,h,l);f=ua(a,f,h);l=c(h);if(0<=l)throw"SearchPeakMagnitude: internal error: m1 = "+l;k=c(f);if(0>=k)throw"SearchPeakMagnitude: internal error: m2 = "+k;l=I(c,h,f,{init_f1:l,init_f2:k,dt_tolerance_seconds:10});if(!l)throw"SearchPeakMagnitude: failed search iter "+d+" (t1="+h.toString()+", t2="+f.toString()+")";if(l.tt>=b.tt)return db(a,l);b=f.AddDays(1)}throw"SearchPeakMagnitude: failed to find event after 2 tries.";};var Na= function(a,b,c){this.time=a;this.kind=b;this.dist_au=c;this.dist_km=c*e.KM_PER_AU};e.Apsis=Na;e.SearchLunarApsis=jc;e.NextLunarApsis=function(a){var b=jc(a.time.AddDays(11));if(1!==b.kind+a.kind)throw"NextLunarApsis INTERNAL ERROR: did not find alternating apogee/perigee: prev="+a.kind+" @ "+a.time.toString()+", next="+b.kind+" @ "+b.time.toString();return b};e.SearchPlanetApsis=lc;e.NextPlanetApsis=function(a,b){if(0!==b.kind&&1!==b.kind)throw"Invalid apsis kind: "+b.kind;var c=b.time.AddDays(.25* -ba[a].OrbitalPeriod);a=lc(a,c);if(1!==a.kind+b.kind)throw"Internal error: previous apsis was "+b.kind+", but found "+a.kind+" for next apsis.";return a};e.InverseRotation=ua;e.CombineRotation=va;e.IdentityMatrix=function(){return new J([[1,0,0],[0,1,0],[0,0,1]])};e.Pivot=function(a,b,c){if(0!==b&&1!==b&&2!==b)throw"Invalid axis "+b+". Must be [0, 1, 2].";var d=v(c)*e.DEG2RAD;c=Math.cos(d);d=Math.sin(d);var f=(b+1)%3,h=(b+2)%3,l=[[0,0,0],[0,0,0],[0,0,0]];l[f][f]=c*a.rot[f][f]-d*a.rot[f][h];l[f][h]= +ca[a].OrbitalPeriod);a=lc(a,c);if(1!==a.kind+b.kind)throw"Internal error: previous apsis was "+b.kind+", but found "+a.kind+" for next apsis.";return a};e.InverseRotation=va;e.CombineRotation=wa;e.IdentityMatrix=function(){return new J([[1,0,0],[0,1,0],[0,0,1]])};e.Pivot=function(a,b,c){if(0!==b&&1!==b&&2!==b)throw"Invalid axis "+b+". Must be [0, 1, 2].";var d=v(c)*e.DEG2RAD;c=Math.cos(d);d=Math.sin(d);var f=(b+1)%3,h=(b+2)%3,l=[[0,0,0],[0,0,0],[0,0,0]];l[f][f]=c*a.rot[f][f]-d*a.rot[f][h];l[f][h]= d*a.rot[f][f]+c*a.rot[f][h];l[f][b]=a.rot[f][b];l[h][f]=c*a.rot[h][f]-d*a.rot[h][h];l[h][h]=d*a.rot[h][f]+c*a.rot[h][h];l[h][b]=a.rot[h][b];l[b][f]=c*a.rot[b][f]-d*a.rot[b][h];l[b][h]=d*a.rot[b][f]+c*a.rot[b][h];l[b][b]=a.rot[b][b];return new J(l)};e.VectorFromSphere=xb;e.EquatorFromVector=yb;e.SphereFromVector=zb;e.HorizonFromVector=function(a,b){a=zb(a);a.lon=mc(a.lon);a.lat+=Ea(b,a.lat);return a};e.VectorFromHorizon=function(a,b,c){var d=mc(a.lon);c=a.lat+nc(c,a.lat);a=new eb(c,d,a.dist);return xb(a, -b)};e.Refraction=Ea;e.InverseRefraction=nc;e.RotateVector=Oa;e.RotateState=wa;e.Rotation_EQJ_ECL=oc;e.Rotation_ECL_EQJ=function(){return new J([[1,0,0],[0,.9174821430670688,.3977769691083922],[0,-.3977769691083922,.9174821430670688]])};e.Rotation_EQJ_EQD=Ab;e.Rotation_EQD_EQJ=Bb;e.Rotation_EQD_HOR=Cb;e.Rotation_HOR_EQD=pc;e.Rotation_HOR_EQJ=qc;e.Rotation_EQJ_HOR=function(a,b){a=qc(a,b);return ua(a)};e.Rotation_EQD_ECL=rc;e.Rotation_ECL_EQD=sc;e.Rotation_ECL_HOR=tc;e.Rotation_HOR_ECL=function(a,b){a= -tc(a,b);return ua(a)};e.Rotation_EQJ_GAL=function(){return new J([[-.0548624779711344,.4941095946388765,-.8676668813529025],[-.8734572784246782,-.4447938112296831,-.1980677870294097],[-.483800052994852,.7470034631630423,.4559861124470794]])};e.Rotation_GAL_EQJ=function(){return new J([[-.0548624779711344,-.8734572784246782,-.483800052994852],[.4941095946388765,-.4447938112296831,.7470034631630423],[-.8676668813529025,-.1980677870294097,.4559861124470794]])};var dd=[["And","Andromeda"],["Ant","Antila"], +b)};e.Refraction=Ea;e.InverseRefraction=nc;e.RotateVector=Oa;e.RotateState=xa;e.Rotation_EQJ_ECL=oc;e.Rotation_ECL_EQJ=function(){return new J([[1,0,0],[0,.9174821430670688,.3977769691083922],[0,-.3977769691083922,.9174821430670688]])};e.Rotation_EQJ_EQD=Ab;e.Rotation_EQD_EQJ=Bb;e.Rotation_EQD_HOR=Cb;e.Rotation_HOR_EQD=pc;e.Rotation_HOR_EQJ=qc;e.Rotation_EQJ_HOR=function(a,b){a=qc(a,b);return va(a)};e.Rotation_EQD_ECL=rc;e.Rotation_ECL_EQD=sc;e.Rotation_ECL_HOR=tc;e.Rotation_HOR_ECL=function(a,b){a= +tc(a,b);return va(a)};e.Rotation_EQJ_GAL=function(){return new J([[-.0548624779711344,.4941095946388765,-.8676668813529025],[-.8734572784246782,-.4447938112296831,-.1980677870294097],[-.483800052994852,.7470034631630423,.4559861124470794]])};e.Rotation_GAL_EQJ=function(){return new J([[-.0548624779711344,-.8734572784246782,-.483800052994852],[.4941095946388765,-.4447938112296831,.7470034631630423],[-.8676668813529025,-.1980677870294097,.4559861124470794]])};var dd=[["And","Andromeda"],["Ant","Antila"], ["Aps","Apus"],["Aql","Aquila"],["Aqr","Aquarius"],["Ara","Ara"],["Ari","Aries"],["Aur","Auriga"],["Boo","Bootes"],["Cae","Caelum"],["Cam","Camelopardis"],["Cap","Capricornus"],["Car","Carina"],["Cas","Cassiopeia"],["Cen","Centaurus"],["Cep","Cepheus"],["Cet","Cetus"],["Cha","Chamaeleon"],["Cir","Circinus"],["CMa","Canis Major"],["CMi","Canis Minor"],["Cnc","Cancer"],["Col","Columba"],["Com","Coma Berenices"],["CrA","Corona Australis"],["CrB","Corona Borealis"],["Crt","Crater"],["Cru","Crux"],["Crv", "Corvus"],["CVn","Canes Venatici"],["Cyg","Cygnus"],["Del","Delphinus"],["Dor","Dorado"],["Dra","Draco"],["Equ","Equuleus"],["Eri","Eridanus"],["For","Fornax"],["Gem","Gemini"],["Gru","Grus"],["Her","Hercules"],["Hor","Horologium"],["Hya","Hydra"],["Hyi","Hydrus"],["Ind","Indus"],["Lac","Lacerta"],["Leo","Leo"],["Lep","Lepus"],["Lib","Libra"],["LMi","Leo Minor"],["Lup","Lupus"],["Lyn","Lynx"],["Lyr","Lyra"],["Men","Mensa"],["Mic","Microscopium"],["Mon","Monoceros"],["Mus","Musca"],["Nor","Norma"], ["Oct","Octans"],["Oph","Ophiuchus"],["Ori","Orion"],["Pav","Pavo"],["Peg","Pegasus"],["Per","Perseus"],["Phe","Phoenix"],["Pic","Pictor"],["PsA","Pisces Austrinus"],["Psc","Pisces"],["Pup","Puppis"],["Pyx","Pyxis"],["Ret","Reticulum"],["Scl","Sculptor"],["Sco","Scorpius"],["Sct","Scutum"],["Ser","Serpens"],["Sex","Sextans"],["Sge","Sagitta"],["Sgr","Sagittarius"],["Tau","Taurus"],["Tel","Telescopium"],["TrA","Triangulum Australe"],["Tri","Triangulum"],["Tuc","Tucana"],["UMa","Ursa Major"],["UMi", @@ -226,8 +226,10 @@ a;this.name=b;this.ra1875=c;this.dec1875=d};e.ConstellationInfo=Mc;e.Constellati };var wc=function(a,b,c,d,f){this.kind=a;this.peak=b;this.sd_penum=c;this.sd_partial=d;this.sd_total=f};e.LunarEclipseInfo=wc;var Uc=function(a,b,c,d,f,h,l){this.time=a;this.u=b;this.r=c;this.k=d;this.p=f;this.target=h;this.dir=l};e.SearchLunarEclipse=vc;var yc=function(a,b,c,d,f){this.kind=a;this.peak=b;this.distance=c;this.latitude=d;this.longitude=f};e.GlobalSolarEclipseInfo=yc;e.NextLunarEclipse=function(a){a=a.AddDays(10);return vc(a)};e.SearchGlobalSolarEclipse=xc;e.NextGlobalSolarEclipse=function(a){a= a.AddDays(10);return xc(a)};var Cc=function(a,b){this.time=a;this.altitude=b};e.EclipseEvent=Cc;var Ec=function(a,b,c,d,f,h){this.kind=a;this.partial_begin=b;this.total_begin=c;this.peak=d;this.total_end=f;this.partial_end=h};e.LocalSolarEclipseInfo=Ec;e.SearchLocalSolarEclipse=Dc;e.NextLocalSolarEclipse=function(a,b){a=a.AddDays(10);return Dc(a,b)};var Hc=function(a,b,c,d){this.start=a;this.peak=b;this.finish=c;this.separation=d};e.TransitInfo=Hc;e.SearchTransit=Gc;e.NextTransit=function(a,b){b= b.AddDays(100);return Gc(a,b)};var Ib=function(a,b,c,d){this.ra=a;this.dec=b;this.spin=c;this.north=d};e.AxisInfo=Ib;e.RotationAxis=function(a,b){b=w(b);var c=b.tt,d=c/36525;switch(a){case q.Sun:a=286.13;var f=63.87;c=84.176+14.1844*c;break;case q.Mercury:a=281.0103-.0328*d;f=61.4155-.0049*d;c=329.5988+6.1385108*c+.01067257*Math.sin(e.DEG2RAD*(174.7910857+4.092335*c))-.00112309*Math.sin(e.DEG2RAD*(349.5821714+8.18467*c))-1.104E-4*Math.sin(e.DEG2RAD*(164.3732571+12.277005*c))-2.539E-5*Math.sin(e.DEG2RAD* -(339.1643429+16.36934*c))-5.71E-6*Math.sin(e.DEG2RAD*(153.9554286+20.461675*c));break;case q.Venus:a=272.76;f=67.16;c=160.2-1.4813688*c;break;case q.Earth:return a=Va([0,0,1],b,E.Into2000),a=Aa(a,b,E.Into2000),a=new B(a[0],a[1],a[2],b),c=yb(a),new Ib(c.ra,c.dec,190.41375788700253+360.9856122880876*b.ut,a);case q.Mars:a=317.269202-.10927547*d+6.8E-5*Math.sin(e.DEG2RAD*(198.991226+19139.4819985*d))+2.38E-4*Math.sin(e.DEG2RAD*(226.292679+38280.8511281*d))+5.2E-5*Math.sin(e.DEG2RAD*(249.663391+57420.7251593* -d))+9E-6*Math.sin(e.DEG2RAD*(266.18351+76560.636795*d))+.419057*Math.sin(e.DEG2RAD*(79.398797+.5042615*d));f=54.432516-.05827105*d+5.1E-5*Math.cos(e.DEG2RAD*(122.433576+19139.9407476*d))+1.41E-4*Math.cos(e.DEG2RAD*(43.058401+38280.8753272*d))+3.1E-5*Math.cos(e.DEG2RAD*(57.663379+57420.7517205*d))+5E-6*Math.cos(e.DEG2RAD*(79.476401+76560.6495004*d))+1.591274*Math.cos(e.DEG2RAD*(166.325722+.5042615*d));c=176.049863+350.891982443297*c+1.45E-4*Math.sin(e.DEG2RAD*(129.071773+19140.0328244*d))+1.57E-4* -Math.sin(e.DEG2RAD*(36.352167+38281.0473591*d))+4E-5*Math.sin(e.DEG2RAD*(56.668646+57420.929536*d))+1E-6*Math.sin(e.DEG2RAD*(67.364003+76560.2552215*d))+1E-6*Math.sin(e.DEG2RAD*(104.79268+95700.4387578*d))+.584542*Math.sin(e.DEG2RAD*(95.391654+.5042615*d));break;case q.Jupiter:f=e.DEG2RAD*(99.360714+4850.4046*d);var h=e.DEG2RAD*(175.895369+1191.9605*d),l=e.DEG2RAD*(300.323162+262.5475*d),k=e.DEG2RAD*(114.012305+6070.2476*d),g=e.DEG2RAD*(49.511251+64.3*d);a=268.056595-.006499*d+1.17E-4*Math.sin(f)+ -9.38E-4*Math.sin(h)+.001432*Math.sin(l)+3E-5*Math.sin(k)+.00215*Math.sin(g);f=64.495303+.002413*d+5E-5*Math.cos(f)+4.04E-4*Math.cos(h)+6.17E-4*Math.cos(l)-1.3E-5*Math.cos(k)+9.26E-4*Math.cos(g);c=284.95+870.536*c;break;case q.Saturn:a=40.589-.036*d;f=83.537-.004*d;c=38.9+810.7939024*c;break;case q.Uranus:a=257.311;f=-15.175;c=203.81-501.1600928*c;break;case q.Neptune:d=e.DEG2RAD*(357.85+52.316*d);a=299.36+.7*Math.sin(d);f=43.46-.51*Math.cos(d);c=249.978+541.1397757*c-.48*Math.sin(d);break;case q.Pluto:a= -132.993;f=-6.163;c=302.695+56.3625225*c;break;default:throw"Invalid body: "+a;}d=f*e.DEG2RAD;h=a*e.DEG2RAD;l=Math.cos(d);b=new B(l*Math.cos(h),l*Math.sin(h),Math.sin(d),b);return new Ib(a/15,f,c,b)}},{}]},{},[1])(1)}); +(339.1643429+16.36934*c))-5.71E-6*Math.sin(e.DEG2RAD*(153.9554286+20.461675*c));break;case q.Venus:a=272.76;f=67.16;c=160.2-1.4813688*c;break;case q.Earth:return a=Va([0,0,1],b,E.Into2000),a=Aa(a,b,E.Into2000),a=new C(a[0],a[1],a[2],b),c=yb(a),new Ib(c.ra,c.dec,190.41375788700253+360.9856122880876*b.ut,a);case q.Moon:var h=e.DEG2RAD*(125.045-.0529921*c),l=e.DEG2RAD*(250.089-.1059842*c),k=e.DEG2RAD*(260.008+13.0120009*c),g=e.DEG2RAD*(176.625+13.3407154*c),m=e.DEG2RAD*(357.529+.9856003*c),n=e.DEG2RAD* +(311.589+26.4057084*c),p=e.DEG2RAD*(134.963+13.064993*c),t=e.DEG2RAD*(276.617+.3287146*c),x=e.DEG2RAD*(34.226+1.7484877*c),A=e.DEG2RAD*(15.134-.1589763*c),z=e.DEG2RAD*(119.743+.0036096*c),ea=e.DEG2RAD*(239.961+.1643573*c),R=e.DEG2RAD*(25.053+12.9590088*c);a=269.9949+.0031*d-3.8787*Math.sin(h)-.1204*Math.sin(l)+.07*Math.sin(k)-.0172*Math.sin(g)+.0072*Math.sin(n)-.0052*Math.sin(A)+.0043*Math.sin(R);f=66.5392+.013*d+1.5419*Math.cos(h)+.0239*Math.cos(l)-.0278*Math.cos(k)+.0068*Math.cos(g)-.0029*Math.cos(n)+ +9E-4*Math.cos(p)+8E-4*Math.cos(A)-9E-4*Math.cos(R);c=38.3213+(13.17635815-1.4E-12*c)*c+3.561*Math.sin(h)+.1208*Math.sin(l)-.0642*Math.sin(k)+.0158*Math.sin(g)+.0252*Math.sin(m)-.0066*Math.sin(n)-.0047*Math.sin(p)-.0046*Math.sin(t)+.0028*Math.sin(x)+.0052*Math.sin(A)+.004*Math.sin(z)+.0019*Math.sin(ea)-.0044*Math.sin(R);break;case q.Mars:a=317.269202-.10927547*d+6.8E-5*Math.sin(e.DEG2RAD*(198.991226+19139.4819985*d))+2.38E-4*Math.sin(e.DEG2RAD*(226.292679+38280.8511281*d))+5.2E-5*Math.sin(e.DEG2RAD* +(249.663391+57420.7251593*d))+9E-6*Math.sin(e.DEG2RAD*(266.18351+76560.636795*d))+.419057*Math.sin(e.DEG2RAD*(79.398797+.5042615*d));f=54.432516-.05827105*d+5.1E-5*Math.cos(e.DEG2RAD*(122.433576+19139.9407476*d))+1.41E-4*Math.cos(e.DEG2RAD*(43.058401+38280.8753272*d))+3.1E-5*Math.cos(e.DEG2RAD*(57.663379+57420.7517205*d))+5E-6*Math.cos(e.DEG2RAD*(79.476401+76560.6495004*d))+1.591274*Math.cos(e.DEG2RAD*(166.325722+.5042615*d));c=176.049863+350.891982443297*c+1.45E-4*Math.sin(e.DEG2RAD*(129.071773+ +19140.0328244*d))+1.57E-4*Math.sin(e.DEG2RAD*(36.352167+38281.0473591*d))+4E-5*Math.sin(e.DEG2RAD*(56.668646+57420.929536*d))+1E-6*Math.sin(e.DEG2RAD*(67.364003+76560.2552215*d))+1E-6*Math.sin(e.DEG2RAD*(104.79268+95700.4387578*d))+.584542*Math.sin(e.DEG2RAD*(95.391654+.5042615*d));break;case q.Jupiter:f=e.DEG2RAD*(99.360714+4850.4046*d);h=e.DEG2RAD*(175.895369+1191.9605*d);l=e.DEG2RAD*(300.323162+262.5475*d);k=e.DEG2RAD*(114.012305+6070.2476*d);g=e.DEG2RAD*(49.511251+64.3*d);a=268.056595-.006499* +d+1.17E-4*Math.sin(f)+9.38E-4*Math.sin(h)+.001432*Math.sin(l)+3E-5*Math.sin(k)+.00215*Math.sin(g);f=64.495303+.002413*d+5E-5*Math.cos(f)+4.04E-4*Math.cos(h)+6.17E-4*Math.cos(l)-1.3E-5*Math.cos(k)+9.26E-4*Math.cos(g);c=284.95+870.536*c;break;case q.Saturn:a=40.589-.036*d;f=83.537-.004*d;c=38.9+810.7939024*c;break;case q.Uranus:a=257.311;f=-15.175;c=203.81-501.1600928*c;break;case q.Neptune:d=e.DEG2RAD*(357.85+52.316*d);a=299.36+.7*Math.sin(d);f=43.46-.51*Math.cos(d);c=249.978+541.1397757*c-.48*Math.sin(d); +break;case q.Pluto:a=132.993;f=-6.163;c=302.695+56.3625225*c;break;default:throw"Invalid body: "+a;}d=f*e.DEG2RAD;h=a*e.DEG2RAD;l=Math.cos(d);b=new C(l*Math.cos(h),l*Math.sin(h),Math.sin(d),b);return new Ib(a/15,f,c,b)}},{}]},{},[1])(1)}); diff --git a/source/js/astronomy.d.ts b/source/js/astronomy.d.ts index 1a14e746..4f79644c 100644 --- a/source/js/astronomy.d.ts +++ b/source/js/astronomy.d.ts @@ -2651,7 +2651,7 @@ export declare class AxisInfo { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date diff --git a/source/js/astronomy.js b/source/js/astronomy.js index 23080d5c..9b3b3236 100644 --- a/source/js/astronomy.js +++ b/source/js/astronomy.js @@ -1631,7 +1631,7 @@ function Libration(date) { const mlat = moon.geo_eclip_lat; const dist_km = moon.distance_au * exports.KM_PER_AU; // Inclination angle - const I = exports.DEG2RAD * 1.54242; + const I = exports.DEG2RAD * 1.543; // Moon's argument of latitude in radians. const f = exports.DEG2RAD * NormalizeLongitude(93.2720950 + 483202.0175233 * t - 0.0036539 * t2 - t3 / 3526000 + t4 / 863310000); // Moon's ascending node's mean longitude in radians. @@ -8092,7 +8092,7 @@ function EarthRotationAxis(time) { * * @param {Body} body * One of the following values: - * `Body.Sun`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, + * `Body.Sun`, `Body.Moon`, `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, * `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. * * @param {FlexibleDateTime} date @@ -8129,6 +8129,54 @@ function RotationAxis(body, date) { break; case Body.Earth: return EarthRotationAxis(time); + case Body.Moon: + // See page 8, Table 2 in: + // https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf + const E1 = exports.DEG2RAD * (125.045 - 0.0529921 * d); + const E2 = exports.DEG2RAD * (250.089 - 0.1059842 * d); + const E3 = exports.DEG2RAD * (260.008 + 13.0120009 * d); + const E4 = exports.DEG2RAD * (176.625 + 13.3407154 * d); + const E5 = exports.DEG2RAD * (357.529 + 0.9856003 * d); + const E6 = exports.DEG2RAD * (311.589 + 26.4057084 * d); + const E7 = exports.DEG2RAD * (134.963 + 13.0649930 * d); + const E8 = exports.DEG2RAD * (276.617 + 0.3287146 * d); + const E9 = exports.DEG2RAD * (34.226 + 1.7484877 * d); + const E10 = exports.DEG2RAD * (15.134 - 0.1589763 * d); + const E11 = exports.DEG2RAD * (119.743 + 0.0036096 * d); + const E12 = exports.DEG2RAD * (239.961 + 0.1643573 * d); + const E13 = exports.DEG2RAD * (25.053 + 12.9590088 * d); + ra = (269.9949 + 0.0031 * T + - 3.8787 * Math.sin(E1) + - 0.1204 * Math.sin(E2) + + 0.0700 * Math.sin(E3) + - 0.0172 * Math.sin(E4) + + 0.0072 * Math.sin(E6) + - 0.0052 * Math.sin(E10) + + 0.0043 * Math.sin(E13)); + dec = (66.5392 + 0.0130 * T + + 1.5419 * Math.cos(E1) + + 0.0239 * Math.cos(E2) + - 0.0278 * Math.cos(E3) + + 0.0068 * Math.cos(E4) + - 0.0029 * Math.cos(E6) + + 0.0009 * Math.cos(E7) + + 0.0008 * Math.cos(E10) + - 0.0009 * Math.cos(E13)); + w = (38.3213 + (13.17635815 - 1.4e-12 * d) * d + + 3.5610 * Math.sin(E1) + + 0.1208 * Math.sin(E2) + - 0.0642 * Math.sin(E3) + + 0.0158 * Math.sin(E4) + + 0.0252 * Math.sin(E5) + - 0.0066 * Math.sin(E6) + - 0.0047 * Math.sin(E7) + - 0.0046 * Math.sin(E8) + + 0.0028 * Math.sin(E9) + + 0.0052 * Math.sin(E10) + + 0.0040 * Math.sin(E11) + + 0.0019 * Math.sin(E12) + - 0.0044 * Math.sin(E13)); + break; case Body.Mars: ra = (317.269202 - 0.10927547 * T + 0.000068 * Math.sin(exports.DEG2RAD * (198.991226 + 19139.4819985 * T)) diff --git a/source/js/astronomy.min.js b/source/js/astronomy.min.js index 829ef500..b4df45f9 100644 --- a/source/js/astronomy.min.js +++ b/source/js/astronomy.min.js @@ -104,10 +104,10 @@ var iaudata=[[[0,0,0,0,1],[-172064161,-174666,33386,92052331,9086,15377]],[[0,0, function iau2000b(a){var b;var c=a.tt/36525;var d=(485868.249036+1.7179159232178E9*c)%ASEC360*ASEC2RAD;var e=(1287104.79305+1.295965810481E8*c)%ASEC360*ASEC2RAD;var f=(335779.526232+1.7395272628478E9*c)%ASEC360*ASEC2RAD;var g=(1072260.70369+1.602961601209E9*c)%ASEC360*ASEC2RAD;var k=(450160.398036-6962890.5431*c)%ASEC360*ASEC2RAD;var h=b=0;for(a=76;0<=a;--a){var l=iaudata[a][0];var m=iaudata[a][1];var n=(l[0]*d+l[1]*e+l[2]*f+l[3]*g+l[4]*k)%PI2;l=Math.sin(n);n=Math.cos(n);b+=(m[0]+m[1]*c)*l+m[2]*n; h+=(m[3]+m[4]*c)*n+m[5]*l}return{dpsi:-1.35E-4+1E-7*b,deps:3.88E-4+1E-7*h}}function mean_obliq(a){a=a.tt/36525;return(((((-4.34E-8*a-5.76E-7)*a+.0020034)*a-1.831E-4)*a-46.836769)*a+84381.406)/3600}var cache_e_tilt;function e_tilt(a){if(!cache_e_tilt||1E-6=u;++u)0!== -q[u]&&f(v.x,v.y,c(r,q[u],u),c(x,q[u],u),function(D,E){return v.x=D,v.y=E});return v}function h(q,u,w,A,v,D,E,J){v=k(v,D,E,J);n+=q*v.y;p+=u*v.y;O+=w*v.x;P+=A*v.x}++exports.CalcMoonCount;a=a.tt/36525;var l,m,n,p,r=b(-6,6,1,4),x=b(-6,6,1,4);var t=a*a;var O=p=n=0;var P=3422.7;var C=g(.19833+.05611*a);var B=g(.27869+.04508*a);var y=g(.16827-.36903*a);var z=g(.34734-5.37261*a);var F=g(.10498-5.37899*a);var G=g(.42681-.41855*a),R=g(.14943-5.37511*a);var H=.84*C+.31*B+14.27*y+7.26*z+.28*F+.24*G;var L=2.94* -C+.31*B+14.27*y+9.34*z+1.12*F+.83*G;var I=-6.4*C-1.89*G;B=.21*C+.31*B+14.27*y-88.7*z-15.3*F+.24*G-1.86*R;y=H-I;C=-3.332E-6*g(.59734-5.37261*a)-5.39E-7*g(.35498-5.37899*a)-6.4E-8*g(.39943-5.37511*a);H=PI2*Frac(.60643382+1336.85522467*a-3.13E-6*t)+H/ARC;L=PI2*Frac(.37489701+1325.55240982*a+2.565E-5*t)+L/ARC;I=PI2*Frac(.99312619+99.99735956*a-4.4E-7*t)+I/ARC;B=PI2*Frac(.25909118+1342.2278298*a-8.92E-6*t)+B/ARC;F=PI2*Frac(.82736186+1236.85308708*a-3.97E-6*t)+y/ARC;for(l=1;4>=l;++l){switch(l){case 1:y= -L;t=4;z=1.000002208;break;case 2:y=I;t=3;z=.997504612-.002495388*a;break;case 3:y=B;t=4;z=1.000002708+139.978*C;break;case 4:y=F;t=6;z=1;break;default:throw"Internal error: I = "+l;}d(0,l,1);d(1,l,Math.cos(y)*z);e(0,l,0);e(1,l,Math.sin(y)*z);for(m=2;m<=t;++m)f(c(r,m-1,l),c(x,m-1,l),c(r,1,l),c(x,1,l),function(q,u){return d(m,l,q),e(m,l,u)});for(m=1;m<=t;++m)d(-m,l,c(r,m,l)),e(-m,l,-c(x,m,l))}h(13.902,14.06,-.001,.2607,0,0,0,4);h(.403,-4.01,.394,.0023,0,0,0,3);h(2369.912,2373.36,.601,28.2333,0,0,0, +function CalcMoon(a){function b(q,u,x,A){for(var v=[],D=0;D<=u-q;++D){var E=v,L=E.push,M,O=x,Q=A,P=[];for(M=0;M<=Q-O;++M)P.push(0);L.call(E,{min:O,array:P})}return{min:q,array:v}}function c(q,u,x){q=q.array[u-q.min];return q.array[x-q.min]}function d(q,u,x){q=r.array[q-r.min];q.array[u-q.min]=x}function e(q,u,x){q=w.array[q-w.min];q.array[u-q.min]=x}function f(q,u,x,A,v){v(q*x-u*A,u*x+q*A)}function g(q){return Math.sin(PI2*q)}function k(q,u,x,A){var v={x:1,y:0};q=[0,q,u,x,A];for(u=1;4>=u;++u)0!== +q[u]&&f(v.x,v.y,c(r,q[u],u),c(w,q[u],u),function(D,E){return v.x=D,v.y=E});return v}function h(q,u,x,A,v,D,E,L){v=k(v,D,E,L);n+=q*v.y;p+=u*v.y;H+=x*v.x;F+=A*v.x}++exports.CalcMoonCount;a=a.tt/36525;var l,m,n,p,r=b(-6,6,1,4),w=b(-6,6,1,4);var t=a*a;var H=p=n=0;var F=3422.7;var C=g(.19833+.05611*a);var B=g(.27869+.04508*a);var y=g(.16827-.36903*a);var z=g(.34734-5.37261*a);var G=g(.10498-5.37899*a);var I=g(.42681-.41855*a),R=g(.14943-5.37511*a);var J=.84*C+.31*B+14.27*y+7.26*z+.28*G+.24*I;var N=2.94* +C+.31*B+14.27*y+9.34*z+1.12*G+.83*I;var K=-6.4*C-1.89*I;B=.21*C+.31*B+14.27*y-88.7*z-15.3*G+.24*I-1.86*R;y=J-K;C=-3.332E-6*g(.59734-5.37261*a)-5.39E-7*g(.35498-5.37899*a)-6.4E-8*g(.39943-5.37511*a);J=PI2*Frac(.60643382+1336.85522467*a-3.13E-6*t)+J/ARC;N=PI2*Frac(.37489701+1325.55240982*a+2.565E-5*t)+N/ARC;K=PI2*Frac(.99312619+99.99735956*a-4.4E-7*t)+K/ARC;B=PI2*Frac(.25909118+1342.2278298*a-8.92E-6*t)+B/ARC;G=PI2*Frac(.82736186+1236.85308708*a-3.97E-6*t)+y/ARC;for(l=1;4>=l;++l){switch(l){case 1:y= +N;t=4;z=1.000002208;break;case 2:y=K;t=3;z=.997504612-.002495388*a;break;case 3:y=B;t=4;z=1.000002708+139.978*C;break;case 4:y=G;t=6;z=1;break;default:throw"Internal error: I = "+l;}d(0,l,1);d(1,l,Math.cos(y)*z);e(0,l,0);e(1,l,Math.sin(y)*z);for(m=2;m<=t;++m)f(c(r,m-1,l),c(w,m-1,l),c(r,1,l),c(w,1,l),function(q,u){return d(m,l,q),e(m,l,u)});for(m=1;m<=t;++m)d(-m,l,c(r,m,l)),e(-m,l,-c(w,m,l))}h(13.902,14.06,-.001,.2607,0,0,0,4);h(.403,-4.01,.394,.0023,0,0,0,3);h(2369.912,2373.36,.601,28.2333,0,0,0, 2);h(-125.154,-112.79,-.725,-.9781,0,0,0,1);h(1.979,6.98,-.445,.0433,1,0,0,4);h(191.953,192.72,.029,3.0861,1,0,0,2);h(-8.466,-13.51,.455,-.1093,1,0,0,1);h(22639.5,22609.07,.079,186.5398,1,0,0,0);h(18.609,3.59,-.094,.0118,1,0,0,-1);h(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2);h(3.215,5.44,.192,-.0386,1,0,0,-3);h(-38.428,-38.64,.001,.6008,1,0,0,-4);h(-.393,-1.43,-.092,.0086,1,0,0,-6);h(-.289,-1.59,.123,-.0053,0,1,0,4);h(-24.42,-25.1,.04,-.3,0,1,0,2);h(18.023,17.93,.007,.1494,0,1,0,1);h(-668.146,-126.98, -1.302,-.3997,0,1,0,0);h(.56,.32,-.001,-.0037,0,1,0,-1);h(-165.145,-165.06,.054,1.9178,0,1,0,-2);h(-1.877,-6.46,-.416,.0339,0,1,0,-4);h(.213,1.02,-.074,.0054,2,0,0,4);h(14.387,14.78,-.017,.2833,2,0,0,2);h(-.586,-1.2,.054,-.01,2,0,0,1);h(769.016,767.96,.107,10.1657,2,0,0,0);h(1.75,2.01,-.018,.0155,2,0,0,-1);h(-211.656,-152.53,5.679,-.3039,2,0,0,-2);h(1.225,.91,-.03,-.0088,2,0,0,-3);h(-30.773,-34.07,-.308,.3722,2,0,0,-4);h(-.57,-1.4,-.074,.0109,2,0,0,-6);h(-2.921,-11.75,.787,-.0484,1,1,0,2);h(1.267, 1.52,-.022,.0164,1,1,0,1);h(-109.673,-115.18,.461,-.949,1,1,0,0);h(-205.962,-182.36,2.056,1.4437,1,1,0,-2);h(.233,.36,.012,-.0025,1,1,0,-3);h(-4.391,-9.66,-.471,.0673,1,1,0,-4);h(.283,1.53,-.111,.006,1,-1,0,4);h(14.577,31.7,-1.54,.2302,1,-1,0,2);h(147.687,138.76,.679,1.1528,1,-1,0,0);h(-1.089,.55,.021,0,1,-1,0,-1);h(28.475,23.59,-.443,-.2257,1,-1,0,-2);h(-.276,-.38,-.006,-.0036,1,-1,0,-3);h(.636,2.27,.146,-.0102,1,-1,0,-4);h(-.189,-1.68,.131,-.0028,0,2,0,2);h(-7.486,-.66,-.037,-.0086,0,2,0,0);h(-8.096, @@ -115,12 +115,12 @@ L;t=4;z=1.000002208;break;case 2:y=I;t=3;z=.997504612-.002495388*a;break;case 3: .078,-.0192,2,1,0,-2);h(-2.74,-2.54,.022,.0324,2,1,0,-4);h(1.181,3.32,-.212,.0213,2,-1,0,2);h(9.703,11.67,-.151,.1268,2,-1,0,0);h(-.352,-.37,.001,-.0028,2,-1,0,-1);h(-2.494,-1.17,-.003,-.0017,2,-1,0,-2);h(.36,.2,-.012,-.0043,2,-1,0,-4);h(-1.167,-1.25,.008,-.0106,1,2,0,0);h(-7.412,-6.12,.117,.0484,1,2,0,-2);h(-.311,-.65,-.032,.0044,1,2,0,-4);h(.757,1.82,-.105,.0112,1,-2,0,2);h(2.58,2.32,.027,.0196,1,-2,0,0);h(2.533,2.4,-.014,-.0212,1,-2,0,-2);h(-.344,-.57,-.025,.0036,0,3,0,-2);h(-.992,-.02,0,0,1,0, 2,2);h(-45.099,-.02,0,-.001,1,0,2,0);h(-.179,-9.52,0,-.0833,1,0,2,-2);h(-.301,-.33,0,.0014,1,0,2,-4);h(-6.382,-3.37,0,-.0481,1,0,-2,2);h(39.528,85.13,0,-.7136,1,0,-2,0);h(9.366,.71,0,-.0112,1,0,-2,-2);h(.202,.02,0,0,1,0,-2,-4);h(.415,.1,0,.0013,0,1,2,0);h(-2.152,-2.26,0,-.0066,0,1,2,-2);h(-1.44,-1.3,0,.0014,0,1,-2,2);h(.384,-.04,0,0,0,1,-2,-2);h(1.938,3.6,-.145,.0401,4,0,0,0);h(-.952,-1.58,.052,-.013,4,0,0,-2);h(-.551,-.94,.032,-.0097,3,1,0,0);h(-.482,-.57,.005,-.0045,3,1,0,-2);h(.681,.96,-.026,.0115, 3,-1,0,0);h(-.297,-.27,.002,-9E-4,2,2,0,-2);h(.254,.21,-.003,0,2,-2,0,-2);h(-.25,-.22,.004,.0014,1,3,0,-2);h(-3.996,0,0,4E-4,2,0,2,0);h(.557,-.75,0,-.009,2,0,2,-2);h(-.459,-.38,0,-.0053,2,0,-2,2);h(-1.298,.74,0,4E-4,2,0,-2,0);h(.538,1.14,0,-.0141,2,0,-2,-2);h(.263,.02,0,0,1,1,2,0);h(.426,.07,0,-6E-4,1,1,-2,-2);h(-.304,.03,0,3E-4,1,-1,2,0);h(-.372,-.19,0,-.0027,1,-1,-2,2);h(.418,0,0,0,0,0,4,0);h(-.33,-.04,0,0,3,0,2,0);t=-526.069*k(0,0,1,-2).y;t+=-3.352*k(0,0,1,-4).y;t+=44.297*k(1,0,1,-2).y;t+=-6*k(1, -0,1,-4).y;t+=20.599*k(-1,0,1,0).y;t+=-30.598*k(-1,0,1,-2).y;t+=-24.649*k(-2,0,1,0).y;t+=-2*k(-2,0,1,-2).y;t+=-22.571*k(0,1,1,-2).y;t+=10.985*k(0,-1,1,-2).y;n+=.82*g(.7736-62.5512*a)+.31*g(.0466-125.1025*a)+.35*g(.5785-25.1042*a)+.66*g(.4591+1335.8075*a)+.64*g(.313-91.568*a)+1.14*g(.148+1331.2898*a)+.21*g(.5918+1056.5859*a)+.44*g(.5784+1322.8595*a)+.24*g(.2275-5.7374*a)+.28*g(.2965+2.6929*a)+.33*g(.3132+6.3368*a);a=B+p/ARC;a=(1.000002708+139.978*C)*(18518.511+1.189+O)*Math.sin(a)-6.24*Math.sin(3*a)+ -t;return{geo_eclip_lon:PI2*Frac((H+n/ARC)/PI2),geo_eclip_lat:Math.PI/648E3*a,distance_au:ARC*EARTH_EQUATORIAL_RADIUS_AU/(.999953253*P)}}var LibrationInfo=function(a,b,c,d,e,f){this.elat=a;this.elon=b;this.mlat=c;this.mlon=d;this.dist_km=e;this.diam_deg=f};exports.LibrationInfo=LibrationInfo; -function Libration(a){var b=MakeTime(a);a=b.tt/36525;var c=a*a,d=c*a,e=c*c,f=CalcMoon(b);b=f.geo_eclip_lon;var g=f.geo_eclip_lat;f=f.distance_au*exports.KM_PER_AU;var k=1.54242*exports.DEG2RAD,h=exports.DEG2RAD*NormalizeLongitude(93.272095+483202.0175233*a-.0036539*c-d/3526E3+e/86331E4),l=exports.DEG2RAD*NormalizeLongitude(125.0445479-1934.1362891*a+.0020754*c+d/467441-e/60616E3),m=exports.DEG2RAD*NormalizeLongitude(357.5291092+35999.0502909*a-1.536E-4*c+d/2449E4),n=exports.DEG2RAD*NormalizeLongitude(134.9633964+ +0,1,-4).y;t+=20.599*k(-1,0,1,0).y;t+=-30.598*k(-1,0,1,-2).y;t+=-24.649*k(-2,0,1,0).y;t+=-2*k(-2,0,1,-2).y;t+=-22.571*k(0,1,1,-2).y;t+=10.985*k(0,-1,1,-2).y;n+=.82*g(.7736-62.5512*a)+.31*g(.0466-125.1025*a)+.35*g(.5785-25.1042*a)+.66*g(.4591+1335.8075*a)+.64*g(.313-91.568*a)+1.14*g(.148+1331.2898*a)+.21*g(.5918+1056.5859*a)+.44*g(.5784+1322.8595*a)+.24*g(.2275-5.7374*a)+.28*g(.2965+2.6929*a)+.33*g(.3132+6.3368*a);a=B+p/ARC;a=(1.000002708+139.978*C)*(18518.511+1.189+H)*Math.sin(a)-6.24*Math.sin(3*a)+ +t;return{geo_eclip_lon:PI2*Frac((J+n/ARC)/PI2),geo_eclip_lat:Math.PI/648E3*a,distance_au:ARC*EARTH_EQUATORIAL_RADIUS_AU/(.999953253*F)}}var LibrationInfo=function(a,b,c,d,e,f){this.elat=a;this.elon=b;this.mlat=c;this.mlon=d;this.dist_km=e;this.diam_deg=f};exports.LibrationInfo=LibrationInfo; +function Libration(a){var b=MakeTime(a);a=b.tt/36525;var c=a*a,d=c*a,e=c*c,f=CalcMoon(b);b=f.geo_eclip_lon;var g=f.geo_eclip_lat;f=f.distance_au*exports.KM_PER_AU;var k=1.543*exports.DEG2RAD,h=exports.DEG2RAD*NormalizeLongitude(93.272095+483202.0175233*a-.0036539*c-d/3526E3+e/86331E4),l=exports.DEG2RAD*NormalizeLongitude(125.0445479-1934.1362891*a+.0020754*c+d/467441-e/60616E3),m=exports.DEG2RAD*NormalizeLongitude(357.5291092+35999.0502909*a-1.536E-4*c+d/2449E4),n=exports.DEG2RAD*NormalizeLongitude(134.9633964+ 477198.8675055*a+.0087414*c+d/69699-e/14712E3);d=exports.DEG2RAD*NormalizeLongitude(297.8501921+445267.1114034*a-.0018819*c+d/545868-e/113065E3);c=1-.002516*a-7.4E-6*c;var p=b-l;e=Math.atan2(Math.sin(p)*Math.cos(g)*Math.cos(k)-Math.sin(g)*Math.sin(k),Math.cos(p)*Math.cos(g));var r=LongitudeOffset(exports.RAD2DEG*(e-h));k=Math.asin(-Math.sin(p)*Math.cos(g)*Math.sin(k)-Math.sin(g)*Math.cos(k));p=-.02752*Math.cos(n)+-.02245*Math.sin(h)+.00684*Math.cos(n-2*h)+-.00293*Math.cos(2*h)+-8.5E-4*Math.cos(2* -h-2*d)+-5.4E-4*Math.cos(n-2*d)+-2E-4*Math.sin(n+h)+-2E-4*Math.cos(n+2*h)+-2E-4*Math.cos(n-h)+1.4E-4*Math.cos(n+2*h-2*d);var x=-.02816*Math.sin(n)+.02244*Math.cos(h)+-.00682*Math.sin(n-2*h)+-.00279*Math.sin(2*h)+-8.3E-4*Math.sin(2*h-2*d)+6.9E-4*Math.sin(n-2*d)+4E-4*Math.cos(n+h)+-2.5E-4*Math.sin(2*n)+-2.3E-4*Math.sin(n+2*h)+2E-4*Math.cos(n-h)+1.9E-4*Math.sin(n-h)+1.3E-4*Math.sin(n+2*h-2*d)+-1E-4*Math.cos(n-3*h);return new LibrationInfo(exports.RAD2DEG*k+(x*Math.cos(e)-p*Math.sin(e)),r+(-(.0252*c*Math.sin(m)+ -.00473*Math.sin(2*n-2*h)+-.00467*Math.sin(n)+.00396*Math.sin(exports.DEG2RAD*(119.75+131.849*a))+.00276*Math.sin(2*n-2*d)+.00196*Math.sin(l)+-.00183*Math.cos(n-h)+.00115*Math.sin(n-2*d)+-9.6E-4*Math.sin(n-d)+4.6E-4*Math.sin(2*h-2*d)+-3.9E-4*Math.sin(n-h)+-3.2E-4*Math.sin(n-m-d)+2.7E-4*Math.sin(2*n-m-2*d)+2.3E-4*Math.sin(exports.DEG2RAD*(72.56+20.186*a))+-1.4E-4*Math.sin(2*d)+1.4E-4*Math.cos(2*n-2*h)+-1.2E-4*Math.sin(n-2*h)+-1.2E-4*Math.sin(2*n)+1.1E-4*Math.sin(2*n-2*m-2*d))+(p*Math.cos(e)+x*Math.sin(e))* +h-2*d)+-5.4E-4*Math.cos(n-2*d)+-2E-4*Math.sin(n+h)+-2E-4*Math.cos(n+2*h)+-2E-4*Math.cos(n-h)+1.4E-4*Math.cos(n+2*h-2*d);var w=-.02816*Math.sin(n)+.02244*Math.cos(h)+-.00682*Math.sin(n-2*h)+-.00279*Math.sin(2*h)+-8.3E-4*Math.sin(2*h-2*d)+6.9E-4*Math.sin(n-2*d)+4E-4*Math.cos(n+h)+-2.5E-4*Math.sin(2*n)+-2.3E-4*Math.sin(n+2*h)+2E-4*Math.cos(n-h)+1.9E-4*Math.sin(n-h)+1.3E-4*Math.sin(n+2*h-2*d)+-1E-4*Math.cos(n-3*h);return new LibrationInfo(exports.RAD2DEG*k+(w*Math.cos(e)-p*Math.sin(e)),r+(-(.0252*c*Math.sin(m)+ +.00473*Math.sin(2*n-2*h)+-.00467*Math.sin(n)+.00396*Math.sin(exports.DEG2RAD*(119.75+131.849*a))+.00276*Math.sin(2*n-2*d)+.00196*Math.sin(l)+-.00183*Math.cos(n-h)+.00115*Math.sin(n-2*d)+-9.6E-4*Math.sin(n-d)+4.6E-4*Math.sin(2*h-2*d)+-3.9E-4*Math.sin(n-h)+-3.2E-4*Math.sin(n-m-d)+2.7E-4*Math.sin(2*n-m-2*d)+2.3E-4*Math.sin(exports.DEG2RAD*(72.56+20.186*a))+-1.4E-4*Math.sin(2*d)+1.4E-4*Math.cos(2*n-2*h)+-1.2E-4*Math.sin(n-2*h)+-1.2E-4*Math.sin(2*n)+1.1E-4*Math.sin(2*n-2*m-2*d))+(p*Math.cos(e)+w*Math.sin(e))* Math.tan(k)),g,b,f,2*exports.RAD2DEG*Math.atan(MOON_MEAN_RADIUS_KM/Math.sqrt(f*f-MOON_MEAN_RADIUS_KM*MOON_MEAN_RADIUS_KM)))}exports.Libration=Libration;function rotate(a,b){return[a.rot[0][0]*b[0]+a.rot[1][0]*b[1]+a.rot[2][0]*b[2],a.rot[0][1]*b[0]+a.rot[1][1]*b[1]+a.rot[2][1]*b[2],a.rot[0][2]*b[0]+a.rot[1][2]*b[1]+a.rot[2][2]*b[2]]}function precession(a,b,c){b=precession_rot(b,c);return rotate(b,a)}function precession_posvel(a,b,c){b=precession_rot(b,c);return RotateState(b,a)} function precession_rot(a,b){a=a.tt/36525;var c=84381.406,d=((((3.337E-7*a-4.67E-7)*a-.00772503)*a+.0512623)*a-.025754)*a+c;c*=ASEC2RAD;var e=((((-9.51E-8*a+1.32851E-4)*a-.00114045)*a-1.0790069)*a+5038.481507)*a*ASEC2RAD;d*=ASEC2RAD;var f=((((-5.6E-8*a+1.70663E-4)*a-.00121197)*a-2.3814292)*a+10.556403)*a*ASEC2RAD;a=Math.sin(c);c=Math.cos(c);var g=Math.sin(-e);e=Math.cos(-e);var k=Math.sin(-d);d=Math.cos(-d);var h=Math.sin(f),l=Math.cos(f);f=l*e-g*h*d;var m=l*g*c+h*d*e*c-a*h*k,n=l*g*a+h*d*e*a+c*h* k,p=-h*e-g*l*d,r=-h*g*c+l*d*e*c-a*l*k;h=-h*g*a+l*d*e*a+c*l*k;g*=k;l=-k*e*c-a*d;a=-k*e*a+d*c;if(b===PrecessDirection.Into2000)return new RotationMatrix([[f,m,n],[p,r,h],[g,l,a]]);if(b===PrecessDirection.From2000)return new RotationMatrix([[f,p,g],[m,r,l],[n,h,a]]);throw"Invalid precess direction";}function era(a){a=(.779057273264+.00273781191135448*a.ut+a.ut%1)%1*360;0>a&&(a+=360);return a} @@ -200,8 +200,8 @@ GeoMoonState(b):GeoEmbState(b);return new StateVector(a.x+c.Sun.r.x+d.r.x,a.y+c. function HelioState(a,b){b=MakeTime(b);switch(a){case Body.Sun:return new StateVector(0,0,0,0,0,0,b);case Body.SSB:return a=new major_bodies_t(b.tt),new StateVector(-a.Sun.r.x,-a.Sun.r.y,-a.Sun.r.z,-a.Sun.v.x,-a.Sun.v.y,-a.Sun.v.z,b);case Body.Mercury:case Body.Venus:case Body.Earth:case Body.Mars:case Body.Jupiter:case Body.Saturn:case Body.Uranus:case Body.Neptune:return a=CalcVsopPosVel(vsop[a],b.tt),ExportState(a,b);case Body.Pluto:return CalcPluto(b,!0);case Body.Moon:case Body.EMB:var c=CalcVsopPosVel(vsop.Earth, b.tt);a=a==Body.Moon?GeoMoonState(b):GeoEmbState(b);return new StateVector(a.x+c.r.x,a.y+c.r.y,a.z+c.r.z,a.vx+c.v.x,a.vy+c.v.y,a.vz+c.v.z,b);default:throw'HelioState: Unsupported body "'+a+'"';}}exports.HelioState=HelioState; function QuadInterp(a,b,c,d,e){var f=(e+c)/2-d;c=(e-c)/2;if(0==f){if(0==c)return null;d=-d/c;if(-1>d||1=d)return null;e=Math.sqrt(d);d=(-c+e)/(2*f);e=(-c-e)/(2*f);if(-1<=d&&1>=d){if(-1<=e&&1>=e)return null}else if(-1<=e&&1>=e)d=e;else return null}return{x:d,t:a+d*b,df_dt:(2*f*d+c)/b}} -function Search(a,b,c,d){var e=VerifyNumber(d&&d.dt_tolerance_seconds||1);e=Math.abs(e/SECONDS_PER_DAY);var f=d&&d.init_f1||a(b),g=d&&d.init_f2||a(c),k=NaN,h=0;d=d&&d.iter_limit||20;for(var l=!0;;){if(++h>d)throw"Excessive iteration in Search()";var m=InterpolateTime(b,c,.5),n=m.ut-b.ut;if(Math.abs(n)(n.ut-b.ut)*(n.ut-c.ut)&&0>(r.ut-b.ut)*(r.ut-c.ut))){p=a(n);var t=a(r);if(0>p&&0<=t){f=p;g=t;b=n;c=r;k=x;l=!1;continue}}}}if(0>f&&0<=k)c=m,g=k;else if(0>k&&0<=g)b=m,f=k;else return null}}exports.Search=Search;function LongitudeOffset(a){for(;-180>=a;)a+=360;for(;180a;)a+=360;for(;360<=a;)a-=360;return a} +function Search(a,b,c,d){var e=VerifyNumber(d&&d.dt_tolerance_seconds||1);e=Math.abs(e/SECONDS_PER_DAY);var f=d&&d.init_f1||a(b),g=d&&d.init_f2||a(c),k=NaN,h=0;d=d&&d.iter_limit||20;for(var l=!0;;){if(++h>d)throw"Excessive iteration in Search()";var m=InterpolateTime(b,c,.5),n=m.ut-b.ut;if(Math.abs(n)(n.ut-b.ut)*(n.ut-c.ut)&&0>(r.ut-b.ut)*(r.ut-c.ut))){p=a(n);var t=a(r);if(0>p&&0<=t){f=p;g=t;b=n;c=r;k=w;l=!1;continue}}}}if(0>f&&0<=k)c=m,g=k;else if(0>k&&0<=g)b=m,f=k;else return null}}exports.Search=Search;function LongitudeOffset(a){for(;-180>=a;)a+=360;for(;180a;)a+=360;for(;360<=a;)a-=360;return a} function SearchSunLongitude(a,b,c){VerifyNumber(a);VerifyNumber(c);b=MakeTime(b);c=b.AddDays(c);return Search(function(d){d=SunPosition(d);return LongitudeOffset(d.elon-a)},b,c)}exports.SearchSunLongitude=SearchSunLongitude;function PairLongitude(a,b,c){if(a===Body.Earth||b===Body.Earth)throw"The Earth does not have a longitude as seen from itself.";c=MakeTime(c);a=GeoVector(a,c,!1);a=Ecliptic(a);b=GeoVector(b,c,!1);b=Ecliptic(b);return NormalizeLongitude(a.elon-b.elon)}exports.PairLongitude=PairLongitude; function AngleFromSun(a,b){if(a==Body.Earth)throw"The Earth does not have an angle as seen from itself.";var c=MakeTime(b);b=GeoVector(Body.Sun,c,!0);a=GeoVector(a,c,!0);return AngleBetween(b,a)}exports.AngleFromSun=AngleFromSun;function EclipticLongitude(a,b){if(a===Body.Sun)throw"Cannot calculate heliocentric longitude of the Sun.";a=HelioVector(a,b);return Ecliptic(a).elon}exports.EclipticLongitude=EclipticLongitude; function VisualMagnitude(a,b,c,d){var e=0,f=0,g=0;switch(a){case Body.Mercury:a=-.6;e=4.98;f=-4.88;g=3.02;break;case Body.Venus:163.6>b?(a=-4.47,e=1.03,f=.57,g=.13):(a=.98,e=-1.02);break;case Body.Mars:a=-1.52;e=1.6;break;case Body.Jupiter:a=-9.4;e=.5;break;case Body.Uranus:a=-7.19;e=.25;break;case Body.Neptune:a=-6.87;break;case Body.Pluto:a=-1;e=4;break;default:throw"VisualMagnitude: unsupported body "+a;}b/=100;return a+b*(e+b*(f+b*g))+5*Math.log10(c*d)} @@ -292,8 +292,10 @@ var TransitInfo=function(a,b,c,d){this.start=a;this.peak=b;this.finish=c;this.se function SearchTransit(a,b){switch(a){case Body.Mercury:var c=2439.7;break;case Body.Venus:c=6051.8;break;default:throw"Invalid body: "+a;}for(;;){var d=SearchRelativeLongitude(a,0,b);if(.4>AngleFromSun(a,d)&&(b=PeakPlanetShadow(a,c,d),b.r