public static double EclipticLongitude(double JD) { double Ldash = MeanLongitude(JD); double LdashDegrees = Ldash; Ldash = AASCoordinateTransformation.DegreesToRadians(Ldash); double D = MeanElongation(JD); D = AASCoordinateTransformation.DegreesToRadians(D); double M = AASEarth.SunMeanAnomaly(JD); M = AASCoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = AASCoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = AASCoordinateTransformation.DegreesToRadians(F); double E = AASEarth.Eccentricity(JD); double Esquared = E * E; double T = (JD - 2451545) / 36525; double A1 = AASCoordinateTransformation.MapTo0To360Range(119.75 + 131.849 * T); A1 = AASCoordinateTransformation.DegreesToRadians(A1); double A2 = AASCoordinateTransformation.MapTo0To360Range(53.09 + 479264.290 * T); A2 = AASCoordinateTransformation.DegreesToRadians(A2); int nLCoefficients = g_MoonCoefficients1.Length; double SigmaL = 0; for (int i = 0; i < nLCoefficients; i++) { double ThisSigma = g_MoonCoefficients2[i].A * Math.Sin(g_MoonCoefficients1[i].D * D + g_MoonCoefficients1[i].M * M + g_MoonCoefficients1[i].Mdash * Mdash + g_MoonCoefficients1[i].F * F); if ((g_MoonCoefficients1[i].M == 1) || (g_MoonCoefficients1[i].M == -1)) { ThisSigma *= E; } else if ((g_MoonCoefficients1[i].M == 2) || (g_MoonCoefficients1[i].M == -2)) { ThisSigma *= Esquared; } SigmaL += ThisSigma; } //Finally the additive terms SigmaL += 3958 * Math.Sin(A1); SigmaL += 1962 * Math.Sin(Ldash - F); SigmaL += 318 * Math.Sin(A2); //And finally apply the nutation in longitude double NutationInLong = AASNutation.NutationInLongitude(JD); return(AASCoordinateTransformation.MapTo0To360Range(LdashDegrees + SigmaL / 1000000 + NutationInLong / 3600)); }
public static double RadiusVector(double JD) { double D = MeanElongation(JD); D = AASCoordinateTransformation.DegreesToRadians(D); double M = AASEarth.SunMeanAnomaly(JD); M = AASCoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = AASCoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = AASCoordinateTransformation.DegreesToRadians(F); double E = AASEarth.Eccentricity(JD); int nRCoefficients = g_MoonCoefficients1.Length; double SigmaR = 0; for (int i = 0; i < nRCoefficients; i++) { double ThisSigma = g_MoonCoefficients2[i].B * Math.Cos(g_MoonCoefficients1[i].D * D + g_MoonCoefficients1[i].M * M + g_MoonCoefficients1[i].Mdash * Mdash + g_MoonCoefficients1[i].F * F); if (g_MoonCoefficients1[i].M == 1) { // in the C++, this was "if (g_MoonCoefficients1[i].M)", because 0 and 1 are used to represent false and true in C++ ThisSigma *= E; } SigmaR += ThisSigma; } return(385000.56 + SigmaR / 1000); }
public static double EclipticLatitude(double JD) { double Ldash = MeanLongitude(JD); Ldash = AASCoordinateTransformation.DegreesToRadians(Ldash); double D = MeanElongation(JD); D = AASCoordinateTransformation.DegreesToRadians(D); double M = AASEarth.SunMeanAnomaly(JD); M = AASCoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = AASCoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = AASCoordinateTransformation.DegreesToRadians(F); double E = AASEarth.Eccentricity(JD); double Esquared = E * E; double T = (JD - 2451545) / 36525; double A1 = AASCoordinateTransformation.MapTo0To360Range(119.75 + 131.849 * T); A1 = AASCoordinateTransformation.DegreesToRadians(A1); double A3 = AASCoordinateTransformation.MapTo0To360Range(313.45 + 481266.484 * T); A3 = AASCoordinateTransformation.DegreesToRadians(A3); int nBCoefficients = g_MoonCoefficients3.Length; double SigmaB = 0; for (int i = 0; i < nBCoefficients; i++) { double ThisSigma = g_MoonCoefficients4[i] * Math.Sin(g_MoonCoefficients3[i].D * D + g_MoonCoefficients3[i].M * M + g_MoonCoefficients3[i].Mdash * Mdash + g_MoonCoefficients3[i].F * F); if ((g_MoonCoefficients3[i].M == 1) || (g_MoonCoefficients3[i].M == -1)) { ThisSigma *= E; } else if ((g_MoonCoefficients3[i].M == 2) || (g_MoonCoefficients3[i].M == -2)) { ThisSigma *= Esquared; } SigmaB += ThisSigma; } //Finally the additive terms SigmaB -= 2235 * Math.Sin(Ldash); SigmaB += 382 * Math.Sin(A3); SigmaB += 175 * Math.Sin(A1 - F); SigmaB += 175 * Math.Sin(A1 + F); SigmaB += 127 * Math.Sin(Ldash - Mdash); SigmaB -= 115 * Math.Sin(Ldash + Mdash); return(SigmaB / 1000000); }
public static double RadiusVector(double JD) { double D = MeanElongation(JD); D = AASCoordinateTransformation.DegreesToRadians(D); double M = AASEarth.SunMeanAnomaly(JD); M = AASCoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = AASCoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = AASCoordinateTransformation.DegreesToRadians(F); double E = AASEarth.Eccentricity(JD); double Esquared = E * E; int nRCoefficients = g_MoonCoefficients1.Length; double SigmaR = 0; for (int i = 0; i < nRCoefficients; i++) { double ThisSigma = g_MoonCoefficients2[i].B * Math.Cos(g_MoonCoefficients1[i].D * D + g_MoonCoefficients1[i].M * M + g_MoonCoefficients1[i].Mdash * Mdash + g_MoonCoefficients1[i].F * F); if ((g_MoonCoefficients1[i].M == 1) || (g_MoonCoefficients1[i].M == -1)) { ThisSigma *= E; } else if ((g_MoonCoefficients1[i].M == 2) || (g_MoonCoefficients1[i].M == -2)) { ThisSigma *= Esquared; } SigmaR += ThisSigma; } return(385000.56 + SigmaR / 1000); }
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); }