void DrawGUIPrediction() { ReentrySimulation.Result result = predictor.GetResult(); if (result != null) { switch (result.outcome) { case ReentrySimulation.Outcome.LANDED: GUILayout.Label("Landing Predictions:"); GUILayout.Label(Coordinates.ToStringDMS(result.endPosition.latitude, result.endPosition.longitude) + "\nASL:" + MuUtils.ToSI(result.endASL, -1, 4) + "m"); GUILayout.Label(ScienceUtil.GetExperimentBiome(result.body, result.endPosition.latitude, result.endPosition.longitude)); double error = Vector3d.Distance(mainBody.GetRelSurfacePosition(result.endPosition.latitude, result.endPosition.longitude, 0), mainBody.GetRelSurfacePosition(core.target.targetLatitude, core.target.targetLongitude, 0)); GUILayout.Label("Target difference = " + MuUtils.ToSI(error, 0) + "m" + "\nMax drag: " + result.maxDragGees.ToString("F1") + "g" + "\nDelta-v needed: " + result.deltaVExpended.ToString("F1") + "m/s" + "\nTime to land: " + GuiUtils.TimeToDHMS(result.endUT - Planetarium.GetUniversalTime(), 1)); break; case ReentrySimulation.Outcome.AEROBRAKED: GUILayout.Label("Predicted orbit after aerobraking:"); Orbit o = result.EndOrbit(); if (o.eccentricity > 1) { GUILayout.Label("Hyperbolic, eccentricity = " + o.eccentricity.ToString("F2")); } else { GUILayout.Label(MuUtils.ToSI(o.PeA, 3) + "m x " + MuUtils.ToSI(o.ApA, 3) + "m"); } GUILayout.Label("Max drag: " + result.maxDragGees.ToString("F1") + "g" + "\nExit atmosphere in: " + GuiUtils.TimeToDHMS(result.endUT - Planetarium.GetUniversalTime(), 1)); break; case ReentrySimulation.Outcome.NO_REENTRY: GUILayout.Label("Orbit does not reenter:\n" + MuUtils.ToSI(orbit.PeA, 3) + "m Pe > " + MuUtils.ToSI(mainBody.RealMaxAtmosphereAltitude(), 3) + "m atmosphere height"); break; case ReentrySimulation.Outcome.TIMED_OUT: GUILayout.Label("Reentry simulation timed out."); break; } } }
void DrawGUIPrediction() { ReentrySimulation.Result result = predictor.GetResult(); if (result != null) { switch (result.outcome) { case ReentrySimulation.Outcome.LANDED: GUILayout.Label("Predicted landing site:"); GUILayout.Label(Coordinates.ToStringDMS(result.endPosition.latitude, result.endPosition.longitude)); double error = Vector3d.Distance(mainBody.GetRelSurfacePosition(result.endPosition.latitude, result.endPosition.longitude, 0), mainBody.GetRelSurfacePosition(core.target.targetLatitude, core.target.targetLongitude, 0)); GUILayout.Label("Difference from target = " + MuUtils.ToSI(error, 0) + "m"); if (result.maxDragGees > 0) { GUILayout.Label("Predicted max drag gees: " + result.maxDragGees.ToString("F1")); } break; case ReentrySimulation.Outcome.AEROBRAKED: GUILayout.Label("Predicted orbit after aerobraking:"); Orbit o = result.EndOrbit(); if (o.eccentricity > 1) { GUILayout.Label("Hyperbolic, eccentricity = " + o.eccentricity.ToString("F2")); } else { GUILayout.Label(MuUtils.ToSI(o.PeA, 3) + "m x " + MuUtils.ToSI(o.ApA, 3) + "m"); } break; case ReentrySimulation.Outcome.NO_REENTRY: GUILayout.Label("Orbit does not reenter:"); GUILayout.Label(MuUtils.ToSI(orbit.PeA, 3) + "m Pe > " + MuUtils.ToSI(mainBody.RealMaxAtmosphereAltitude(), 3) + "m atmosphere height"); break; case ReentrySimulation.Outcome.TIMED_OUT: GUILayout.Label("Reentry simulation timed out."); break; } } }