//Returns the next time at which a will cross its ascending 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 ascending node is in the past. //NOTE: this function will throw an ArgumentException if a is a hyperbolic orbit and the "ascending node" //occurs at a true anomaly that a does not actually ever attain public static double TimeOfAscendingNode(this Orbit a, Orbit b, double UT) { if (a.eccentricity >= 1.0) { return(UT); } else { return(a.TimeOfTrueAnomaly(a.AscendingNodeTrueAnomaly(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 ascending 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 ascending node is in the past. //NOTE: this function will throw an ArgumentException if a is a hyperbolic orbit and the "ascending node" //occurs at a true anomaly that a does not actually ever attain public static double TimeOfAscendingNode(this Orbit a, Orbit b, double UT) { return(a.TimeOfTrueAnomaly(a.AscendingNodeTrueAnomaly(b), UT)); }
//Returns whether a has an ascending node with b. This can be false //if a is hyperbolic and the would-be ascending node is within the opening //angle of the hyperbola. public static bool AscendingNodeExists(this Orbit a, Orbit b) { return(Math.Abs(MuUtils.ClampDegrees180(a.AscendingNodeTrueAnomaly(b))) <= a.MaximumTrueAnomaly()); }
//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. public static double DescendingNodeTrueAnomaly(this Orbit a, Orbit b) { return(MuUtils.ClampDegrees360(a.AscendingNodeTrueAnomaly(b) + 180)); }