public static double MeanObliquityOfEcliptic(double JD) { double U = (JD - 2451545) / 3652500; double Usquared = U * U; double Ucubed = Usquared * U; double U4 = Ucubed * U; double U5 = U4 * U; double U6 = U5 * U; double U7 = U6 * U; double U8 = U7 * U; double U9 = U8 * U; double U10 = U9 * U; return(AASCoordinateTransformation.DMSToDegrees(23, 26, 21.448) - AASCoordinateTransformation.DMSToDegrees(0, 0, 4680.93) * U - AASCoordinateTransformation.DMSToDegrees(0, 0, 1.55) * Usquared + AASCoordinateTransformation.DMSToDegrees(0, 0, 1999.25) * Ucubed - AASCoordinateTransformation.DMSToDegrees(0, 0, 51.38) * U4 - AASCoordinateTransformation.DMSToDegrees(0, 0, 249.67) * U5 - AASCoordinateTransformation.DMSToDegrees(0, 0, 39.05) * U6 + AASCoordinateTransformation.DMSToDegrees(0, 0, 7.12) * U7 + AASCoordinateTransformation.DMSToDegrees(0, 0, 27.87) * U8 + AASCoordinateTransformation.DMSToDegrees(0, 0, 5.79) * U9 + AASCoordinateTransformation.DMSToDegrees(0, 0, 2.45) * U10); }
public static AAS2DCoordinate PrecessEquatorialFK4(double Alpha, double Delta, double JD0, double JD) { double T = (JD0 - 2415020.3135) / 36524.2199; double t = (JD - JD0) / 36524.2199; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians Alpha = AASCoordinateTransformation.HoursToRadians(Alpha); Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double sigma = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2304.250 + 1.396 * T) * t + 0.302 * tsquared + 0.018 * tcubed)); double zeta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, 0.791 * tsquared + 0.001 * tcubed)) + sigma; double phi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2004.682 - 0.853 * T) * t - 0.426 * tsquared - 0.042 * tcubed)); double A = Math.Cos(Delta) * Math.Sin(Alpha + sigma); double B = Math.Cos(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) - Math.Sin(phi) * Math.Sin(Delta); double C = Math.Sin(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) + Math.Cos(phi) * Math.Sin(Delta); double DeltaAlpha = AASCoordinateTransformation.DMSToDegrees(0, 0, 0.0775 + 0.0850 * T); AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To24Range(AASCoordinateTransformation.RadiansToHours(Math.Atan2(A, B) + zeta) + DeltaAlpha); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(C)); return(value); }
public static AASPhysicalSunDetails Calculate(double JD) { double theta = AASCoordinateTransformation.MapTo0To360Range((JD - 2398220) * 360 / 25.38); double I = 7.25; double K = 73.6667 + 1.3958333 * (JD - 2396758) / 36525; //Calculate the apparent longitude of the sun (excluding the effect of nutation) double L = AASEarth.EclipticLongitude(JD); double R = AASEarth.RadiusVector(JD); double SunLong = L + 180 - AASCoordinateTransformation.DMSToDegrees(0, 0, 20.4898 / R); double epsilon = AASNutation.TrueObliquityOfEcliptic(JD); //Convert to radians epsilon = AASCoordinateTransformation.DegreesToRadians(epsilon); SunLong = AASCoordinateTransformation.DegreesToRadians(SunLong); K = AASCoordinateTransformation.DegreesToRadians(K); I = AASCoordinateTransformation.DegreesToRadians(I); theta = AASCoordinateTransformation.DegreesToRadians(theta); double x = Math.Atan(-Math.Cos(SunLong) * Math.Tan(epsilon)); double y = Math.Atan(-Math.Cos(SunLong - K) * Math.Tan(I)); AASPhysicalSunDetails details = new AASPhysicalSunDetails(); details.P = AASCoordinateTransformation.RadiansToDegrees(x + y); details.B0 = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(SunLong - K) * Math.Sin(I))); double eta = Math.Atan(Math.Tan(SunLong - K) * Math.Cos(I)); details.L0 = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(eta - theta)); return(details); }
public static AAS2DCoordinate PrecessEcliptic(double Lambda, double Beta, double JD0, double JD) { double T = (JD0 - 2451545.0) / 36525; double Tsquared = T * T; double t = (JD - JD0) / 36525; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians Lambda = AASCoordinateTransformation.DegreesToRadians(Lambda); Beta = AASCoordinateTransformation.DegreesToRadians(Beta); double eta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (47.0029 - 0.06603 * T + 0.000598 * Tsquared) * t + (-0.03302 + 0.000598 * T) * tsquared + 0.00006 * tcubed)); double pi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, 174.876384 * 3600 + 3289.4789 * T + 0.60622 * Tsquared - (869.8089 + 0.50491 * T) * t + 0.03536 * tsquared)); double p = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (5029.0966 + 2.22226 * T - 0.000042 * Tsquared) * t + (1.11113 - 0.000042 * T) * tsquared - 0.000006 * tcubed)); double A = Math.Cos(eta) * Math.Cos(Beta) * Math.Sin(pi - Lambda) - Math.Sin(eta) * Math.Sin(Beta); double B = Math.Cos(Beta) * Math.Cos(pi - Lambda); double C = Math.Cos(eta) * Math.Sin(Beta) + Math.Sin(eta) * Math.Cos(Beta) * Math.Sin(pi - Lambda); AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(p + pi - Math.Atan2(A, B))); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(C)); return(value); }
public static AAS2DCoordinate PrecessEquatorial(double Alpha, double Delta, double JD0, double JD) { double T = (JD0 - 2451545.0) / 36525; double Tsquared = T * T; double t = (JD - JD0) / 36525; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians Alpha = AASCoordinateTransformation.HoursToRadians(Alpha); Delta = AASCoordinateTransformation.DegreesToRadians(Delta); double sigma = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2306.2181 + 1.39656 * T - 0.000139 * Tsquared) * t + (0.30188 - 0.000344 * T) * tsquared + 0.017998 * tcubed)); double zeta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2306.2181 + 1.39656 * T - 0.000139 * Tsquared) * t + (1.09468 + 0.000066 * T) * tsquared + 0.018203 * tcubed)); double phi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, (2004.3109 - 0.8533 * T - 0.000217 * Tsquared) * t - (0.42665 + 0.000217 * T) * tsquared - 0.041833 * tcubed)); double A = Math.Cos(Delta) * Math.Sin(Alpha + sigma); double B = Math.Cos(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) - Math.Sin(phi) * Math.Sin(Delta); double C = Math.Sin(phi) * Math.Cos(Delta) * Math.Cos(Alpha + sigma) + Math.Cos(phi) * Math.Sin(Delta); AAS2DCoordinate value = new AAS2DCoordinate(); value.X = AASCoordinateTransformation.MapTo0To24Range(AASCoordinateTransformation.RadiansToHours(Math.Atan2(A, B) + zeta)); value.Y = AASCoordinateTransformation.RadiansToDegrees(Math.Asin(C)); return(value); }
public static double Calculate(double JD) { double rho = (JD - 2451545) / 365250; double rhosquared = rho * rho; double rhocubed = rhosquared * rho; double rho4 = rhocubed * rho; double rho5 = rho4 * rho; //Calculate the Suns mean longitude double L0 = AASCoordinateTransformation.MapTo0To360Range(280.4664567 + 360007.6982779 * rho + 0.03032028 * rhosquared + rhocubed / 49931 - rho4 / 15300 - rho5 / 2000000); //Calculate the Suns apparent right ascension double SunLong = AASSun.ApparentEclipticLongitude(JD); double SunLat = AASSun.ApparentEclipticLatitude(JD); double epsilon = AASNutation.TrueObliquityOfEcliptic(JD); AAS2DCoordinate Equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, epsilon); epsilon = AASCoordinateTransformation.DegreesToRadians(epsilon); double E = L0 - 0.0057183 - Equatorial.X * 15 + AASCoordinateTransformation.DMSToDegrees(0, 0, AASNutation.NutationInLongitude(JD)) * Math.Cos(epsilon); if (E > 180) { E = -(360 - E); } E *= 4; //Convert to minutes of time return(E); }
public static AASEclipticalElementDetails Calculate(double i0, double w0, double omega0, double JD0, double JD) { double T = (JD0 - 2451545.0) / 36525; double Tsquared = T * T; double t = (JD - JD0) / 36525; double tsquared = t * t; double tcubed = tsquared * t; //Now convert to radians double i0rad = AASCoordinateTransformation.DegreesToRadians(i0); double omega0rad = AASCoordinateTransformation.DegreesToRadians(omega0); double eta = (47.0029 - 0.06603 * T + 0.000598 * Tsquared) * t + (-0.03302 + 0.000598 * T) * tsquared + 0.00006 * tcubed; eta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, eta)); double pi = 174.876384 * 3600 + 3289.4789 * T + 0.60622 * Tsquared - (869.8089 + 0.50491 * T) * t + 0.03536 * tsquared; pi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, pi)); double p = (5029.0966 + 2.22226 * T - 0.000042 * Tsquared) * t + (1.11113 - 0.000042 * T) * tsquared - 0.000006 * tcubed; p = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, p)); double sini0rad = Math.Sin(i0rad); double cosi0rad = Math.Cos(i0rad); double sinomega0rad_pi = Math.Sin(omega0rad - pi); double cosomega0rad_pi = Math.Cos(omega0rad - pi); double sineta = Math.Sin(eta); double coseta = Math.Cos(eta); double A = sini0rad * sinomega0rad_pi; double B = -sineta * cosi0rad + coseta * sini0rad * cosomega0rad_pi; double irad = Math.Asin(Math.Sqrt(A * A + B * B)); AASEclipticalElementDetails details = new AASEclipticalElementDetails(); details.i = AASCoordinateTransformation.RadiansToDegrees(irad); double cosi = cosi0rad * coseta + sini0rad * sineta * cosomega0rad_pi; if (cosi < 0) { details.i = 180 - details.i; } double phi = pi + p; details.omega = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(A, B) + phi)); A = -sineta * sinomega0rad_pi; B = sini0rad * coseta - cosi0rad * sineta * cosomega0rad_pi; double deltaw = AASCoordinateTransformation.RadiansToDegrees(Math.Atan2(A, B)); details.w = AASCoordinateTransformation.MapTo0To360Range(w0 + deltaw); return(details); }
public static double CorrectionInLatitude(double Longitude, double JD) { double T = (JD - 2451545) / 36525; double Ldash = Longitude - 1.397 * T - 0.00031 * T * T; //Convert to radians Ldash = AASCoordinateTransformation.DegreesToRadians(Ldash); double value = 0.03916 * (Math.Cos(Ldash) - Math.Sin(Ldash)); return(AASCoordinateTransformation.DMSToDegrees(0, 0, value)); }
public static double ApparentEclipticLongitude(double JD) { double Longitude = GeometricFK5EclipticLongitude(JD); //Apply the correction in longitude due to nutation Longitude += AASCoordinateTransformation.DMSToDegrees(0, 0, AASNutation.NutationInLongitude(JD)); //Apply the correction in longitude due to aberration double R = AASEarth.RadiusVector(JD); Longitude -= AASCoordinateTransformation.DMSToDegrees(0, 0, 20.4898 / R); return(Longitude); }
public static AAS3DCoordinate ConvertVSOPToFK5AnyEquinox(AAS3DCoordinate value, double JDEquinox) { double t = (JDEquinox - 2451545.0) / 36525; double tsquared = t * t; double tcubed = tsquared * t; double sigma = 2306.2181 * t + 0.30188 * tsquared + 0.017988 * tcubed; sigma = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, sigma)); double zeta = 2306.2181 * t + 1.09468 * tsquared + 0.018203 * tcubed; zeta = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, zeta)); double phi = 2004.3109 * t - 0.42665 * tsquared - 0.041833 * tcubed; phi = AASCoordinateTransformation.DegreesToRadians(AASCoordinateTransformation.DMSToDegrees(0, 0, phi)); double cossigma = Math.Cos(sigma); double coszeta = Math.Cos(zeta); double cosphi = Math.Cos(phi); double sinsigma = Math.Sin(sigma); double sinzeta = Math.Sin(zeta); double sinphi = Math.Sin(phi); double xx = cossigma * coszeta * cosphi - sinsigma * sinzeta; double xy = sinsigma * coszeta + cossigma * sinzeta * cosphi; double xz = cossigma * sinphi; double yx = -cossigma * sinzeta - sinsigma * coszeta * cosphi; double yy = cossigma * coszeta - sinsigma * sinzeta * cosphi; double yz = -sinsigma * sinphi; double zx = -coszeta * sinphi; double zy = -sinzeta * sinphi; double zz = cosphi; AAS3DCoordinate result = new AAS3DCoordinate() { X = xx * value.X + yx * value.Y + zx * value.Z, Y = xy * value.X + yy * value.Y + zy * value.Z, Z = xz * value.X + yz * value.Y + zz * value.Z }; return(result); }
public static double ApparentEclipticLongitude(double JD, bool bHighPrecision) { double Longitude = GeometricFK5EclipticLongitude(JD, bHighPrecision); //Apply the correction in longitude due to nutation Longitude += AASCoordinateTransformation.DMSToDegrees(0, 0, AASNutation.NutationInLongitude(JD)); //Apply the correction in longitude due to aberration double R = AASEarth.RadiusVector(JD, bHighPrecision); if (bHighPrecision) { Longitude -= (0.005775518 * R * AASCoordinateTransformation.DMSToDegrees(0, 0, VariationGeometricEclipticLongitude(JD))); } else { Longitude -= AASCoordinateTransformation.DMSToDegrees(0, 0, 20.4898 / R); } return(Longitude); }
public static double TrueObliquityOfEcliptic(double JD) { return(MeanObliquityOfEcliptic(JD) + AASCoordinateTransformation.DMSToDegrees(0, 0, NutationInObliquity(JD))); }
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); }