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 SpringEquinox(long Year) { //calculate the approximate date double JDE; if (Year <= 1000) { double Y = Year / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 1721139.29189 + 365242.13740 * Y + 0.06134 * Ysquared + 0.00111 * Ycubed - 0.00071 * Y4; } else { double Y = (Year - 2000) / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 2451623.80984 + 365242.37404 * Y + 0.05169 * Ysquared - 0.00411 * Ycubed - 0.00057 * Y4; } double Correction; do { double SunLongitude = AASSun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(-SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
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 TrueLongitudeAscendingNode(double JD) { double TrueAscendingNode = MeanLongitudeAscendingNode(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); //Add the principal additive terms TrueAscendingNode -= 1.4979 * Math.Sin(2 * (D - F)); TrueAscendingNode -= 0.1500 * Math.Sin(M); TrueAscendingNode -= 0.1226 * Math.Sin(2 * D); TrueAscendingNode += 0.1176 * Math.Sin(2 * F); TrueAscendingNode -= 0.0801 * Math.Sin(2 * (Mdash - F)); return(AASCoordinateTransformation.MapTo0To360Range(TrueAscendingNode)); }
public static AAS2DCoordinate AdjustPositionUsingMotionInSpace(double r, double DeltaR, double t, double Alpha, double Delta, double PMAlpha, double PMDelta) { //Convert DeltaR from km/s to Parsecs / Year DeltaR /= 977792; //Convert from seconds of time to Radians / Year PMAlpha /= 13751; //Convert from seconds of arc to Radians / Year PMDelta /= 206265; //Now convert to radians Alpha = AASCoordinateTransformation.HoursToRadians(Alpha); Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double x = r * Math.Cos(Delta) * Math.Cos(Alpha); double y = r * Math.Cos(Delta) * Math.Sin(Alpha); double z = r * Math.Sin(Delta); double DeltaX = x / r * DeltaR - z * PMDelta * Math.Cos(Alpha) - y * PMAlpha; double DeltaY = y / r * DeltaR - z * PMDelta * Math.Sin(Alpha) + x * PMAlpha; double DeltaZ = z / r * DeltaR + r * PMDelta * Math.Cos(Delta); x += t * DeltaX; y += t * DeltaY; z += t * DeltaZ; AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To24Range(AASCoordinateTransformation.RadiansToHours(Math.Atan2(y, x))); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(z, Math.Sqrt(x * x + y * y))); return(value); }
public static double AutumnEquinox(long Year) { //calculate the approximate date double JDE; if (Year <= 1000) { double Y = Year / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 1721325.70455 + 365242.49558 * Y - 0.11677 * Ysquared - 0.00297 * Ycubed + 0.00074 * Y4; } else { double Y = (Year - 2000) / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 2451810.21715 + 365242.01767 * Y - 0.11575 * Ysquared + 0.00337 * Ycubed + 0.00078 * Y4; } double Correction; do { double SunLongitude = AASSun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(180 - SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
private static void CalculateSetHelper(ref AASRiseTransitSetDetails details, double theta0, double deltaT, double Alpha1, double Delta1, double Alpha2, double Delta2, double Alpha3, double Delta3, double Longitude, double Latitude, double LatitudeRad, double h0, ref double M2) { for (int i = 0; i < 2; i++) { //Calculate the details of setting if (details.bSetValid) { double theta1 = theta0 + 360.985647 * M2; theta1 = AASCoordinateTransformation.MapTo0To360Range(theta1); double n = M2 + deltaT / 86400; double Alpha = AASInterpolate.Interpolate(n, Alpha1, Alpha2, Alpha3); double Delta = AASInterpolate.Interpolate(n, Delta1, Delta2, Delta3); double H = theta1 - Longitude - Alpha * 15; AAS2DCoordinate Horizontal = AASCoordinateTransformation.Equatorial2Horizontal(H / 15, Delta, Latitude); double DeltaM = (Horizontal.Y - h0) / (360 * Math.Cos(AASCoordinateTransformation.DegreesToRadians(Delta)) * Math.Cos(LatitudeRad) * Math.Sin(AASCoordinateTransformation.DegreesToRadians(H))); M2 += DeltaM; if ((M2 < 0) || (M2 >= 1)) { details.bSetValid = false; } } } }
private static void HelperSubroutine(double e, double lambdadash, double p, double a, double omega, double i, double c1, double s1, ref double r, ref double lambda, ref double gamma, ref double w) { double e2 = e * e; double e3 = e2 * e; double e4 = e3 * e; double e5 = e4 * e; double M = AASCoordinateTransformation.DegreesToRadians(lambdadash - p); double Crad = (2 * e - 0.25 * e3 + 0.0520833333 * e5) * Math.Sin(M) + (1.25 * e2 - 0.458333333 * e4) * Math.Sin(2 * M) + (1.083333333 * e3 - 0.671875 * e5) * Math.Sin(3 * M) + 1.072917 * e4 * Math.Sin(4 * M) + 1.142708 * e5 * Math.Sin(5 * M); double C = AASCoordinateTransformation.RadiansToDegrees(Crad); r = a * (1 - e2) / (1 + e * Math.Cos(M + Crad)); double g = omega - 168.8112; double grad = AASCoordinateTransformation.DegreesToRadians(g); double irad = AASCoordinateTransformation.DegreesToRadians(i); double a1 = Math.Sin(irad) * Math.Sin(grad); double a2 = c1 * Math.Sin(irad) * Math.Cos(grad) - s1 * Math.Cos(irad); gamma = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sqrt(a1 * a1 + a2 * a2))); double urad = Math.Atan2(a1, a2); double u = AASCoordinateTransformation.RadiansToDegrees(urad); w = AASCoordinateTransformation.MapTo0To360Range(168.8112 + u); double h = c1 * Math.Sin(irad) - s1 * Math.Cos(irad) * Math.Cos(grad); double psirad = Math.Atan2(s1 * Math.Sin(grad), h); double psi = AASCoordinateTransformation.RadiansToDegrees(psirad); lambda = lambdadash + C + u - g - psi; }
public static AAS2DCoordinate Equatorial2TopocentricDelta(double Alpha, double Delta, double Distance, double Longitude, double Latitude, double Height, double JD) { double RhoSinThetaPrime = AASGlobe.RhoSinThetaPrime(Latitude, Height); double RhoCosThetaPrime = AASGlobe.RhoCosThetaPrime(Latitude, Height); //Calculate the Sidereal time double theta = AASSidereal.ApparentGreenwichSiderealTime(JD); //Convert to radians Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double cosDelta = Math.Cos(Delta); //Calculate the Parallax double pi = Math.Asin(g_AAParallax_C1 / Distance); //Calculate the hour angle double H = AASCoordinateTransformation.HoursToRadians(theta - Longitude / 15 - Alpha); double cosH = Math.Cos(H); double sinH = Math.Sin(H); AAS2DCoordinate DeltaTopocentric = new AAS2DCoordinate { X = AASCoordinateTransformation.RadiansToHours(-pi * RhoCosThetaPrime * sinH / cosDelta), Y = AASCoordinateTransformation.RadiansToDegrees(-pi * (RhoSinThetaPrime * cosDelta - RhoCosThetaPrime * cosH * Math.Sin(Delta))) }; return(DeltaTopocentric); }
public static AASEclipticalElementDetails FK4B1950ToFK5J2000(double i0, double w0, double omega0) { //convert to radians double L = AASCoordinateTransformation.DegreesToRadians(5.19856209); double J = AASCoordinateTransformation.DegreesToRadians(0.00651966); double i0rad = AASCoordinateTransformation.DegreesToRadians(i0); double omega0rad = AASCoordinateTransformation.DegreesToRadians(omega0); double sini0rad = Math.Sin(i0rad); double cosi0rad = Math.Cos(i0rad); //Calculate some values used later double cosJ = Math.Cos(J); double sinJ = Math.Sin(J); double W = L + omega0rad; double cosW = Math.Cos(W); double sinW = Math.Sin(W); double A = sinJ * sinW; double B = sini0rad * cosJ + cosi0rad * sinJ * cosW; //Calculate the values AASEclipticalElementDetails details = new AASEclipticalElementDetails(); details.i = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sqrt(A * A + B * B))); double cosi = cosi0rad * cosJ - sini0rad * sinJ * cosW; if (cosi < 0) { details.i = 180 - details.i; } details.w = AASCoordinateTransformation.MapTo0To360Range(w0 + AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(A, B))); details.omega = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(sini0rad * sinW, cosi0rad * sinJ + sini0rad * cosJ * cosW)) - 4.50001688); return(details); }
public static double TrueApogee(double k) { double MeanJD = MeanApogee(k); //convert from K to T double T = k / 1325.55; double Tsquared = T * T; double Tcubed = Tsquared * T; double T4 = Tcubed * T; double D = AASCoordinateTransformation.MapTo0To360Range(171.9179 + 335.9106046 * k - 0.0100383 * Tsquared - 0.00001156 * Tcubed + 0.000000055 * T4); D = AASCoordinateTransformation.DegreesToRadians(D); double M = AASCoordinateTransformation.MapTo0To360Range(347.3477 + 27.1577721 * k - 0.0008130 * Tsquared - 0.0000010 * Tcubed); M = AASCoordinateTransformation.DegreesToRadians(M); double F = AASCoordinateTransformation.MapTo0To360Range(316.6109 + 364.5287911 * k - 0.0125053 * Tsquared - 0.0000148 * Tcubed); F = AASCoordinateTransformation.DegreesToRadians(F); int nApogeeCoefficients = g_MoonPerigeeApogeeCoefficients2.Length; double Sigma = 0; for (int i = 0; i < nApogeeCoefficients; i++) { Sigma += (g_MoonPerigeeApogeeCoefficients2[i].C + T * g_MoonPerigeeApogeeCoefficients2[i].T) * Math.Sin(D * g_MoonPerigeeApogeeCoefficients2[i].D + M * g_MoonPerigeeApogeeCoefficients2[i].M + F * g_MoonPerigeeApogeeCoefficients2[i].F); } return(MeanJD + Sigma); }
public static double DistanceBetweenPoints(double GeographicalLatitude1, double GeographicalLongitude1, double GeographicalLatitude2, double GeographicalLongitude2) { //Convert from degress to radians GeographicalLatitude1 = AASCoordinateTransformation.DegreesToRadians(GeographicalLatitude1); GeographicalLatitude2 = AASCoordinateTransformation.DegreesToRadians(GeographicalLatitude2); GeographicalLongitude1 = AASCoordinateTransformation.DegreesToRadians(GeographicalLongitude1); GeographicalLongitude2 = AASCoordinateTransformation.DegreesToRadians(GeographicalLongitude2); double F = (GeographicalLatitude1 + GeographicalLatitude2) / 2; double G = (GeographicalLatitude1 - GeographicalLatitude2) / 2; double lambda = (GeographicalLongitude1 - GeographicalLongitude2) / 2; double sinG = Math.Sin(G); double cosG = Math.Cos(G); double cosF = Math.Cos(F); double sinF = Math.Sin(F); double sinLambda = Math.Sin(lambda); double cosLambda = Math.Cos(lambda); double S = (sinG * sinG * cosLambda * cosLambda) + (cosF * cosF * sinLambda * sinLambda); double C = (cosG * cosG * cosLambda * cosLambda) + (sinF * sinF * sinLambda * sinLambda); double w = Math.Atan(Math.Sqrt(S / C)); double R = Math.Sqrt(S * C) / w; double D = 2 * w * 6378.14; double Hprime = (3 * R - 1) / (2 * C); double Hprime2 = (3 * R + 1) / (2 * S); const double f = 0.0033528131778969144060323814696721; return(D * (1 + (f * Hprime * sinF * sinF * cosG * cosG) - (f * Hprime2 * cosF * cosF * sinG * sinG))); }
public static AAS2DCoordinate Equatorial2Topocentric(double Alpha, double Delta, double Distance, double Longitude, double Latitude, double Height, double JD) { double RhoSinThetaPrime = AASGlobe.RhoSinThetaPrime(Latitude, Height); double RhoCosThetaPrime = AASGlobe.RhoCosThetaPrime(Latitude, Height); //Calculate the Sidereal time double theta = AASSidereal.ApparentGreenwichSiderealTime(JD); //Convert to radians Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double cosDelta = Math.Cos(Delta); //Calculate the Parallax double pi = Math.Asin(g_AAParallax_C1 / Distance); double sinpi = Math.Sin(pi); //Calculate the hour angle double H = AASCoordinateTransformation.HoursToRadians(theta - Longitude / 15 - Alpha); double cosH = Math.Cos(H); double sinH = Math.Sin(H); //Calculate the adjustment in right ascension double DeltaAlpha = Math.Atan2(-RhoCosThetaPrime * sinpi * sinH, cosDelta - RhoCosThetaPrime * sinpi * cosH); AAS2DCoordinate Topocentric = new AAS2DCoordinate { X = AASCoordinateTransformation.MapTo0To24Range(Alpha + AASCoordinateTransformation.RadiansToHours(DeltaAlpha)), Y = AASCoordinateTransformation.RadiansToDegrees(Math.Atan2((Math.Sin(Delta) - RhoSinThetaPrime * sinpi) * Math.Cos(DeltaAlpha), cosDelta - RhoCosThetaPrime * sinpi * cosH)) }; return(Topocentric); }
public static AASBinaryStarDetails Calculate(double t, double P, double T, double e, double a, double i, double omega, double w) { double n = 360 / P; double M = AASCoordinateTransformation.MapTo0To360Range(n * (t - T)); double E = AASKepler.Calculate(M, e); E = AASCoordinateTransformation.DegreesToRadians(E); i = AASCoordinateTransformation.DegreesToRadians(i); w = AASCoordinateTransformation.DegreesToRadians(w); omega = AASCoordinateTransformation.DegreesToRadians(omega); AASBinaryStarDetails details = new AASBinaryStarDetails { r = a * (1 - e * Math.Cos(E)) }; double v = Math.Atan(Math.Sqrt((1 + e) / (1 - e)) * Math.Tan(E / 2)) * 2; details.Theta = Math.Atan2(Math.Sin(v + w) * Math.Cos(i), Math.Cos(v + w)) + omega; details.Theta = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(details.Theta)); double sinvw = Math.Sin(v + w); double cosvw = Math.Cos(v + w); double cosi = Math.Cos(i); details.Rho = details.r * Math.Sqrt((sinvw * sinvw * cosi * cosi) + (cosvw * cosvw)); return(details); }
public static double Calculate(double JD) { double rho = (JD - 2451545) / 365250; double rhosquared = rho * rho; double rhocubed = rhosquared * rho; double rho4 = rhocubed * rho; double rho5 = rho4 * rho; //Calculate the Suns mean longitude double L0 = AASCoordinateTransformation.MapTo0To360Range(280.4664567 + 360007.6982779 * rho + 0.03032028 * rhosquared + rhocubed / 49931 - rho4 / 15300 - rho5 / 2000000); //Calculate the Suns apparent right ascension double SunLong = AASSun.ApparentEclipticLongitude(JD); double SunLat = AASSun.ApparentEclipticLatitude(JD); double epsilon = AASNutation.TrueObliquityOfEcliptic(JD); AAS2DCoordinate Equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, epsilon); epsilon = AASCoordinateTransformation.DegreesToRadians(epsilon); double E = L0 - 0.0057183 - Equatorial.X * 15 + AASCoordinateTransformation.DMSToDegrees(0, 0, AASNutation.NutationInLongitude(JD)) * Math.Cos(epsilon); if (E > 180) { E = -(360 - E); } E *= 4; //Convert to minutes of time return(E); }
public static double EarthAphelion(long k, bool bBarycentric) { double kdash = k + 0.5; double ksquared = kdash * kdash; double JD = 2451547.507 + 365.2596358 * kdash + 0.0000000156 * ksquared; if (!bBarycentric) { //Apply the corrections double A1 = AASCoordinateTransformation.MapTo0To360Range(328.41 + 132.788585 * k); A1 = AASCoordinateTransformation.DegreesToRadians(A1); double A2 = AASCoordinateTransformation.MapTo0To360Range(316.13 + 584.903153 * k); A2 = AASCoordinateTransformation.DegreesToRadians(A2); double A3 = AASCoordinateTransformation.MapTo0To360Range(346.20 + 450.380738 * k); A3 = AASCoordinateTransformation.DegreesToRadians(A3); double A4 = AASCoordinateTransformation.MapTo0To360Range(136.95 + 659.306737 * k); A4 = AASCoordinateTransformation.DegreesToRadians(A4); double A5 = AASCoordinateTransformation.MapTo0To360Range(249.52 + 329.653368 * k); A5 = AASCoordinateTransformation.DegreesToRadians(A5); JD -= 1.352 * Math.Sin(A1); JD += 0.061 * Math.Sin(A2); JD += 0.062 * Math.Sin(A3); JD += 0.029 * Math.Sin(A4); JD += 0.031 * Math.Sin(A5); } return(JD); }
public static AAS2DCoordinate PrecessEquatorial(double Alpha, double Delta, double JD0, double JD) { double T = (JD0 - 2451545.0) / 36525; double Tsquared = T * T; double t = (JD - JD0) / 36525; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians Alpha = AASCoordinateTransformation.HoursToRadians(Alpha); Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double sigma = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2306.2181 + 1.39656 * T - 0.000139 * Tsquared) * t + (0.30188 - 0.000344 * T) * tsquared + 0.017998 * tcubed)); double zeta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2306.2181 + 1.39656 * T - 0.000139 * Tsquared) * t + (1.09468 + 0.000066 * T) * tsquared + 0.018203 * tcubed)); double phi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2004.3109 - 0.8533 * T - 0.000217 * Tsquared) * t - (0.42665 + 0.000217 * T) * tsquared - 0.041833 * tcubed)); double A = Math.Cos(Delta) * Math.Sin(Alpha + sigma); double B = Math.Cos(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) - Math.Sin(phi) * Math.Sin(Delta); double C = Math.Sin(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) + Math.Cos(phi) * Math.Sin(Delta); AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To24Range(AASCoordinateTransformation.RadiansToHours(Math.Atan2(A, B) + zeta)); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(C)); return(value); }
private static double VariationGeometricEclipticLongitude(double JD) { //D is the number of days since the epoch double D = JD - 2451545.00; double tau = (D / 365250); double tau2 = tau * tau; double tau3 = tau2 * tau; double deltaLambda = 3548.193 + 118.568 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(87.5287 + 359993.7286 * tau)) + 2.476 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(85.0561 + 719987.4571 * tau)) + 1.376 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(27.8502 + 4452671.1152 * tau)) + 0.119 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(73.1375 + 450368.8564 * tau)) + 0.114 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(337.2264 + 329644.6718 * tau)) + 0.086 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(222.5400 + 659289.3436 * tau)) + 0.078 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(162.8136 + 9224659.7915 * tau)) + 0.054 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(82.5823 + 1079981.1857 * tau)) + 0.052 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(171.5189 + 225184.4282 * tau)) + 0.034 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(30.3214 + 4092677.3866 * tau)) + 0.033 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(119.8105 + 337181.4711 * tau)) + 0.023 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(247.5418 + 299295.6151 * tau)) + 0.023 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(325.1526 + 315559.5560 * tau)) + 0.021 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(155.1241 + 675553.2846 * tau)) + 7.311 * tau * Math.Sin(AASCoordinateTransformation.DegreesToRadians(333.4515 + 359993.7286 * tau)) + 0.305 * tau * Math.Sin(AASCoordinateTransformation.DegreesToRadians(330.9814 + 719987.4571 * tau)) + 0.010 * tau * Math.Sin(AASCoordinateTransformation.DegreesToRadians(328.5170 + 1079981.1857 * tau)) + 0.309 * tau2 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(241.4518 + 359993.7286 * tau)) + 0.021 * tau2 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(205.0482 + 719987.4571 * tau)) + 0.004 * tau2 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(297.8610 + 4452671.1152 * tau)) + 0.010 * tau3 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(154.7066 + 359993.7286 * tau)); return(deltaLambda); }
public static AAS2DCoordinate PrecessEquatorialFK4(double Alpha, double Delta, double JD0, double JD) { double T = (JD0 - 2415020.3135) / 36524.2199; double t = (JD - JD0) / 36524.2199; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians Alpha = AASCoordinateTransformation.HoursToRadians(Alpha); Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double sigma = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2304.250 + 1.396 * T) * t + 0.302 * tsquared + 0.018 * tcubed)); double zeta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, 0.791 * tsquared + 0.001 * tcubed)) + sigma; double phi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2004.682 - 0.853 * T) * t - 0.426 * tsquared - 0.042 * tcubed)); double A = Math.Cos(Delta) * Math.Sin(Alpha + sigma); double B = Math.Cos(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) - Math.Sin(phi) * Math.Sin(Delta); double C = Math.Sin(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) + Math.Cos(phi) * Math.Sin(Delta); double DeltaAlpha = AASCoordinateTransformation.DMSToDegrees(0, 0, 0.0775 + 0.0850 * T); AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To24Range(AASCoordinateTransformation.RadiansToHours(Math.Atan2(A, B) + zeta) + DeltaAlpha); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(C)); return(value); }
public static double WinterSolstice(long Year) { //calculate the approximate date double JDE; if (Year <= 1000) { double Y = Year / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 1721414.39987 + 365242.88257 * Y - 0.00769 * Ysquared - 0.00933 * Ycubed - 0.00006 * Y4; } else { double Y = (Year - 2000) / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 2451900.05952 + 365242.74049 * Y - 0.06223 * Ysquared - 0.00823 * Ycubed + 0.00032 * Y4; } double Correction; do { double SunLongitude = AASSun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(270 - SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
public static double ApogeeParallax(double k) { //convert from K to T double T = k / 1325.55; double Tsquared = T * T; double Tcubed = Tsquared * T; double T4 = Tcubed * T; double D = AASCoordinateTransformation.MapTo0To360Range(171.9179 + 335.9106046 * k - 0.0100383 * Tsquared - 0.00001156 * Tcubed + 0.000000055 * T4); D = AASCoordinateTransformation.DegreesToRadians(D); double M = AASCoordinateTransformation.MapTo0To360Range(347.3477 + 27.1577721 * k - 0.0008130 * Tsquared - 0.0000010 * Tcubed); M = AASCoordinateTransformation.DegreesToRadians(M); double F = AASCoordinateTransformation.MapTo0To360Range(316.6109 + 364.5287911 * k - 0.0125053 * Tsquared - 0.0000148 * Tcubed); F = AASCoordinateTransformation.DegreesToRadians(F); int nApogeeCoefficients = g_MoonPerigeeApogeeCoefficients4.Length; double Parallax = 3245.251; for (int i = 0; i < nApogeeCoefficients; i++) { Parallax += (g_MoonPerigeeApogeeCoefficients4[i].C + T * g_MoonPerigeeApogeeCoefficients4[i].T) * Math.Cos(D * g_MoonPerigeeApogeeCoefficients4[i].D + M * g_MoonPerigeeApogeeCoefficients4[i].M + F * g_MoonPerigeeApogeeCoefficients4[i].F); } return(Parallax / 3600); }
public static double SummerSolstice(long Year) { //calculate the approximate date double JDE; if (Year <= 1000) { double Y = Year / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 1721233.25401 + 365241.72562 * Y - 0.05323 * Ysquared + 0.00907 * Ycubed + 0.00025 * Y4; } else { double Y = (Year - 2000) / 1000.0; double Ysquared = Y * Y; double Ycubed = Ysquared * Y; double Y4 = Ycubed * Y; JDE = 2451716.56767 + 365241.62603 * Y + 0.00325 * Ysquared + 0.00888 * Ycubed - 0.00030 * Y4; } double Correction; do { double SunLongitude = AASSun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(AASCoordinateTransformation.DegreesToRadians(90 - SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
public static AASPhysicalSunDetails Calculate(double JD) { double theta = AASCoordinateTransformation.MapTo0To360Range((JD - 2398220) * 360 / 25.38); double I = 7.25; double K = 73.6667 + 1.3958333 * (JD - 2396758) / 36525; //Calculate the apparent longitude of the sun (excluding the effect of nutation) double L = AASEarth.EclipticLongitude(JD); double R = AASEarth.RadiusVector(JD); double SunLong = L + 180 - AASCoordinateTransformation.DMSToDegrees(0, 0, 20.4898 / R); double epsilon = AASNutation.TrueObliquityOfEcliptic(JD); //Convert to radians epsilon = AASCoordinateTransformation.DegreesToRadians(epsilon); SunLong = AASCoordinateTransformation.DegreesToRadians(SunLong); K = AASCoordinateTransformation.DegreesToRadians(K); I = AASCoordinateTransformation.DegreesToRadians(I); theta = AASCoordinateTransformation.DegreesToRadians(theta); double x = Math.Atan(-Math.Cos(SunLong) * Math.Tan(epsilon)); double y = Math.Atan(-Math.Cos(SunLong - K) * Math.Tan(I)); AASPhysicalSunDetails details = new AASPhysicalSunDetails(); details.P = AASCoordinateTransformation.RadiansToDegrees(x + y); details.B0 = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(SunLong - K) * Math.Sin(I))); double eta = Math.Atan(Math.Tan(SunLong - K) * Math.Cos(I)); details.L0 = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(eta - theta)); return(details); }
public static AAS2DCoordinate PrecessEcliptic(double Lambda, double Beta, double JD0, double JD) { double T = (JD0 - 2451545.0) / 36525; double Tsquared = T * T; double t = (JD - JD0) / 36525; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians Lambda = AASCoordinateTransformation.DegreesToRadians(Lambda); Beta = AASCoordinateTransformation.DegreesToRadians(Beta); double eta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (47.0029 - 0.06603 * T + 0.000598 * Tsquared) * t + (-0.03302 + 0.000598 * T) * tsquared + 0.00006 * tcubed)); double pi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, 174.876384 * 3600 + 3289.4789 * T + 0.60622 * Tsquared - (869.8089 + 0.50491 * T) * t + 0.03536 * tsquared)); double p = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (5029.0966 + 2.22226 * T - 0.000042 * Tsquared) * t + (1.11113 - 0.000042 * T) * tsquared - 0.000006 * tcubed)); double A = Math.Cos(eta) * Math.Cos(Beta) * Math.Sin(pi - Lambda) - Math.Sin(eta) * Math.Sin(Beta); double B = Math.Cos(Beta) * Math.Cos(pi - Lambda); double C = Math.Cos(eta) * Math.Sin(Beta) + Math.Sin(eta) * Math.Cos(Beta) * Math.Sin(pi - Lambda); AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(p + pi - Math.Atan2(A, B))); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(C)); return(value); }
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 ParallacticAngle(double HourAngle, double Latitude, double delta) { HourAngle = AASCoordinateTransformation.HoursToRadians(HourAngle); Latitude = AASCoordinateTransformation.DegreesToRadians(Latitude); delta = AASCoordinateTransformation.DegreesToRadians(delta); return(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Sin(HourAngle), Math.Tan(Latitude) * Math.Cos(delta) - Math.Sin(delta) * Math.Cos(HourAngle)))); }
public static double RhoSinThetaPrime(double GeographicalLatitude, double Height) { GeographicalLatitude = AASCoordinateTransformation.DegreesToRadians(GeographicalLatitude); double U = Math.Atan(0.99664719 * Math.Tan(GeographicalLatitude)); return(0.99664719 * Math.Sin(U) + (Height / 6378149 * Math.Sin(GeographicalLatitude))); }
public static double SaturnMagnitudeMuller(double r, double Delta, double DeltaU, double B) { //Convert from degrees to radians B = AASCoordinateTransformation.DegreesToRadians(B); double sinB = Math.Sin(B); return(-8.68 + 5 * Math.Log10(r * Delta) + 0.044 * Math.Abs(DeltaU) - 2.60 * Math.Sin(Math.Abs(B)) + 1.25 * sinB * sinB); }
public static double NutationInDeclination(double Alpha, double Obliquity, double NutationInLongitude, double NutationInObliquity) { //Convert to radians Alpha = AASCoordinateTransformation.HoursToRadians(Alpha); Obliquity = AASCoordinateTransformation.DegreesToRadians(Obliquity); return(Math.Sin(Obliquity) * Math.Cos(Alpha) * NutationInLongitude + Math.Sin(Alpha) * NutationInObliquity); }
public static double IlluminatedFraction(double PhaseAngle) { //Convert from degrees to radians PhaseAngle = AASCoordinateTransformation.DegreesToRadians(PhaseAngle); //Return the result return((1 + Math.Cos(PhaseAngle)) / 2); }