public static double EclipticLongitude(double JD, bool bHighPrecision) { if (bHighPrecision) { return(AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(AASVSOP87D_Neptune.L(JD)))); } double rho = (JD - 2451545) / 365250; double rhosquared = rho * rho; double rhocubed = rhosquared * rho; double rho4 = rhocubed * rho; //Calculate L0 int nL0Coefficients = g_L0NeptuneCoefficients.Length; double L0 = 0; int i; for (i = 0; i < nL0Coefficients; i++) { L0 += g_L0NeptuneCoefficients[i].A * Math.Cos(g_L0NeptuneCoefficients[i].B + g_L0NeptuneCoefficients[i].C * rho); } //Calculate L1 int nL1Coefficients = g_L1NeptuneCoefficients.Length; double L1 = 0; for (i = 0; i < nL1Coefficients; i++) { L1 += g_L1NeptuneCoefficients[i].A * Math.Cos(g_L1NeptuneCoefficients[i].B + g_L1NeptuneCoefficients[i].C * rho); } //Calculate L2 int nL2Coefficients = g_L2NeptuneCoefficients.Length; double L2 = 0; for (i = 0; i < nL2Coefficients; i++) { L2 += g_L2NeptuneCoefficients[i].A * Math.Cos(g_L2NeptuneCoefficients[i].B + g_L2NeptuneCoefficients[i].C * rho); } //Calculate L3 int nL3Coefficients = g_L3NeptuneCoefficients.Length; double L3 = 0; for (i = 0; i < nL3Coefficients; i++) { L3 += g_L3NeptuneCoefficients[i].A * Math.Cos(g_L3NeptuneCoefficients[i].B + g_L3NeptuneCoefficients[i].C * rho); } //Calculate L4 int nL4Coefficients = g_L4NeptuneCoefficients.Length; double L4 = 0; for (i = 0; i < nL4Coefficients; i++) { L4 += g_L4NeptuneCoefficients[i].A * Math.Cos(g_L4NeptuneCoefficients[i].B + g_L4NeptuneCoefficients[i].C * rho); } double value = (L0 + L1 * rho + L2 * rhosquared + L3 * rhocubed + L4 * rho4) / 100000000; //convert results back to degrees value = AASCoordinateTransformation.MapTo0To360Range(AASCoordinateTransformation.RadiansToDegrees(value)); return(value); }
public void LTest(double jd, double expectedResult) { double result = AASVSOP87D_Neptune.L(jd); Assert.Equal(expectedResult, result); }