예제 #1
0
        /// <summary>
        /// Calculates appearance of Saturn rings
        /// </summary>
        /// <param name="jd">Julian date to calculate for</param>
        /// <param name="saturn">Heliocentric coordinates of Saturn.</param>
        /// <param name="earth">Heliocentric coordinates of Earth.</param>
        /// <param name="epsilon">True obliquity of ecliptic.</param>
        /// <returns>
        /// Appearance data for Saturn rings.
        /// </returns>
        /// <remarks>
        /// Method is taken from AA(II), chapter 45.
        /// </remarks>
        public static RingsAppearance SaturnRings(double jd, CrdsHeliocentrical saturn, CrdsHeliocentrical earth, double epsilon)
        {
            RingsAppearance rings = new RingsAppearance();
            double          T     = (jd - 2451545.0) / 36525.0;
            double          T2    = T * T;

            double i     = 28.075216 - 0.012998 * T + 0.000004 * T2;
            double Omega = 169.508470 + 1.394681 * T + 0.000412 * T2;

            double lambda0 = Omega - 90;
            double beta0   = 90 - i;

            i     = Angle.ToRadians(i);
            Omega = Angle.ToRadians(Omega);

            CrdsEcliptical ecl = saturn.ToRectangular(earth).ToEcliptical();

            double beta   = Angle.ToRadians(ecl.Beta);
            double lambda = Angle.ToRadians(ecl.Lambda);

            rings.B = Angle.ToDegrees(Math.Asin(Math.Sin(i) * Math.Cos(beta) * Math.Sin(lambda - Omega) - Math.Cos(i) * Math.Sin(beta)));
            rings.a = 375.35 / ecl.Distance;
            rings.b = rings.a * Math.Sin(Math.Abs(Angle.ToRadians(rings.B)));

            double N  = 113.6655 + 0.8771 * T;
            double l_ = Angle.ToRadians(saturn.L - 0.01759 / saturn.R);
            double b_ = Angle.ToRadians(saturn.B - 0.000764 * Math.Cos(Angle.ToRadians(saturn.L - N)) / saturn.R);

            double U1 = Angle.ToDegrees(Math.Atan((Math.Sin(i) * Math.Sin(b_) + Math.Cos(i) * Math.Cos(b_) * Math.Sin(l_ - Omega)) / (Math.Cos(b_) * Math.Cos(l_ - Omega))));
            double U2 = Angle.ToDegrees(Math.Atan((Math.Sin(i) * Math.Sin(beta) + Math.Cos(i) * Math.Cos(beta) * Math.Sin(lambda - Omega)) / (Math.Cos(beta) * Math.Cos(lambda - Omega))));

            rings.DeltaU = Math.Abs(U1 - U2);

            CrdsEcliptical eclPole = new CrdsEcliptical();

            eclPole.Set(lambda0, beta0);

            CrdsEquatorial eq     = ecl.ToEquatorial(epsilon);
            CrdsEquatorial eqPole = eclPole.ToEquatorial(epsilon);

            double alpha  = Angle.ToRadians(eq.Alpha);
            double delta  = Angle.ToRadians(eq.Delta);
            double alpha0 = Angle.ToRadians(eqPole.Alpha);
            double delta0 = Angle.ToRadians(eqPole.Delta);

            double y = Math.Cos(delta0) * Math.Sin(alpha0 - alpha);
            double x = Math.Sin(delta0) * Math.Cos(delta) - Math.Cos(delta0) * Math.Sin(delta) * Math.Cos(alpha0 - alpha);

            rings.P = Angle.ToDegrees(Math.Atan2(y, x));

            return(rings);
        }
예제 #2
0
        public static CrdsRectangular[,] Positions(double jd, CrdsHeliocentrical earth, CrdsHeliocentrical jupiter)
        {
            CrdsRectangular[,] positions = new CrdsRectangular[4, 2];

            // distance from Earth to Jupiter
            double distance = jupiter.ToRectangular(earth).ToEcliptical().Distance;

            // light-time effect
            double tau = PlanetPositions.LightTimeEffect(distance);

            // time, in days, since calculation epoch, with respect of light-time effect
            double t = jd - 2443000.5 - tau;

            double[] l_deg = new double[5];
            l_deg[1] = 106.07719 + 203.488955790 * t;
            l_deg[2] = 175.73161 + 101.374724735 * t;
            l_deg[3] = 120.55883 + 50.317609207 * t;
            l_deg[4] = 84.44459 + 21.571071177 * t;

            double[] l = new double[5];
            for (int i = 0; i < 5; i++)
            {
                l[i] = ToRadians(l_deg[i]);
            }

            double[] pi = new double[5];
            pi[1] = ToRadians(To360(97.0881 + 0.16138586 * t));
            pi[2] = ToRadians(To360(154.8663 + 0.04726307 * t));
            pi[3] = ToRadians(To360(188.1840 + 0.00712734 * t));
            pi[4] = ToRadians(To360(335.2868 + 0.00184000 * t));

            double[] w = new double[5];
            w[1] = ToRadians(312.3346 - 0.13279386 * t);
            w[2] = ToRadians(100.4411 - 0.03263064 * t);
            w[3] = ToRadians(119.1942 - 0.00717703 * t);
            w[4] = ToRadians(322.6186 - 0.00175934 * t);

            // Principal inequality in the longitude of Jupiter:
            double GAMMA = 0.33033 * Sin(ToRadians(163.679 + 0.0010512 * t)) +
                           0.03439 * Sin(ToRadians(34.486 - 0.0161731 * t));

            // Phase of small libraton:
            double PHI_lambda = ToRadians(199.6766 + 0.17379190 * t);

            // Longitude of the node of the equator of Jupiter on the ecliptic:
            double psi = ToRadians(316.5182 - 0.00000208 * t);

            // Mean anomalies of Jupiter and Saturn:
            double G  = ToRadians(30.23756 + 0.0830925701 * t + GAMMA);
            double G_ = ToRadians(31.97853 + 0.0334597339 * t);

            // Longitude of the perihelion of Jupiter:
            double Pi = ToRadians(13.469942);

            double[] SIGMA = new double[5];

            SIGMA[1] =
                0.47259 * Sin(2 * (l[1] - l[2])) +
                -0.03478 * Sin(pi[3] - pi[4]) +
                0.01081 * Sin(l[2] - 2 * l[3] + pi[3]) +
                0.00738 * Sin(PHI_lambda) +
                0.00713 * Sin(l[2] - 2 * l[3] + pi[2]) +
                -0.00674 * Sin(pi[1] + pi[3] - 2 * Pi - 2 * G) +
                0.00666 * Sin(l[2] - 2 * l[3] + pi[4]) +
                0.00445 * Sin(l[1] - pi[3]) +
                -0.00354 * Sin(l[1] - l[2]) +
                -0.00317 * Sin(2 * psi - 2 * Pi) +
                0.00265 * Sin(l[1] - pi[4]) +
                -0.00186 * Sin(G) +
                0.00162 * Sin(pi[2] - pi[3]) +
                0.00158 * Sin(4 * (l[1] - l[2])) +
                -0.00155 * Sin(l[1] - l[3]) +
                -0.00138 * Sin(psi + w[3] - 2 * Pi - 2 * G) +
                -0.00115 * Sin(2 * (l[1] - 2 * l[2] + w[2])) +
                0.00089 * Sin(pi[2] - pi[4]) +
                0.00085 * Sin(l[1] + pi[3] - 2 * Pi - 2 * G) +
                0.00083 * Sin(w[2] - w[3]) +
                0.00053 * Sin(psi - w[2]);
            SIGMA[2] =
                1.06476 * Sin(2 * (l[2] - l[3])) +
                0.04256 * Sin(l[1] - 2 * l[2] + pi[3]) +
                0.03581 * Sin(l[2] - pi[3]) +
                0.02395 * Sin(l[1] - 2 * l[2] + pi[4]) +
                0.01984 * Sin(l[2] - pi[4]) +
                -0.01778 * Sin(PHI_lambda) +
                0.01654 * Sin(l[2] - pi[2]) +
                0.01334 * Sin(l[2] - 2 * l[3] + pi[2]) +
                0.01294 * Sin(pi[3] - pi[4]) +
                -0.01142 * Sin(l[2] - l[3]) +
                -0.01057 * Sin(G) +
                -0.00775 * Sin(2 * (psi - Pi)) +
                0.00524 * Sin(2 * (l[1] - l[2])) +
                -0.00460 * Sin(l[1] - l[3]) +
                0.00316 * Sin(psi - 2 * G + w[3] - 2 * Pi) +
                -0.00203 * Sin(pi[1] + pi[3] - 2 * Pi - 2 * G) +
                0.00146 * Sin(psi - w[3]) +
                -0.00145 * Sin(2 * G) +
                0.00125 * Sin(psi - w[4]) +
                -0.00115 * Sin(l[1] - 2 * l[3] + pi[3]) +
                -0.00094 * Sin(2 * (l[2] - w[2])) +
                0.00086 * Sin(2 * (l[1] - 2 * l[2] + w[2])) +
                -0.00086 * Sin(5 * G_ - 2 * G + ToRadians(52.225)) +
                -0.00078 * Sin(l[2] - l[4]) +
                -0.00064 * Sin(3 * l[3] - 7 * l[4] + 4 * pi[4]) +
                0.00064 * Sin(pi[1] - pi[4]) +
                -0.00063 * Sin(l[1] - 2 * l[3] + pi[4]) +
                0.00058 * Sin(w[3] - w[4]) +
                0.00056 * Sin(2 * (psi - Pi - G)) +
                0.00056 * Sin(2 * (l[2] - l[4])) +
                0.00055 * Sin(2 * (l[1] - l[3])) +
                0.00052 * Sin(3 * l[3] - 7 * l[4] + pi[3] + 3 * pi[4]) +
                -0.00043 * Sin(l[1] - pi[3]) +
                0.00041 * Sin(5 * (l[2] - l[3])) +
                0.00041 * Sin(pi[4] - Pi) +
                0.00032 * Sin(w[2] - w[3]) +
                0.00032 * Sin(2 * (l[3] - G - Pi));
            SIGMA[3] =
                0.16490 * Sin(l[3] - pi[3]) +
                0.09081 * Sin(l[3] - pi[4]) +
                -0.06907 * Sin(l[2] - l[3]) +
                0.03784 * Sin(pi[3] - pi[4]) +
                0.01846 * Sin(2 * (l[3] - l[4])) +
                -0.01340 * Sin(G) +
                -0.01014 * Sin(2 * (psi - Pi)) +
                0.00704 * Sin(l[2] - 2 * l[3] + pi[3]) +
                -0.00620 * Sin(l[2] - 2 * l[3] + pi[2]) +
                -0.00541 * Sin(l[3] - l[4]) +
                0.00381 * Sin(l[2] - 2 * l[3] + pi[4]) +
                0.00235 * Sin(psi - w[3]) +
                0.00198 * Sin(psi - w[4]) +
                0.00176 * Sin(PHI_lambda) +
                0.00130 * Sin(3 * (l[3] - l[4])) +
                0.00125 * Sin(l[1] - l[3]) +
                -0.00119 * Sin(5 * G_ - 2 * G + ToRadians(52.225)) +
                0.00109 * Sin(l[1] - l[2]) +
                -0.00100 * Sin(3 * l[3] - 7 * l[4] + 4 * pi[4]) +
                0.00091 * Sin(w[3] - w[4]) +
                0.00080 * Sin(3 * l[3] - 7 * l[4] + pi[3] + 3 * pi[4]) +
                -0.00075 * Sin(2 * l[2] - 3 * l[3] + pi[3]) +
                0.00072 * Sin(pi[1] + pi[3] - 2 * Pi - 2 * G) +
                0.00069 * Sin(pi[4] - Pi) +
                -0.00058 * Sin(2 * l[3] - 3 * l[4] + pi[4]) +
                -0.00057 * Sin(l[3] - 2 * l[4] + pi[4]) +
                0.00056 * Sin(l[3] + pi[3] - 2 * Pi - 2 * G) +
                -0.00052 * Sin(l[2] - 2 * l[3] + pi[1]) +
                -0.00050 * Sin(pi[2] - pi[3]) +
                0.00048 * Sin(l[3] - 2 * l[4] + pi[3]) +
                -0.00045 * Sin(2 * l[2] - 3 * l[3] + pi[4]) +
                -0.00041 * Sin(pi[2] - pi[4]) +
                -0.00038 * Sin(2 * G) +
                -0.00037 * Sin(pi[3] - pi[4] + w[3] - w[4]) +
                -0.00032 * Sin(3 * l[3] - 7 * l[4] + 2 * pi[3] + 2 * pi[4]) +
                0.00030 * Sin(4 * (l[3] - l[4])) +
                0.00029 * Sin(l[3] + pi[4] - 2 * Pi - 2 * G) +
                -0.00028 * Sin(w[3] + psi - 2 * Pi - 2 * G) +
                0.00026 * Sin(l[3] - Pi - G) +
                0.00024 * Sin(l[2] - 3 * l[3] + 2 * l[4]) +
                0.00021 * Sin(l[3] - Pi - G) +
                -0.00021 * Sin(l[3] - pi[2]) +
                0.00017 * Sin(2 * (l[3] - pi[3]));
            SIGMA[4] =
                0.84287 * Sin(l[4] - pi[4]) +
                0.03431 * Sin(pi[4] - pi[3]) +
                -0.03305 * Sin(2 * (psi - Pi)) +
                -0.03211 * Sin(G) +
                -0.01862 * Sin(l[4] - pi[3]) +
                0.01186 * Sin(psi - w[4]) +
                0.00623 * Sin(l[4] + pi[4] - 2 * G - 2 * Pi) +
                0.00387 * Sin(2 * (l[4] - pi[4])) +
                -0.00284 * Sin(5 * G_ - 2 * G + ToRadians(52.225)) +
                -0.00234 * Sin(2 * (psi - pi[4])) +
                -0.00223 * Sin(l[3] - l[4]) +
                -0.00208 * Sin(l[4] - Pi) +
                0.00178 * Sin(psi + w[4] - 2 * pi[4]) +
                0.00134 * Sin(pi[4] - Pi) +
                0.00125 * Sin(2 * (l[4] - G - Pi)) +
                -0.00117 * Sin(2 * G) +
                -0.00112 * Sin(2 * (l[3] - l[4])) +
                0.00107 * Sin(3 * l[3] - 7 * l[4] + 4 * pi[4]) +
                0.00102 * Sin(l[4] - G - Pi) +
                0.00096 * Sin(2 * l[4] - psi - w[4]) +
                0.00087 * Sin(2 * (psi - w[4])) +
                -0.00085 * Sin(3 * l[3] - 7 * l[4] + pi[3] + 3 * pi[4]) +
                0.00085 * Sin(l[3] - 2 * l[4] + pi[4]) +
                -0.00081 * Sin(2 * (l[4] - psi)) +
                0.00071 * Sin(l[4] + pi[4] - 2 * Pi - 3 * G) +
                0.00061 * Sin(l[1] - l[4]) +
                -0.00056 * Sin(psi - w[3]) +
                -0.00054 * Sin(l[3] - 2 * l[4] + pi[3]) +
                0.00051 * Sin(l[2] - l[4]) +
                0.00042 * Sin(2 * (psi - G - Pi)) +
                0.00039 * Sin(2 * (pi[4] - w[4])) +
                0.00036 * Sin(psi + Pi - pi[4] - w[4]) +
                0.00035 * Sin(2 * G_ - G + ToRadians(188.37)) +
                -0.00035 * Sin(l[4] - pi[4] + 2 * Pi - 2 * psi) +
                -0.00032 * Sin(l[4] + pi[4] - 2 * Pi - G) +
                0.00030 * Sin(2 * G_ - 2 * G + ToRadians(149.15)) +
                0.00029 * Sin(3 * l[3] - 7 * l[4] + 2 * pi[3] + 2 * pi[4]) +
                0.00028 * Sin(l[4] - pi[4] + 2 * psi - 2 * Pi) +
                -0.00028 * Sin(2 * (l[4] - w[4])) +
                -0.00027 * Sin(pi[3] - pi[4] + w[3] - w[4]) +
                -0.00026 * Sin(5 * G_ - 3 * G + ToRadians(188.37)) +
                0.00025 * Sin(w[4] - w[3]) +
                -0.00025 * Sin(l[2] - 3 * l[3] + 2 * l[4]) +
                -0.00023 * Sin(3 * (l[3] - l[4])) +
                0.00021 * Sin(2 * l[4] - 2 * Pi - 3 * G) +
                -0.00021 * Sin(2 * l[3] - 3 * l[4] + pi[4]) +
                0.00019 * Sin(l[4] - pi[4] - G) +
                -0.00019 * Sin(2 * l[4] - pi[3] - pi[4]) +
                -0.00018 * Sin(l[4] - pi[4] + G) +
                -0.00016 * Sin(l[4] + pi[3] - 2 * Pi - 2 * G);

            // True longitudes of the sattelites:
            double[] L = new double[5];
            for (int i = 0; i < 5; i++)
            {
                L[i]     = ToRadians(To360(l_deg[i] + SIGMA[i]));
                SIGMA[i] = ToRadians(SIGMA[i]);
            }

            double[] BB = new double[5];

            BB[1] = Atan(
                0.0006393 * Sin(L[1] - w[1]) +
                0.0001825 * Sin(L[1] - w[2]) +
                0.0000329 * Sin(L[1] - w[3]) +
                -0.0000311 * Sin(L[1] - psi) +
                0.0000093 * Sin(L[1] - w[4]) +
                0.0000075 * Sin(3 * L[1] - 4 * l[2] - 1.9927 * SIGMA[1] + w[2]) +
                0.0000046 * Sin(L[1] + psi - 2 * Pi - 2 * G));

            BB[2] = Atan(
                0.0081004 * Sin(L[2] - w[2]) +
                0.0004512 * Sin(L[2] - w[3]) +
                -0.0003284 * Sin(L[2] - psi) +
                0.0001160 * Sin(L[2] - w[4]) +
                0.0000272 * Sin(l[1] - 2 * l[3] + 1.0146 * SIGMA[2] + w[2]) +
                -0.0000144 * Sin(L[2] - w[1]) +
                0.0000143 * Sin(L[2] + psi - 2 * Pi - 2 * G) +
                0.0000035 * Sin(L[2] - psi + G) +
                -0.0000028 * Sin(l[1] - 2 * l[3] + 1.0146 * SIGMA[2] + w[3]));
            BB[3] = Atan(
                0.0032402 * Sin(L[3] - w[3]) +
                -0.0016911 * Sin(L[3] - psi) +
                0.0006847 * Sin(L[3] - w[4]) +
                -0.0002797 * Sin(L[3] - w[2]) +
                0.0000321 * Sin(L[3] + psi - 2 * Pi - 2 * G) +
                0.0000051 * Sin(L[3] - psi + G) +
                -0.0000045 * Sin(L[3] - psi - G) +
                -0.0000045 * Sin(L[3] + psi - 2 * Pi) +
                0.0000037 * Sin(L[3] + psi - 2 * Pi - 3 * G) +
                0.0000030 * Sin(2 * l[2] - 3 * L[3] + 4.03 * SIGMA[3] + w[2]) +
                -0.0000021 * Sin(2 * l[2] - 3 * L[3] + 4.03 * SIGMA[3] + w[3]));

            BB[4] = Atan(
                -0.0076579 * Sin(L[4] - psi) +
                0.0044134 * Sin(L[4] - w[4]) +
                -0.0005112 * Sin(L[4] - w[3]) +
                0.0000773 * Sin(L[4] + psi - 2 * Pi - 2 * G) +
                0.0000104 * Sin(L[4] - psi + G) +
                -0.0000102 * Sin(L[4] - psi - G) +
                0.0000088 * Sin(L[4] + psi - 2 * Pi - 3 * G) +
                -0.0000038 * Sin(L[4] + psi - 2 * Pi - G));

            double[] R = new double[5];
            R[1] =
                5.90569 * (1 + (-0.0041339 * Cos(2 * (l[1] - l[2])) +
                                -0.0000387 * Cos(l[1] - pi[3]) +
                                -0.0000214 * Cos(l[1] - pi[4]) +
                                0.0000170 * Cos(l[1] - l[2]) +
                                -0.0000131 * Cos(4 * (l[1] - l[2])) +
                                0.0000106 * Cos(l[1] - l[3]) +
                                -0.0000066 * Cos(l[1] + pi[3] - 2 * Pi - 2 * G)));
            R[2] =
                9.39657 * (1 + (0.0093848 * Cos(l[1] - l[2]) +
                                -0.0003116 * Cos(l[2] - pi[3]) +
                                -0.0001744 * Cos(l[2] - pi[4]) +
                                -0.0001442 * Cos(l[2] - pi[2]) +
                                0.0000553 * Cos(l[2] - l[3]) +
                                0.0000523 * Cos(l[1] - l[3]) +
                                -0.0000290 * Cos(2 * (l[1] - l[2])) +
                                0.0000164 * Cos(2 * (l[2] - w[2])) +
                                0.0000107 * Cos(l[1] - 2 * l[3] + pi[3]) +
                                -0.0000102 * Cos(l[2] - pi[1]) +
                                -0.0000091 * Cos(2 * (l[1] - l[3]))));
            R[3] =
                14.98832 * (1 + (-0.0014388 * Cos(l[3] - pi[3]) +
                                 -0.0007919 * Cos(l[3] - pi[4]) +
                                 0.0006342 * Cos(l[2] - l[3]) +
                                 -0.0001761 * Cos(2 * (l[3] - l[4])) +
                                 0.0000294 * Cos(l[3] - l[4]) +
                                 -0.0000156 * Cos(3 * (l[3] - l[4])) +
                                 0.0000156 * Cos(l[1] - l[3]) +
                                 -0.0000153 * Cos(l[1] - l[2]) +
                                 0.0000070 * Cos(2 * l[2] - 3 * l[3] + pi[3]) +
                                 -0.0000051 * Cos(l[3] + pi[3] - 2 * Pi - 2 * G)));
            R[4] =
                26.36273 * (1 + (-0.0073546 * Cos(l[4] - pi[4]) +
                                 0.0001621 * Cos(l[4] - pi[3]) +
                                 0.0000974 * Cos(l[3] - l[4]) +
                                 -0.0000543 * Cos(l[4] + pi[4] - 2 * Pi - 2 * G) +
                                 -0.0000271 * Cos(2 * (l[4] - pi[4])) +
                                 0.0000182 * Cos(l[4] - Pi) +
                                 0.0000177 * Cos(2 * (l[3] - l[4])) +
                                 -0.0000167 * Cos(2 * l[4] - psi - w[4]) +
                                 0.0000167 * Cos(psi - w[4]) +
                                 -0.0000155 * Cos(2 * (l[4] - Pi - G)) +
                                 0.0000142 * Cos(2 * (l[4] - psi)) +
                                 0.0000105 * Cos(l[1] - l[4]) +
                                 0.0000092 * Cos(l[2] - l[4]) +
                                 -0.0000089 * Cos(l[4] - Pi - G) +
                                 -0.0000062 * Cos(l[4] + pi[4] - 2 * Pi - 3 * G) +
                                 0.0000048 * Cos(2 * (l[4] - w[4]))));

            double T0 = (jd - 2433282.423) / 36525.0;
            double P  = ToRadians(1.3966626 * T0 + 0.0003088 * T0 * T0);

            for (int i = 0; i < 5; i++)
            {
                L[i] += P;
            }
            psi += P;

            double T = (jd - 2415020.5) / 36525;
            double I = ToRadians(3.120262 + 0.0006 * T);

            double[] X = new double[6];
            double[] Y = new double[6];
            double[] Z = new double[6];

            for (int i = 1; i < 5; i++)
            {
                X[i] = R[i] * Cos(L[i] - psi) * Cos(BB[i]);
                Y[i] = R[i] * Sin(L[i] - psi) * Cos(BB[i]);
                Z[i] = R[i] * Sin(BB[i]);
            }

            X[5] = 0; Y[5] = 0; Z[5] = 1;

            double[] A1 = new double[6];
            double[] B1 = new double[6];
            double[] C1 = new double[6];

            for (int i = 1; i < 6; i++)
            {
                A1[i] = X[i];
                B1[i] = Y[i] * Cos(I) - Z[i] * Sin(I);
                C1[i] = Y[i] * Sin(I) + Z[i] * Cos(I);
            }

            double[] A2 = new double[6];
            double[] B2 = new double[6];
            double[] C2 = new double[6];

            double T1 = (jd - 2451545.0) / 36525;
            double T2 = T1 * T1;
            double T3 = T2 * T1;

            double OMEGA = 100.464407 + 1.0209774 * T1 + 0.00040315 * T2 + 0.000000404 * T3;

            OMEGA = ToRadians(OMEGA);

            double Inc = 1.303267 - 0.0054965 * T1 + 0.00000466 * T2 + 0.000000002 * T3;

            Inc = ToRadians(Inc);

            double PHI = psi - OMEGA;

            for (int i = 5; i >= 1; i--)
            {
                A2[i] = A1[i] * Cos(PHI) - B1[i] * Sin(PHI);
                B2[i] = A1[i] * Sin(PHI) + B1[i] * Cos(PHI);
                C2[i] = C1[i];
            }

            double[] A3 = new double[6];
            double[] B3 = new double[6];
            double[] C3 = new double[6];

            for (int i = 5; i >= 1; i--)
            {
                A3[i] = A2[i];
                B3[i] = B2[i] * Cos(Inc) - C2[i] * Sin(Inc);
                C3[i] = B2[i] * Sin(Inc) + C2[i] * Cos(Inc);
            }

            double[] A4 = new double[6];
            double[] B4 = new double[6];
            double[] C4 = new double[6];

            for (int i = 5; i >= 1; i--)
            {
                A4[i] = A3[i] * Cos(OMEGA) - B3[i] * Sin(OMEGA);
                B4[i] = A3[i] * Sin(OMEGA) + B3[i] * Cos(OMEGA);
                C4[i] = C3[i];
            }

            double[] A5 = new double[6];
            double[] B5 = new double[6];
            double[] C5 = new double[6];

            for (int m = 0; m < 2; m++)
            {
                // "0" for shadows
                double Radius = m == 0 ? earth.R : 0;

                // Rectangular geocentric ecliptic coordinates of Jupiter:
                double x = jupiter.R * Cos(ToRadians(jupiter.B)) * Cos(ToRadians(jupiter.L)) + Radius * Cos(ToRadians(earth.L + 180));
                double y = jupiter.R * Cos(ToRadians(jupiter.B)) * Sin(ToRadians(jupiter.L)) + Radius * Sin(ToRadians(earth.L + 180));
                double z = jupiter.R * Sin(ToRadians(jupiter.B)) + Radius * Sin(ToRadians(-earth.B));

                double Delta  = Sqrt(x * x + y * y + z * z);
                double LAMBDA = Atan2(y, x);
                double alpha  = Atan(z / Sqrt(x * x + y * y));

                for (int i = 5; i >= 1; i--)
                {
                    A5[i] = A4[i] * Sin(LAMBDA) - B4[i] * Cos(LAMBDA);
                    B5[i] = A4[i] * Cos(LAMBDA) + B4[i] * Sin(LAMBDA);
                    C5[i] = C4[i];
                }

                double[] A6 = new double[6];
                double[] B6 = new double[6];
                double[] C6 = new double[6];

                for (int i = 5; i >= 1; i--)
                {
                    A6[i] = A5[i];
                    B6[i] = C5[i] * Sin(alpha) + B5[i] * Cos(alpha);
                    C6[i] = C5[i] * Cos(alpha) - B5[i] * Sin(alpha);
                }

                double D = Atan2(A6[5], C6[5]);

                CrdsRectangular[] rectangular = new CrdsRectangular[4];

                for (int i = 0; i < 4; i++)
                {
                    rectangular[i] = new CrdsRectangular(
                        A6[i + 1] * Cos(D) - C6[i + 1] * Sin(D),
                        A6[i + 1] * Sin(D) + C6[i + 1] * Cos(D),
                        B6[i + 1]
                        );
                }

                double[] K = { 17295, 21819, 27558, 36548 };

                for (int i = 0; i < 4; i++)
                {
                    rectangular[i].X += Abs(rectangular[i].Z) / K[i] * Sqrt(1 - Pow(rectangular[i].X / R[i + 1], 2));
                }

                for (int i = 0; i < 4; i++)
                {
                    double W = Delta / (Delta + rectangular[i].Z / 2095.0);
                    rectangular[i].X *= W;
                    rectangular[i].Y *= W;
                }

                for (int i = 0; i < 4; i++)
                {
                    positions[i, m] = rectangular[i];
                }
            }

            return(positions);
        }
예제 #3
0
        public static CrdsRectangular[] Positions(double jd, CrdsHeliocentrical earth, CrdsHeliocentrical uranus)
        {
            CrdsRectangular[] moons = new CrdsRectangular[MOONS_COUNT];

            // Rectangular topocentrical coordinates of Uranus
            CrdsRectangular rectUranus = uranus.ToRectangular(earth);

            // Ecliptical coordinates of Uranus
            CrdsEcliptical eclUranus = rectUranus.ToEcliptical();

            // Distance from Earth to Uranus, in AU
            double distanceUranus = eclUranus.Distance;

            // light-time effect
            double tau = PlanetPositions.LightTimeEffect(distanceUranus);

            double t = jd - 2444239.5 - tau;

            double[] elem = new double[6 * MOONS_COUNT];
            double[] an   = new double[MOONS_COUNT];
            double[] ae   = new double[MOONS_COUNT];
            double[] ai   = new double[MOONS_COUNT];

            // Calculate GUST86 elements:

            for (int i = 0; i < 5; i++)
            {
                an[i] = IEEERemainder(fqn[i] * t + phn[i], 2 * PI);
                ae[i] = IEEERemainder(fqe[i] * t + phe[i], 2 * PI);
                ai[i] = IEEERemainder(fqi[i] * t + phi[i], 2 * PI);
            }

            elem[0 * 6 + 0] = 4.44352267
                              - Cos(an[0] - an[1] * 3.0 + an[2] * 2.0) * 3.492e-5
                              + Cos(an[0] * 2.0 - an[1] * 6.0 + an[2] * 4.0) * 8.47e-6
                              + Cos(an[0] * 3.0 - an[1] * 9.0 + an[2] * 6.0) * 1.31e-6
                              - Cos(an[0] - an[1]) * 5.228e-5
                              - Cos(an[0] * 2.0 - an[1] * 2.0) * 1.3665e-4;
            elem[0 * 6 + 1] =
                Sin(an[0] - an[1] * 3.0 + an[2] * 2.0) * .02547217
                - Sin(an[0] * 2.0 - an[1] * 6.0 + an[2] * 4.0) * .00308831
                - Sin(an[0] * 3.0 - an[1] * 9.0 + an[2] * 6.0) * 3.181e-4
                - Sin(an[0] * 4.0 - an[1] * 12 + an[2] * 8.0) * 3.749e-5
                - Sin(an[0] - an[1]) * 5.785e-5
                - Sin(an[0] * 2.0 - an[1] * 2.0) * 6.232e-5
                - Sin(an[0] * 3.0 - an[1] * 3.0) * 2.795e-5
                + t * 4.44519055 - .23805158;
            elem[0 * 6 + 2] = Cos(ae[0]) * .00131238
                              + Cos(ae[1]) * 7.181e-5
                              + Cos(ae[2]) * 6.977e-5
                              + Cos(ae[3]) * 6.75e-6
                              + Cos(ae[4]) * 6.27e-6
                              + Cos(an[0]) * 1.941e-4
                              - Cos(-an[0] + an[1] * 2.0) * 1.2331e-4
                              + Cos(an[0] * -2.0 + an[1] * 3.0) * 3.952e-5;
            elem[0 * 6 + 3] = Sin(ae[0]) * .00131238
                              + Sin(ae[1]) * 7.181e-5
                              + Sin(ae[2]) * 6.977e-5
                              + Sin(ae[3]) * 6.75e-6
                              + Sin(ae[4]) * 6.27e-6
                              + Sin(an[0]) * 1.941e-4
                              - Sin(-an[0] + an[1] * 2.0) * 1.2331e-4
                              + Sin(an[0] * -2.0 + an[1] * 3.0) * 3.952e-5;
            elem[0 * 6 + 4] = Cos(ai[0]) * .03787171
                              + Cos(ai[1]) * 2.701e-5
                              + Cos(ai[2]) * 3.076e-5
                              + Cos(ai[3]) * 1.218e-5
                              + Cos(ai[4]) * 5.37e-6;
            elem[0 * 6 + 4] = Sin(ai[0]) * .03787171
                              + Sin(ai[1]) * 2.701e-5
                              + Sin(ai[2]) * 3.076e-5
                              + Sin(ai[3]) * 1.218e-5
                              + Sin(ai[4]) * 5.37e-6;

            elem[1 * 6 + 0] = 2.49254257
                              + Cos(an[0] - an[1] * 3.0 + an[2] * 2.0) * 2.55e-6
                              - Cos(an[1] - an[2]) * 4.216e-5
                              - Cos(an[1] * 2.0 - an[2] * 2.0) * 1.0256e-4;
            elem[1 * 6 + 1] =
                -Sin(an[0] - an[1] * 3.0 + an[2] * 2.0) * .0018605
                + Sin(an[0] * 2.0 - an[1] * 6.0 + an[2] * 4.0) * 2.1999e-4
                + Sin(an[0] * 3.0 - an[1] * 9.0 + an[2] * 6.0) * 2.31e-5
                + Sin(an[0] * 4.0 - an[1] * 12 + an[2] * 8.0) * 4.3e-6
                - Sin(an[1] - an[2]) * 9.011e-5
                - Sin(an[1] * 2.0 - an[2] * 2.0) * 9.107e-5
                - Sin(an[1] * 3.0 - an[2] * 3.0) * 4.275e-5
                - Sin(an[1] * 2.0 - an[3] * 2.0) * 1.649e-5
                + t * 2.49295252 + 3.09804641;
            elem[1 * 6 + 2] = Cos(ae[0]) * -3.35e-6
                              + Cos(ae[1]) * .00118763
                              + Cos(ae[2]) * 8.6159e-4
                              + Cos(ae[3]) * 7.15e-5
                              + Cos(ae[4]) * 5.559e-5
                              - Cos(-an[1] + an[2] * 2.0) * 8.46e-5
                              + Cos(an[1] * -2.0 + an[2] * 3.0) * 9.181e-5
                              + Cos(-an[1] + an[3] * 2.0) * 2.003e-5
                              + Cos(an[1]) * 8.977e-5;
            elem[1 * 6 + 3] = Sin(ae[0]) * -3.35e-6
                              + Sin(ae[1]) * .00118763
                              + Sin(ae[2]) * 8.6159e-4
                              + Sin(ae[3]) * 7.15e-5
                              + Sin(ae[4]) * 5.559e-5
                              - Sin(-an[1] + an[2] * 2.0) * 8.46e-5
                              + Sin(an[1] * -2.0 + an[2] * 3.0) * 9.181e-5
                              + Sin(-an[1] + an[3] * 2.0) * 2.003e-5
                              + Sin(an[1]) * 8.977e-5;
            elem[1 * 6 + 4] = Cos(ai[0]) * -1.2175e-4
                              + Cos(ai[1]) * 3.5825e-4
                              + Cos(ai[2]) * 2.9008e-4
                              + Cos(ai[3]) * 9.778e-5
                              + Cos(ai[4]) * 3.397e-5;
            elem[1 * 6 + 5] = Sin(ai[0]) * -1.2175e-4
                              + Sin(ai[1]) * 3.5825e-4
                              + Sin(ai[2]) * 2.9008e-4
                              + Sin(ai[3]) * 9.778e-5
                              + Sin(ai[4]) * 3.397e-5;
            elem[2 * 6 + 0] = 1.5159549
                              + Cos(an[2] - an[3] * 2.0 + ae[2]) * 9.74e-6
                              - Cos(an[1] - an[2]) * 1.06e-4
                              + Cos(an[1] * 2.0 - an[2] * 2.0) * 5.416e-5
                              - Cos(an[2] - an[3]) * 2.359e-5
                              - Cos(an[2] * 2.0 - an[3] * 2.0) * 7.07e-5
                              - Cos(an[2] * 3.0 - an[3] * 3.0) * 3.628e-5;
            elem[2 * 6 + 1] =
                Sin(an[0] - an[1] * 3.0 + an[2] * 2.0) * 6.6057e-4
                - Sin(an[0] * 2.0 - an[1] * 6.0 + an[2] * 4.0) * 7.651e-5
                - Sin(an[0] * 3.0 - an[1] * 9.0 + an[2] * 6.0) * 8.96e-6
                - Sin(an[0] * 4.0 - an[1] * 12.0 + an[2] * 8.0) * 2.53e-6
                - Sin(an[2] - an[3] * 4.0 + an[4] * 3.0) * 5.291e-5
                - Sin(an[2] - an[3] * 2.0 + ae[4]) * 7.34e-6
                - Sin(an[2] - an[3] * 2.0 + ae[3]) * 1.83e-6
                + Sin(an[2] - an[3] * 2.0 + ae[2]) * 1.4791e-4
                + Sin(an[2] - an[3] * 2.0 + ae[1]) * -7.77e-6
                + Sin(an[1] - an[2]) * 9.776e-5
                + Sin(an[1] * 2.0 - an[2] * 2.0) * 7.313e-5
                + Sin(an[1] * 3.0 - an[2] * 3.0) * 3.471e-5
                + Sin(an[1] * 4.0 - an[2] * 4.0) * 1.889e-5
                - Sin(an[2] - an[3]) * 6.789e-5
                - Sin(an[2] * 2.0 - an[3] * 2.0) * 8.286e-5
                + Sin(an[2] * 3.0 - an[3] * 3.0) * -3.381e-5
                - Sin(an[2] * 4.0 - an[3] * 4.0) * 1.579e-5
                - Sin(an[2] - an[4]) * 1.021e-5
                - Sin(an[2] * 2.0 - an[4] * 2.0) * 1.708e-5
                + t * 1.51614811 + 2.28540169;
            elem[2 * 6 + 2] = Cos(ae[0]) * -2.1e-7
                              - Cos(ae[1]) * 2.2795e-4
                              + Cos(ae[2]) * .00390469
                              + Cos(ae[3]) * 3.0917e-4
                              + Cos(ae[4]) * 2.2192e-4
                              + Cos(an[1]) * 2.934e-5
                              + Cos(an[2]) * 2.62e-5
                              + Cos(-an[1] + an[2] * 2.0) * 5.119e-5
                              - Cos(an[1] * -2.0 + an[2] * 3.0) * 1.0386e-4
                              - Cos(an[1] * -3.0 + an[2] * 4.0) * 2.716e-5
                              + Cos(an[3]) * -1.622e-5
                              + Cos(-an[2] + an[3] * 2.0) * 5.4923e-4
                              + Cos(an[2] * -2.0 + an[3] * 3.0) * 3.47e-5
                              + Cos(an[2] * -3.0 + an[3] * 4.0) * 1.281e-5
                              + Cos(-an[2] + an[4] * 2.0) * 2.181e-5
                              + Cos(an[2]) * 4.625e-5;
            elem[2 * 6 + 3] = Sin(ae[0]) * -2.1e-7
                              - Sin(ae[1]) * 2.2795e-4
                              + Sin(ae[2]) * .00390469
                              + Sin(ae[3]) * 3.0917e-4
                              + Sin(ae[4]) * 2.2192e-4
                              + Sin(an[1]) * 2.934e-5
                              + Sin(an[2]) * 2.62e-5
                              + Sin(-an[1] + an[2] * 2.0) * 5.119e-5
                              - Sin(an[1] * -2.0 + an[2] * 3.0) * 1.0386e-4
                              - Sin(an[1] * -3.0 + an[2] * 4.0) * 2.716e-5
                              + Sin(an[3]) * -1.622e-5
                              + Sin(-an[2] + an[3] * 2.0) * 5.4923e-4
                              + Sin(an[2] * -2.0 + an[3] * 3.0) * 3.47e-5
                              + Sin(an[2] * -3.0 + an[3] * 4.0) * 1.281e-5
                              + Sin(-an[2] + an[4] * 2.0) * 2.181e-5
                              + Sin(an[2]) * 4.625e-5;
            elem[2 * 6 + 4] = Cos(ai[0]) * -1.086e-5
                              - Cos(ai[1]) * 8.151e-5
                              + Cos(ai[2]) * .00111336
                              + Cos(ai[3]) * 3.5014e-4
                              + Cos(ai[4]) * 1.065e-4;
            elem[2 * 6 + 5] = Sin(ai[0]) * -1.086e-5
                              - Sin(ai[1]) * 8.151e-5
                              + Sin(ai[2]) * .00111336
                              + Sin(ai[3]) * 3.5014e-4
                              + Sin(ai[4]) * 1.065e-4;
            elem[3 * 6 + 0] = .72166316
                              - Cos(an[2] - an[3] * 2.0 + ae[2]) * 2.64e-6
                              - Cos(an[3] * 2.0 - an[4] * 3.0 + ae[4]) * 2.16e-6
                              + Cos(an[3] * 2.0 - an[4] * 3.0 + ae[3]) * 6.45e-6
                              - Cos(an[3] * 2.0 - an[4] * 3.0 + ae[2]) * 1.11e-6
                              + Cos(an[1] - an[3]) * -6.223e-5
                              - Cos(an[2] - an[3]) * 5.613e-5
                              - Cos(an[3] - an[4]) * 3.994e-5
                              - Cos(an[3] * 2.0 - an[4] * 2.0) * 9.185e-5
                              - Cos(an[3] * 3.0 - an[4] * 3.0) * 5.831e-5
                              - Cos(an[3] * 4.0 - an[4] * 4.0) * 3.86e-5
                              - Cos(an[3] * 5.0 - an[4] * 5.0) * 2.618e-5
                              - Cos(an[3] * 6.0 - an[4] * 6.0) * 1.806e-5;
            elem[3 * 6 + 1] =
                Sin(an[2] - an[3] * 4.0 + an[4] * 3.0) * 2.061e-5
                - Sin(an[2] - an[3] * 2.0 + ae[4]) * 2.07e-6
                - Sin(an[2] - an[3] * 2.0 + ae[3]) * 2.88e-6
                - Sin(an[2] - an[3] * 2.0 + ae[2]) * 4.079e-5
                + Sin(an[2] - an[3] * 2.0 + ae[1]) * 2.11e-6
                - Sin(an[3] * 2.0 - an[4] * 3.0 + ae[4]) * 5.183e-5
                + Sin(an[3] * 2.0 - an[4] * 3.0 + ae[3]) * 1.5987e-4
                + Sin(an[3] * 2.0 - an[4] * 3.0 + ae[2]) * -3.505e-5
                - Sin(an[3] * 3.0 - an[4] * 4.0 + ae[4]) * 1.56e-6
                + Sin(an[1] - an[3]) * 4.054e-5
                + Sin(an[2] - an[3]) * 4.617e-5
                - Sin(an[3] - an[4]) * 3.1776e-4
                - Sin(an[3] * 2.0 - an[4] * 2.0) * 3.0559e-4
                - Sin(an[3] * 3.0 - an[4] * 3.0) * 1.4836e-4
                - Sin(an[3] * 4.0 - an[4] * 4.0) * 8.292e-5
                + Sin(an[3] * 5.0 - an[4] * 5.0) * -4.998e-5
                - Sin(an[3] * 6.0 - an[4] * 6.0) * 3.156e-5
                - Sin(an[3] * 7.0 - an[4] * 7.0) * 2.056e-5
                - Sin(an[3] * 8.0 - an[4] * 8.0) * 1.369e-5
                + t * .72171851 + .85635879;
            elem[3 * 6 + 2] = Cos(ae[0]) * -2e-8
                              - Cos(ae[1]) * 1.29e-6
                              - Cos(ae[2]) * 3.2451e-4
                              + Cos(ae[3]) * 9.3281e-4
                              + Cos(ae[4]) * .00112089
                              + Cos(an[1]) * 3.386e-5
                              + Cos(an[3]) * 1.746e-5
                              + Cos(-an[1] + an[3] * 2.0) * 1.658e-5
                              + Cos(an[2]) * 2.889e-5
                              - Cos(-an[2] + an[3] * 2.0) * 3.586e-5
                              + Cos(an[3]) * -1.786e-5
                              - Cos(an[4]) * 3.21e-5
                              - Cos(-an[3] + an[4] * 2.0) * 1.7783e-4
                              + Cos(an[3] * -2.0 + an[4] * 3.0) * 7.9343e-4
                              + Cos(an[3] * -3.0 + an[4] * 4.0) * 9.948e-5
                              + Cos(an[3] * -4.0 + an[4] * 5.0) * 4.483e-5
                              + Cos(an[3] * -5.0 + an[4] * 6.0) * 2.513e-5
                              + Cos(an[3] * -6.0 + an[4] * 7.0) * 1.543e-5;
            elem[3 * 6 + 3] = Sin(ae[0]) * -2e-8
                              - Sin(ae[1]) * 1.29e-6
                              - Sin(ae[2]) * 3.2451e-4
                              + Sin(ae[3]) * 9.3281e-4
                              + Sin(ae[4]) * .00112089
                              + Sin(an[1]) * 3.386e-5
                              + Sin(an[3]) * 1.746e-5
                              + Sin(-an[1] + an[3] * 2.0) * 1.658e-5
                              + Sin(an[2]) * 2.889e-5
                              - Sin(-an[2] + an[3] * 2.0) * 3.586e-5
                              + Sin(an[3]) * -1.786e-5
                              - Sin(an[4]) * 3.21e-5
                              - Sin(-an[3] + an[4] * 2.0) * 1.7783e-4
                              + Sin(an[3] * -2.0 + an[4] * 3.0) * 7.9343e-4
                              + Sin(an[3] * -3.0 + an[4] * 4.0) * 9.948e-5
                              + Sin(an[3] * -4.0 + an[4] * 5.0) * 4.483e-5
                              + Sin(an[3] * -5.0 + an[4] * 6.0) * 2.513e-5
                              + Sin(an[3] * -6.0 + an[4] * 7.0) * 1.543e-5;
            elem[3 * 6 + 4] = Cos(ai[0]) * -1.43e-6
                              - Cos(ai[1]) * 1.06e-6
                              - Cos(ai[2]) * 1.4013e-4
                              + Cos(ai[3]) * 6.8572e-4
                              + Cos(ai[4]) * 3.7832e-4;
            elem[3 * 6 + 5] = Sin(ai[0]) * -1.43e-6
                              - Sin(ai[1]) * 1.06e-6
                              - Sin(ai[2]) * 1.4013e-4
                              + Sin(ai[3]) * 6.8572e-4
                              + Sin(ai[4]) * 3.7832e-4;
            elem[4 * 6 + 0] = .46658054
                              + Cos(an[3] * 2.0 - an[4] * 3.0 + ae[4]) * 2.08e-6
                              - Cos(an[3] * 2.0 - an[4] * 3.0 + ae[3]) * 6.22e-6
                              + Cos(an[3] * 2.0 - an[4] * 3.0 + ae[2]) * 1.07e-6
                              - Cos(an[1] - an[4]) * 4.31e-5
                              + Cos(an[2] - an[4]) * -3.894e-5
                              - Cos(an[3] - an[4]) * 8.011e-5
                              + Cos(an[3] * 2.0 - an[4] * 2.0) * 5.906e-5
                              + Cos(an[3] * 3.0 - an[4] * 3.0) * 3.749e-5
                              + Cos(an[3] * 4.0 - an[4] * 4.0) * 2.482e-5
                              + Cos(an[3] * 5.0 - an[4] * 5.0) * 1.684e-5;
            elem[4 * 6 + 1] =
                -Sin(an[2] - an[3] * 4.0 + an[4] * 3.0) * 7.82e-6
                + Sin(an[3] * 2.0 - an[4] * 3.0 + ae[4]) * 5.129e-5
                - Sin(an[3] * 2.0 - an[4] * 3.0 + ae[3]) * 1.5824e-4
                + Sin(an[3] * 2.0 - an[4] * 3.0 + ae[2]) * 3.451e-5
                + Sin(an[1] - an[4]) * 4.751e-5
                + Sin(an[2] - an[4]) * 3.896e-5
                + Sin(an[3] - an[4]) * 3.5973e-4
                + Sin(an[3] * 2.0 - an[4] * 2.0) * 2.8278e-4
                + Sin(an[3] * 3.0 - an[4] * 3.0) * 1.386e-4
                + Sin(an[3] * 4.0 - an[4] * 4.0) * 7.803e-5
                + Sin(an[3] * 5.0 - an[4] * 5.0) * 4.729e-5
                + Sin(an[3] * 6.0 - an[4] * 6.0) * 3e-5
                + Sin(an[3] * 7.0 - an[4] * 7.0) * 1.962e-5
                + Sin(an[3] * 8.0 - an[4] * 8.0) * 1.311e-5
                + t * .46669212 - .9155918;
            elem[4 * 6 + 2] = Cos(ae[1]) * -3.5e-7
                              + Cos(ae[2]) * 7.453e-5
                              - Cos(ae[3]) * 7.5868e-4
                              + Cos(ae[4]) * .00139734
                              + Cos(an[1]) * 3.9e-5
                              + Cos(-an[1] + an[4] * 2.0) * 1.766e-5
                              + Cos(an[2]) * 3.242e-5
                              + Cos(an[3]) * 7.975e-5
                              + Cos(an[4]) * 7.566e-5
                              + Cos(-an[3] + an[4] * 2.0) * 1.3404e-4
                              - Cos(an[3] * -2.0 + an[4] * 3.0) * 9.8726e-4
                              - Cos(an[3] * -3.0 + an[4] * 4.0) * 1.2609e-4
                              - Cos(an[3] * -4.0 + an[4] * 5.0) * 5.742e-5
                              - Cos(an[3] * -5.0 + an[4] * 6.0) * 3.241e-5
                              - Cos(an[3] * -6.0 + an[4] * 7.0) * 1.999e-5
                              - Cos(an[3] * -7.0 + an[4] * 8.0) * 1.294e-5;
            elem[4 * 6 + 3] = Sin(ae[1]) * -3.5e-7
                              + Sin(ae[2]) * 7.453e-5
                              - Sin(ae[3]) * 7.5868e-4
                              + Sin(ae[4]) * .00139734
                              + Sin(an[1]) * 3.9e-5
                              + Sin(-an[1] + an[4] * 2.0) * 1.766e-5
                              + Sin(an[2]) * 3.242e-5
                              + Sin(an[3]) * 7.975e-5
                              + Sin(an[4]) * 7.566e-5
                              + Sin(-an[3] + an[4] * 2.0) * 1.3404e-4
                              - Sin(an[3] * -2.0 + an[4] * 3.0) * 9.8726e-4
                              - Sin(an[3] * -3.0 + an[4] * 4.0) * 1.2609e-4
                              - Sin(an[3] * -4.0 + an[4] * 5.0) * 5.742e-5
                              - Sin(an[3] * -5.0 + an[4] * 6.0) * 3.241e-5
                              - Sin(an[3] * -6.0 + an[4] * 7.0) * 1.999e-5
                              - Sin(an[3] * -7.0 + an[4] * 8.0) * 1.294e-5;
            elem[4 * 6 + 4] = Cos(ai[0]) * -4.4e-7
                              - Cos(ai[1]) * 3.1e-7
                              + Cos(ai[2]) * 3.689e-5
                              - Cos(ai[3]) * 5.9633e-4
                              + Cos(ai[4]) * 4.5169e-4;
            elem[4 * 6 + 5] = Sin(ai[0]) * -4.4e-7
                              - Sin(ai[1]) * 3.1e-7
                              + Sin(ai[2]) * 3.689e-5
                              - Sin(ai[3]) * 5.9633e-4
                              + Sin(ai[4]) * 4.5169e-4;

            // Get rectangular (Uranus-reffered) coordinates of moons
            CrdsRectangular[] gust86Rect = new CrdsRectangular[MOONS_COUNT];

            for (int body = 0; body < MOONS_COUNT; body++)
            {
                double[] elem_body = new double[6];
                for (int i = 0; i < 6; i++)
                {
                    elem_body[i] = elem[body * 6 + i];
                }

                double[] x = new double[3];
                EllipticToRectangularN(gust86_rmu[body], elem_body, ref x);

                gust86Rect[body]   = new CrdsRectangular();
                gust86Rect[body].X = GUST86toVsop87[0] * x[0] + GUST86toVsop87[1] * x[1] + GUST86toVsop87[2] * x[2];
                gust86Rect[body].Y = GUST86toVsop87[3] * x[0] + GUST86toVsop87[4] * x[1] + GUST86toVsop87[5] * x[2];
                gust86Rect[body].Z = GUST86toVsop87[6] * x[0] + GUST86toVsop87[7] * x[1] + GUST86toVsop87[8] * x[2];
            }

            for (int i = 0; i < MOONS_COUNT; i++)
            {
                moons[i] = new CrdsRectangular(
                    rectUranus.X + gust86Rect[i].X,
                    rectUranus.Y + gust86Rect[i].Y,
                    rectUranus.Z + gust86Rect[i].Z
                    );
            }

            return(moons);
        }
예제 #4
0
        public static CrdsRectangular[] Positions(double jd, CrdsHeliocentrical earth, CrdsHeliocentrical mars)
        {
            CrdsRectangular[] moons = new CrdsRectangular[MOONS_COUNT];

            // Rectangular topocentrical coordinates of Mars
            CrdsRectangular rectMars = mars.ToRectangular(earth);

            // Ecliptical coordinates of Mars
            CrdsEcliptical eclMars = rectMars.ToEcliptical();

            // Distance from Earth to Mars, in AU
            double distanceMars = eclMars.Distance;

            // light-time effect
            double tau = PlanetPositions.LightTimeEffect(distanceMars);

            // ESAPHODEI model
            double t = jd - 2451545.0 + 6491.5 - tau;

            GenerateMarsSatToVSOP87(t, ref mars_sat_to_vsop87);

            // Get rectangular (Mars-reffered) coordinates of moons
            CrdsRectangular[] esaphodeiRect = new CrdsRectangular[MOONS_COUNT];

            for (int body = 0; body < MOONS_COUNT; body++)
            {
                MarsSatBody bp = mars_sat_bodies[body];

                double[] elem = new double[6];
                for (int n = 0; n < 6; n++)
                {
                    elem[n] = bp.constants[n];
                }

                for (int j = 0; j < 2; j++)
                {
                    for (int i = bp.lists[j].size - 1; i >= 0; i--)
                    {
                        double d = bp.lists[j].terms[i].phase + t * bp.lists[j].terms[i].frequency;
                        elem[j] += bp.lists[j].terms[i].amplitude * Cos(d);
                    }
                }

                for (int j = 2; j < 4; j++)
                {
                    for (int i = bp.lists[j].size - 1; i >= 0; i--)
                    {
                        double d = bp.lists[j].terms[i].phase + t * bp.lists[j].terms[i].frequency;
                        elem[2 * j - 2] += bp.lists[j].terms[i].amplitude * Cos(d);
                        elem[2 * j - 1] += bp.lists[j].terms[i].amplitude * Sin(d);
                    }
                }

                elem[1] += (bp.l + bp.acc * t) * t;

                double[] x = new double[3];
                EllipticToRectangularA(mars_sat_bodies[body].mu, elem, ref x);


                esaphodeiRect[body] = new CrdsRectangular();

                esaphodeiRect[body].X = mars_sat_to_vsop87[0] * x[0]
                                        + mars_sat_to_vsop87[1] * x[1]
                                        + mars_sat_to_vsop87[2] * x[2];
                esaphodeiRect[body].Y = mars_sat_to_vsop87[3] * x[0]
                                        + mars_sat_to_vsop87[4] * x[1]
                                        + mars_sat_to_vsop87[5] * x[2];
                esaphodeiRect[body].Z = mars_sat_to_vsop87[6] * x[0]
                                        + mars_sat_to_vsop87[7] * x[1]
                                        + mars_sat_to_vsop87[8] * x[2];

                moons[body] = new CrdsRectangular(
                    rectMars.X + esaphodeiRect[body].X,
                    rectMars.Y + esaphodeiRect[body].Y,
                    rectMars.Z + esaphodeiRect[body].Z
                    );
            }

            return(moons);
        }
예제 #5
0
        public static CrdsRectangular[] Positions(double jd, CrdsHeliocentrical earth, CrdsHeliocentrical saturn)
        {
            // p.324

            var e0 = saturn.ToRectangular(earth).ToEcliptical();

            // Convert coordinates to B1950 epoch = 2433282.4235;
            e0 = ConvertCoordinatesToEquinox(jd, Date.EPOCH_B1950, e0);

            double t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11;

            t1  = jd - 2411093.0;
            t2  = t1 / 365.25;
            t3  = (jd - 2433282.423) / 365.25 + 1950.0;
            t4  = jd - 2411368.0;
            t5  = t4 / 365.25;
            t6  = jd - 2415020.0;
            t7  = t6 / 36525.0;
            t8  = t6 / 365.25;
            t9  = (jd - 2442000.5) / 365.25;
            t10 = jd - 2409786.0;
            t11 = t10 / 36525.0;

            double[] W = new double[9];

            W[0] = 5.095 * (t3 - 1866.39);
            W[1] = 74.4 + 32.39 * t2;
            W[2] = 134.3 + 92.62 * t2;
            W[3] = 32.0 - 0.5118 * t5;
            W[4] = 276.59 + 0.5118 * t5;
            W[5] = 267.2635 + 1222.1136 * t7;
            W[6] = 175.4762 + 1221.5515 * t7;
            W[7] = 2.4891 + 0.002435 * t7;
            W[8] = 113.35 - 0.2597 * t7;

            double s1 = Sin(ToRadians(28.0817));
            double c1 = Cos(ToRadians(28.0817));
            double s2 = Sin(ToRadians(168.8112));
            double c2 = Cos(ToRadians(168.8112));
            double e1 = 0.05589 - 0.000346 * t7;

            double[] lambda = new double[9];
            double[] r      = new double[9];
            double[] gamma  = new double[9];
            double[] OMEGA  = new double[9];

            // MIMAS (I)
            {
                double L = 127.64 + 381.994497 * t1 - 43.57 * Sin(ToRadians(W[0])) - 0.720 * Sin(ToRadians(3 * W[0])) - 0.02144 * Sin(ToRadians(5 * W[0]));
                double p = 106.1 + 365.549 * t2;
                double M = L - p;
                double C = 2.18287 * Sin(ToRadians(M)) + 0.025988 * Sin(ToRadians(2 * M)) + 0.00043 * Sin(ToRadians(3 * M));
                lambda[1] = L + C;
                r[1]      = 3.06879 / (1 + 0.01905 * Cos(ToRadians(M + C)));
                gamma[1]  = 1.563;
                OMEGA[1]  = 54.5 - 365.072 * t2;
            }

            // ENCELADUS (II)
            {
                double L = 200.317 + 262.7319002 * t1 + 0.25667 * Sin(ToRadians(W[1])) + 0.20883 * Sin(ToRadians(W[2]));
                double p = 309.107 + 123.44121 * t2;
                double M = L - p;
                double C = 0.55577 * Sin(ToRadians(M)) + 0.00168 * Sin(ToRadians(2 * M));
                lambda[2] = L + C;
                r[2]      = 3.94118 / (1 + 0.00485 * Cos(ToRadians(M + C)));
                gamma[2]  = 0.0262;
                OMEGA[2]  = 348.0 - 151.95 * t2;
            }

            // TETHYS (III)
            {
                lambda[3] = 285.306 + 190.69791226 * t1 + 2.063 * Sin(ToRadians(W[0])) + 0.03409 * Sin(ToRadians(3 * W[0])) + 0.001015 * Sin(ToRadians(5 * W[0]));
                r[3]      = 4.880998;
                gamma[3]  = 1.0976;
                OMEGA[3]  = 111.33 - 72.2441 * t2;
            }

            // DIONE (IV)
            {
                double L = 254.712 + 131.53493193 * t1 - 0.0215 * Sin(ToRadians(W[1])) - 0.01733 * Sin(ToRadians(W[2]));
                double p = 174.8 + 30.820 * t2;
                double M = L - p;
                double C = 0.24717 * Sin(ToRadians(M)) + 0.00033 * Sin(ToRadians(2 * M));
                lambda[4] = L + C;
                r[4]      = 6.24871 / (1 + 0.002157 * Cos(ToRadians(M + C)));
                gamma[4]  = 0.0139;
                OMEGA[4]  = 232.0 - 30.27 * t2;
            }

            // RHEA (V)
            {
                double p_      = 342.7 + 10.057 * t2;
                double a1      = 0.000265 * Sin(ToRadians(p_)) + 0.001 * Sin(ToRadians(W[4]));
                double a2      = 0.000265 * Cos(ToRadians(p_)) + 0.001 * Cos(ToRadians(W[4]));
                double e       = Sqrt(a1 * a1 + a2 * a2);
                double p       = ToDegrees(Atan2(a1, a2));
                double N       = 345.0 - 10.057 * t2;
                double lambda_ = 359.244 + 79.69004720 * t1 + 0.086754 * Sin(ToRadians(N));
                double i       = 28.0362 + 0.346898 * Cos(ToRadians(N)) + 0.01930 * Cos(ToRadians(W[3]));
                double Omega   = 168.8034 + 0.736936 * Sin(ToRadians(N)) + 0.041 * Sin(ToRadians(W[3]));
                double a       = 8.725924;
                Subroutine(e, lambda_, p, Omega, i, a, out lambda[5], out gamma[5], out OMEGA[5], out r[5]);
            }

            // TITAN (VI)
            {
                double L      = 261.1582 + 22.57697855 * t4 + 0.074025 * Sin(ToRadians(W[3]));
                double i_     = 27.45141 + 0.295999 * Cos(ToRadians(W[3]));
                double OMEGA_ = 168.66925 + 0.628808 * Sin(ToRadians(W[3]));
                double a1     = Sin(ToRadians(W[7])) * Sin(ToRadians(OMEGA_ - W[8]));
                double a2     = Cos(ToRadians(W[7])) * Sin(ToRadians(i_)) - Sin(ToRadians(W[7])) * Cos(ToRadians(i_)) * Cos(ToRadians(OMEGA_ - W[8]));
                double g0     = 102.8623;
                double psi    = ToDegrees(Atan2(a1, a2));
                double s      = Sqrt(a1 * a1 + a2 * a2);
                double g      = W[4] - OMEGA_ - psi;
                double w_     = 0;
                for (int j = 0; j < 3; j++)
                {
                    w_ = W[4] + 0.37515 * (Sin((ToRadians(2 * g))) - Sin(ToRadians(2 * g0)));
                    g  = w_ - OMEGA_ - psi;
                }
                double e_      = 0.029092 + 0.00019048 * (Cos(ToRadians(2 * g)) - Cos(ToRadians(2 * g0)));
                double q       = 2 * (W[5] - w_);
                double b1      = Sin(ToRadians(i_)) * Sin(ToRadians(OMEGA_ - W[8]));
                double b2      = Cos(ToRadians(W[7])) * Sin(ToRadians(i_)) * Cos(ToRadians(OMEGA_ - W[8])) - Sin(ToRadians(W[7])) * Cos(ToRadians(i_));
                double theta   = ToDegrees(Atan2(b1, b2)) + W[8];
                double e       = e_ + 0.002778797 * e_ * Cos(ToRadians(q));
                double p       = w_ + 0.159215 * Sin(ToRadians(q));
                double u       = 2 * W[5] - 2 * theta + psi;
                double h       = 0.9375 * e_ * e_ * Sin(ToRadians(q)) + 0.1875 * s * s * Sin(2 * ToRadians(W[5] - theta));
                double lambda_ = L - 0.254744 * (e1 * Sin(ToRadians(W[6])) + 0.75 * e1 * e1 * Sin(ToRadians(2 * W[6])) + h);
                double i       = i_ + 0.031843 * s * Cos(ToRadians(u));
                double Omega   = OMEGA_ + (0.031843 * s * Sin(ToRadians(u))) / Sin(ToRadians(i_));
                double a       = 20.216193;
                Subroutine(e, lambda_, p, Omega, i, a, out lambda[6], out gamma[6], out OMEGA[6], out r[6]);
            }

            // HYPERION (VII)
            {
                double eta    = 92.39 + 0.5621071 * t6;
                double zeta   = 148.19 - 19.18 * t8;
                double theta  = 184.8 - 35.41 * t9;
                double theta_ = theta - 7.5;
                double a_s    = 176.0 + 12.22 * t8;
                double b_s    = 8.0 + 24.44 * t8;
                double c_s    = b_s + 5.0;
                double w_     = 69.898 - 18.67088 * t8;
                double phi    = 2 * (w_ - W[5]);
                double chi    = 94.9 - 2.292 * t8;
                double a      = 24.50601 - 0.08686 * Cos(ToRadians(eta)) - 0.00166 * Cos(ToRadians(zeta + eta)) + 0.00175 * Cos(ToRadians(zeta - eta));
                double e      = 0.103458 - 0.004099 * Cos(ToRadians(eta)) - 0.000167 * Cos(ToRadians(zeta + eta))
                                + 0.000235 * Cos(ToRadians(zeta - eta)) + 0.02303 * Cos(ToRadians(zeta)) - 0.00212 * Cos(ToRadians(2 * zeta))
                                + 0.000151 * Cos(ToRadians(3 * zeta)) + 0.00013 * Cos(ToRadians(phi));
                double p = w_ + 0.15648 * Sin(ToRadians(chi)) - 0.4457 * Sin(ToRadians(eta)) - 0.2657 * Sin(ToRadians(zeta + eta))
                           - 0.3573 * Sin(ToRadians(zeta - eta)) - 12.872 * Sin(ToRadians(zeta)) + 1.668 * Sin(ToRadians(2 * zeta))
                           - 0.2419 * Sin(ToRadians(3 * zeta)) - 0.07 * Sin(ToRadians(phi));
                double lambda_ = 177.047 + 16.91993829 * t6 + 0.15648 * Sin(ToRadians(chi)) + 9.142 * Sin(ToRadians(eta))
                                 + 0.007 * Sin(ToRadians(2 * eta)) - 0.014 * Sin(ToRadians(3 * eta)) + 0.2275 * Sin(ToRadians(zeta + eta))
                                 + 0.2112 * Sin(ToRadians(zeta - eta)) - 0.26 * Sin(ToRadians(zeta)) - 0.0098 * Sin(ToRadians(2 * zeta))
                                 - 0.013 * Sin(ToRadians(a_s)) + 0.017 * Sin(ToRadians(b_s)) - 0.0303 * Sin(ToRadians(phi));
                double i     = 27.3347 + 0.643486 * Cos(ToRadians(chi)) + 0.315 * Cos(ToRadians(W[3])) + 0.018 * Cos(ToRadians(theta)) - 0.018 * Cos(ToRadians(c_s));
                double Omega = 168.6812 + 1.40136 * Cos(ToRadians(chi)) + 0.68599 * Sin(ToRadians(W[3]))
                               - 0.0392 * Sin(ToRadians(c_s)) + 0.0366 * Sin(ToRadians(theta_));
                Subroutine(e, lambda_, p, Omega, i, a, out lambda[7], out gamma[7], out OMEGA[7], out r[7]);
            }

            // IAPETUS (VIII)
            {
                double L      = 261.1582 + 22.57697855 * t4;
                double w__    = 91.796 + 0.562 * t7;
                double psi    = 4.367 - 0.195 * t7;
                double theta  = 146.819 - 3.198 * t7;
                double phi    = 60.470 + 1.521 * t7;
                double PHI    = 205.055 - 2.091 * t7;
                double e_     = 0.028298 + 0.001156 * t11;
                double w_0    = 352.91 + 11.71 * t11;
                double mu     = 76.3852 + 4.53795125 * t10;
                double i_     = 18.4602 - 0.9518 * t11 - 0.072 * t11 * t11 + 0.0054 * t11 * t11 * t11;
                double OMEGA_ = 143.198 - 3.919 * t11 + 0.116 * t11 * t11 + 0.008 * t11 * t11 * t11;
                double l      = mu - w_0;
                double g      = w_0 - OMEGA_ - psi;
                double g1     = w_0 - OMEGA_ - phi;
                double ls     = W[5] - w__;
                double gs     = w__ - theta;
                double lt     = L - W[4];
                double gt     = W[4] - PHI;
                double u1     = 2 * (l + g - ls - gs);
                double u2     = l + g1 - lt - gt;
                double u3     = l + 2 * (g - ls - gs);
                double u4     = lt + gt - g1;
                double u5     = 2 * (ls + gs);
                double a      = 58.935028 + 0.004638 * Cos(ToRadians(u1)) + 0.058222 * Cos(ToRadians(u2));
                double e      = e_ - 0.0014097 * Cos(ToRadians(g1 - gt)) + 0.0003733 * Cos(ToRadians(u5 - 2 * g))
                                + 0.0001180 * Cos(ToRadians(u3)) + 0.0002408 * Cos(ToRadians(l))
                                + 0.0003849 * Cos(ToRadians(l + u2)) + 0.0006190 * Cos(ToRadians(u4));
                double w = 0.08077 * Sin(ToRadians(g1 - gt)) + 0.02139 * Sin(ToRadians(u5 - 2 * g)) - 0.00676 * Sin(ToRadians(u3))
                           + 0.01380 * Sin(ToRadians(l)) + 0.01632 * Sin(ToRadians(l + u2)) + 0.03547 * Sin(ToRadians(u4));
                double p       = w_0 + w / e_;
                double lambda_ = mu - 0.04299 * Sin(ToRadians(u2)) - 0.00789 * Sin(ToRadians(u1)) - 0.06312 * Sin(ToRadians(ls))
                                 - 0.00295 * Sin(ToRadians(2 * ls)) - 0.02231 * Sin(ToRadians(u5)) + 0.00650 * Sin(ToRadians(u5 + psi));
                double i = i_ + 0.04204 * Cos(ToRadians(u5 + psi)) + 0.00235 * Cos(ToRadians(l + g1 + lt + gt + phi))
                           + 0.00360 * Cos(ToRadians(u2 + phi));
                double w_ = 0.04204 * Sin(ToRadians(u5 + psi)) + 0.00235 * Sin(ToRadians(l + g1 + lt + gt + phi))
                            + 0.00358 * Sin(ToRadians(u2 + phi));
                double Omega = OMEGA_ + w_ / Sin(ToRadians(u2 + phi));
                Subroutine(e, lambda_, p, Omega, i, a, out lambda[8], out gamma[8], out OMEGA[8], out r[8]);
            }

            double[] X = new double[10];
            double[] Y = new double[10];
            double[] Z = new double[10];

            for (int j = 1; j <= 8; j++)
            {
                double u = lambda[j] - OMEGA[j];
                double w = OMEGA[j] - 168.8112;
                X[j] = r[j] * (Cos(ToRadians(u)) * Cos(ToRadians(w)) - Sin(ToRadians(u)) * Cos(ToRadians(gamma[j])) * Sin(ToRadians(w)));
                Y[j] = r[j] * (Sin(ToRadians(u)) * Cos(ToRadians(w)) * Cos(ToRadians(gamma[j])) + Cos(ToRadians(u)) * Sin(ToRadians(w)));
                Z[j] = r[j] * Sin(ToRadians(u)) * Sin(ToRadians(gamma[j]));
            }
            X[9] = 0; Y[9] = 0; Z[9] = 1;

            double[] A4 = new double[10];
            double[] B4 = new double[10];
            double[] C4 = new double[10];

            for (int j = 1; j <= 9; j++)
            {
                // Rotation towards the plane of the ecliptic
                double A1 = X[j];
                double B1 = c1 * Y[j] - s1 * Z[j];
                double C1 = s1 * Y[j] + c1 * Z[j];
                // Rotation towards the vernal equinox
                double A2 = c2 * A1 - s2 * B1;
                double B2 = s2 * A1 + c2 * B1;
                double C2 = C1;

                double A3 = A2 * Sin(ToRadians(e0.Lambda)) - B2 * Cos(ToRadians(e0.Lambda));
                double B3 = A2 * Cos(ToRadians(e0.Lambda)) + B2 * Sin(ToRadians(e0.Lambda));
                double C3 = C2;

                A4[j] = A3;
                B4[j] = B3 * Cos(ToRadians(e0.Beta)) + C3 * Sin(ToRadians(e0.Beta));
                C4[j] = C3 * Cos(ToRadians(e0.Beta)) - B3 * Sin(ToRadians(e0.Beta));
            }

            double D = Atan2(A4[9], C4[9]);

            CrdsRectangular[] moons = new CrdsRectangular[8];

            double[] K = { 20947, 23715, 26382, 29876, 35313, 53800, 59222, 91820 };

            for (int j = 0; j < 8; j++)
            {
                moons[j]   = new CrdsRectangular();
                moons[j].X = A4[j + 1] * Cos(D) - C4[j + 1] * Sin(D);
                moons[j].Y = A4[j + 1] * Sin(D) + C4[j + 1] * Cos(D);
                moons[j].Z = B4[j + 1];

                // Light-time effect:
                moons[j].X += Abs(moons[j].Z) / K[j] * Sqrt(1 - Pow((moons[j].X / r[j + 1]), 2));

                // Perspective effect:
                moons[j].X *= (e0.Distance / (e0.Distance + moons[j].Z / 2475.0));
            }

            return(moons);
        }