コード例 #1
0
        static Vector3 GetVertexOfOrbitEllipse(double a, double ecc, double nu, double[,] T)
        {
            double E  = OrbitUtils.TrueAnom2EccentricAnom(nu, ecc);
            double rx = a * (Math.Cos(E) - ecc);
            double ry = a * Math.Sqrt(1 - ecc * ecc) * Math.Sin(E);

            return((Vector3)OrbitUtils.ApplyTransform(rx, ry, T));
        }
コード例 #2
0
        /// <summary>
        /// Updates the position and velocity of the body in its orbit based on
        /// the current anomaly. Reference plane is the ecliptic plane (J2000).
        /// </summary>
        void UpdatePositionAndVelocity()
        {
            // Heliocentric coordinates in its orbital plane r'.
            double rx = a * (Math.Cos(E) - ecc);
            double ry = a * Math.Sqrt(1 - ecc * ecc) * Math.Sin(E);

            // Heliocentric velocity in its orbital plane v'.
            double cosE = Math.Cos(E);
            double r    = a * (1 - ecc * cosE);
            double k    = Math.Sqrt(mu * a) / r;
            double vx   = k * -Math.Sin(E);
            double vy   = k * Math.Sqrt(1 - ecc * ecc) * cosE;

            double[,] T = OrbitUtils.GetTransformToEcliptic(i, Om, w);
            pos         = OrbitUtils.ApplyTransform(rx, ry, T);
            vel         = OrbitUtils.ApplyTransform(vx, vy, T);
        }