diff --git a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
index e34a3cd4..e7adae31 100644
--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -122,8 +122,19 @@ static ReadoutLibrary()
readouts.Add(new ImpactBiome());
// Vessel
- readouts.Add(new Name());
- readouts.Add(new DeltaVStaged());
+ readouts.Add(new Name());
+ readouts.Add(new DecelerationDeltaV());
+ readouts.Add(new DecelerationTime());
+ readouts.Add(new DecelerationDistanceTotal());
+ readouts.Add(new DecelerationDistanceHorizontal());
+ readouts.Add(new DecelerationDistanceVertical());
+ readouts.Add(new DecelerationAltitudeOverGround());
+ readouts.Add(new DecelerationAltitude());
+ readouts.Add(new DecelerationBiome());
+ readouts.Add(new DecelerationLatitude());
+ readouts.Add(new DecelerationLongitude());
+ readouts.Add(new DecelerationSlope());
+ readouts.Add(new DeltaVStaged());
readouts.Add(new DeltaVCurrent());
readouts.Add(new DeltaVTotal());
readouts.Add(new DeltaVCurrentTotal());
diff --git a/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs b/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
index 2bf4c4b3..1f315061 100644
--- a/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/Longitude.cs
@@ -35,7 +35,7 @@ public Longitude()
public override void Draw(SectionModule section)
{
double angle = AngleHelper.Clamp180(FlightGlobals.ship_longitude);
- DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? "W" : " E"), section.IsHud);
+ DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? " W" : " E"), section.IsHud);
}
}
}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationAltitude.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationAltitude.cs
new file mode 100644
index 00000000..f810cf9f
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationAltitude.cs
@@ -0,0 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationAltitude : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationAltitude()
+ {
+ this.Name = "Decel. Point: Alt. Terrain";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Shows the terrain altitude/elevation at the point your Deceleration Burn will end.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine(DecelerationProcessor.Altitude.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationAltitudeOverGround.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationAltitudeOverGround.cs
new file mode 100644
index 00000000..c0a98524
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationAltitudeOverGround.cs
@@ -0,0 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationAltitudeOverGround : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationAltitudeOverGround()
+ {
+ this.Name = "Decel. Point: Alt. Remaining";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Shows the remaining altitude over the point your Deceleration Burn will end.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine(DecelerationProcessor.AltitudeOverGround.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationBiome.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationBiome.cs
new file mode 100644
index 00000000..c92121e7
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationBiome.cs
@@ -0,0 +1,64 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationBiome : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationBiome()
+ {
+ this.Name = "Decel. Point: Biome";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Shows the biome at the point your Deceleration Burn will end.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (DecelerationProcessor.ShowDetails)
+ {
+ this.DrawLine(DecelerationProcessor.Biome, section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDeltaV.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDeltaV.cs
new file mode 100644
index 00000000..64976fe5
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDeltaV.cs
@@ -0,0 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationDeltaV : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationDeltaV()
+ {
+ this.Name = "Decel. Burn: deltaV";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Total change in velocity to kill all surface velocity including potential velocity gained trough freefall.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine("Decel. Burn: deltaV", DecelerationProcessor.DecelerationDeltaV.ToSpeed() + " (" + (DecelerationProcessor.HasDeltaV ? "S" + DecelerationProcessor.FinalStage : "X") + ")", section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceHorizontal.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceHorizontal.cs
new file mode 100644
index 00000000..d0f99b07
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceHorizontal.cs
@@ -0,0 +1,67 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationDistanceHorizontal : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationDistanceHorizontal()
+ {
+ this.Name = "Decel. Burn: Horiz. Dist.";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Horizontal distance covered during Deceleration Burn.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine(DecelerationProcessor.HorizontalDistance.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceTotal.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceTotal.cs
new file mode 100644
index 00000000..397982af
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceTotal.cs
@@ -0,0 +1,67 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationDistanceTotal : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationDistanceTotal()
+ {
+ this.Name = "Decel. Burn: Total Dist.";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Total distance covered during Deceleration Burn.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine(DecelerationProcessor.TotalDistance.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceVertical.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceVertical.cs
new file mode 100644
index 00000000..71ef99f8
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationDistanceVertical.cs
@@ -0,0 +1,67 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationDistanceVertical : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationDistanceVertical()
+ {
+ this.Name = "Decel. Burn: Vert. Dist.";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Vertical distance covered during Deceleration Burn.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine(DecelerationProcessor.VerticalDistance.ToDistance(), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationLatitude.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationLatitude.cs
new file mode 100644
index 00000000..5eb977cb
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationLatitude.cs
@@ -0,0 +1,66 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationLatitude : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationLatitude()
+ {
+ this.Name = "Decel. Point: Latitude";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Shows the latitude at the point your Deceleration Burn will end.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (DecelerationProcessor.ShowDetails)
+ {
+ this.DrawLine(Units.ToAngleDMS(DecelerationProcessor.Latitude) + (DecelerationProcessor.Latitude < 0.0 ? " S" : " N"), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationLongditude.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationLongditude.cs
new file mode 100644
index 00000000..10a4d576
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationLongditude.cs
@@ -0,0 +1,67 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationLongitude : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationLongitude()
+ {
+ this.Name = "Decel. Point: Longditude";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Shows the longditude at the point your Deceleration Burn will end.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (DecelerationProcessor.ShowDetails)
+ {
+ double angle = AngleHelper.Clamp180(DecelerationProcessor.Longitude);
+ DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? " W" : " E"), section.IsHud);
+ }
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationProcessor.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationProcessor.cs
new file mode 100644
index 00000000..58fff937
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationProcessor.cs
@@ -0,0 +1,279 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Extensions;
+using KerbalEngineer.Flight.Readouts.Vessel;
+
+using UnityEngine;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ using Helpers;
+ using System;
+
+ // Shamelessly Stolen From Maneuver Node Processor by Harry Young
+
+ public class DecelerationProcessor : IUpdatable, IUpdateRequest
+ {
+ #region Properties
+
+ private static readonly DecelerationProcessor instance = new DecelerationProcessor();
+
+ // Burn Based Information
+ public static double DecelerationTime { get; private set; }
+ public static double DecelerationDeltaV { get; private set; }
+ public static double HorizontalDistance { get; private set; }
+ public static double VerticalDistance { get; private set; }
+ public static double TotalDistance { get; private set; }
+ // Internal Calculation Steps
+ private static double ProgradeDeltaV;
+ private static double RadialDeltaV;
+ private double m_Gravity;
+ private double m_RadarAltitude;
+
+ // Additional DeltaV Information
+ public static int FinalStage { get; private set; }
+ public static double AvailableDeltaV { get; private set; }
+ public static bool HasDeltaV { get; private set; }
+
+ // Landing Point Readouts
+ public static double Altitude { get; private set; }
+ public static string Biome { get; private set; }
+ public static double Latitude { get; private set; }
+ public static double Longitude { get; private set; }
+ public static double AltitudeOverGround { get; private set; }
+ public static string Slope { get; private set; }
+ // Internal Calculation Steps
+ private double impactAltitude;
+ private double impactLatitude;
+ private double impactLongitude;
+ private Quaternion surfaceRotation;
+
+ // Execution Info
+ public static bool ShowDetails { get; set; }
+ public bool UpdateRequested { get; set; }
+
+ #endregion
+
+ #region Methods: public
+
+ public static void RequestUpdate()
+ {
+ instance.UpdateRequested = true;
+ SimulationProcessor.RequestUpdate();
+ }
+
+ public static void Reset()
+ {
+ FlightEngineerCore.Instance.AddUpdatable(SimulationProcessor.Instance);
+ FlightEngineerCore.Instance.AddUpdatable(instance);
+ }
+
+ public void Update()
+ {
+ //Check Background Logistics
+ if (FlightGlobals.currentMainBody == null || FlightGlobals.ActiveVessel == null || SimulationProcessor.LastStage == null || !SimulationProcessor.ShowDetails)
+ {
+ ShowDetails = false;
+ return;
+ }
+ // Check if we are actually moving
+ if (ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel) == ExperimentSituations.SrfLanded || ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel) == ExperimentSituations.SrfSplashed)
+ {
+ ShowDetails = false;
+ return;
+ }
+
+ var dtime = 0.0;
+
+ #region Burn Calculations
+
+ // Calculate Required DeltaV and Required Parameters
+ m_Gravity = FlightGlobals.currentMainBody.gravParameter / Math.Pow(FlightGlobals.currentMainBody.Radius, 2.0);
+ m_RadarAltitude = FlightGlobals.ActiveVessel.terrainAltitude > 0.0
+ ? FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude
+ : FlightGlobals.ship_altitude;
+ ProgradeDeltaV = FlightGlobals.ActiveVessel.horizontalSrfSpeed;
+ RadialDeltaV = Math.Sqrt((2 * m_Gravity * m_RadarAltitude) + Math.Pow(FlightGlobals.ship_verticalSpeed, 2.0));
+ DecelerationDeltaV = Math.Sqrt(Math.Pow(ProgradeDeltaV, 2.0)+Math.Pow(RadialDeltaV, 2.0));
+
+ // Get Burn Time
+ HasDeltaV = GetSuicideBurnTime(DecelerationDeltaV, ref dtime);
+ DecelerationTime = dtime;
+
+ // Get Distance Traveled during Burn. Since we kill velocity I can assume average Velocity over burn.
+ HorizontalDistance = 0.5 * ProgradeDeltaV * DecelerationTime;
+ VerticalDistance = 0.5 * RadialDeltaV * DecelerationTime;
+ TotalDistance = 0.5 * DecelerationDeltaV * DecelerationTime;
+
+ #endregion
+
+ #region Landing Point Calculations
+
+ // I now know my horizontal Distance and I know my Heading, so I can calculate a Landing Point, get it's slope and Altitude and from that predict the radar altitude after the burn.
+ if (FlightGlobals.ActiveVessel.mainBody.pqsController != null)
+ {
+ //do impact site calculations, special thanks to Muddr for Pointing me to http://www.movable-type.co.uk/scripts/latlong.html
+ surfaceRotation = GetSurfaceRotation();
+ var incl = surfaceRotation.eulerAngles.y;
+ var currentlat = FlightGlobals.ActiveVessel.latitude;
+ var currentlon = FlightGlobals.ActiveVessel.longitude;
+ var angdst = 360 * HorizontalDistance / (2 * Math.PI * FlightGlobals.currentMainBody.Radius);
+ var bodyrot = 360 * DecelerationTime / FlightGlobals.ActiveVessel.mainBody.rotationPeriod;
+
+ impactLatitude = currentlat + Math.Sin(incl) * angdst;
+ impactLongitude = currentlon + Math.Cos(incl) * angdst;
+
+ //calculate the actual altitude of the impact site
+ //altitude for long/lat code stolen from some ISA MapSat forum post; who knows why this works, but it seems to.
+ var rad = QuaternionD.AngleAxis(this.impactLongitude, Vector3d.down) * QuaternionD.AngleAxis(this.impactLatitude, Vector3d.forward) * Vector3d.right;
+ this.impactAltitude = FlightGlobals.ActiveVessel.mainBody.pqsController.GetSurfaceHeight(rad) - FlightGlobals.ActiveVessel.mainBody.pqsController.radius;
+ if ((this.impactAltitude < 0) && FlightGlobals.ActiveVessel.mainBody.ocean)
+ {
+ this.impactAltitude = 0;
+ }
+ }
+
+ // Set accessable properties.
+ Longitude = this.impactLongitude;
+ Latitude = this.impactLatitude;
+ Altitude = this.impactAltitude;
+ Slope = GetSlopeAngleAndHeadingLanding(FlightGlobals.currentMainBody.GetRelSurfacePosition(impactLatitude, impactLongitude, impactAltitude));
+ AltitudeOverGround = FlightGlobals.ship_altitude - Altitude - VerticalDistance;
+ Biome = ScienceUtil.GetExperimentBiome(FlightGlobals.ActiveVessel.mainBody, this.impactLatitude, this.impactLongitude);
+
+ #endregion
+
+ ShowDetails = true;
+
+ }
+
+ #endregion
+
+ #region Methods: private Additional Calculations
+
+ //Suicide Burn time
+ private static bool GetSuicideBurnTime(double deltaV, ref double burnTime)
+ {
+ for (var i = SimulationProcessor.Stages.Length - 1; i > -1; i--)
+ {
+ var stage = SimulationProcessor.Stages[i];
+ var stageDeltaV = stage.deltaV;
+ var startMass = stage.totalMass;
+
+ //ProcessStageDrain
+ if (deltaV <= Double.Epsilon)
+ {
+ break;
+ }
+ if (stageDeltaV <= Double.Epsilon)
+ {
+ continue;
+ }
+
+ FinalStage = i;
+
+ double deltaVDrain = deltaV.Clamp(0.0, stageDeltaV);
+
+ var exhaustVelocity = stage.isp * Units.GRAVITY;
+ var flowRate = stage.thrust / exhaustVelocity;
+ var endMass = Math.Exp(Math.Log(startMass) - deltaVDrain / exhaustVelocity);
+ var deltaMass = (startMass - endMass) * Math.Exp(-(deltaVDrain * 0.001) / exhaustVelocity);
+ burnTime += deltaMass / flowRate;
+
+ deltaV -= deltaVDrain;
+ stageDeltaV -= deltaVDrain;
+ startMass -= deltaMass;
+ }
+ return deltaV <= Double.Epsilon;
+ }
+
+ // Helper to get locas Surface Rotation, Required to get Heading, Taken From attitudeprocessor
+ private Quaternion GetSurfaceRotation()
+ {
+ // This code was derived from MechJeb2's implementation for getting the vessel's surface relative rotation.
+ var centreOfMass = FlightGlobals.ActiveVessel.CoMD;
+ var up = (centreOfMass - FlightGlobals.ActiveVessel.mainBody.position).normalized;
+ var north = Vector3.ProjectOnPlane((FlightGlobals.ActiveVessel.mainBody.position + FlightGlobals.ActiveVessel.mainBody.transform.up * (float)FlightGlobals.ActiveVessel.mainBody.Radius) - centreOfMass, up).normalized;
+
+ return Quaternion.Inverse(Quaternion.Euler(90.0f, 0.0f, 0.0f) * Quaternion.Inverse(FlightGlobals.ActiveVessel.transform.rotation) * Quaternion.LookRotation(north, up));
+ }
+
+ // Slope at landing Point
+ private string GetSlopeAngleAndHeadingLanding(Vector3d LandingPoint)
+ {
+ try
+ {
+ var result = "--° @ ---°";
+ var mainBody = FlightGlobals.ActiveVessel.mainBody;
+ var rad = (LandingPoint - mainBody.position).normalized;
+ RaycastHit hit;
+ if (Physics.Raycast(LandingPoint, -rad, out hit, Mathf.Infinity, 1 << 15)) // Just "Local Scenery" please
+ {
+ var norm = hit.normal;
+ norm = norm.normalized;
+ var raddotnorm = Vector3d.Dot(rad, norm);
+ if (raddotnorm > 1.0)
+ {
+ raddotnorm = 1.0;
+ }
+ else if (raddotnorm < 0.0)
+ {
+ raddotnorm = 0.0;
+ }
+ var slope = Math.Acos(raddotnorm) * 180 / Math.PI;
+ result = Units.ToAngle(slope, 1);
+ if (slope < 0.05)
+ {
+ result += " @ ---°";
+ }
+ else
+ {
+ var side = Vector3d.Cross(rad, norm).normalized;
+ var east = Vector3d.Cross(rad, Vector3d.up).normalized;
+ var north = Vector3d.Cross(rad, east).normalized;
+ var sidedoteast = Vector3d.Dot(side, east);
+ var direction = Math.Acos(sidedoteast) * 180 / Math.PI;
+ var sidedotnorth = Vector3d.Dot(side, north);
+ if (sidedotnorth < 0)
+ {
+ direction = 360 - direction;
+ }
+ result += " @ " + Units.ToAngle(direction, 1);
+ }
+ }
+
+ return result;
+ }
+ catch (Exception ex)
+ {
+ MyLogger.Exception(ex, "Surface->Slope->GetSlopeAngleAndHeading");
+ return "--° @ ---°";
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationSlope.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationSlope.cs
new file mode 100644
index 00000000..9b7cbf09
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationSlope.cs
@@ -0,0 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+using UnityEngine;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationSlope : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationSlope()
+ {
+ this.Name = "Decel. Point: Slope";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Shows the slope at the point your Deceleration Burn will end.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+ this.DrawLine(DecelerationProcessor.Slope, section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+ }
+}
+ #endregion
\ No newline at end of file
diff --git a/KerbalEngineer/Flight/Readouts/Vessel/DecelerationTime.cs b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationTime.cs
new file mode 100644
index 00000000..4cdf5373
--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Vessel/DecelerationTime.cs
@@ -0,0 +1,69 @@
+//
+// Kerbal Engineer Redux
+//
+// Copyright (C) 2014 CYBUTEK
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+
+#region Using Directives
+
+using System;
+
+using KerbalEngineer.Flight.Sections;
+using KerbalEngineer.Helpers;
+
+#endregion
+
+namespace KerbalEngineer.Flight.Readouts.Vessel
+{
+ public class DecelerationTime : ReadoutModule
+ {
+ #region Constructors
+
+ public DecelerationTime()
+ {
+ this.Name = "Decel. Burn: Duration";
+ this.Category = ReadoutCategory.GetCategory("Vessel");
+ this.HelpString = "Time required at 100% burn to kill all surface velocity including potential velocity gained trough free fall.";
+ this.IsDefault = false;
+ }
+
+ #endregion
+
+ #region Methods: public
+
+ public override void Draw(SectionModule section)
+ {
+ if (!DecelerationProcessor.ShowDetails)
+ {
+ return;
+ }
+
+ this.DrawLine("Decel. Burn: Duration", TimeFormatter.ConvertToString(DecelerationProcessor.DecelerationTime), section.IsHud);
+ }
+
+ public override void Reset()
+ {
+ DecelerationProcessor.Reset();
+ }
+
+ public override void Update()
+ {
+ DecelerationProcessor.RequestUpdate();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/KerbalEngineer/KerbalEngineer.csproj b/KerbalEngineer/KerbalEngineer.csproj
index 84b8b30f..b16fb6b5 100644
--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -122,6 +122,15 @@
+
+
+
+
+
+
+
+
+
@@ -245,6 +254,9 @@
+
+
+
diff --git a/UpgradeLog.htm b/UpgradeLog.htm
new file mode 100644
index 00000000..a4721bbe
Binary files /dev/null and b/UpgradeLog.htm differ