/// <summary> /// Gets the UT for the equatorial DN. /// </summary> /// <returns>The equatorial DN UT.</returns> /// <param name="o">The Orbit to calculate the UT from.</param> public static double getEquatorialDNUT(Orbit o) { //TODO: Add safeguards for bad UTs, may need to be refactored to NodeManager Vector3d DNVector = QuaternionD.AngleAxis(NodeTools.Angle360(o.LAN + 180), Planetarium.Zup.Z) * Planetarium.Zup.X; return(o.GetUTforTrueAnomaly(o.GetTrueAnomalyOfZupVector(DNVector), 2)); }
/// <summary> /// Gets the ejection angle of the current maneuver node. /// </summary> /// <returns>The ejection angle in degrees. Positive results are the angle from prograde, negative results are the angle from retrograde.</returns> /// <param name="nodeUT">Kerbal Spece Program Universal Time.</param> public static double getEjectionAngle(Orbit o, double nodeUT) { CelestialBody body = o.referenceBody; // Calculate the angle between the node's position and the reference body's velocity at nodeUT Vector3d prograde = body.orbit.getOrbitalVelocityAtUT(nodeUT); Vector3d position = o.getRelativePositionAtUT(nodeUT); double eangle = NodeTools.Angle360((Math.Atan2(prograde.y, prograde.x) - Math.Atan2(position.y, position.x)) * 180.0 / Math.PI); // Correct to angle from retrograde if needed. if (eangle > 180) { eangle = 180 - eangle; } return(eangle); }