public static double ApparentGreenwichSiderealTime(double JD)
        {
            double MeanObliquity       = AASNutation.MeanObliquityOfEcliptic(JD);
            double TrueObliquity       = MeanObliquity + AASNutation.NutationInObliquity(JD) / 3600;
            double NutationInLongitude = AASNutation.NutationInLongitude(JD);

            double Value = MeanGreenwichSiderealTime(JD) + (NutationInLongitude * Math.Cos(AASCoordinateTransformation.DegreesToRadians(TrueObliquity)) / 54000);

            return(AASCoordinateTransformation.MapTo0To24Range(Value));
        }
Esempio n. 2
0
        public static AAS3DCoordinate EquatorialRectangularCoordinatesMeanEquinox(double JD, bool bHighPrecision)
        {
            double Longitude = AASCoordinateTransformation.DegreesToRadians(GeometricFK5EclipticLongitude(JD, bHighPrecision));
            double Latitude  = AASCoordinateTransformation.DegreesToRadians(GeometricFK5EclipticLatitude(JD, bHighPrecision));
            double R         = AASEarth.RadiusVector(JD, bHighPrecision);
            double epsilon   = AASCoordinateTransformation.DegreesToRadians(AASNutation.MeanObliquityOfEcliptic(JD));

            AAS3DCoordinate value = new AAS3DCoordinate
            {
                X = R * Math.Cos(Latitude) * Math.Cos(Longitude),
                Y = R * (Math.Cos(Latitude) * Math.Sin(Longitude) * Math.Cos(epsilon) - Math.Sin(Latitude) * Math.Sin(epsilon)),
                Z = R * (Math.Cos(Latitude) * Math.Sin(Longitude) * Math.Sin(epsilon) + Math.Sin(Latitude) * Math.Cos(epsilon))
            };

            return(value);
        }
Esempio n. 3
0
        public static void CalculateOpticalLibration(double JD, double Lambda, double Beta, ref double ldash, ref double bdash, ref double ldash2, ref double bdash2, ref double epsilon, ref double omega, ref double DeltaU, ref double sigma, ref double I, ref double rho)
        {
            //Calculate the initial quantities
            double Lambdarad = AASCoordinateTransformation.DegreesToRadians(Lambda);
            double Betarad   = AASCoordinateTransformation.DegreesToRadians(Beta);

            I      = AASCoordinateTransformation.DegreesToRadians(1.54242);
            DeltaU = AASCoordinateTransformation.DegreesToRadians(AASNutation.NutationInLongitude(JD) / 3600);
            double F = AASCoordinateTransformation.DegreesToRadians(AASMoon.ArgumentOfLatitude(JD));

            omega   = AASCoordinateTransformation.DegreesToRadians(AASMoon.MeanLongitudeAscendingNode(JD));
            epsilon = AASNutation.MeanObliquityOfEcliptic(JD) + AASNutation.NutationInObliquity(JD) / 3600;

            //Calculate the optical librations
            double W = Lambdarad - DeltaU / 3600 - omega;
            double A = Math.Atan2(Math.Sin(W) * Math.Cos(Betarad) * Math.Cos(I) - Math.Sin(Betarad) * Math.Sin(I), Math.Cos(W) * Math.Cos(Betarad));

            ldash = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(A) - AASCoordinateTransformation.RadiansToDegrees(F));
            if (ldash > 180)
            {
                ldash -= 360;
            }
            bdash = Math.Asin(-Math.Sin(W) * Math.Cos(Betarad) * Math.Sin(I) - Math.Sin(Betarad) * Math.Cos(I));

            //Calculate the physical librations
            double T  = (JD - 2451545.0) / 36525;
            double K1 = 119.75 + 131.849 * T;

            K1 = AASCoordinateTransformation.DegreesToRadians(K1);
            double K2 = 72.56 + 20.186 * T;

            K2 = AASCoordinateTransformation.DegreesToRadians(K2);

            double M = AASEarth.SunMeanAnomaly(JD);

            M = AASCoordinateTransformation.DegreesToRadians(M);
            double Mdash = AASMoon.MeanAnomaly(JD);

            Mdash = AASCoordinateTransformation.DegreesToRadians(Mdash);
            double D = AASMoon.MeanElongation(JD);

            D = AASCoordinateTransformation.DegreesToRadians(D);
            double E = AASEarth.Eccentricity(JD);

            rho = -0.02752 * Math.Cos(Mdash) +
                  -0.02245 * Math.Sin(F) +
                  0.00684 * Math.Cos(Mdash - 2 * F) +
                  -0.00293 * Math.Cos(2 * F) +
                  -0.00085 * Math.Cos(2 * F - 2 * D) +
                  -0.00054 * Math.Cos(Mdash - 2 * D) +
                  -0.00020 * Math.Sin(Mdash + F) +
                  -0.00020 * Math.Cos(Mdash + 2 * F) +
                  -0.00020 * Math.Cos(Mdash - F) +
                  0.00014 * Math.Cos(Mdash + 2 * F - 2 * D);

            sigma = -0.02816 * Math.Sin(Mdash) +
                    0.02244 * Math.Cos(F) +
                    -0.00682 * Math.Sin(Mdash - 2 * F) +
                    -0.00279 * Math.Sin(2 * F) +
                    -0.00083 * Math.Sin(2 * F - 2 * D) +
                    0.00069 * Math.Sin(Mdash - 2 * D) +
                    0.00040 * Math.Cos(Mdash + F) +
                    -0.00025 * Math.Sin(2 * Mdash) +
                    -0.00023 * Math.Sin(Mdash + 2 * F) +
                    0.00020 * Math.Cos(Mdash - F) +
                    0.00019 * Math.Sin(Mdash - F) +
                    0.00013 * Math.Sin(Mdash + 2 * F - 2 * D) +
                    -0.00010 * Math.Cos(Mdash - 3 * F);

            double tau = 0.02520 * E * Math.Sin(M) +
                         0.00473 * Math.Sin(2 * Mdash - 2 * F) +
                         -0.00467 * Math.Sin(Mdash) +
                         0.00396 * Math.Sin(K1) +
                         0.00276 * Math.Sin(2 * Mdash - 2 * D) +
                         0.00196 * Math.Sin(omega) +
                         -0.00183 * Math.Cos(Mdash - F) +
                         0.00115 * Math.Sin(Mdash - 2 * D) +
                         -0.00096 * Math.Sin(Mdash - D) +
                         0.00046 * Math.Sin(2 * F - 2 * D) +
                         -0.00039 * Math.Sin(Mdash - F) +
                         -0.00032 * Math.Sin(Mdash - M - D) +
                         0.00027 * Math.Sin(2 * Mdash - M - 2 * D) +
                         0.00023 * Math.Sin(K2) +
                         -0.00014 * Math.Sin(2 * D) +
                         0.00014 * Math.Cos(2 * Mdash - 2 * F) +
                         -0.00012 * Math.Sin(Mdash - 2 * F) +
                         -0.00012 * Math.Sin(2 * Mdash) +
                         0.00011 * Math.Sin(2 * Mdash - 2 * M - 2 * D);

            ldash2 = -tau + (rho * Math.Cos(A) + sigma * Math.Sin(A)) * Math.Tan(bdash);
            bdash  = AASCoordinateTransformation.RadiansToDegrees(bdash);
            bdash2 = sigma * Math.Cos(A) - rho * Math.Sin(A);
        }
        public static CAAPhysicalMarsDetails Calculate(double JD, bool bHighPrecision)
        {
            //What will be the return value
            CAAPhysicalMarsDetails details = new CAAPhysicalMarsDetails();

            //Step 1
            double T          = (JD - 2451545) / 36525;
            double Lambda0    = 352.9065 + 1.17330 * T;
            double Lambda0rad = AASCoordinateTransformation.DegreesToRadians(Lambda0);
            double Beta0      = 63.2818 - 0.00394 * T;
            double Beta0rad   = AASCoordinateTransformation.DegreesToRadians(Beta0);

            //Step 2
            double l0    = AASEarth.EclipticLongitude(JD, bHighPrecision);
            double l0rad = AASCoordinateTransformation.DegreesToRadians(l0);
            double b0    = AASEarth.EclipticLatitude(JD, bHighPrecision);
            double b0rad = AASCoordinateTransformation.DegreesToRadians(b0);
            double R     = AASEarth.RadiusVector(JD, bHighPrecision);

            double PreviousLightTravelTime = 0;
            double LightTravelTime         = 0;
            double x        = 0;
            double y        = 0;
            double z        = 0;
            bool   bIterate = true;
            double DELTA    = 0;
            double l        = 0;
            double lrad     = 0;
            double b        = 0;
            double r        = 0;

            while (bIterate)
            {
                double JD2 = JD - LightTravelTime;

                //Step 3
                l    = AASMars.EclipticLongitude(JD2, bHighPrecision);
                lrad = AASCoordinateTransformation.DegreesToRadians(l);
                b    = AASMars.EclipticLatitude(JD2, bHighPrecision);
                double brad = AASCoordinateTransformation.DegreesToRadians(b);
                r = AASMars.RadiusVector(JD2, bHighPrecision);

                //Step 4
                x               = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad);
                y               = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad);
                z               = r * Math.Sin(brad) - R * Math.Sin(b0rad);
                DELTA           = Math.Sqrt(x * x + y * y + z * z);
                LightTravelTime = AASElliptical.DistanceToLightTime(DELTA);

                //Prepare for the next loop around
                bIterate = (Math.Abs(LightTravelTime - PreviousLightTravelTime) > 2E-6); //2E-6 correponds to 0.17 of a second
                if (bIterate)
                {
                    PreviousLightTravelTime = LightTravelTime;
                }
            }

            //Step 5
            double lambdarad = Math.Atan2(y, x);
            double lambda    = AASCoordinateTransformation.RadiansToDegrees(lambdarad);
            double betarad   = Math.Atan2(z, Math.Sqrt(x * x + y * y));
            double beta      = AASCoordinateTransformation.RadiansToDegrees(betarad);

            //Step 6
            details.DE = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(-Math.Sin(Beta0rad) * Math.Sin(betarad) - Math.Cos(Beta0rad) * Math.Cos(betarad) * Math.Cos(Lambda0rad - lambdarad)));

            //Step 7
            double N    = 49.5581 + 0.7721 * T;
            double Nrad = AASCoordinateTransformation.DegreesToRadians(N);

            double ldash    = l - 0.00697 / r;
            double ldashrad = AASCoordinateTransformation.DegreesToRadians(ldash);
            double bdash    = b - 0.000225 * (Math.Cos(lrad - Nrad) / r);
            double bdashrad = AASCoordinateTransformation.DegreesToRadians(bdash);

            //Step 8
            details.DS = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(-Math.Sin(Beta0rad) * Math.Sin(bdashrad) - Math.Cos(Beta0rad) * Math.Cos(bdashrad) * Math.Cos(Lambda0rad - ldashrad)));

            //Step 9
            double W = AASCoordinateTransformation.MapTo0To360Range(11.504 + 350.89200025 * (JD - LightTravelTime - 2433282.5));

            //Step 10
            double          e0             = AASNutation.MeanObliquityOfEcliptic(JD);
            double          e0rad          = AASCoordinateTransformation.DegreesToRadians(e0);
            AAS2DCoordinate PoleEquatorial = AASCoordinateTransformation.Ecliptic2Equatorial(Lambda0, Beta0, e0);
            double          alpha0rad      = AASCoordinateTransformation.HoursToRadians(PoleEquatorial.X);
            double          delta0rad      = AASCoordinateTransformation.DegreesToRadians(PoleEquatorial.Y);

            //Step 11
            double u        = y * Math.Cos(e0rad) - z * Math.Sin(e0rad);
            double v        = y * Math.Sin(e0rad) + z * Math.Cos(e0rad);
            double alpharad = Math.Atan2(u, x);
            double alpha    = AASCoordinateTransformation.RadiansToHours(alpharad);
            double deltarad = Math.Atan2(v, Math.Sqrt(x * x + u * u));
            double delta    = AASCoordinateTransformation.RadiansToDegrees(deltarad);
            double xi       = Math.Atan2(Math.Sin(delta0rad) * Math.Cos(deltarad) * Math.Cos(alpha0rad - alpharad) - Math.Sin(deltarad) * Math.Cos(delta0rad), Math.Cos(deltarad) * Math.Sin(alpha0rad - alpharad));

            //Step 12
            details.w = AASCoordinateTransformation.MapTo0To360Range(W - AASCoordinateTransformation.RadiansToDegrees(xi));

            //Step 13
            double NutationInLongitude = AASNutation.NutationInLongitude(JD);
            double NutationInObliquity = AASNutation.NutationInObliquity(JD);

            //Step 14
            lambda += 0.005693 * Math.Cos(l0rad - lambdarad) / Math.Cos(betarad);
            beta   += 0.005693 * Math.Sin(l0rad - lambdarad) * Math.Sin(betarad);

            //Step 15
            Lambda0 += NutationInLongitude / 3600;
            lambda  += NutationInLongitude / 3600;
            e0      += NutationInObliquity / 3600;

            //Step 16
            AAS2DCoordinate ApparentPoleEquatorial = AASCoordinateTransformation.Ecliptic2Equatorial(Lambda0, Beta0, e0);
            double          alpha0dash             = AASCoordinateTransformation.HoursToRadians(ApparentPoleEquatorial.X);
            double          delta0dash             = AASCoordinateTransformation.DegreesToRadians(ApparentPoleEquatorial.Y);
            AAS2DCoordinate ApparentMars           = AASCoordinateTransformation.Ecliptic2Equatorial(lambda, beta, e0);
            double          alphadash = AASCoordinateTransformation.HoursToRadians(ApparentMars.X);
            double          deltadash = AASCoordinateTransformation.DegreesToRadians(ApparentMars.Y);

            //Step 17
            details.P = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Cos(delta0dash) * Math.Sin(alpha0dash - alphadash), Math.Sin(delta0dash) * Math.Cos(deltadash) - Math.Cos(delta0dash) * Math.Sin(deltadash) * Math.Cos(alpha0dash - alphadash))));

            //Step 18
            double          SunLambda     = AASSun.GeometricEclipticLongitude(JD, bHighPrecision);
            double          SunBeta       = AASSun.GeometricEclipticLatitude(JD, bHighPrecision);
            AAS2DCoordinate SunEquatorial = AASCoordinateTransformation.Ecliptic2Equatorial(SunLambda, SunBeta, e0);

            details.X = AASMoonIlluminatedFraction.PositionAngle(SunEquatorial.X, SunEquatorial.Y, alpha, delta);

            //Step 19
            details.d = 9.36 / DELTA;
            details.k = AASIlluminatedFraction.IlluminatedFraction(r, R, DELTA);
            details.q = (1 - details.k) * details.d;

            return(details);
        }
Esempio n. 5
0
        public static AASNearParabolicObjectDetails Calculate(double JD, ref AASNearParabolicObjectElements elements, bool bHighPrecision)
        {
            double Epsilon = AASNutation.MeanObliquityOfEcliptic(elements.JDEquinox);

            double JD0 = JD;

            //What will be the return value
            AASNearParabolicObjectDetails details = new AASNearParabolicObjectDetails();

            Epsilon = AASCoordinateTransformation.DegreesToRadians(Epsilon);
            double omega = AASCoordinateTransformation.DegreesToRadians(elements.omega);
            double w     = AASCoordinateTransformation.DegreesToRadians(elements.w);
            double i     = AASCoordinateTransformation.DegreesToRadians(elements.i);

            double sinEpsilon = Math.Sin(Epsilon);
            double cosEpsilon = Math.Cos(Epsilon);
            double sinOmega   = Math.Sin(omega);
            double cosOmega   = Math.Cos(omega);
            double cosi       = Math.Cos(i);
            double sini       = Math.Sin(i);

            double F = cosOmega;
            double G = sinOmega * cosEpsilon;
            double H = sinOmega * sinEpsilon;
            double P = -sinOmega * cosi;
            double Q = cosOmega * cosi * cosEpsilon - sini * sinEpsilon;
            double R = cosOmega * cosi * sinEpsilon + sini * cosEpsilon;
            double a = Math.Sqrt(F * F + P * P);
            double b = Math.Sqrt(G * G + Q * Q);
            double c = Math.Sqrt(H * H + R * R);
            double A = Math.Atan2(F, P);
            double B = Math.Atan2(G, Q);
            double C = Math.Atan2(H, R);

            AAS3DCoordinate SunCoord = AASSun.EquatorialRectangularCoordinatesAnyEquinox(JD, elements.JDEquinox, bHighPrecision);

            for (int j = 0; j < 2; j++)
            {
                double v = 0;
                double r = 0;
                CalulateTrueAnnomalyAndRadius(JD0, ref elements, ref v, ref r);

                double x = r * a * Math.Sin(A + w + v);
                double y = r * b * Math.Sin(B + w + v);
                double z = r * c * Math.Sin(C + w + v);

                if (j == 0)
                {
                    details.HeliocentricRectangularEquatorial.X = x;
                    details.HeliocentricRectangularEquatorial.Y = y;
                    details.HeliocentricRectangularEquatorial.Z = z;

                    //Calculate the heliocentric ecliptic coordinates also
                    double u    = w + v;
                    double cosu = Math.Cos(u);
                    double sinu = Math.Sin(u);

                    details.HeliocentricRectangularEcliptical.X = r * (cosOmega * cosu - sinOmega * sinu * cosi);
                    details.HeliocentricRectangularEcliptical.Y = r * (sinOmega * cosu + cosOmega * sinu * cosi);
                    details.HeliocentricRectangularEcliptical.Z = r * sini * sinu;

                    details.HeliocentricEclipticLongitude = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(details.HeliocentricRectangularEcliptical.Y, details.HeliocentricRectangularEcliptical.X)));
                    details.HeliocentricEclipticLatitude  = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(details.HeliocentricRectangularEcliptical.Z / r));
                }

                double psi   = SunCoord.X + x;
                double nu    = SunCoord.Y + y;
                double sigma = SunCoord.Z + z;

                double Alpha = Math.Atan2(nu, psi);
                Alpha = AASCoordinateTransformation.RadiansToDegrees(Alpha);
                double Delta = Math.Atan2(sigma, Math.Sqrt(psi * psi + nu * nu));
                Delta = AASCoordinateTransformation.RadiansToDegrees(Delta);
                double Distance = Math.Sqrt(psi * psi + nu * nu + sigma * sigma);

                if (j == 0)
                {
                    details.TrueGeocentricRA          = AASCoordinateTransformation.MapTo0To24Range(Alpha / 15);
                    details.TrueGeocentricDeclination = Delta;
                    details.TrueGeocentricDistance    = Distance;
                    details.TrueGeocentricLightTime   = AASElliptical.DistanceToLightTime(Distance);
                }
                else
                {
                    details.AstrometricGeocentricRA          = AASCoordinateTransformation.MapTo0To24Range(Alpha / 15);
                    details.AstrometricGeocentricDeclination = Delta;
                    details.AstrometricGeocentricDistance    = Distance;
                    details.AstrometricGeocentricLightTime   = AASElliptical.DistanceToLightTime(Distance);

                    double RES = Math.Sqrt(SunCoord.X * SunCoord.X + SunCoord.Y * SunCoord.Y + SunCoord.Z * SunCoord.Z);

                    details.Elongation = AASCoordinateTransformation.RadiansToDegrees(Math.Acos((RES * RES + Distance * Distance - r * r) / (2 * RES * Distance)));
                    details.PhaseAngle = AASCoordinateTransformation.RadiansToDegrees(Math.Acos((r * r + Distance * Distance - RES * RES) / (2 * r * Distance)));
                }

                if (j == 0) //Prepare for the next loop around
                {
                    JD0 = JD - details.TrueGeocentricLightTime;
                }
            }

            return(details);
        }
        public static CAAPhysicalJupiterDetails Calculate(double JD, bool bHighPrecision)
        {
            //What will be the return value
            CAAPhysicalJupiterDetails details = new CAAPhysicalJupiterDetails();

            //Step 1
            double d         = JD - 2433282.5;
            double T1        = d / 36525;
            double alpha0    = 268.00 + 0.1061 * T1;
            double alpha0rad = AASCoordinateTransformation.DegreesToRadians(alpha0);
            double delta0    = 64.50 - 0.0164 * T1;
            double delta0rad = AASCoordinateTransformation.DegreesToRadians(delta0);

            //Step 2
            double W1 = AASCoordinateTransformation.MapTo0To360Range(17.710 + 877.90003539 * d);
            double W2 = AASCoordinateTransformation.MapTo0To360Range(16.838 + 870.27003539 * d);

            //Step 3
            double l0    = AASEarth.EclipticLongitude(JD, bHighPrecision);
            double l0rad = AASCoordinateTransformation.DegreesToRadians(l0);
            double b0    = AASEarth.EclipticLatitude(JD, bHighPrecision);
            double b0rad = AASCoordinateTransformation.DegreesToRadians(b0);
            double R     = AASEarth.RadiusVector(JD, bHighPrecision);

            //Step 4
            double l    = AASJupiter.EclipticLongitude(JD, bHighPrecision);
            double lrad = AASCoordinateTransformation.DegreesToRadians(l);
            double b    = AASJupiter.EclipticLatitude(JD, bHighPrecision);
            double brad = AASCoordinateTransformation.DegreesToRadians(b);
            double r    = AASJupiter.RadiusVector(JD, bHighPrecision);

            //Step 5
            double x     = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad);
            double y     = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad);
            double z     = r * Math.Sin(brad) - R * Math.Sin(b0rad);
            double DELTA = Math.Sqrt(x * x + y * y + z * z);

            //Step 6
            l   -= 0.012990 * DELTA / (r * r);
            lrad = AASCoordinateTransformation.DegreesToRadians(l);

            //Step 7
            x     = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad);
            y     = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad);
            z     = r * Math.Sin(brad) - R * Math.Sin(b0rad);
            DELTA = Math.Sqrt(x * x + y * y + z * z);

            //Step 8
            double e0    = AASNutation.MeanObliquityOfEcliptic(JD);
            double e0rad = AASCoordinateTransformation.DegreesToRadians(e0);

            //Step 9
            double alphas = Math.Atan2(Math.Cos(e0rad) * Math.Sin(lrad) - Math.Sin(e0rad) * Math.Tan(brad), Math.Cos(lrad));
            double deltas = Math.Asin(Math.Cos(e0rad) * Math.Sin(brad) + Math.Sin(e0rad) * Math.Cos(brad) * Math.Sin(lrad));

            //Step 10
            details.DS = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(-Math.Sin(delta0rad) * Math.Sin(deltas) - Math.Cos(delta0rad) * Math.Cos(deltas) * Math.Cos(alpha0rad - alphas)));

            //Step 11
            double u        = y * Math.Cos(e0rad) - z * Math.Sin(e0rad);
            double v        = y * Math.Sin(e0rad) + z * Math.Cos(e0rad);
            double alpharad = Math.Atan2(u, x);
            double alpha    = AASCoordinateTransformation.RadiansToDegrees(alpharad);
            double deltarad = Math.Atan2(v, Math.Sqrt(x * x + u * u));
            double delta    = AASCoordinateTransformation.RadiansToDegrees(deltarad);
            double xi       = Math.Atan2(Math.Sin(delta0rad) * Math.Cos(deltarad) * Math.Cos(alpha0rad - alpharad) - Math.Sin(deltarad) * Math.Cos(delta0rad), Math.Cos(deltarad) * Math.Sin(alpha0rad - alpharad));

            //Step 12
            details.DE = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(-Math.Sin(delta0rad) * Math.Sin(deltarad) - Math.Cos(delta0rad) * Math.Cos(deltarad) * Math.Cos(alpha0rad - alpharad)));

            //Step 13
            details.Geometricw1 = AASCoordinateTransformation.MapTo0To360Range(W1 - AASCoordinateTransformation.RadiansToDegrees(xi) - 5.07033 * DELTA);
            details.Geometricw2 = AASCoordinateTransformation.MapTo0To360Range(W2 - AASCoordinateTransformation.RadiansToDegrees(xi) - 5.02626 * DELTA);

            //Step 14
            double C = 57.2958 * (2 * r * DELTA + R * R - r * r - DELTA * DELTA) / (4 * r * DELTA);

            if (Math.Sin(lrad - l0rad) > 0)
            {
                details.Apparentw1 = AASCoordinateTransformation.MapTo0To360Range(details.Geometricw1 + C);
                details.Apparentw2 = AASCoordinateTransformation.MapTo0To360Range(details.Geometricw2 + C);
            }
            else
            {
                details.Apparentw1 = AASCoordinateTransformation.MapTo0To360Range(details.Geometricw1 - C);
                details.Apparentw2 = AASCoordinateTransformation.MapTo0To360Range(details.Geometricw2 - C);
            }

            //Step 15
            double NutationInLongitude = AASNutation.NutationInLongitude(JD);
            double NutationInObliquity = AASNutation.NutationInObliquity(JD);

            e0   += NutationInObliquity / 3600;
            e0rad = AASCoordinateTransformation.DegreesToRadians(e0);

            //Step 16
            alpha   += 0.005693 * (Math.Cos(alpharad) * Math.Cos(l0rad) * Math.Cos(e0rad) + Math.Sin(alpharad) * Math.Sin(l0rad)) / Math.Cos(deltarad);
            alpha    = AASCoordinateTransformation.MapTo0To360Range(alpha);
            alpharad = AASCoordinateTransformation.DegreesToRadians(alpha);
            delta   += 0.005693 * (Math.Cos(l0rad) * Math.Cos(e0rad) * (Math.Tan(e0rad) * Math.Cos(deltarad) - Math.Sin(alpharad) * Math.Sin(deltarad)) + Math.Cos(alpharad) * Math.Sin(deltarad) * Math.Sin(l0rad));

            //Step 17
            double NutationRA   = AASNutation.NutationInRightAscension(alpha / 15, delta, e0, NutationInLongitude, NutationInObliquity);
            double alphadash    = alpha + NutationRA / 3600;
            double alphadashrad = AASCoordinateTransformation.DegreesToRadians(alphadash);
            double NutationDec  = AASNutation.NutationInDeclination(alpha / 15, e0, NutationInLongitude, NutationInObliquity);
            double deltadash    = delta + NutationDec / 3600;
            double deltadashrad = AASCoordinateTransformation.DegreesToRadians(deltadash);

            NutationRA = AASNutation.NutationInRightAscension(alpha0 / 15, delta0, e0, NutationInLongitude, NutationInObliquity);
            double alpha0dash    = alpha0 + NutationRA / 3600;
            double alpha0dashrad = AASCoordinateTransformation.DegreesToRadians(alpha0dash);

            NutationDec = AASNutation.NutationInDeclination(alpha0 / 15, e0, NutationInLongitude, NutationInObliquity);
            double delta0dash    = delta0 + NutationDec / 3600;
            double delta0dashrad = AASCoordinateTransformation.DegreesToRadians(delta0dash);

            //Step 18
            details.P = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Cos(delta0dashrad) * Math.Sin(alpha0dashrad - alphadashrad), Math.Sin(delta0dashrad) * Math.Cos(deltadashrad) - Math.Cos(delta0dashrad) * Math.Sin(deltadashrad) * Math.Cos(alpha0dashrad - alphadashrad))));

            return(details);
        }