public static double EclipticLatitude(double JD, bool bHighPrecision) { if (bHighPrecision) { return(AASCoordinateTransformation.MapToMinus90To90Range(AASCoordinateTransformation.RadiansToDegrees(AASVSOP87D_Neptune.B(JD)))); } double rho = (JD - 2451545) / 365250; double rhosquared = rho * rho; double rhocubed = rhosquared * rho; double rho4 = rhocubed * rho; //Calculate B0 int nB0Coefficients = g_B0NeptuneCoefficients.Length; double B0 = 0; int i; for (i = 0; i < nB0Coefficients; i++) { B0 += g_B0NeptuneCoefficients[i].A * Math.Cos(g_B0NeptuneCoefficients[i].B + g_B0NeptuneCoefficients[i].C * rho); } //Calculate B1 int nB1Coefficients = g_B1NeptuneCoefficients.Length; double B1 = 0; for (i = 0; i < nB1Coefficients; i++) { B1 += g_B1NeptuneCoefficients[i].A * Math.Cos(g_B1NeptuneCoefficients[i].B + g_B1NeptuneCoefficients[i].C * rho); } //Calculate B2 int nB2Coefficients = g_B2NeptuneCoefficients.Length; double B2 = 0; for (i = 0; i < nB2Coefficients; i++) { B2 += g_B2NeptuneCoefficients[i].A * Math.Cos(g_B2NeptuneCoefficients[i].B + g_B2NeptuneCoefficients[i].C * rho); } //Calculate B3 int nB3Coefficients = g_B3NeptuneCoefficients.Length; double B3 = 0; for (i = 0; i < nB3Coefficients; i++) { B3 += g_B3NeptuneCoefficients[i].A * Math.Cos(g_B3NeptuneCoefficients[i].B + g_B3NeptuneCoefficients[i].C * rho); } //Calculate B4 int nB4Coefficients = g_B4NeptuneCoefficients.Length; double B4 = 0; for (i = 0; i < nB4Coefficients; i++) { B4 += g_B4NeptuneCoefficients[i].A * Math.Cos(g_B4NeptuneCoefficients[i].B + g_B4NeptuneCoefficients[i].C * rho); } double value = (B0 + B1 * rho + B2 * rhosquared + B3 * rhocubed + B4 * rho4) / 100000000; //convert results back to degrees value = AASCoordinateTransformation.RadiansToDegrees(value); return(value); }
public void BTest(double jd, double expectedResult) { double result = AASVSOP87D_Neptune.B(jd); Assert.Equal(expectedResult, result); }