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 double AltitudeOfSun(double JD, double Longitude, double Latitude, bool bHighPrecision) { //Calculate the selenographic details AASSelenographicMoonDetails selenographicDetails = CalculateSelenographicPositionOfSun(JD, bHighPrecision); //convert to radians Latitude = AASCoordinateTransformation.DegreesToRadians(Latitude); Longitude = AASCoordinateTransformation.DegreesToRadians(Longitude); selenographicDetails.b0 = AASCoordinateTransformation.DegreesToRadians(selenographicDetails.b0); selenographicDetails.c0 = AASCoordinateTransformation.DegreesToRadians(selenographicDetails.c0); return(AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(selenographicDetails.b0) * Math.Sin(Latitude) + Math.Cos(selenographicDetails.b0) * Math.Cos(Latitude) * Math.Sin(selenographicDetails.c0 + Longitude)))); }