Esempio n. 1
0
        /// <inheritdoc/>
        public override Equator GetEquatorCoordinate(DateTime time, bool isApparent = false)
        {
            double T = (Julian.ToJulianDay(time) - 2451545.0) / 36525.0;

            double L0 = 280.46645 + 36000.76983 * T + 0.0003030 * T * T;
            double M  = 357.52910 + 35999.05030 * T - 0.0001559 * T * T - 0.00000048 * T * T * T;
            double e  = 0.016708617 - 0.000042037 * T - 0.0000001236 * T * T;

            L0 = BasicTools.SimplifyAngle(L0);
            M  = BasicTools.SimplifyAngle(M);
            e  = BasicTools.SimplifyAngle(e);

            double C = Math.Abs((1.914600 - 0.004817 * T - 0.000014 * T * T)) * Math.Sin(M * (Math.PI / 180.0)) + (0.019993 - 0.000101 * T) * Math.Sin(2 * M * (Math.PI / 180.0)) + 0.000290 * Math.Sin(3 * M * (Math.PI / 180.0));

            C = BasicTools.SimplifyAngle(C);

            double theta = L0 + C;

            double theta2000 = theta - 0.01397 * (time.Year - 2000);

            double omega = 125.04 - 1934.136 * T;

            omega = BasicTools.SimplifyAngle(omega);
            double lambda = theta - 0.00569 - 0.00478 * Math.Sin(omega * (Math.PI / 180.0));

            double sinDelta, delta, alpha;

            if (isApparent)
            {
                sinDelta = Math.Sin((CoordinateSystem.GetEclipticObliquity(time, false) + 0.00256 * Math.Cos(omega) * (Math.PI / 180.0)) * (Math.PI / 180.0)) * Math.Sin(lambda * (Math.PI / 180.0));
                delta    = Math.Asin(sinDelta) * (180.0 / Math.PI);

                alpha = Math.Atan2(Math.Cos((CoordinateSystem.GetEclipticObliquity(time, false) + 0.00256 * Math.Cos(omega) * (Math.PI / 180.0)) * (Math.PI / 180.0)) * Math.Sin(lambda * (Math.PI / 180.0)), Math.Cos(lambda * (Math.PI / 180.0))) * (180.0 / Math.PI);
            }
            else
            {
                sinDelta = Math.Sin(CoordinateSystem.GetEclipticObliquity(time, false) * (Math.PI / 180.0)) * Math.Sin(theta2000 * (Math.PI / 180.0));
                delta    = Math.Asin(sinDelta) * (180.0 / Math.PI);

                alpha = Math.Atan2(Math.Cos(CoordinateSystem.GetEclipticObliquity(time, false) * (Math.PI / 180.0)) * Math.Sin(theta2000 * (Math.PI / 180.0)), Math.Cos(theta2000 * (Math.PI / 180.0))) * (180.0 / Math.PI);
            }

            if (alpha <= 0)
            {
                while (!(alpha >= 0 && alpha <= 360))
                {
                    alpha += 360;
                }
            }

            Equator c = new Equator
            {
                RA  = alpha,
                Dec = delta
            };

            return(c);
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public override double GetToEarthDistance(DateTime time)
        {
            double T = (Julian.ToJulianDay(time) - 2451545.0) / 36525.0;

            double M = 357.52910 + 35999.05030 * T - 0.0001559 * T * T - 0.00000048 * T * T * T;
            double e = 0.016708617 - 0.000042037 * T - 0.0000001236 * T * T;

            M = BasicTools.SimplifyAngle(M);
            e = BasicTools.SimplifyAngle(e);

            double C = Math.Abs((1.914600 - 0.004817 * T - 0.000014 * T * T)) * Math.Sin(M * (Math.PI / 180.0)) + (0.019993 - 0.000101 * T) * Math.Sin(2 * M * (Math.PI / 180.0)) + 0.000290 * Math.Sin(3 * M * (Math.PI / 180.0));

            C = BasicTools.SimplifyAngle(C);

            double v = M + C;

            v = BasicTools.SimplifyAngle(v);

            double distance = 1.0000011018 * (1 - e * e) / (1 + e * Math.Cos(v * (Math.PI / 180.0)));

            return(distance);
        }