コード例 #1
0
        //The mean anomaly of the orbit.
        //For elliptical orbits, the value return is always between 0 and 2pi
        //For hyperbolic orbits, the value can be any number.
        internal static double MeanAnomalyAtUT(this Orbit o, double UT)
        {
            double ret = o.meanAnomalyAtEpoch + o.MeanMotion() * (UT - o.epoch);

            if (o.eccentricity < 1)
            {
                ret = MuUtils.ClampRadiansTwoPi(ret);
            }
            return(ret);
        }
コード例 #2
0
        //The next time at which the orbiting object will reach the given mean anomaly.
        //For elliptical orbits, this will be a time between UT and UT + o.period
        //For hyperbolic orbits, this can be any time, including a time in the past, if
        //the given mean anomaly occurred in the past
        internal static double UTAtMeanAnomaly(this Orbit o, double meanAnomaly, double UT)
        {
            double currentMeanAnomaly = o.MeanAnomalyAtUT(UT);
            double meanDifference     = meanAnomaly - currentMeanAnomaly;

            if (o.eccentricity < 1)
            {
                meanDifference = MuUtils.ClampRadiansTwoPi(meanDifference);
            }
            return(UT + meanDifference / o.MeanMotion());
        }
コード例 #3
0
        //Originally by Zool, revised by The_Duck
        //Converts an eccentric anomaly into a mean anomaly.
        //For an elliptical orbit, the returned value is between 0 and 2pi
        //For a hyperbolic orbit, the returned value is any number
        internal static double GetMeanAnomalyAtEccentricAnomaly(this Orbit o, double E)
        {
            double e = o.eccentricity;

            if (e < 1) //elliptical orbits
            {
                return(MuUtils.ClampRadiansTwoPi(E - (e * Math.Sin(E))));
            }
            else //hyperbolic orbits
            {
                return((e * Math.Sinh(E)) - E);
            }
        }
コード例 #4
0
 //Returns whether o has a descending node with the equator. This can be false
 //if o is hyperbolic and the would-be descending node is within the opening
 //angle of the hyperbola.
 internal static bool DescendingNodeEquatorialExists(this Orbit o)
 {
     return(Math.Abs(MuUtils.ClampDegrees180(o.DescendingNodeEquatorialTrueAnomaly())) <= o.MaximumTrueAnomaly());
 }
コード例 #5
0
 //Returns whether a has a descending node with b. This can be false
 //if a is hyperbolic and the would-be descending node is within the opening
 //angle of the hyperbola.
 internal static bool DescendingNodeExists(this Orbit a, Orbit b)
 {
     return(Math.Abs(MuUtils.ClampDegrees180(a.DescendingNodeTrueAnomaly(b))) <= a.MaximumTrueAnomaly());
 }
コード例 #6
0
 //Gives the true anomaly at which o crosses the equator going southwards, if o is east-moving,
 //or northwards, if o is west-moving.
 //The returned value is always between 0 and 360.
 internal static double DescendingNodeEquatorialTrueAnomaly(this Orbit o)
 {
     return(MuUtils.ClampDegrees360(o.AscendingNodeEquatorialTrueAnomaly() + 180));
 }
コード例 #7
0
 //Gives the true anomaly (in a's orbit) at which a crosses its descending node
 //with b's orbit.
 //The returned value is always between 0 and 360.
 internal static double DescendingNodeTrueAnomaly(this Orbit a, Orbit b)
 {
     return(MuUtils.ClampDegrees360(a.AscendingNodeTrueAnomaly(b) + 180));
 }