示例#1
0
        /// <summary>
        /// Get Position of Venus and Mars
        /// </summary>
        /// <param name="planetNo"></param>
        /// <param name="T"></param>
        /// <returns></returns>
        private static Xyz GetPosExp1(int planetNo, double T)
        {
            PlanetExpP0[] ParamL0, ParamL1, ParamQ;
            PlanetExpP1   ParamP;

            switch (planetNo)
            {
            case Planet.VENUS:
                ParamL0 = VenusL0;
                ParamL1 = VenusL1;
                ParamQ  = VenusQ;
                ParamP  = VenusP;
                break;

            case Planet.MARS:
                ParamL0 = MarsL0;
                ParamL1 = MarsL1;
                ParamQ  = MarsQ;
                ParamP  = MarsP;
                break;

            default:
                throw new ArithmeticException();
            }

            double L1 = (ParamP.L6 + ParamP.L7 * T) * UdMath.udsin(ParamP.L8 + ParamP.L9 * T);

            for (int i = 0; i < ParamL1.GetLength(0); i++)
            {
                L1 += ParamL1[i].a * UdMath.udsin(ParamL1[i].b + ParamL1[i].c * T);
            }

            double L0 = ParamP.L1 + ParamP.L2 * T + ParamP.L3 * UdMath.udsin(ParamP.L4 + ParamP.L5 * T + 2.0 * L1);

            for (int i = 0; i < ParamL0.GetLength(0); i++)
            {
                L0 += ParamL0[i].a * UdMath.udsin(ParamL0[i].b + ParamL0[i].c * T);
            }

            double lambda = UdMath.deg2rad(UdMath.degmal(L0 + L1));
            double beta   = Math.Asin(ParamP.B1 * UdMath.udsin(ParamP.B2 + ParamP.B3 * T + L1));
            double q      = (ParamP.q1 + ParamP.q2 * T) * UdMath.udcos(ParamP.q3 + ParamP.q4 * T) + ParamP.q5;

            for (int i = 0; i < ParamQ.GetLength(0); i++)
            {
                q += ParamQ[i].a * UdMath.udcos(ParamQ[i].b + ParamQ[i].c * T);
            }

            double radius = Math.Pow(10.0, q);

            return(new Xyz(radius * Math.Cos(beta) * Math.Cos(lambda),
                           radius * Math.Cos(beta) * Math.Sin(lambda),
                           radius * Math.Sin(beta)));
        }
示例#2
0
        /// <summary>
        /// Get Position of Jupiter and Saturn
        /// </summary>
        /// <param name="planetNo"></param>
        /// <param name="T"></param>
        /// <returns></returns>
        private static Xyz GetPosExp2(int planetNo, double T)
        {
            PlanetExpP0[] ParamN, ParamB, ParamQ;
            PlanetExpP2   ParamP;
            double        q, N;

            switch (planetNo)
            {
            case Planet.JUPITER:
                ParamN = JupiterN;
                ParamB = JupiterB;
                ParamQ = JupiterQ;
                ParamP = JupiterP;
                N      = 341.5208 + 30.34907 * T;
                N     += (0.0350 + 0.00028 * T) * UdMath.udsin(245.94 - 30.349 * T) + 0.0004;
                N     -= (0.0019 + 0.00002 * T) * UdMath.udsin(162.78 + 0.38 * T);
                q      = (0.000132 + 0.0000011 * T) * UdMath.udcos(245.93 - 30.349 * T);
                break;

            case Planet.SATURN:
                ParamN = SaturnN;
                ParamB = SaturnB;
                ParamQ = SaturnQ;
                ParamP = SaturnP;
                N      = 12.3042 + 12.22117 * T;
                N     += (0.0934 + 0.00075 * T) * UdMath.udsin(250.29 + 12.221 * T) + 0.0008;
                N     += (0.0057 + 0.00005 * T) * UdMath.udsin(265.8 - 11.81 * T);
                N     += (0.0049 + 0.00004 * T) * UdMath.udsin(162.7 + 0.38 * T);
                N     += (0.0019 + 0.00002 * T) * UdMath.udsin(262.0 + 24.44 * T);
                q      = (0.000354 + 0.0000028 * T) * UdMath.udcos(70.28 + 12.22 * T) + 0.000183;
                q     += (0.000021 + 0.0000002 * T) * UdMath.udcos(265.80 - 11.81 * T);
                break;

            default:
                throw new ArithmeticException();
            }

            // Lambda
            for (int i = 0; i < ParamN.GetLength(0); i++)
            {
                N += ParamN[i].a * UdMath.udsin(ParamN[i].b + ParamN[i].c * T);
            }

            double f = N + ParamP.f1 * UdMath.udsin(N)
                       + ParamP.f2 * UdMath.udsin(2.0 * N)
                       + ParamP.f3 * UdMath.udsin(3.0 * N)
                       + ParamP.f4 * UdMath.udsin(4.0 * N);

            double V = ParamP.V1 * UdMath.udsin(2.0 * f + ParamP.V2);

            double lambda = UdMath.deg2rad(UdMath.degmal(f + V + ParamP.L1 + ParamP.L2 * T));

            // Beta
            double beta = Math.Asin(ParamP.B1 * UdMath.udsin(f + ParamP.B2)) + UdMath.deg2rad((ParamP.B3 + ParamP.B4 * T) * UdMath.udsin(f + ParamP.B5));

            for (int i = 0; i < ParamB.GetLength(0); i++)
            {
                beta += ParamB[i].a * UdMath.udsin(ParamB[i].b + ParamB[i].c * T);
            }

            // Radius
            for (int i = 0; i < ParamQ.GetLength(0); i++)
            {
                q += ParamQ[i].a * UdMath.udcos(ParamQ[i].b + ParamQ[i].c * T);
            }

            double r      = Math.Pow(10.0, q);
            double radius = r * ParamP.r1 / (1.0 + ParamP.r2 * UdMath.udcos(f));

            return(new Xyz(radius * Math.Cos(beta) * Math.Cos(lambda),
                           radius * Math.Cos(beta) * Math.Sin(lambda),
                           radius * Math.Sin(beta)));
        }