public static CAASelenographicMoonDetails CalculateSelenographicPositionOfSun(double JD) { double R = CAAEarth.RadiusVector(JD) * 149597970; double Delta = CAAMoon.RadiusVector(JD); double lambda0 = CAASun.ApparentEclipticLongitude(JD); double lambda = CAAMoon.EclipticLongitude(JD); double beta = CAAMoon.EclipticLatitude(JD); double lambdah = CAACoordinateTransformation.MapTo0To360Range(lambda0 + 180 + Delta / R * 57.296 * Math.Cos(CAACoordinateTransformation.DegreesToRadians(beta)) * Math.Sin(CAACoordinateTransformation.DegreesToRadians(lambda0 - lambda))); double betah = Delta / R * beta; //What will be the return value CAASelenographicMoonDetails details = new CAASelenographicMoonDetails(); //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 = CAACoordinateTransformation.MapTo0To360Range(450 - details.l0); return(details); }
public static CAAPhysicalMoonDetails CalculateTopocentric(double JD, double Longitude, double Latitude) { //First convert to radians Longitude = CAACoordinateTransformation.DegreesToRadians(Longitude); Latitude = CAACoordinateTransformation.DegreesToRadians(Latitude); double Lambda = 0; double Beta = 0; double epsilon = 0; CAA2DCoordinate Equatorial = new CAA2DCoordinate(); CAAPhysicalMoonDetails details = CalculateHelper(JD, ref Lambda, ref Beta, ref epsilon, ref Equatorial); double R = CAAMoon.RadiusVector(JD); double pi = CAAMoon.RadiusVectorToHorizontalParallax(R); double Alpha = CAACoordinateTransformation.HoursToRadians(Equatorial.X); double Delta = CAACoordinateTransformation.DegreesToRadians(Equatorial.Y); double AST = CAASidereal.ApparentGreenwichSiderealTime(JD); double H = CAACoordinateTransformation.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 = CAACoordinateTransformation.DegreesToRadians(details.P); double DeltaL = -pidash *Math.Sin(Q - Prad) / Math.Cos(CAACoordinateTransformation.DegreesToRadians(details.b)); details.l += DeltaL; double DeltaB = pidash * Math.Cos(Q - Prad); details.b += DeltaB; details.P += DeltaL * Math.Sin(CAACoordinateTransformation.DegreesToRadians(details.b)) - pidash * Math.Sin(Q) * Math.Tan(Delta); return(details); }
public static AstroRaDec GetPlanet(double jDate, EO planetIn, double locLat, double locLong, double locHeight) { int planet = (int)planetIn; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static CAAGalileanMoonsDetails galDetails; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static CAAEllipticalPlanetaryDetails jupDetails; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static CAAPhysicalJupiterDetails jupPhisical; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static double jDateLast = 0; locLong = -locLong; if (planet < 9) { EPD Details = ELL.Calculate(jDate, planetIn); COR corrected = CAAParallax.Equatorial2Topocentric(Details.ApparentGeocentricRA, Details.ApparentGeocentricDeclination, Details.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate); return(new AstroRaDec(corrected.X, corrected.Y, Details.ApparentGeocentricDistance, false, false)); } else if (planet == 9) { double lat = CAAMoon.EclipticLatitude(jDate); double lng = CAAMoon.EclipticLongitude(jDate); double dis = CAAMoon.RadiusVector(jDate) / 149598000; double epsilon = CAANutation.TrueObliquityOfEcliptic(jDate); COR d = CT.Ec2Eq(lng, lat, epsilon); COR corrected = CAAParallax.Equatorial2Topocentric(d.X, d.Y, dis, locLong, locLat, locHeight, jDate); return(new AstroRaDec(corrected.X, corrected.Y, dis, false, false)); } else { if (jDate != jDateLast) { jupDetails = ELL.Calculate(jDate, (EO)4); jupPhisical = CAAPhysicalJupiter.Calculate(jDate); COR corrected = CAAParallax.Equatorial2Topocentric(jupDetails.ApparentGeocentricRA, jupDetails.ApparentGeocentricDeclination, jupDetails.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate); jupDetails.ApparentGeocentricRA = corrected.X; jupDetails.ApparentGeocentricDeclination = corrected.Y; galDetails = GM.Calculate(jDate); jDateLast = jDate; } double jupiterDiameter = 0.000954501; double scale = (Math.Atan(.5 * (jupiterDiameter / jupDetails.ApparentGeocentricDistance))) / 3.1415927 * 180; double raScale = (scale / Math.Cos(jupDetails.ApparentGeocentricDeclination / 180.0 * 3.1415927)) / 15; double xMoon = 0; double yMoon = 0; double zMoon = 0; bool shadow = false; bool eclipsed = false; switch (planet) { case 10: // IO xMoon = galDetails.Satellite1.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite1.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite1.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite1.bInEclipse; shadow = galDetails.Satellite1.bInShadowTransit; break; case 11: //Europa xMoon = galDetails.Satellite2.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite2.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite2.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite2.bInEclipse; shadow = galDetails.Satellite2.bInShadowTransit; break; case 12: //Ganymede xMoon = galDetails.Satellite3.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite3.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite3.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite3.bInEclipse; shadow = galDetails.Satellite3.bInShadowTransit; break; case 13: //Callisto xMoon = galDetails.Satellite4.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite4.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite4.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite4.bInEclipse; shadow = galDetails.Satellite4.bInShadowTransit; break; case 14: // IO Shadow xMoon = galDetails.Satellite1.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite1.bInShadowTransit; break; case 15: //Europa Shadow xMoon = galDetails.Satellite2.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite2.bInShadowTransit; break; case 16: //Ganymede Shadow xMoon = galDetails.Satellite3.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite3.bInShadowTransit; break; case 17: //Callisto Shadow xMoon = galDetails.Satellite4.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite4.bInShadowTransit; break; } double xTemp; double yTemp; double radians = jupPhisical.P / 180.0 * 3.1415927; xTemp = xMoon * Math.Cos(radians) - yMoon * Math.Sin(radians); yTemp = xMoon * Math.Sin(radians) + yMoon * Math.Cos(radians); xMoon = xTemp; yMoon = yTemp; return(new AstroRaDec(jupDetails.ApparentGeocentricRA - (xMoon * raScale), jupDetails.ApparentGeocentricDeclination + yMoon * scale, jupDetails.ApparentGeocentricDistance + (zMoon * jupiterDiameter / 2), shadow, eclipsed)); } }