private void UpdateEngineFloatCurve()
        {
            // If it's less then the min ratio, we're going to assume that it's not initialized,
            // so we'll bring it up to max which is normally where it would start
            if (currentEMR < CurrentNodePair.Min.ratio || currentEMR > CurrentNodePair.Max.ratio)
            {
                currentEMR = CurrentNodePair.Max.ratio;
            }

            float fullRatioDiff    = CurrentNodePair.Max.ratio - CurrentNodePair.Min.ratio;
            float currentRatioDiff = currentEMR - CurrentNodePair.Min.ratio;
            float ratioPercentage  = currentRatioDiff / fullRatioDiff;

            MixtureConfigNode current = GenerateMixtureConfigNodeForRatio(currentEMR);

            UpdateThrust(current.maxThrust, current.minThrust);
            FloatCurve newCurve = FloatCurveTransformer.GenerateForPercentage(CurrentNodePair.Min.atmosphereCurve, CurrentNodePair.Max.atmosphereCurve, ratioPercentage);

            engineModule.atmosphereCurve = newCurve;

            engineModule.maxFuelFlow = current.maxThrust / (newCurve.Evaluate(0.0f) * engineModule.g);

            //EMRUtils.Log("Setting max thrust to ", current.maxThrust);
            //EMRUtils.Log("Fuel flow set to ", engineModule.maxFuelFlow);
        }
        private MixtureConfigNode GenerateMixtureConfigNodeForRatio(float ratio)
        {
            float fullRatioDiff    = CurrentNodePair.Max.ratio - CurrentNodePair.Min.ratio;
            float currentRatioDiff = ratio - CurrentNodePair.Min.ratio;
            float ratioPercentage  = currentRatioDiff / fullRatioDiff;

            MixtureConfigNode resultNode = new MixtureConfigNode()
            {
                configName      = CurrentNodePair.Min.configName,
                ratio           = ratio,
                atmosphereCurve = FloatCurveTransformer.GenerateForPercentage(CurrentNodePair.Min.atmosphereCurve, CurrentNodePair.Max.atmosphereCurve, ratioPercentage),
                maxThrust       = (ratioPercentage * (CurrentNodePair.Max.maxThrust - CurrentNodePair.Min.maxThrust)) + CurrentNodePair.Min.maxThrust,
                minThrust       = (ratioPercentage * (CurrentNodePair.Max.minThrust - CurrentNodePair.Min.minThrust)) + CurrentNodePair.Min.minThrust
            };

            //EMRUtils.Log("Resultant node: ", resultNode);
            return(resultNode);
        }
 private string BuildIspAndThrustString(MixtureConfigNode node)
 {
     return(node.atmosphereCurve.Evaluate(0) + "s   Thrust: " + MathUtils.ToStringSI(node.maxThrust, 4, 0, "N"));
 }