//Returns the next time at which a will cross its descending node with b. //For elliptical orbits this is a time between UT and UT + a.period. //For hyperbolic orbits this can be any time, including a time in the past if //the descending node is in the past. //NOTE: this function will throw an ArgumentException if a is a hyperbolic orbit and the "descending node" //occurs at a true anomaly that a does not actually ever attain public static double TimeOfDescendingNode(this Orbit a, Orbit b, double UT) { if (a.eccentricity >= 1.0) { return(UT); } else { return(a.TimeOfTrueAnomaly(a.DescendingNodeTrueAnomaly(b), UT)); } }
/// Return the UT of the AN or DN, whichever is sooner public static double TimeOfPlaneChange(Orbit currentOrbit, Orbit targetOrbit, double minTime, out bool ascending) { double ascTime = currentOrbit.TimeOfTrueAnomaly(currentOrbit.AscendingNodeTrueAnomaly(targetOrbit), minTime), descTime = currentOrbit.TimeOfTrueAnomaly(currentOrbit.DescendingNodeTrueAnomaly(targetOrbit), minTime); if (ascTime > minTime && ascTime < descTime) { ascending = true; return(ascTime); } else { ascending = false; return(descTime); } }
//Returns the next time at which a will cross its descending node with b. //For elliptical orbits this is a time between UT and UT + a.period. //For hyperbolic orbits this can be any time, including a time in the past if //the descending node is in the past. //NOTE: this function will throw an ArgumentException if a is a hyperbolic orbit and the "descending node" //occurs at a true anomaly that a does not actually ever attain public static double TimeOfDescendingNode(this Orbit a, Orbit b, double UT) { return(a.TimeOfTrueAnomaly(a.DescendingNodeTrueAnomaly(b), UT)); }
//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. public static bool DescendingNodeExists(this Orbit a, Orbit b) { return(Math.Abs(MuUtils.ClampDegrees180(a.DescendingNodeTrueAnomaly(b))) <= a.MaximumTrueAnomaly()); }