public void BTest(double jd, double expectedResult)
        {
            double result = AASVSOP87D_Jupiter.B(jd);

            Assert.Equal(expectedResult, result);
        }
Ejemplo n.º 2
0
        public static double EclipticLatitude(double JD, bool bHighPrecision)
        {
            if (bHighPrecision)
            {
                return(AASCoordinateTransformation.MapToMinus90To90Range(AASCoordinateTransformation.RadiansToDegrees(AASVSOP87D_Jupiter.B(JD))));
            }

            double rho        = (JD - 2451545) / 365250;
            double rhosquared = rho * rho;
            double rhocubed   = rhosquared * rho;
            double rho4       = rhocubed * rho;
            double rho5       = rho4 * rho;

            //Calculate B0
            int    nB0Coefficients = g_B0JupiterCoefficients.Length;
            double B0 = 0;
            int    i;

            for (i = 0; i < nB0Coefficients; i++)
            {
                B0 += g_B0JupiterCoefficients[i].A * Math.Cos(g_B0JupiterCoefficients[i].B + g_B0JupiterCoefficients[i].C * rho);
            }

            //Calculate B1
            int    nB1Coefficients = g_B1JupiterCoefficients.Length;
            double B1 = 0;

            for (i = 0; i < nB1Coefficients; i++)
            {
                B1 += g_B1JupiterCoefficients[i].A * Math.Cos(g_B1JupiterCoefficients[i].B + g_B1JupiterCoefficients[i].C * rho);
            }

            //Calculate B2
            int    nB2Coefficients = g_B2JupiterCoefficients.Length;
            double B2 = 0;

            for (i = 0; i < nB2Coefficients; i++)
            {
                B2 += g_B2JupiterCoefficients[i].A * Math.Cos(g_B2JupiterCoefficients[i].B + g_B2JupiterCoefficients[i].C * rho);
            }

            //Calculate B3
            int    nB3Coefficients = g_B3JupiterCoefficients.Length;
            double B3 = 0;

            for (i = 0; i < nB3Coefficients; i++)
            {
                B3 += g_B3JupiterCoefficients[i].A * Math.Cos(g_B3JupiterCoefficients[i].B + g_B3JupiterCoefficients[i].C * rho);
            }

            //Calculate B4
            int    nB4Coefficients = g_B4JupiterCoefficients.Length;
            double B4 = 0;

            for (i = 0; i < nB4Coefficients; i++)
            {
                B4 += g_B4JupiterCoefficients[i].A * Math.Cos(g_B4JupiterCoefficients[i].B + g_B4JupiterCoefficients[i].C * rho);
            }

            //Calculate B5
            int    nB5Coefficients = g_B5JupiterCoefficients.Length;
            double B5 = 0;

            for (i = 0; i < nB5Coefficients; i++)
            {
                B5 += g_B5JupiterCoefficients[i].A * Math.Cos(g_B5JupiterCoefficients[i].B + g_B5JupiterCoefficients[i].C * rho);
            }

            double value = (B0 + B1 * rho + B2 * rhosquared + B3 * rhocubed + B4 * rho4 + B5 * rho5) / 100000000;

            //convert results back to degrees
            value = AASCoordinateTransformation.RadiansToDegrees(value);
            return(value);
        }