예제 #1
0
        public CometOrbit(Comet comet, int division)
        {
            this.Division = division;
            Orbit         = new Xyz[division + 1];

            if (comet.e < 1.0 - TOLERANCE)
            {
                GetOrbitEllip(comet);
            }
            else if (comet.e > 1.0 + TOLERANCE)
            {
                GetOrbitHyper(comet);
            }
            else
            {
                GetOrbitPara(comet);
            }

            Matrix vec  = comet.VectorConstant;
            Matrix prec = Matrix.PrecMatrix(comet.EquinoxJD, Astro.JD2000);

            for (int i = 0; i <= division; i++)
            {
                Orbit[i] = Orbit[i].Rotate(vec).Rotate(prec);
            }
        }
예제 #2
0
        public void LoadPanel(Comet comet, ATime atime)
        {
            Comet = comet;
            ATime = atime;

            ObjectOrbit = new CometOrbit(Comet, 1000);

            UpdatePositions(atime);
            UpdatePlanetOrbit(atime);
            UpdateRotationMatrix(atime);
        }
예제 #3
0
        private void UpdatePositions(ATime atime)
        {
            if (PaintEnabled)
            {
                ObjectPos = Comet.GetPos(atime.JD);

                for (int i = 0; i < 9; i++)
                {
                    PlanetPos[i] = Planet.GetPos(Planet.MERCURY + i, atime);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Parabolic Orbit
        /// </summary>
        /// <param name="comet"></param>
        private void GetOrbitPara(Comet comet)
        {
            int idx1, idx2;

            idx1 = idx2 = this.Division / 2;
            double dV = (Math.Atan(Math.Sqrt(MAXORBIT / comet.q - 1.0)) * 2.0) / (this.Division / 2);

            double V = 0.0;

            for (int i = 0; i <= (this.Division / 2); i++, V += dV)
            {
                double TanV2 = Math.Sin(V / 2.0) / Math.Cos(V / 2.0);
                double RCosV = comet.q * (1.0 - TanV2 * TanV2);
                double RSinV = 2.0 * comet.q * TanV2;
                Orbit[idx1++] = new Xyz(RCosV, RSinV, 0.0);
                Orbit[idx2--] = new Xyz(RCosV, -RSinV, 0.0);
            }
        }
예제 #5
0
        /// <summary>
        /// Hyperbolic Orbit
        /// </summary>
        /// <param name="comet"></param>
        private void GetOrbitHyper(Comet comet)
        {
            int idx1, idx2;

            idx1 = idx2 = this.Division / 2;
            double t    = Math.Sqrt(comet.e * comet.e - 1.0);
            double axis = comet.q / (comet.e - 1.0);
            double dF   = UdMath.arccosh((MAXORBIT + axis) / (axis * comet.e)) / (this.Division / 2);

            double F = 0.0;

            for (int i = 0; i <= (this.Division / 2); i++, F += dF)
            {
                double RCosV = axis * (comet.e - UdMath.cosh(F));
                double RSinV = axis * t * UdMath.sinh(F);
                Orbit[idx1++] = new Xyz(RCosV, RSinV, 0.0);
                Orbit[idx2--] = new Xyz(RCosV, -RSinV, 0.0);
            }
        }
예제 #6
0
        /// <summary>
        /// Elliptical Orbit
        /// </summary>
        /// <param name="comet"></param>
        private void GetOrbitEllip(Comet comet)
        {
            double axis = comet.q / (1.0 - comet.e);
            double ae2  = -2.0 * axis * comet.e;
            double t    = Math.Sqrt(1.0 - comet.e * comet.e);

            if (axis * (1.0 + comet.e) > MAXORBIT)
            {
                double dE = Math.Acos((1.0 - MAXORBIT / axis) / comet.e) / ((this.Division / 2) * (this.Division / 2));
                int    idx1, idx2;
                idx1 = idx2 = this.Division / 2;

                for (int i = 0; i <= (this.Division / 2); i++)
                {
                    double E     = dE * i * i;
                    double RCosV = axis * (Math.Cos(E) - comet.e);
                    double RSinV = axis * t * Math.Sin(E);
                    Orbit[idx1++] = new Xyz(RCosV, RSinV, 0.0);
                    Orbit[idx2--] = new Xyz(RCosV, -RSinV, 0.0);
                }
            }
            else
            {
                int idx1, idx2, idx3, idx4;
                idx1 = 0;
                idx2 = idx3 = this.Division / 2;
                idx4 = this.Division;

                double E = 0.0;
                for (int i = 0; i <= (this.Division / 4); i++, E += (2.0 * Math.PI / this.Division))
                {
                    double RCosV = axis * (Math.Cos(E) - comet.e);
                    double RSinV = axis * t * Math.Sin(E);
                    Orbit[idx1++] = new Xyz(RCosV, RSinV, 0.0);
                    Orbit[idx2--] = new Xyz(ae2 - RCosV, RSinV, 0.0);
                    Orbit[idx3++] = new Xyz(ae2 - RCosV, -RSinV, 0.0);
                    Orbit[idx4--] = new Xyz(RCosV, -RSinV, 0.0);
                }
            }
        }