public static CAA2DCoordinate Equatorial2Topocentric(double Alpha, double Delta, double Distance, double Longitude, double Latitude, double Height, double JD) { double RhoSinThetaPrime = CAAGlobe.RhoSinThetaPrime(Latitude, Height); double RhoCosThetaPrime = CAAGlobe.RhoCosThetaPrime(Latitude, Height); //Calculate the Sidereal time double theta = CAASidereal.ApparentGreenwichSiderealTime(JD); //Convert to radians Delta = CAACoordinateTransformation.DegreesToRadians(Delta); double cosDelta = Math.Cos(Delta); //Calculate the Parallax double pi = Math.Asin(GlobalMembersStdafx.g_AAParallax_C1 / Distance); double sinpi = Math.Sin(pi); //Calculate the hour angle double H = CAACoordinateTransformation.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); CAA2DCoordinate Topocentric = new CAA2DCoordinate(); Topocentric.X = CAACoordinateTransformation.MapTo0To24Range(Alpha + CAACoordinateTransformation.RadiansToHours(DeltaAlpha)); Topocentric.Y = CAACoordinateTransformation.RadiansToDegrees(Math.Atan2((Math.Sin(Delta) - RhoSinThetaPrime * sinpi) * Math.Cos(DeltaAlpha), cosDelta - RhoCosThetaPrime * sinpi * cosH)); return(Topocentric); }
//////////////////////////////// Implementation /////////////////////////////// protected 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 = CAACoordinateTransformation.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 = CAACoordinateTransformation.RadiansToDegrees(Crad); r = a * (1 - e2) / (1 + e * Math.Cos(M + Crad)); double g = omega - 168.8112; double grad = CAACoordinateTransformation.DegreesToRadians(g); double irad = CAACoordinateTransformation.DegreesToRadians(i); double a1 = Math.Sin(irad) * Math.Sin(grad); double a2 = c1 * Math.Sin(irad) * Math.Cos(grad) - s1 * Math.Cos(irad); gamma = CAACoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sqrt(a1 * a1 + a2 * a2))); double urad = Math.Atan2(a1, a2); double u = CAACoordinateTransformation.RadiansToDegrees(urad); w = CAACoordinateTransformation.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 = CAACoordinateTransformation.RadiansToDegrees(psirad); lambda = lambdadash + C + u - g - psi; }
//Conversion functions public static CAA2DCoordinate Equatorial2TopocentricDelta(double Alpha, double Delta, double Distance, double Longitude, double Latitude, double Height, double JD) { double RhoSinThetaPrime = CAAGlobe.RhoSinThetaPrime(Latitude, Height); double RhoCosThetaPrime = CAAGlobe.RhoCosThetaPrime(Latitude, Height); //Calculate the Sidereal time double theta = CAASidereal.ApparentGreenwichSiderealTime(JD); //Convert to radians Delta = CAACoordinateTransformation.DegreesToRadians(Delta); double cosDelta = Math.Cos(Delta); //Calculate the Parallax double pi = Math.Asin(GlobalMembersStdafx.g_AAParallax_C1 / Distance); //Calculate the hour angle double H = CAACoordinateTransformation.HoursToRadians(theta - Longitude / 15 - Alpha); double cosH = Math.Cos(H); double sinH = Math.Sin(H); CAA2DCoordinate DeltaTopocentric = new CAA2DCoordinate(); DeltaTopocentric.X = CAACoordinateTransformation.RadiansToHours(-pi * RhoCosThetaPrime * sinH / cosDelta); DeltaTopocentric.Y = CAACoordinateTransformation.RadiansToDegrees(-pi * (RhoSinThetaPrime * cosDelta - RhoCosThetaPrime * cosH * Math.Sin(Delta))); return(DeltaTopocentric); }
public static double AutumnEquinox(int Year) { //calculate the approximate date double JDE = 0; 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 = CAASun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(180 - SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
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 = CAACoordinateTransformation.MapTo0To360Range(171.9179 + 335.9106046 * k - 0.0100383 * Tsquared - 0.00001156 * Tcubed + 0.000000055 * T4); D = CAACoordinateTransformation.DegreesToRadians(D); double M = CAACoordinateTransformation.MapTo0To360Range(347.3477 + 27.1577721 * k - 0.0008130 * Tsquared - 0.0000010 * Tcubed); M = CAACoordinateTransformation.DegreesToRadians(M); double F = CAACoordinateTransformation.MapTo0To360Range(316.6109 + 364.5287911 * k - 0.0125053 * Tsquared - 0.0000148 * Tcubed); F = CAACoordinateTransformation.DegreesToRadians(F); int nApogeeCoefficients = GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients2.Length; double Sigma = 0; for (int i = 0; i < nApogeeCoefficients; i++) { Sigma += (GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients2[i].C + T * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients2[i].T) * Math.Sin(D * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients2[i].D + M * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients2[i].M + F * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients2[i].F); } return(MeanJD + Sigma); }
public static CAAEclipticalElementDetails FK4B1950ToFK5J2000(double i0, double w0, double omega0) { //convert to radians double L = CAACoordinateTransformation.DegreesToRadians(5.19856209); double J = CAACoordinateTransformation.DegreesToRadians(0.00651966); double i0rad = CAACoordinateTransformation.DegreesToRadians(i0); double omega0rad = CAACoordinateTransformation.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 CAAEclipticalElementDetails details = new CAAEclipticalElementDetails(); details.i = CAACoordinateTransformation.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 = CAACoordinateTransformation.MapTo0To360Range(w0 + CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(A, B))); details.omega = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(sini0rad * sinW, cosi0rad * sinJ + sini0rad * cosJ * cosW)) - 4.50001688); return(details); }
public static double PassageThroNode(double k) { //convert from K to T double T = k / 1342.23; double Tsquared = T * T; double Tcubed = Tsquared * T; double T4 = Tcubed * T; double D = CAACoordinateTransformation.MapTo0To360Range(183.6380 + 331.73735682 * k + 0.0014852 * Tsquared + 0.00000209 * Tcubed - 0.000000010 * T4); double M = CAACoordinateTransformation.MapTo0To360Range(17.4006 + 26.82037250 * k + 0.0001186 * Tsquared + 0.00000006 * Tcubed); double Mdash = CAACoordinateTransformation.MapTo0To360Range(38.3776 + 355.52747313 * k + 0.0123499 * Tsquared + 0.000014627 * Tcubed - 0.000000069 * T4); double omega = CAACoordinateTransformation.MapTo0To360Range(123.9767 - 1.44098956 * k + 0.0020608 * Tsquared + 0.00000214 * Tcubed - 0.000000016 * T4); double V = CAACoordinateTransformation.MapTo0To360Range(299.75 + 132.85 * T - 0.009173 * Tsquared); double P = CAACoordinateTransformation.MapTo0To360Range(omega + 272.75 - 2.3 * T); double E = 1 - 0.002516 * T - 0.0000074 * Tsquared; //convert to radians D = CAACoordinateTransformation.DegreesToRadians(D); double D2 = 2 * D; double D4 = D2 * D2; M = CAACoordinateTransformation.DegreesToRadians(M); Mdash = CAACoordinateTransformation.DegreesToRadians(Mdash); double Mdash2 = 2 * Mdash; omega = CAACoordinateTransformation.DegreesToRadians(omega); V = CAACoordinateTransformation.DegreesToRadians(V); P = CAACoordinateTransformation.DegreesToRadians(P); double JD = 2451565.1619 + 27.212220817 * k + 0.0002762 * Tsquared + 0.000000021 * Tcubed - 0.000000000088 * T4 - 0.4721 * Math.Sin(Mdash) - 0.1649 * Math.Sin(D2) - 0.0868 * Math.Sin(D2 - Mdash) + 0.0084 * Math.Sin(D2 + Mdash) - E * 0.0083 * Math.Sin(D2 - M) - E * 0.0039 * Math.Sin(D2 - M - Mdash) + 0.0034 * Math.Sin(Mdash2) - 0.0031 * Math.Sin(D2 - Mdash2) + E * 0.0030 * Math.Sin(D2 + M) + E * 0.0028 * Math.Sin(M - Mdash) + E * 0.0026 * Math.Sin(M) + 0.0025 * Math.Sin(D4) + 0.0024 * Math.Sin(D) + E * 0.0022 * Math.Sin(M + Mdash) + 0.0017 * Math.Sin(omega) + 0.0014 * Math.Sin(D4 - Mdash) + E * 0.0005 * Math.Sin(D2 + M - Mdash) + E * 0.0004 * Math.Sin(D2 - M + Mdash) - E * 0.0003 * Math.Sin(D2 - M * M) + E * 0.0003 * Math.Sin(D4 - M) + 0.0003 * Math.Sin(V) + 0.0003 * Math.Sin(P); return(JD); }
//Static methods //////////////////////////////// Implementation /////////////////////////////// public static double SpringEquinox(int Year) { //calculate the approximate date double JDE = 0; 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 = CAASun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(-SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
//Static methods ///////////////////////// Implementation ////////////////////////////////////// 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 = CAACoordinateTransformation.MapTo0To360Range(280.4664567 + 360007.6982779 * rho + 0.03032028 * rhosquared + rhocubed / 49931 - rho4 / 15300 - rho5 / 2000000); //Calculate the Suns apparent right ascension double SunLong = CAASun.ApparentEclipticLongitude(JD); double SunLat = CAASun.ApparentEclipticLatitude(JD); double epsilon = CAANutation.TrueObliquityOfEcliptic(JD); CAA2DCoordinate Equatorial = CAACoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, epsilon); epsilon = CAACoordinateTransformation.DegreesToRadians(epsilon); double E = L0 - 0.0057183 - Equatorial.X * 15 + CAACoordinateTransformation.DMSToDegrees(0, 0, CAANutation.NutationInLongitude(JD)) * Math.Cos(epsilon); if (E > 180) { E = -(360 - E); } E *= 4; //Convert to minutes of time return(E); }
public static double SummerSolstice(int Year) { //calculate the approximate date double JDE = 0; 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 = CAASun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(90 - SunLongitude)); JDE += Correction; }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second return(JDE); }
//C++ TO C# CONVERTER NOTE: C# does not allow default values for parameters. Overloaded methods are inserted above. //ORIGINAL LINE: static double EarthPerihelion(int k, bool bBarycentric = false) public static double EarthPerihelion(int k, bool bBarycentric) { double kdash = k; double ksquared = kdash * kdash; double JD = 2451547.507 + 365.2596358 * kdash + 0.0000000156 * ksquared; if (!bBarycentric) { //Apply the corrections double A1 = CAACoordinateTransformation.MapTo0To360Range(328.41 + 132.788585 * k); A1 = CAACoordinateTransformation.DegreesToRadians(A1); double A2 = CAACoordinateTransformation.MapTo0To360Range(316.13 + 584.903153 * k); A2 = CAACoordinateTransformation.DegreesToRadians(A2); double A3 = CAACoordinateTransformation.MapTo0To360Range(346.20 + 450.380738 * k); A3 = CAACoordinateTransformation.DegreesToRadians(A3); double A4 = CAACoordinateTransformation.MapTo0To360Range(136.95 + 659.306737 * k); A4 = CAACoordinateTransformation.DegreesToRadians(A4); double A5 = CAACoordinateTransformation.MapTo0To360Range(249.52 + 329.653368 * k); A5 = CAACoordinateTransformation.DegreesToRadians(A5); JD += 1.278 * Math.Sin(A1); JD -= 0.055 * Math.Sin(A2); JD -= 0.091 * Math.Sin(A3); JD -= 0.056 * Math.Sin(A4); JD -= 0.045 * Math.Sin(A5); } return(JD); }
public static double WinterSolstice(int Year) { //calculate the approximate date double JDE = 0; 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 = CAASun.ApparentEclipticLongitude(JDE); Correction = 58 * Math.Sin(CAACoordinateTransformation.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 DistanceBetweenPoints(double GeographicalLatitude1, double GeographicalLongitude1, double GeographicalLatitude2, double GeographicalLongitude2) { //Convert from degress to radians GeographicalLatitude1 = CAACoordinateTransformation.DegreesToRadians(GeographicalLatitude1); GeographicalLatitude2 = CAACoordinateTransformation.DegreesToRadians(GeographicalLatitude2); GeographicalLongitude1 = CAACoordinateTransformation.DegreesToRadians(GeographicalLongitude1); GeographicalLongitude2 = CAACoordinateTransformation.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); double f = 0.0033528131778969144060323814696721; return(D * (1 + (f * Hprime * sinF * sinF * cosG * cosG) - (f * Hprime2 * cosF * cosF * sinG * sinG))); }
//Static methods //Tangible Process Only End ////////////////////////////////// Implementation ///////////////////////////// public static CAABinaryStarDetails Calculate(double t, double P, double T, double e, double a, double i, double omega, double w) { double n = 360 / P; double M = CAACoordinateTransformation.MapTo0To360Range(n * (t - T)); double E = CAAKepler.Calculate(M, e); E = CAACoordinateTransformation.DegreesToRadians(E); i = CAACoordinateTransformation.DegreesToRadians(i); w = CAACoordinateTransformation.DegreesToRadians(w); omega = CAACoordinateTransformation.DegreesToRadians(omega); CAABinaryStarDetails details = new CAABinaryStarDetails(); details.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 = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.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 PerigeeParallax(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 = CAACoordinateTransformation.MapTo0To360Range(171.9179 + 335.9106046 * k - 0.0100383 * Tsquared - 0.00001156 * Tcubed + 0.000000055 * T4); D = CAACoordinateTransformation.DegreesToRadians(D); double M = CAACoordinateTransformation.MapTo0To360Range(347.3477 + 27.1577721 * k - 0.0008130 * Tsquared - 0.0000010 * Tcubed); M = CAACoordinateTransformation.DegreesToRadians(M); double F = CAACoordinateTransformation.MapTo0To360Range(316.6109 + 364.5287911 * k - 0.0125053 * Tsquared - 0.0000148 * Tcubed); F = CAACoordinateTransformation.DegreesToRadians(F); int nPerigeeCoefficients = GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients3.Length; double Parallax = 3629.215; for (int i = 0; i < nPerigeeCoefficients; i++) { Parallax += (GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients3[i].C + T * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients3[i].T) * Math.Cos(D * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients3[i].D + M * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients3[i].M + F * GlobalMembersStdafx.g_MoonPerigeeApogeeCoefficients3[i].F); } return(Parallax / 3600); }
public static double TrueLongitudeAscendingNode(double JD) { double TrueAscendingNode = MeanLongitudeAscendingNode(JD); double D = MeanElongation(JD); D = CAACoordinateTransformation.DegreesToRadians(D); double M = CAAEarth.SunMeanAnomaly(JD); M = CAACoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = CAACoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = CAACoordinateTransformation.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(CAACoordinateTransformation.MapTo0To360Range(TrueAscendingNode)); }
public static double EclipticLongitude(double JD) { double Ldash = MeanLongitude(JD); double LdashDegrees = Ldash; Ldash = CAACoordinateTransformation.DegreesToRadians(Ldash); double D = MeanElongation(JD); D = CAACoordinateTransformation.DegreesToRadians(D); double M = CAAEarth.SunMeanAnomaly(JD); M = CAACoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = CAACoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = CAACoordinateTransformation.DegreesToRadians(F); double E = CAAEarth.Eccentricity(JD); double T = (JD - 2451545) / 36525; double A1 = CAACoordinateTransformation.MapTo0To360Range(119.75 + 131.849 * T); A1 = CAACoordinateTransformation.DegreesToRadians(A1); double A2 = CAACoordinateTransformation.MapTo0To360Range(53.09 + 479264.290 * T); A2 = CAACoordinateTransformation.DegreesToRadians(A2); double A3 = CAACoordinateTransformation.MapTo0To360Range(313.45 + 481266.484 * T); A3 = CAACoordinateTransformation.DegreesToRadians(A3); int nLCoefficients = GlobalMembersStdafx.g_MoonCoefficients1.Length; Debug.Assert(GlobalMembersStdafx.g_MoonCoefficients2.Length == nLCoefficients); double SigmaL = 0; for (int i = 0; i < nLCoefficients; i++) { double ThisSigma = GlobalMembersStdafx.g_MoonCoefficients2[i].A * Math.Sin(GlobalMembersStdafx.g_MoonCoefficients1[i].D * D + GlobalMembersStdafx.g_MoonCoefficients1[i].M * M + GlobalMembersStdafx.g_MoonCoefficients1[i].Mdash * Mdash + GlobalMembersStdafx.g_MoonCoefficients1[i].F * F); if (GlobalMembersStdafx.g_MoonCoefficients1[i].M != 0) { ThisSigma *= E; } 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 = CAANutation.NutationInLongitude(JD); return(CAACoordinateTransformation.MapTo0To360Range(LdashDegrees + SigmaL / 1000000 + NutationInLong / 3600)); }
public static double IlluminatedFraction(double PhaseAngle) { //Convert from degrees to radians PhaseAngle = CAACoordinateTransformation.DegreesToRadians(PhaseAngle); //Return the result return((1 + Math.Cos(PhaseAngle)) / 2); }
public static double PhaseAngle(double GeocentricElongation, double EarthObjectDistance, double EarthSunDistance) { //Convert from degrees to radians GeocentricElongation = CAACoordinateTransformation.DegreesToRadians(GeocentricElongation); //Return the result return(CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(EarthSunDistance * Math.Sin(GeocentricElongation), EarthObjectDistance - EarthSunDistance * Math.Cos(GeocentricElongation))))); }
//C++ TO C# CONVERTER NOTE: C# does not allow default values for parameters. Overloaded methods are inserted above. //ORIGINAL LINE: static double RefractionFromTrue(double Altitude, double Pressure = 1010, double Temperature = 10) public static double RefractionFromTrue(double Altitude, double Pressure, double Temperature) { double @value = 1.02 / (Math.Tan(CAACoordinateTransformation.DegreesToRadians(Altitude + 10.3 / (Altitude + 5.11)))) + 0.0019279; @value *= (Pressure / 1010 * 283 / (273 + Temperature)); @value /= 60; return(@value); }
//Static methods /////////////////////////// Implementation //////////////////////////////////// public static double RhoSinThetaPrime(double GeographicalLatitude, double Height) { GeographicalLatitude = CAACoordinateTransformation.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 SaturnMagnitudeAA(double r, double Delta, double DeltaU, double B) { //Convert from degrees to radians B = CAACoordinateTransformation.DegreesToRadians(B); double sinB = Math.Sin(B); return(-8.88 + 5 * Math.Log10(r * Delta) + 0.044 * Math.Abs(DeltaU) - 2.60 * Math.Sin(Math.Abs(B)) + 1.25 * sinB * sinB); }
//C++ TO C# CONVERTER NOTE: C# does not allow default values for parameters. Overloaded methods are inserted above. //ORIGINAL LINE: static double RefractionFromApparent(double Altitude, double Pressure = 1010, double Temperature = 10) public static double RefractionFromApparent(double Altitude, double Pressure, double Temperature) { double @value = 1 / (Math.Tan(CAACoordinateTransformation.DegreesToRadians(Altitude + 7.31 / (Altitude + 4.4)))) + 0.0013515; @value *= (Pressure / 1010 * 283 / (273 + Temperature)); @value /= 60; return(@value); }
//Static methods ////////////////////// Implementation ///////////////////////////////////////// public static double ParallacticAngle(double HourAngle, double Latitude, double delta) { HourAngle = CAACoordinateTransformation.HoursToRadians(HourAngle); Latitude = CAACoordinateTransformation.DegreesToRadians(Latitude); delta = CAACoordinateTransformation.DegreesToRadians(delta); return(CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Sin(HourAngle), Math.Tan(Latitude) * Math.Cos(delta) - Math.Sin(delta) * Math.Cos(HourAngle)))); }
public static double EclipticLatitude(double JD) { double Ldash = MeanLongitude(JD); Ldash = CAACoordinateTransformation.DegreesToRadians(Ldash); double D = MeanElongation(JD); D = CAACoordinateTransformation.DegreesToRadians(D); double M = CAAEarth.SunMeanAnomaly(JD); M = CAACoordinateTransformation.DegreesToRadians(M); double Mdash = MeanAnomaly(JD); Mdash = CAACoordinateTransformation.DegreesToRadians(Mdash); double F = ArgumentOfLatitude(JD); F = CAACoordinateTransformation.DegreesToRadians(F); double E = CAAEarth.Eccentricity(JD); double T = (JD - 2451545) / 36525; double A1 = CAACoordinateTransformation.MapTo0To360Range(119.75 + 131.849 * T); A1 = CAACoordinateTransformation.DegreesToRadians(A1); double A2 = CAACoordinateTransformation.MapTo0To360Range(53.09 + 479264.290 * T); A2 = CAACoordinateTransformation.DegreesToRadians(A2); double A3 = CAACoordinateTransformation.MapTo0To360Range(313.45 + 481266.484 * T); A3 = CAACoordinateTransformation.DegreesToRadians(A3); int nBCoefficients = GlobalMembersStdafx.g_MoonCoefficients3.Length; Debug.Assert(GlobalMembersStdafx.g_MoonCoefficients4.Length == nBCoefficients); double SigmaB = 0; for (int i = 0; i < nBCoefficients; i++) { double ThisSigma = GlobalMembersStdafx.g_MoonCoefficients4[i] * Math.Sin(GlobalMembersStdafx.g_MoonCoefficients3[i].D * D + GlobalMembersStdafx.g_MoonCoefficients3[i].M * M + GlobalMembersStdafx.g_MoonCoefficients3[i].Mdash * Mdash + GlobalMembersStdafx.g_MoonCoefficients3[i].F * F); if (GlobalMembersStdafx.g_MoonCoefficients3[i].M != 0) { ThisSigma *= E; } 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 NutationInDeclination(double Alpha, double Delta, double Obliquity, double NutationInLongitude, double NutationInObliquity) { //Convert to radians Alpha = CAACoordinateTransformation.HoursToRadians(Alpha); Delta = CAACoordinateTransformation.DegreesToRadians(Delta); Obliquity = CAACoordinateTransformation.DegreesToRadians(Obliquity); return(Math.Sin(Obliquity) * Math.Cos(Alpha) * NutationInLongitude + Math.Sin(Alpha) * NutationInObliquity); }
public static double RadiusOfCurvature(double GeographicalLatitude) { //Convert from degress to radians GeographicalLatitude = CAACoordinateTransformation.DegreesToRadians(GeographicalLatitude); double sinGeo = Math.Sin(GeographicalLatitude); return((6378.14 * (1 - 0.0066943847614084)) / Math.Pow((1 - 0.0066943847614084 * sinGeo * sinGeo), 1.5)); }
public static double RadiusOfParallelOfLatitude(double GeographicalLatitude) { //Convert from degress to radians GeographicalLatitude = CAACoordinateTransformation.DegreesToRadians(GeographicalLatitude); double sinGeo = Math.Sin(GeographicalLatitude); return((6378.14 * Math.Cos(GeographicalLatitude)) / (Math.Sqrt(1 - 0.0066943847614084 * sinGeo * sinGeo))); }
public static double RhoCosThetaPrime(double GeographicalLatitude, double Height) { //Convert from degress to radians GeographicalLatitude = CAACoordinateTransformation.DegreesToRadians(GeographicalLatitude); double U = Math.Atan(0.99664719 * Math.Tan(GeographicalLatitude)); return(Math.Cos(U) + (Height / 6378149 * Math.Cos(GeographicalLatitude))); }
//Static methods /////////////////////////// Implementation //////////////////////////////////// public static CAAEclipticalElementDetails Calculate(double i0, double w0, double omega0, 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 double i0rad = CAACoordinateTransformation.DegreesToRadians(i0); double omega0rad = CAACoordinateTransformation.DegreesToRadians(omega0); double eta = (47.0029 - 0.06603 * T + 0.000598 * Tsquared) * t + (-0.03302 + 0.000598 * T) * tsquared + 0.00006 * tcubed; eta = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, eta)); double pi = 174.876384 * 3600 + 3289.4789 * T + 0.60622 * Tsquared - (869.8089 + 0.50491 * T) * t + 0.03536 * tsquared; pi = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, pi)); double p = (5029.0966 + 2.22226 * T - 0.000042 * Tsquared) * t + (1.11113 - 0.000042 * T) * tsquared - 0.000006 * tcubed; p = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, p)); double sini0rad = Math.Sin(i0rad); double cosi0rad = Math.Cos(i0rad); double sinomega0rad_pi = Math.Sin(omega0rad - pi); double cosomega0rad_pi = Math.Cos(omega0rad - pi); double sineta = Math.Sin(eta); double coseta = Math.Cos(eta); double A = sini0rad * sinomega0rad_pi; double B = -sineta * cosi0rad + coseta * sini0rad * cosomega0rad_pi; double irad = Math.Asin(Math.Sqrt(A * A + B * B)); CAAEclipticalElementDetails details = new CAAEclipticalElementDetails(); details.i = CAACoordinateTransformation.RadiansToDegrees(irad); double cosi = cosi0rad * coseta + sini0rad * sineta * cosomega0rad_pi; if (cosi < 0) { details.i = 180 - details.i; } double phi = pi + p; details.omega = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(A, B) + phi)); A = -sineta * sinomega0rad_pi; B = sini0rad * coseta - cosi0rad * sineta * cosomega0rad_pi; double deltaw = CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(A, B)); details.w = CAACoordinateTransformation.MapTo0To360Range(w0 + deltaw); return(details); }