internal TakeoffComputation(TakeoffSpeedValues Values)
 {
     this.Values = Values;
     this.Output = Adjust(Compute());
 }
        private TakeOffOutput Adjust(TakeOffOutput CurrOutput)
        {
            if (Values.BasicVals.Flaps == FlapsSetting.F35)
            {
                Failed = true; return(new TakeOffOutput());
            }
            TakeOffOutput NewOutput = CurrOutput;

            if (CurrOutput.VR > CurrOutput.V2)
            {
                NewOutput.V2 = CurrOutput.VR;
            }
            if (Values.AntiIce)
            {
                NewOutput.V2 += 20; NewOutput.VCLB += 20; NewOutput.VFRI += 20;
            }
            if (Values.Conditions == RunwayConditions.WET || Values.Conditions == RunwayConditions.ICE)
            {
                NewOutput.V1 -= 8;
                double HeadwindComponent = 0.0;
                double Angle             = Values.RunwayHdg + 90 - Values.WindHdg;
                int    Multiplier        = Angle >= 0 ? -1 : 1;
                double SinAngle          = Math.Sin(Math.Abs(Angle) * (Math.PI / 180.0));
                if (SinAngle == 0)
                {
                    HeadwindComponent = 0.0;
                }
                else
                {
                    HeadwindComponent = (this.Values.WindSpd * Multiplier) / SinAngle;
                }
                if (HeadwindComponent < 0)
                {
                    NewOutput.V1 += (int)Math.Round(0.3 * Math.Round(HeadwindComponent));
                }
                else
                {
                    NewOutput.V1 += (int)Math.Round(0.1 * Math.Round(HeadwindComponent));
                }
                if (Values.Conditions == RunwayConditions.ICE)
                {
                    NewOutput.VFRI += 20;
                    NewOutput.VCLB += 20;
                }
            }
            switch (Values.BasicVals.Flaps)
            {
            case FlapsSetting.F5:
                if (NewOutput.VR < 108)
                {
                    NewOutput.VR = 108;
                }
                if (NewOutput.V1 < 97)
                {
                    NewOutput.V1 = 97;
                }
                break;

            case FlapsSetting.F10:
                if (NewOutput.VR < 104)
                {
                    NewOutput.VR = 104;
                }
                if (NewOutput.V1 < 96)
                {
                    NewOutput.V1 = 96;
                }
                break;

            case FlapsSetting.F15:
                if (NewOutput.VR < 100)
                {
                    NewOutput.VR = 100;
                }
                if (NewOutput.V1 < 96)
                {
                    NewOutput.V1 = 96;
                }
                break;
            }
            return(NewOutput);
        }