Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            var hashCode = 892106565;

            hashCode = hashCode * -1521134295 + CoordX.GetHashCode();
            hashCode = hashCode * -1521134295 + CoordY.GetHashCode();
            hashCode = hashCode * -1521134295 + ParamA.GetHashCode();
            hashCode = hashCode * -1521134295 + ParamB.GetHashCode();
            hashCode = hashCode * -1521134295 + ParamC.GetHashCode();
            hashCode = hashCode * -1521134295 + Distance.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <double> > .Default.GetHashCode(Traits);

            return(hashCode);
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            string result = "";

            result += " CoordX: " + CoordX.ToString();
            result += " CoordY: " + CoordY.ToString();
            result += " ParamA: " + ParamA.ToString();
            result += " ParamB: " + ParamB.ToString();
            result += " ParamC: " + ParamC.ToString();

            result += "\nTraits: ";
            for (int i = 0; i < Traits.Count; i++)
            {
                result += Traits[i].ToString() + " | ";
            }
            result += "\nDistance to neighbour: " + Distance.ToString();

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get Position of Mercury, Uranus, Neptune, Pluto
        /// </summary>
        /// <param name="planetNo"></param>
        /// <param name="T"></param>
        /// <returns></returns>
        private static Xyz GetPosExp3(int planetNo, double T)
        {
            PlanetExpP0[] ParamL, ParamB, ParamR;
            double        lambda, beta, radius;

            switch (planetNo)
            {
            case Planet.MERCURY:
                ParamL = MercuryLambda;
                ParamB = MercuryBeta;
                ParamR = MercuryR;

                lambda  = 252.2502 + 149474.0714 * T;
                lambda += (23.4405 + 0.0023 * T) * UdMath.udcos(149472.5153 * T + 84.7947);
                lambda += (2.9818 + 0.0006 * T) * UdMath.udcos(298945.031 * T + 259.589);

                beta  = (6.7057 + 0.0017 * T) * UdMath.udcos(149472.886 * T + 113.919);
                beta += (1.4396 + 0.0005 * T) * UdMath.udcos(0.37 * T + 119.12);
                beta += (1.3643 + 0.0005 * T) * UdMath.udcos(298945.40 * T + 288.71);

                radius  = 0.395283 + 0.000002 * T;
                radius += (0.078341 + 0.000008 * T) * UdMath.udcos(149472.515 * T + 354.795);
                radius += (0.007955 + 0.000002 * T) * UdMath.udcos(298945.03 * T + 169.59);
                break;

            case Planet.URANUS:
                ParamL = UranusLambda;
                ParamB = UranusBeta;
                ParamR = UranusR;

                lambda  = 313.33676 + 428.72880 * T;
                lambda += 3.20671 * T * UdMath.udcos(705.15539 * T + 114.02740);
                lambda += 2.69325 * T * UdMath.udcos(597.77389 * T + 317.76510);
                lambda += 0.00015 * T * UdMath.udcos(3798.6 * T + 313.4);

                beta  = -0.02997;
                beta += 1.78488 * T * UdMath.udcos(507.52281 * T + 188.32394);
                beta += 0.56518 * T * UdMath.udcos(892.2869 * T + 354.9571);
                beta += 0.00036 * T * UdMath.udcos(1526.5 * T + 263.0);

                radius  = 19.203034 + 0.042617 * T;
                radius += 0.361949 * T * UdMath.udcos(440.702 * T + 19.879);
                radius += 0.166685 * T * UdMath.udcos(702.024 * T + 307.419);
                break;

            case Planet.NEPTUNE:
                ParamL = NeptuneLambda;
                ParamB = NeptuneBeta;
                ParamR = NeptuneR;

                lambda  = -55.13323 + 219.93503 * T;
                lambda += 0.04403 * T * UdMath.udcos(684.128 * T + 332.797);
                lambda += 0.02928 * T * UdMath.udcos(904.371 * T + 342.114);

                beta = 0.01725;

                radius  = 30.073033;
                radius += 0.009784 * T * UdMath.udcos(515.2 * T + 195.7);
                break;

            case Planet.PLUTO:
                ParamL = PlutoLambda;
                ParamB = PlutoBeta;
                ParamR = PlutoR;

                lambda = 241.82574 + 179.09519 * T;
                beta   = -2.30285;

                radius  = 38.662489;
                radius += 0.007619 * T * UdMath.udcos(1425.9 * T + 31.0);
                radius += 0.002543 * T * UdMath.udcos(2196.1 * T + 199.5);
                break;

            default:
                throw new ArithmeticException();
            }

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

            lambda = UdMath.deg2rad(UdMath.degmal(lambda));

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

            beta = UdMath.deg2rad(beta);

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

            return(new Xyz(radius * Math.Cos(beta) * Math.Cos(lambda),
                           radius * Math.Cos(beta) * Math.Sin(lambda),
                           radius * Math.Sin(beta)));
        }
Ejemplo n.º 4
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)));
        }