Exemplo n.º 1
0
        public static double CorrectEquinox(double JDE, EquinoxType Equinox)
        {
            Earth  earth = new Earth();
            double L = earth.CalculateHelocentricLongitude(JDE, 5);
            double B = earth.CalculateHelocentricLatitude(JDE, 4);
            double R = earth.CalculateRadiusVector(JDE, 5);
            double dL, dB, aberration, nutation;

            earth.CorrectLB(L, B, JDE, out dL, out dB);
            aberration = -(20.4898 / R);
            nutation   = MathHelper.Rev(earth.CalculateNutation(JDE));
            double ApparentGeocentricLongitude;

            ApparentGeocentricLongitude = L - 180 - (nutation / 3600) + (dL / 3600) + (aberration / 3600);
            double correction = 58 * MathHelper.Sin((int)Equinox * 90 - ApparentGeocentricLongitude);
            double JDE0       = JDE + correction;

            if (correction <= 0.0000005 && correction >= -0.0000005)
            {
                return(Math.Round(JDE0, 5));;
            }
            else
            {
                return(CorrectEquinox(JDE0, Equinox));
            }
        }
Exemplo n.º 2
0
        public static double GetApproximateEquinox(int year, EquinoxType type)
        {
            double Y;
            double JDE0 = 0;

            if (year < 1000)
            {
                Y = year / 1000d;
                switch (type)
                {
                case EquinoxType.VernalEquinox:
                    JDE0 = 1721139.29189 + (365242.13740 * Y) + (0.06134 * Math.Pow(Y, 2)) + (0.00111 * Math.Pow(Y, 3)) - (0.00071 * Math.Pow(Y, 4));
                    break;

                case EquinoxType.SumerSolstice:
                    JDE0 = 1721233.25401 + (365241.72562 * Y) - (0.05323 * Math.Pow(Y, 2)) + (0.00907 * Math.Pow(Y, 3)) + (0.00025 * Math.Pow(Y, 4));
                    break;

                case EquinoxType.AutumnEquinox:
                    JDE0 = 1721325.70455 + (365242.49558 * Y) - (0.11677 * Math.Pow(Y, 2)) - (0.00297 * Math.Pow(Y, 3)) + (0.00074 * Math.Pow(Y, 4));
                    break;

                case EquinoxType.WinterSolstice:
                    JDE0 = 1721414.39987 + (365242.88257 * Y) - (0.00769 * Math.Pow(Y, 2)) - (0.00933 * Math.Pow(Y, 3)) - (0.00006 * Math.Pow(Y, 4));
                    break;
                }
            }
            else
            {
                Y = (year - 2000d) / 1000d;
                switch (type)
                {
                case EquinoxType.VernalEquinox:
                    JDE0 = 2451623.80984 + (365242.37404 * Y) - (0.05169 * Math.Pow(Y, 2)) - (0.00411 * Math.Pow(Y, 3)) - (0.00057 * Math.Pow(Y, 4));
                    break;

                case EquinoxType.SumerSolstice:
                    JDE0 = 2451716.56767 + (365241.62603 * Y) + (0.00325 * Math.Pow(Y, 2)) + (0.00888 * Math.Pow(Y, 3)) - (0.00030 * Math.Pow(Y, 4));
                    break;

                case EquinoxType.AutumnEquinox:
                    JDE0 = 2451810.21715 + (365242.01767 * Y) + (0.11575 * Math.Pow(Y, 2)) + (0.00337 * Math.Pow(Y, 3)) - (0.00078 * Math.Pow(Y, 4));
                    break;

                case EquinoxType.WinterSolstice:
                    JDE0 = 2451900.05952 + (365242.74049 * Y) + (0.06223 * Math.Pow(Y, 2)) + (0.00823 * Math.Pow(Y, 3)) - (0.00032 * Math.Pow(Y, 4));
                    break;
                }
            }
            JDE0 = Math.Round(JDE0, 5);
            double T, W, D;
            int    S;

            T = (JDE0 - 2451545.0) / 36525;
            T = Math.Round(T, 9);
            W = DegreeToRadian((35999.373 * T) - 2.47);
            D = 1 + (0.0334 * Math.Cos(W)) + (0.0007 * Math.Cos(2 * W));
            D = Math.Round(D, 4);
            S = CalculateSolPeriodicTerms(T);
            //double JDE1 = CorrectEquinox(JDE0, type);
            double JDE = Math.Round(JDE0 + ((0.00001 * S) / D), 5);

            return(JDE);
        }