public static AASSelenographicMoonDetails CalculateSelenographicPositionOfSun(double JD, bool bHighPrecision) { double R = AASEarth.RadiusVector(JD, bHighPrecision) * 149597970; double Delta = AASMoon.RadiusVector(JD); double lambda0 = AASSun.ApparentEclipticLongitude(JD, bHighPrecision); double lambda = AASMoon.EclipticLongitude(JD); double beta = AASMoon.EclipticLatitude(JD); double lambdah = AASCoordinateTransformation.MapTo0To360Range(lambda0 + 180 + Delta / R * 57.296 * Math.Cos(AASCoordinateTransformation.DegreesToRadians(beta)) * Math.Sin(AASCoordinateTransformation.DegreesToRadians(lambda0 - lambda))); double betah = Delta / R * beta; //What will be the return value AASSelenographicMoonDetails details = new AASSelenographicMoonDetails(); //Calculate the optical libration double omega = 0; double DeltaU = 0; double sigma = 0; double I = 0; double rho = 0; double ldash0 = 0; double bdash0 = 0; double ldash20 = 0; double bdash20 = 0; double epsilon = 0; CalculateOpticalLibration(JD, lambdah, betah, ref ldash0, ref bdash0, ref ldash20, ref bdash20, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho); details.l0 = ldash0 + ldash20; details.b0 = bdash0 + bdash20; details.c0 = AASCoordinateTransformation.MapTo0To360Range(450 - details.l0); return(details); }
public static AASPhysicalMoonDetails CalculateHelper(double JD, ref double Lambda, ref double Beta, ref double epsilon, ref AAS2DCoordinate Equatorial) { //What will be the return value AASPhysicalMoonDetails details = new AASPhysicalMoonDetails(); //Calculate the initial quantities Lambda = AASMoon.EclipticLongitude(JD); Beta = AASMoon.EclipticLatitude(JD); //Calculate the optical libration double omega = 0; double DeltaU = 0; double sigma = 0; double I = 0; double rho = 0; double ldash = 0; double bdash = 0; double ldash2 = 0; double bdash2 = 0; CalculateOpticalLibration(JD, Lambda, Beta, ref ldash, ref bdash, ref ldash2, ref bdash2, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho); details.ldash = ldash; details.bdash = bdash; details.ldash2 = ldash2; details.bdash2 = bdash2; double epsilonrad = AASCoordinateTransformation.DegreesToRadians(epsilon); //Calculate the total libration details.l = details.ldash + details.ldash2; details.b = details.bdash + details.bdash2; double b = AASCoordinateTransformation.DegreesToRadians(details.b); //Calculate the position angle double V = omega + DeltaU + AASCoordinateTransformation.DegreesToRadians(sigma) / Math.Sin(I); double I_rho = I + AASCoordinateTransformation.DegreesToRadians(rho); double X = Math.Sin(I_rho) * Math.Sin(V); double Y = Math.Sin(I_rho) * Math.Cos(V) * Math.Cos(epsilonrad) - Math.Cos(I_rho) * Math.Sin(epsilonrad); double w = Math.Atan2(X, Y); Equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(Lambda, Beta, epsilon); double Alpha = AASCoordinateTransformation.HoursToRadians(Equatorial.X); details.P = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sqrt(X * X + Y * Y) * Math.Cos(Alpha - w) / (Math.Cos(b)))); return(details); }