Beispiel #1
0
        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 RTest(double jd, double expectedResult)
        {
            double result = AASVSOP87D_Earth.R(jd);

            Assert.Equal(expectedResult, result);
        }