public static double RadiusVector(double JD, bool bHighPrecision) { if (bHighPrecision) { return(AASVSOP87D_Earth.R(JD)); } double rho = (JD - 2451545) / 365250; double rhosquared = rho * rho; double rhocubed = rhosquared * rho; double rho4 = rhocubed * rho; //Calculate R0 int nR0Coefficients = g_R0EarthCoefficients.Length; double R0 = 0; int i; for (i = 0; i < nR0Coefficients; i++) { R0 += g_R0EarthCoefficients[i].A * Math.Cos(g_R0EarthCoefficients[i].B + g_R0EarthCoefficients[i].C * rho); } //Calculate R1 int nR1Coefficients = g_R1EarthCoefficients.Length; double R1 = 0; for (i = 0; i < nR1Coefficients; i++) { R1 += g_R1EarthCoefficients[i].A * Math.Cos(g_R1EarthCoefficients[i].B + g_R1EarthCoefficients[i].C * rho); } //Calculate R2 int nR2Coefficients = g_R2EarthCoefficients.Length; double R2 = 0; for (i = 0; i < nR2Coefficients; i++) { R2 += g_R2EarthCoefficients[i].A * Math.Cos(g_R2EarthCoefficients[i].B + g_R2EarthCoefficients[i].C * rho); } //Calculate R3 int nR3Coefficients = g_R3EarthCoefficients.Length; double R3 = 0; for (i = 0; i < nR3Coefficients; i++) { R3 += g_R3EarthCoefficients[i].A * Math.Cos(g_R3EarthCoefficients[i].B + g_R3EarthCoefficients[i].C * rho); } //Calculate R4 int nR4Coefficients = g_R4EarthCoefficients.Length; double R4 = 0; for (i = 0; i < nR4Coefficients; i++) { R4 += g_R4EarthCoefficients[i].A * Math.Cos(g_R4EarthCoefficients[i].B + g_R4EarthCoefficients[i].C * rho); } return((R0 + R1 * rho + R2 * rhosquared + R3 * rhocubed + R4 * rho4) / 100000000); }
public void BTest(double jd, double expectedResult) { double result = AASVSOP87D_Earth.B(jd); Assert.Equal(expectedResult, result); }
public void RDashTest(double jd, double expectedResult) { double result = AASVSOP87D_Earth.R_DASH(jd); Assert.Equal(expectedResult, result); }
public static double EclipticLatitude(double JD, bool bHighPrecision) { if (bHighPrecision) { return(AASCoordinateTransformation.MapToMinus90To90Range(AASCoordinateTransformation.RadiansToDegrees(AASVSOP87D_Earth.B(JD)))); } double rho = (JD - 2451545) / 365250; //Calculate B0 int nB0Coefficients = g_B0EarthCoefficients.Length; double B0 = 0; int i; for (i = 0; i < nB0Coefficients; i++) { B0 += g_B0EarthCoefficients[i].A * Math.Cos(g_B0EarthCoefficients[i].B + g_B0EarthCoefficients[i].C * rho); } //Calculate B1 int nB1Coefficients = g_B1EarthCoefficients.Length; double B1 = 0; for (i = 0; i < nB1Coefficients; i++) { B1 += g_B1EarthCoefficients[i].A * Math.Cos(g_B1EarthCoefficients[i].B + g_B1EarthCoefficients[i].C * rho); } //Note for Earth there are no B2, B3 or B4 coefficients to calculate double value = (B0 + B1 * rho) / 100000000; //convert results back to degrees value = AASCoordinateTransformation.RadiansToDegrees(value); return(value); }
public static double EclipticLongitude(double JD, bool bHighPrecision) { if (bHighPrecision) { return(AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(AASVSOP87D_Earth.L(JD)))); } double rho = (JD - 2451545) / 365250; double rhosquared = rho * rho; double rhocubed = rhosquared * rho; double rho4 = rhocubed * rho; double rho5 = rho4 * rho; //Calculate L0 int nL0Coefficients = g_L0EarthCoefficients.Length; double L0 = 0; int i; for (i = 0; i < nL0Coefficients; i++) { L0 += g_L0EarthCoefficients[i].A * Math.Cos(g_L0EarthCoefficients[i].B + g_L0EarthCoefficients[i].C * rho); } //Calculate L1 int nL1Coefficients = g_L1EarthCoefficients.Length; double L1 = 0; for (i = 0; i < nL1Coefficients; i++) { L1 += g_L1EarthCoefficients[i].A * Math.Cos(g_L1EarthCoefficients[i].B + g_L1EarthCoefficients[i].C * rho); } //Calculate L2 int nL2Coefficients = g_L2EarthCoefficients.Length; double L2 = 0; for (i = 0; i < nL2Coefficients; i++) { L2 += g_L2EarthCoefficients[i].A * Math.Cos(g_L2EarthCoefficients[i].B + g_L2EarthCoefficients[i].C * rho); } //Calculate L3 int nL3Coefficients = g_L3EarthCoefficients.Length; double L3 = 0; for (i = 0; i < nL3Coefficients; i++) { L3 += g_L3EarthCoefficients[i].A * Math.Cos(g_L3EarthCoefficients[i].B + g_L3EarthCoefficients[i].C * rho); } //Calculate L4 int nL4Coefficients = g_L4EarthCoefficients.Length; double L4 = 0; for (i = 0; i < nL4Coefficients; i++) { L4 += g_L4EarthCoefficients[i].A * Math.Cos(g_L4EarthCoefficients[i].B + g_L4EarthCoefficients[i].C * rho); } //Calculate L5 int nL5Coefficients = g_L5EarthCoefficients.Length; double L5 = 0; for (i = 0; i < nL5Coefficients; i++) { L5 += g_L5EarthCoefficients[i].A * Math.Cos(g_L5EarthCoefficients[i].B + g_L5EarthCoefficients[i].C * rho); } double value = (L0 + L1 * rho + L2 * rhosquared + L3 * rhocubed + L4 * rho4 + L5 * rho5) / 100000000; //convert results back to degrees value = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(value)); return(value); }