Esempio n. 1
0
        private void ButtonDivide_Click(object sender, RoutedEventArgs e)
        {
            plotView.Model.Series.Clear();
            FuzzyNumber result = new FuzzyNumber();
            int         scale;

            ParseFNTextBoxes();
            TryParse(textBoxDiscretization.Text, out var disPara);
            FuzzyNumber fuzzyNumberA = new FuzzyNumber(a1, a2, a3, a4, disPara);
            FuzzyNumber fuzzyNumberB = new FuzzyNumber(b1, b2, b3, b4, disPara);

            result = FNAlgebra.divideAB(fuzzyNumberA, fuzzyNumberB);
            if (fuzzyNumberA.detectFailureChange(result))
            {
                textBoxOutput.Text = "You can't divide by 0";
            }
            else
            {
                resultToContinue   = result;
                textBoxOutput.Text = "{ " + result + "}";
                scale = result.findMaxValueOfFuzzyNumber(fuzzyNumberA, fuzzyNumberB, result);
                PlotModelDefine.ScalePlotOFN(plotView.Model, scale);

                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(fuzzyNumberA, disPara, "Number A"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(fuzzyNumberB, disPara, "Number B"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(result, disPara, "Result"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(fuzzyNumberA, disPara, "Number A"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(fuzzyNumberB, disPara, "Number B"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(result, disPara, "Result"));
                plotView.InvalidatePlot();
            }
        }
Esempio n. 2
0
        // returns value referenced to point [0,0] (X), scales canvas
        private double converterX(double XnumberToConvert, FuzzyNumber fuzzyNumber)
        {
            double tempXnumberToConvert = 0;
            double maxFromFuzzyNumber   = Math.Abs(FuzzyNumber.findMaxValueOfFuzzyNumber(fuzzyNumber));
            double scale = 0;

            if (scaleClass == 0)
            {
                scale      = 960 / maxFromFuzzyNumber / 2;
                scaleClass = scale;
            }
            else
            {
                scale = scaleClass;
            }

            //960 = 0 on X
            tempXnumberToConvert = XnumberToConvert * scale + 960;


            return(tempXnumberToConvert);
        }