Ejemplo n.º 1
0
        /// <summary>
        /// Gets the descending node orbit.
        /// </summary>
        /// <param name="desc">The desc.</param>
        /// <returns><c>true</c> if descending node exists, otherwise <c>false</c></returns>
        public bool GetDescendingNode(out Vector3d desc)
        {
            Vector3d norm     = Vector3d.Cross(OrbitNormal, EclipticNormal);
            bool     s        = Vector3d.Dot(Vector3d.Cross(norm, SemiMajorAxisBasis), OrbitNormal) < 0;
            double   ecc      = 0d;
            double   trueAnom = Vector3d.Angle(norm, -CenterPoint) * KeplerOrbitUtils.Deg2Rad;

            if (Eccentricity < 1.0)
            {
                double cosT = Math.Cos(trueAnom);
                ecc = Math.Acos((Eccentricity + cosT) / (1d + Eccentricity * cosT));
                if (s)
                {
                    ecc = KeplerOrbitUtils.PI_2 - ecc;
                }
            }
            else if (Eccentricity > 1.0)
            {
                trueAnom = Vector3d.Angle(norm, CenterPoint) * KeplerOrbitUtils.Deg2Rad;
                if (trueAnom >= Math.Acos(-1d / Eccentricity))
                {
                    desc = new Vector3d();
                    return(false);
                }

                double cosT = Math.Cos(trueAnom);
                ecc = KeplerOrbitUtils.Acosh((Eccentricity + cosT) / (1 + Eccentricity * cosT)) * (s ? -1 : 1);
            }
            else
            {
                desc = new Vector3d();
                return(false);
            }

            desc = GetFocalPositionAtEccentricAnomaly(ecc);
            return(true);
        }