public static AAS3DCoordinate EquatorialRectangularCoordinatesB1950(double JD, bool bHighPrecision) { AAS3DCoordinate value = EclipticRectangularCoordinatesJ2000(JD, bHighPrecision); value = AASFK5.ConvertVSOPToFK5B1950(value); return(value); }
public static AAS3DCoordinate EquatorialRectangularCoordinatesAnyEquinox(double JD, double JDEquinox, bool bHighPrecision) { AAS3DCoordinate value = EquatorialRectangularCoordinatesJ2000(JD, bHighPrecision); value = AASFK5.ConvertVSOPToFK5AnyEquinox(value, JDEquinox); return(value); }
public static AAS3DCoordinate EquatorialRectangularCoordinatesJ2000(double JD) { AAS3DCoordinate value = EclipticRectangularCoordinatesJ2000(JD); value = AASFK5.ConvertVSOPToFK5J2000(value); return(value); }
public static double GeometricFK5EclipticLongitude(double JD, bool bHighPrecision) { //Convert to the FK5 stystem double Longitude = GeometricEclipticLongitude(JD, bHighPrecision); double Latitude = GeometricEclipticLatitude(JD, bHighPrecision); Longitude += AASFK5.CorrectionInLongitude(Longitude, Latitude, JD); return(Longitude); }
public static double GeometricFK5EclipticLatitude(double JD) { //Convert to the FK5 stystem double Longitude = GeometricEclipticLongitude(JD); double Latitude = GeometricEclipticLatitude(JD); double SunLatCorrection = AASFK5.CorrectionInLatitude(Longitude, JD); Latitude += SunLatCorrection; return(Latitude); }
public static AAS3DCoordinate EarthVelocity(double JD, bool bHighPrecision) { AAS3DCoordinate velocity = new AAS3DCoordinate(); if (bHighPrecision) { velocity.X = AASVSOP87A_Earth.X_DASH(JD); velocity.Y = AASVSOP87A_Earth.Y_DASH(JD); velocity.Z = AASVSOP87A_Earth.Z_DASH(JD); velocity = AASFK5.ConvertVSOPToFK5J2000(velocity); velocity.X *= 100000000; velocity.Y *= 100000000; velocity.Z *= 100000000; return(velocity); } double T = (JD - 2451545) / 36525; double L2 = 3.1761467 + 1021.3285546 * T; double L3 = 1.7534703 + 628.3075849 * T; double L4 = 6.2034809 + 334.0612431 * T; double L5 = 0.5995465 + 52.9690965 * T; double L6 = 0.8740168 + 21.3299095 * T; double L7 = 5.4812939 + 7.4781599 * T; double L8 = 5.3118863 + 3.8133036 * T; double Ldash = 3.8103444 + 8399.6847337 * T; double D = 5.1984667 + 7771.3771486 * T; double Mdash = 2.3555559 + 8328.6914289 * T; double F = 1.6279052 + 8433.4661601 * T; int nAberrationCoefficients = g_AberrationCoefficients.Length; for (int i = 0; i < nAberrationCoefficients; i++) { double Argument = g_AberrationCoefficients[i].L2 * L2 + g_AberrationCoefficients[i].L3 * L3 + g_AberrationCoefficients[i].L4 * L4 + g_AberrationCoefficients[i].L5 * L5 + g_AberrationCoefficients[i].L6 * L6 + g_AberrationCoefficients[i].L7 * L7 + g_AberrationCoefficients[i].L8 * L8 + g_AberrationCoefficients[i].Ldash * Ldash + g_AberrationCoefficients[i].D * D + g_AberrationCoefficients[i].Mdash * Mdash + g_AberrationCoefficients[i].F * F; velocity.X += (g_AberrationCoefficients[i].xsin + g_AberrationCoefficients[i].xsint * T) * Math.Sin(Argument); velocity.X += (g_AberrationCoefficients[i].xcos + g_AberrationCoefficients[i].xcost * T) * Math.Cos(Argument); velocity.Y += (g_AberrationCoefficients[i].ysin + g_AberrationCoefficients[i].ysint * T) * Math.Sin(Argument); velocity.Y += (g_AberrationCoefficients[i].ycos + g_AberrationCoefficients[i].ycost * T) * Math.Cos(Argument); velocity.Z += (g_AberrationCoefficients[i].zsin + g_AberrationCoefficients[i].zsint * T) * Math.Sin(Argument); velocity.Z += (g_AberrationCoefficients[i].zcos + g_AberrationCoefficients[i].zcost * T) * Math.Cos(Argument); } return(velocity); }
public static AASSaturnRingDetails Calculate(double JD, bool bHighPrecision) { //What will be the return value AASSaturnRingDetails details = new AASSaturnRingDetails(); double T = (JD - 2451545) / 36525; double T2 = T * T; //Step 1. Calculate the inclination of the plane of the ring and the longitude of the ascending node referred to the ecliptic and mean equinox of the date double i = 28.075216 - 0.012998 * T + 0.000004 * T2; double irad = AASCoordinateTransformation.DegreesToRadians(i); double omega = 169.508470 + 1.394681 * T + 0.000412 * T2; double omegarad = AASCoordinateTransformation.DegreesToRadians(omega); //Step 2. Calculate the heliocentric longitude, latitude and radius vector of the Earth in the FK5 system double l0 = AASEarth.EclipticLongitude(JD, bHighPrecision); double b0 = AASEarth.EclipticLatitude(JD, bHighPrecision); l0 += AASFK5.CorrectionInLongitude(l0, b0, JD); double l0rad = AASCoordinateTransformation.DegreesToRadians(l0); b0 += AASFK5.CorrectionInLatitude(l0, JD); double b0rad = AASCoordinateTransformation.DegreesToRadians(b0); double R = AASEarth.RadiusVector(JD, bHighPrecision); //Step 3. Calculate the corresponding coordinates l,b,r for Saturn but for the instance t-lightraveltime double DELTA = 9; double PreviousEarthLightTravelTime = 0; double EarthLightTravelTime = AASElliptical.DistanceToLightTime(DELTA); double JD1 = JD - EarthLightTravelTime; bool bIterate = true; double x = 0; double y = 0; double z = 0; double l = 0; double b = 0; double r = 0; while (bIterate) { //Calculate the position of Saturn l = AASSaturn.EclipticLongitude(JD1, bHighPrecision); b = AASSaturn.EclipticLatitude(JD1, bHighPrecision); l += AASFK5.CorrectionInLongitude(l, b, JD1); b += AASFK5.CorrectionInLatitude(l, JD1); double lrad = AASCoordinateTransformation.DegreesToRadians(l); double brad = AASCoordinateTransformation.DegreesToRadians(b); r = AASSaturn.RadiusVector(JD1, bHighPrecision); //Step 4 x = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad); y = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad); z = r * Math.Sin(brad) - R * Math.Sin(b0rad); DELTA = Math.Sqrt(x * x + y * y + z * z); EarthLightTravelTime = AASElliptical.DistanceToLightTime(DELTA); //Prepare for the next loop around bIterate = (Math.Abs(EarthLightTravelTime - PreviousEarthLightTravelTime) > 2e-6); //2e-6 corresponds to 0.17 of a second if (bIterate) { JD1 = JD - EarthLightTravelTime; PreviousEarthLightTravelTime = EarthLightTravelTime; } } //Step 5. Calculate Saturn's geocentric Longitude and Latitude double lambda = Math.Atan2(y, x); double beta = Math.Atan2(z, Math.Sqrt(x * x + y * y)); //Step 6. Calculate B, a and b details.B = Math.Asin(Math.Sin(irad) * Math.Cos(beta) * Math.Sin(lambda - omegarad) - Math.Cos(irad) * Math.Sin(beta)); details.a = 375.35 / DELTA; details.b = details.a * Math.Sin(Math.Abs(details.B)); details.B = AASCoordinateTransformation.RadiansToDegrees(details.B); //Step 7. Calculate the longitude of the ascending node of Saturn's orbit double N = 113.6655 + 0.8771 * T; double Nrad = AASCoordinateTransformation.DegreesToRadians(N); double ldash = l - 0.01759 / r; double ldashrad = AASCoordinateTransformation.DegreesToRadians(ldash); double bdash = b - 0.000764 * Math.Cos(ldashrad - Nrad) / r; double bdashrad = AASCoordinateTransformation.DegreesToRadians(bdash); //Step 8. Calculate Bdash details.Bdash = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(irad) * Math.Cos(bdashrad) * Math.Sin(ldashrad - omegarad) - Math.Cos(irad) * Math.Sin(bdashrad))); //Step 9. Calculate DeltaU details.U1 = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Sin(irad) * Math.Sin(bdashrad) + Math.Cos(irad) * Math.Cos(bdashrad) * Math.Sin(ldashrad - omegarad), Math.Cos(bdashrad) * Math.Cos(ldashrad - omegarad)))); details.U2 = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Sin(irad) * Math.Sin(beta) + Math.Cos(irad) * Math.Cos(beta) * Math.Sin(lambda - omegarad), Math.Cos(beta) * Math.Cos(lambda - omegarad)))); details.DeltaU = Math.Abs(details.U1 - details.U2); if (details.DeltaU > 180) { details.DeltaU = 360 - details.DeltaU; } //Step 10. Calculate the Nutations double Obliquity = AASNutation.TrueObliquityOfEcliptic(JD); double NutationInLongitude = AASNutation.NutationInLongitude(JD); //Step 11. Calculate the Ecliptical longitude and latitude of the northern pole of the ring plane double lambda0 = omega - 90; double beta0 = 90 - i; //Step 12. Correct lambda and beta for the aberration of Saturn lambda += AASCoordinateTransformation.DegreesToRadians(0.005693 * Math.Cos(l0rad - lambda) / Math.Cos(beta)); beta += AASCoordinateTransformation.DegreesToRadians(0.005693 * Math.Sin(l0rad - lambda) * Math.Sin(beta)); //Step 13. Add nutation in longitude to lambda0 and lambda lambda = AASCoordinateTransformation.RadiansToDegrees(lambda); lambda += NutationInLongitude / 3600; lambda = AASCoordinateTransformation.MapTo0To360Range(lambda); lambda0 += NutationInLongitude / 3600; lambda0 = AASCoordinateTransformation.MapTo0To360Range(lambda0); //Step 14. Convert to equatorial coordinates beta = AASCoordinateTransformation.RadiansToDegrees(beta); AAS2DCoordinate GeocentricEclipticSaturn = AASCoordinateTransformation.Ecliptic2Equatorial(lambda, beta, Obliquity); double alpha = AASCoordinateTransformation.HoursToRadians(GeocentricEclipticSaturn.X); double delta = AASCoordinateTransformation.DegreesToRadians(GeocentricEclipticSaturn.Y); AAS2DCoordinate GeocentricEclipticNorthPole = AASCoordinateTransformation.Ecliptic2Equatorial(lambda0, beta0, Obliquity); double alpha0 = AASCoordinateTransformation.HoursToRadians(GeocentricEclipticNorthPole.X); double delta0 = AASCoordinateTransformation.DegreesToRadians(GeocentricEclipticNorthPole.Y); //Step 15. Calculate the Position angle details.P = AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Cos(delta0) * Math.Sin(alpha0 - alpha), Math.Sin(delta0) * Math.Cos(delta) - Math.Cos(delta0) * Math.Sin(delta) * Math.Cos(alpha0 - alpha))); return(details); }
public static AASEllipticalPlanetaryDetails Calculate(double JD, AASEllipticalObject ellipticalObject, bool bHighPrecision) { //What will the the return value AASEllipticalPlanetaryDetails details = new AASEllipticalPlanetaryDetails(); //Calculate the position of the earth first double JD0 = JD; double L0 = AASEarth.EclipticLongitude(JD0, bHighPrecision); double B0 = AASEarth.EclipticLatitude(JD0, bHighPrecision); double R0 = AASEarth.RadiusVector(JD0, bHighPrecision); L0 = AASCoordinateTransformation.DegreesToRadians(L0); B0 = AASCoordinateTransformation.DegreesToRadians(B0); double cosB0 = Math.Cos(B0); //Iterate to find the positions adjusting for light-time correction if required double L = 0; double B = 0; double R = 0; if (ellipticalObject != AASEllipticalObject.SUN) { bool bRecalc = true; bool bFirstRecalc = true; double LPrevious = 0; double BPrevious = 0; double RPrevious = 0; while (bRecalc) { switch (ellipticalObject) { case AASEllipticalObject.SUN: L = AASSun.GeometricEclipticLongitude(JD0, bHighPrecision); B = AASSun.GeometricEclipticLatitude(JD0, bHighPrecision); R = AASEarth.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.MERCURY: L = AASMercury.EclipticLongitude(JD0, bHighPrecision); B = AASMercury.EclipticLatitude(JD0, bHighPrecision); R = AASMercury.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.VENUS: L = AASVenus.EclipticLongitude(JD0, bHighPrecision); B = AASVenus.EclipticLatitude(JD0, bHighPrecision); R = AASVenus.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.MARS: L = AASMars.EclipticLongitude(JD0, bHighPrecision); B = AASMars.EclipticLatitude(JD0, bHighPrecision); R = AASMars.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.JUPITER: L = AASJupiter.EclipticLongitude(JD0, bHighPrecision); B = AASJupiter.EclipticLatitude(JD0, bHighPrecision); R = AASJupiter.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.SATURN: L = AASSaturn.EclipticLongitude(JD0, bHighPrecision); B = AASSaturn.EclipticLatitude(JD0, bHighPrecision); R = AASSaturn.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.URANUS: L = AASUranus.EclipticLongitude(JD0, bHighPrecision); B = AASUranus.EclipticLatitude(JD0, bHighPrecision); R = AASUranus.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.NEPTUNE: L = AASNeptune.EclipticLongitude(JD0, bHighPrecision); B = AASNeptune.EclipticLatitude(JD0, bHighPrecision); R = AASNeptune.RadiusVector(JD0, bHighPrecision); break; case AASEllipticalObject.PLUTO: L = AASPluto.EclipticLongitude(JD0); B = AASPluto.EclipticLatitude(JD0); R = AASPluto.RadiusVector(JD0); break; default: break; } if (!bFirstRecalc) { bRecalc = ((Math.Abs(L - LPrevious) > 0.00001) || (Math.Abs(B - BPrevious) > 0.00001) || (Math.Abs(R - RPrevious) > 0.000001)); LPrevious = L; BPrevious = B; RPrevious = R; } else { bFirstRecalc = false; } //Calculate the new value if (bRecalc) { double Lrad = AASCoordinateTransformation.DegreesToRadians(L); double Brad = AASCoordinateTransformation.DegreesToRadians(B); double cosB = Math.Cos(Brad); double cosL = Math.Cos(Lrad); double x1 = R * cosB * cosL - R0 * cosB0 * Math.Cos(L0); double y1 = R * cosB * Math.Sin(Lrad) - R0 * cosB0 * Math.Sin(L0); double z1 = R * Math.Sin(Brad) - R0 * Math.Sin(B0); double distance = Math.Sqrt(x1 * x1 + y1 * y1 + z1 * z1); //Prepare for the next loop around JD0 = JD - AASElliptical.DistanceToLightTime(distance); } } } double x = 0; double y = 0; double z = 0; if (ellipticalObject != AASEllipticalObject.SUN) { double Lrad = AASCoordinateTransformation.DegreesToRadians(L); double Brad = AASCoordinateTransformation.DegreesToRadians(B); double cosB = Math.Cos(Brad); double cosL = Math.Cos(Lrad); x = R * cosB * cosL - R0 * cosB0 * Math.Cos(L0); y = R * cosB * Math.Sin(Lrad) - R0 * cosB0 * Math.Sin(L0); z = R * Math.Sin(Brad) - R0 * Math.Sin(B0); } else { x = -R0 *cosB0 *Math.Cos(L0); y = -R0 *cosB0 *Math.Sin(L0); z = -R0 *Math.Sin(B0); } double x2 = x * x; double y2 = y * y; details.ApparentGeocentricLatitude = AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(z, Math.Sqrt(x2 + y2))); details.ApparentGeocentricDistance = Math.Sqrt(x2 + y2 + z * z); details.ApparentGeocentricLongitude = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(y, x))); details.ApparentLightTime = AASElliptical.DistanceToLightTime(details.ApparentGeocentricDistance); //Adjust for Aberration AAS2DCoordinate Aberration = AASAberration.EclipticAberration(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, JD, bHighPrecision); details.ApparentGeocentricLongitude += Aberration.X; details.ApparentGeocentricLatitude += Aberration.Y; //convert to the FK5 system double DeltaLong = AASFK5.CorrectionInLongitude(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, JD); details.ApparentGeocentricLatitude += AASFK5.CorrectionInLatitude(details.ApparentGeocentricLongitude, JD); details.ApparentGeocentricLongitude += DeltaLong; //Correct for nutation double NutationInLongitude = AASNutation.NutationInLongitude(JD); double Epsilon = AASNutation.TrueObliquityOfEcliptic(JD); details.ApparentGeocentricLongitude += AASCoordinateTransformation.DMSToDegrees(0, 0, NutationInLongitude); //Convert to RA and Dec AAS2DCoordinate ApparentEqu = AASCoordinateTransformation.Ecliptic2Equatorial(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, Epsilon); details.ApparentGeocentricRA = ApparentEqu.X; details.ApparentGeocentricDeclination = ApparentEqu.Y; return(details); }