public static void DrawGaussPoints(Graphics area, int w, int h,
                                           string nameFuzzy,
                                           Color colorLine,
                                           double c,
                                           double sigma,
                                           double Xbottom,
                                           double Xtop,
                                           BoundaryTypeEnum bound,
                                           int i = 0)
        {
            double xX = c;
            double yY = MFunc.GaussMF(c, c, sigma, bound);

            var PointConv = ConvertToScreen(xX, yY, w, h, Xbottom, Xtop);
            var xE        = PointConv.X;
            var yE        = PointConv.Y;

            var PointNull = ConvertToScreen(xX, -0.05, w, h, Xbottom, Xtop);

            Pen pen = new Pen(Color.Black, 2);

            area.DrawLine(pen, (float)xE - 2, (float)yE, (float)(xE + 2), (float)yE);
            area.DrawLine(pen, (float)xE, (float)yE - 2, (float)xE, (float)(yE + 2));

            Pen pen_gray = new Pen(Color.Gray);

            pen_gray.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            area.DrawLine(pen_gray, xE, yE, PointNull.X, PointNull.Y);

            // Create font and brush.
            Font       drawFont  = new Font("Arial", 10);
            SolidBrush drawBrush = new SolidBrush(Color.Blue);
            // Set format of string.
            StringFormat drawFormat = new StringFormat();

            drawFormat.Alignment     = StringAlignment.Center;
            drawFormat.LineAlignment = StringAlignment.Near;
            String txt       = (xX).ToString();
            PointF drawPoint = new PointF(PointNull.X, PointNull.Y);

            area.DrawString(txt, drawFont, drawBrush, drawPoint, drawFormat);

            SolidBrush drawBrushName = new SolidBrush(colorLine);

            drawFormat.Alignment     = StringAlignment.Center;
            drawFormat.LineAlignment = StringAlignment.Far;
            txt = nameFuzzy;
            if (i % 2 == 0)
            {
                PointNull = ConvertToScreen(xX, yY + 0.01, w, h, Xbottom, Xtop);
            }
            else
            {
                PointNull = ConvertToScreen(xX, yY + 0.06, w, h, Xbottom, Xtop);
            }
            drawPoint = new PointF(PointNull.X, PointNull.Y);

            area.DrawString(txt, drawFont, drawBrushName, drawPoint, drawFormat);
        }
        private void UpdateFuzzyMF(double notFuz)
        {
            //currentComplaint.MFnotFuzzy = new List<double>();
            foreach (var fuz in currentComplaint.Fuzzy)
            {
                double res = 0;
                switch (fuz.Type)
                {
                case TypeMFuncEnum.GAUSS:
                    fuz.GaussParam = DatabaseManager.Instance.GetGaussMFuncParams(fuz.GaussParam.ID);
                    res            = MFunc.GaussMF(notFuz, fuz.GaussParam.C, fuz.GaussParam.Sigma, fuz.Bound);
                    break;

                case TypeMFuncEnum.TRIANGULARE:
                    fuz.TrianglParam = DatabaseManager.Instance.GetTriangulareMFuncParams(fuz.TrianglParam.ID);
                    res = MFunc.TriangularMF(notFuz, fuz.TrianglParam.A, fuz.TrianglParam.B, fuz.TrianglParam.C, fuz.Bound);
                    break;

                case TypeMFuncEnum.TRAPEZOIDAL:
                    fuz.TrapezParam = DatabaseManager.Instance.GetTrapezoidalMFuncParams(fuz.TrapezParam.ID);
                    res             = MFunc.TrapezoidalMF(notFuz, fuz.TrapezParam.A, fuz.TrapezParam.B, fuz.TrapezParam.C, fuz.TrapezParam.D, fuz.Bound);
                    break;

                default:
                    res = 0;
                    break;
                }
                currentComplaint.MFnotFuzzy.Add(res);
            }
        }
        public static void DrawGaussMF(Graphics area, int w, int h,
                                       Color color,
                                       double c,
                                       double sigma,
                                       double Xbottom,
                                       double Xtop,
                                       BoundaryTypeEnum bound,
                                       QuantifierEnum quantEnum = QuantifierEnum.EMPTY)
        {
            Pen pen = new Pen(color, 2);

            //var w = panel.Width;
            //var h = panel.Height;
            var gx = 0.1f * w;
            var gw = 0.8f * w;
            var gy = 0.1f * h;
            var gh = 0.7f * h;

            var k = (Xtop - Xbottom) / gw;

            double xLast = Xbottom;
            double yLast;// = MFunc.GaussMF(xLast, c, sigma, bound);

            switch (quantEnum)
            {
            case QuantifierEnum.NOT:
                yLast = 1 - MFunc.GaussMF(xLast, c, sigma, bound);
                break;

            case QuantifierEnum.VERY:
                yLast = Math.Pow(MFunc.GaussMF(xLast, c, sigma, bound), 2);
                break;

            case QuantifierEnum.MORE_OR_LESS:
                yLast = Math.Sqrt(MFunc.GaussMF(xLast, c, sigma, bound));
                break;

            default:
                yLast = MFunc.GaussMF(xLast, c, sigma, bound);
                break;
            }

            double y;

            for (int i = 1; i <= gw; i++)
            {
                double x = Xbottom + k * i;
                switch (quantEnum)
                {
                case QuantifierEnum.NOT:
                    y = 1 - MFunc.GaussMF(x, c, sigma, bound);
                    break;

                case QuantifierEnum.VERY:
                    y = Math.Pow(MFunc.GaussMF(x, c, sigma, bound), 2);
                    break;

                case QuantifierEnum.MORE_OR_LESS:
                    y = Math.Sqrt(MFunc.GaussMF(x, c, sigma, bound));
                    break;

                default:
                    y = MFunc.GaussMF(x, c, sigma, bound);
                    break;
                }
                area.DrawLine(pen,
                              (float)gx + i - 1,
                              (float)(gy + (1 - yLast) * gh),
                              (float)gx + i,
                              (float)(gy + (1 - y) * gh));

                xLast = x;
                yLast = y;
            }
        }