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); }
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); }