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 CalculateTopocentric(double JD, double Longitude, double Latitude) { //First convert to radians Longitude = AASCoordinateTransformation.DegreesToRadians(Longitude); Latitude = AASCoordinateTransformation.DegreesToRadians(Latitude); double Lambda = 0; double Beta = 0; double epsilon = 0; AAS2DCoordinate Equatorial = new AAS2DCoordinate(); AASPhysicalMoonDetails details = CalculateHelper(JD, ref Lambda, ref Beta, ref epsilon, ref Equatorial); double R = AASMoon.RadiusVector(JD); double pi = AASMoon.RadiusVectorToHorizontalParallax(R); double Alpha = AASCoordinateTransformation.HoursToRadians(Equatorial.X); double Delta = AASCoordinateTransformation.DegreesToRadians(Equatorial.Y); double AST = AASSidereal.ApparentGreenwichSiderealTime(JD); double H = AASCoordinateTransformation.HoursToRadians(AST) - Longitude - Alpha; double Q = Math.Atan2(Math.Cos(Latitude) * Math.Sin(H), Math.Cos(Delta) * Math.Sin(Latitude) - Math.Sin(Delta) * Math.Cos(Latitude) * Math.Cos(H)); double Z = Math.Acos(Math.Sin(Delta) * Math.Sin(Latitude) + Math.Cos(Delta) * Math.Cos(Latitude) * Math.Cos(H)); double pidash = pi * (Math.Sin(Z) + 0.0084 * Math.Sin(2 * Z)); double Prad = AASCoordinateTransformation.DegreesToRadians(details.P); double DeltaL = -pidash *Math.Sin(Q - Prad) / Math.Cos(AASCoordinateTransformation.DegreesToRadians(details.b)); details.l += DeltaL; double DeltaB = pidash * Math.Cos(Q - Prad); details.b += DeltaB; double DeltaP = DeltaL * Math.Sin(AASCoordinateTransformation.DegreesToRadians(details.b)) - pidash * Math.Sin(Q) * Math.Tan(Delta); details.P += DeltaP; return(details); }