示例#1
0
        public List <Line> ClampedSplineLines(double[] knots, double[] controlPoints, double[] derivations)
        {
            var    lines    = new List <Line>();
            double y        = 0;
            var    previous = new Point();
            var    current  = new Point();

            SetDefaultSplineColor_2();
            for (int i = 0; i < knots.Length - 1; i++)
            {
                bool   canDraw = false;
                double x       = knots[i];
                while (x <= knots[i + 1])
                {
                    if (x >= knots[i + 1] - DrawPrecision)
                    {
                        x = knots[i + 1];
                    }

                    y       = _clampedSplineEngine.HermiteSplineFunctionValue(x, knots[i], controlPoints[i], knots[i + 1], controlPoints[i + 1], derivations[i], derivations[i + 1]);
                    current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                    if (canDraw)
                    {
                        lines.Add(_auxiliaryEngine.DrawLine(previous, current, SPLINE_COLOR_2));
                    }
                    canDraw  = true;
                    previous = current;
                    x       += DrawPrecision;
                }
                SwitchSplineColor_2();
            }
            return(lines);
        }
示例#2
0
        public List <Line> HermiteSplineLines(double[] knots, double[] controlPoints, double[] derivations)
        {
            //if (knots.Length != controlPoints.Length) throw new IncorectSplineInputExcetion("Number of knots cooridnates must be the same as number of controlPoints coordinates")

            var    lines    = new List <Line>();
            double y        = 0;
            var    previous = new Point();
            var    current  = new Point();

            SetDefaultSplineColor_1();
            for (int i = 0; i < knots.Length - 1; i++)
            {
                bool   canDraw = false;
                double x       = knots[i];
                while (x <= knots[i + 1])
                {
                    if (x >= knots[i + 1] - DrawPrecision)
                    {
                        x = knots[i + 1];
                    }
                    y       = _hermiteSplineEngine.HermiteSplineFunctionValue(x, knots[i], controlPoints[i], knots[i + 1], controlPoints[i + 1], derivations[i], derivations[i + 1]);
                    current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                    if (canDraw)
                    {
                        lines.Add(_auxiliaryEngine.DrawLine(previous, current, SPLINE_COLOR_1));
                    }
                    canDraw  = true;
                    previous = current;
                    x       += DrawPrecision;
                }
                SwitchSplineColor_1();
            }
            return(lines);
        }
示例#3
0
        public void BSplineOfDegree3(double[] knot, double cp0, double cp1, double cp2, double cp3)
        {
            double          x        = knot[3];
            double          y        = 0;
            Point           previous = new Point();
            Point           current  = new Point();
            SolidColorBrush color    = new SolidColorBrush();

            color.Color = Color.FromArgb(200, 0, 0, 0);

            do
            {
                y = cp3 * Math.Pow(x - knot[3], 3)
                    + cp2 * (Math.Pow(x - knot[2], 3) - ((Math.Pow(x - knot[3], 3) * (knot[2] - knot[4]) * (knot[2] - knot[5]) * (knot[2] - knot[6])) / ((knot[3] - knot[4]) * (knot[3] - knot[5]) * (knot[3] - knot[6]))))
                    + cp1 * (Math.Pow(x - knot[1], 3) - ((Math.Pow(x - knot[2], 3) * (knot[1] - knot[3]) * (knot[1] - knot[4]) * (knot[1] - knot[5])) / ((knot[2] - knot[3]) * (knot[2] - knot[4]) * (knot[2] - knot[5]))) -
                             ((Math.Pow(x - knot[3], 3) * (knot[1] - knot[2]) * (knot[1] - knot[4]) * (knot[1] - knot[5])) / ((knot[3] - knot[2]) * (knot[3] - knot[4]) * (knot[3] - knot[5]))))
                    + cp0 * (Math.Pow(x - knot[0], 3) - ((Math.Pow(x - knot[1], 3) * (knot[0] - knot[2]) * (knot[0] - knot[3]) * (knot[0] - knot[4])) / ((knot[1] - knot[2]) * (knot[1] - knot[3]) * (knot[1] - knot[4]))) -
                             ((Math.Pow(x - knot[2], 3) * (knot[0] - knot[1]) * (knot[0] - knot[3]) * (knot[0] - knot[4])) / ((knot[2] - knot[1]) * (knot[2] - knot[3]) * (knot[2] - knot[4]))) -
                             ((Math.Pow(x - knot[3], 3) * (knot[0] - knot[1]) * (knot[0] - knot[2]) * (knot[0] - knot[4])) / ((knot[3] - knot[1]) * (knot[3] - knot[2]) * (knot[3] - knot[4]))));
                current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                if (x != knot[3])
                {
                    _auxiliaryEngine.DrawLine(previous, current, color);
                }

                previous = current;
                x       += 0.01;
            } while (x <= knot[4]);
        }
示例#4
0
        internal List <Line> PartialBSplineLines(int degree, double[] knotsWithGeneratedServiceKnots, double[] controlPoints, int fromIdx, int toIdx)
        {
            var    lines = new List <Line>();
            var    controlPointsCount = controlPoints.Length;
            var    isDegreeEven       = degree % 2 == 0;
            double x        = 0;
            double y        = 0;
            var    previous = new Point();
            var    current  = new Point();

            //EngineUtils.ServiceKnots(knots, degree, true);
            SetDefaultSplineColor_1();

            for (int i = fromIdx; i < toIdx; i++)
            {
                bool canDraw = false;
                x = knotsWithGeneratedServiceKnots[i + degree];

                while (x <= knotsWithGeneratedServiceKnots[i + degree + 1])
                {
                    y = 0;
                    for (int j = 0; j <= degree; j++)
                    {
                        try
                        {
                            double[] momentarilyUsedKnots = new double[degree + 2];


                            Array.Copy(knotsWithGeneratedServiceKnots, j + i, momentarilyUsedKnots, 0, degree + 2);
                            if (x >= knotsWithGeneratedServiceKnots[i + degree + 1] - DrawPrecision)
                            {
                                x = knotsWithGeneratedServiceKnots[i + degree + 1];
                            }
                            y += controlPoints[i + j] * _bSplineEngine.Bell(x, degree, momentarilyUsedKnots, isDegreeEven, j + 1);    //degree + 2);
                        }
                        catch (Exception) { }
                    }

                    //current = isDegreeEven ? TransformCoordinates.WorldAreaToPlotArea(x, y, PA, WA) : TransformCoordinates.WorldAreaToPlotArea(x, -y, PA, WA);
                    current = TransformCoordinates.WorldAreaToPlotArea(x, -y, _plotArea, _worldArea);
                    // if (x != knotsWithGeneratedServiceKnots[i + degree])
                    if (canDraw)
                    {
                        lines.Add(_auxiliaryEngine.DrawLine(previous, current, SPLINE_COLOR_1));
                    }
                    canDraw = true;
                    //else {
                    // _auxiliaryEngine.DrawEllipse(current.knots-W_DIV_2,current.controlPoints-H_DIV_2,_SplineColor);
                    //}

                    previous = current;
                    x       += DrawPrecision;
                }
                SwitchSplineColor_1();
            }

            return(lines);
        }
示例#5
0
        public void BellFunctionOfDegree3(double v1, double v2, double v3, double v4, double v5)
        {
            double x           = v1;
            double y           = 0;
            Point  previous    = new Point();
            Point  current     = new Point();
            bool   canMakeLine = false;


            do
            {
                if (x <= v2)
                {
                    y       = Math.Pow(x - v1, 3);
                    current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                    if (canMakeLine)
                    {
                        SolidColorBrush color = new SolidColorBrush();
                        color.Color = Color.FromArgb(200, 255, 0, 0);
                        _auxiliaryEngine.DrawLine(previous, current, color);
                    }
                    else
                    {
                        //  color.Color = Color.FromArgb(200, 80, 80, 80);
                        //  line(plotAreaMin_X, 0, v1, 0, color);
                        //  line(v4, 0, plotAreaMax_X, 0, color);
                        canMakeLine = true;
                    }
                }
                else if (x <= v3)
                {
                    y       = Math.Pow(x - v1, 3) - ((Math.Pow(x - v2, 3) * (v1 - v3) * (v1 - v4) * (v1 - v5)) / ((v2 - v3) * (v2 - v4) * (v2 - v5)));
                    current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                    SolidColorBrush color = new SolidColorBrush();
                    color.Color = Color.FromArgb(200, 0, 255, 0);
                    _auxiliaryEngine.DrawLine(previous.X, previous.Y, current.X, current.Y, color);
                }
                else if (x <= v4)
                {
                    y       = Math.Pow(x - v1, 3) - ((Math.Pow(x - v2, 3) * (v1 - v3) * (v1 - v4) * (v1 - v5)) / ((v2 - v3) * (v2 - v4) * (v2 - v5))) - ((Math.Pow(x - v3, 3) * (v1 - v2) * (v1 - v4) * (v1 - v5)) / ((v3 - v2) * (v3 - v4) * (v3 - v5)));
                    current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                    SolidColorBrush color = new SolidColorBrush();
                    color.Color = Color.FromArgb(200, 0, 0, 255);
                    _auxiliaryEngine.DrawLine(previous.X, previous.Y, current.X, current.Y, color);
                }
                else
                {
                    y       = Math.Pow(x - v1, 3) - ((Math.Pow(x - v2, 3) * (v1 - v3) * (v1 - v4) * (v1 - v5)) / ((v2 - v3) * (v2 - v4) * (v2 - v5))) - ((Math.Pow(x - v3, 3) * (v1 - v2) * (v1 - v4) * (v1 - v5)) / ((v3 - v2) * (v3 - v4) * (v3 - v5))) - ((Math.Pow(x - v4, 3) * (v1 - v2) * (v1 - v3) * (v1 - v5)) / ((v4 - v2) * (v4 - v3) * (v4 - v5)));
                    current = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);
                    SolidColorBrush color = new SolidColorBrush();
                    color.Color = Color.FromArgb(200, 0, 255, 255);
                    _auxiliaryEngine.DrawLine(previous.X, previous.Y, current.X, current.Y, color);
                }

                previous = current;
                x       += DrawPrecision;
            } while (x <= v5);
        }
示例#6
0
        //private double DrawPrecisionDiv2;

        private void Initialize(Canvas canvas, PlotArea pa, WorldArea wa, double drawPrecision)
        {
            this._canvas                = canvas;
            this._plotArea              = pa;
            this._worldArea             = wa;
            this.DrawPrecision          = drawPrecision;
            _waZeroPointInPACoordinates = TransformCoordinates.WorldAreaToPlotArea(0, 0, _plotArea, _worldArea);
            InitColors();
            this._bSplineEngine       = new BSplineGenerator();
            this._hermiteSplineEngine = new HermiteSplineGenerator();
            this._clampedSplineEngine = new ClampedSplineGenerator();
            this._globalBSplineEngine = new GlobalBSplineGenerator();
        }
示例#7
0
        public void BSplineBasisFunction(int degree, double[] knots)
        {
            //int degree = knots.Length - 2;
            bool isDegreeEven = degree % 2 == 0;

            double[] Y        = new double[knots.Length - 1];
            double[] auxKnots = SilverlightApplication3.BSpline.ServiceKnots(knots, degree, false);

            List <Point> previous = new List <Point>();
            List <Point> current  = new List <Point>();

            SolidColorBrush color = new SolidColorBrush();

            color.Color = Color.FromArgb(200, 0, 0, 0);

            for (int i = 0; i < knots.Length - 1; i++)
            {
                previous.Add(new Point());
                current.Add(new Point());
            }
            double x = 0;

            double[] usedKnots = new double[degree + 2];
            do
            {
                for (int i = 0; i < Y.Length; i++)
                {
                    Array.Copy(auxKnots, i, usedKnots, 0, degree + 2);
                    // Array.Reverse(used_knots);
                    Y[i]       = _bSplineEngine.Bell(x, degree, usedKnots, isDegreeEven, i + 1);
                    current[i] = isDegreeEven ? TransformCoordinates.WorldAreaToPlotArea(x, Y[i], _plotArea, _worldArea) : TransformCoordinates.WorldAreaToPlotArea(x, -Y[i], _plotArea, _worldArea);
                    //  current[i] = TransformCoordinates.world_to_plot_area(x, -controlPoints[i], _pa, _wa); //calculate_bell returns correct value (99.999% sure), but if I remove '-'

                    //   current[i] = TransformCoordinates.world_to_plot_area(x, controlPoints[i], _pa, _wa);

                    //basis will be upside down (no idea why) :)
                    if (x != 0)
                    {
                        _auxiliaryEngine.DrawLine(previous[i], current[i], color);
                    }

                    previous[i] = current[i];
                }

                x += DrawPrecision;
            } while (x <= 1);
        }
示例#8
0
        /// <summary>
        /// Calculate and draws runge function where parameters are in WORLD AREA coordinate system
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <param name="numberOfPoints"></param>
        /// <param name="numberOfInterval"></param>
        /// /// <param name="degree"></param>
        public Ellipse[] RungeFunction(double left, double right, int numberOfPoints, int numberOfInterval, int degree)
        {
            SolidColorBrush ellipseColor     = new SolidColorBrush(Color.FromArgb(192, 20, 20, 127));
            SolidColorBrush knotEllipseColor = new SolidColorBrush(Color.FromArgb(192, 20, 127, 127));

            Ellipse[] ellipses = new Ellipse[numberOfPoints];
            double    h        = (right - left) / (numberOfPoints - 1);
            double    x        = left;
            double    y        = 0;


            Point point;

            int[] knotsIndexes = new int[numberOfInterval + 1];

            for (int i = 0; i < knotsIndexes.Length; i++)
            {
                knotsIndexes[i] = i * (numberOfPoints - 1) / numberOfInterval;
            }

            int j = 0;

            for (int i = 0; i < numberOfPoints; i++)
            {
                y = 1 / (1 + x * x);

                point = TransformCoordinates.WorldAreaToPlotArea(x, y, _plotArea, _worldArea);

                if (i == knotsIndexes[j])
                {
                    ellipses[i] = _auxiliaryEngine.DrawEllipse(point, knotEllipseColor);
                    j++;
                }
                else
                {
                    ellipses[i] = _auxiliaryEngine.DrawEllipse(point, ellipseColor);
                }
                x += h;
            }



            return(ellipses);
        }
        public void SetNewWorldArea(double newXMin, double newXMax, double newYMin, double newYMax)
        {
            //if (newXMin < 0.5 || newYMin < 0.5 || newXMax < 0.5 || newYMax < 0.5)
            //{
            //    haha.Text = "Too high zoom";
            //    return;
            //}

            WorldArea oldWA = _worldArea;

            _worldArea = new WorldArea(newXMin, newXMax, newYMin, newYMax);

            _waZeroPointInPACoordinates = TransformCoordinates.WorldAreaToPlotArea(0, 0, _plotArea, _worldArea);
            _engine            = new SplineDrawer(canvas1, _plotArea, _worldArea, DrawPrecision);
            x_min_TextBox.Text = newXMin.ToString();
            x_max_TextBox.Text = newXMax.ToString();
            y_min_TextBox.Text = newYMin.ToString();
            y_max_TextBox.Text = newYMax.ToString();

            ResetCanvas();
        }
示例#10
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////


        public void PolynomialFunction(double[] arguments, double leftInterval, double rightInterval)
        {
            _previous = new Point();
            bool            canMakeLine = false;
            double          y;
            SolidColorBrush color = new SolidColorBrush();

            color.Color = Color.FromArgb(200, 192, 192, 192);
            do
            {
                y = arguments[5] * Math.Pow(leftInterval, 5) + arguments[4] * Math.Pow(leftInterval, 4) + arguments[3] * Math.Pow(leftInterval, 3) +
                    arguments[2] * Math.Pow(leftInterval, 2) + arguments[1] * leftInterval + arguments[0];
                Point current = TransformCoordinates.WorldAreaToPlotArea(leftInterval, y, _plotArea, _worldArea);
                if (canMakeLine)
                {
                    _auxiliaryEngine.DrawLine(_previous.X, _previous.Y, current.X, current.Y, color);
                }
                leftInterval = leftInterval + DrawPrecision;
                canMakeLine  = true;
                _previous    = current;
            } while (leftInterval <= rightInterval);
        }
示例#11
0
        // private object _selectedSpline;
        //private FunctionComboBoxViewModel functionComboBoxViewModel;
        /**********************/

        public MainPage()
        {
            InitializeComponent();
            this.DrawPrecision      = DEFAULT_DRAW_PRECISION;
            this.RedrawingPrecision = DEFAULT_REDRAWING_PRECISION;
            //functionComboBoxViewModel = new FunctionComboBoxViewModel();
            _plotArea  = new PlotArea(PLOT_AREA_MIN_X, PLOT_AREA_MAX_X, PLOT_AREA_MIN_Y, PLOT_AREA_MAX_Y);
            _worldArea = new WorldArea(WORLD_AREA_DEFAULT_MIN_XY, WORLD_AREA_DEFAULT_MAX_XY, WORLD_AREA_DEFAULT_MIN_XY, WORLD_AREA_DEFAULT_MAX_XY);
            // _pa.x_min = 0; _pa.x_max = 775; _pa.y_min = 0; _pa.y_max = 575; _wa.x_min = -10; _wa.x_max = 10; _wa.y_min = -10; _wa.y_max = 10;
            _engine = new SplineDrawer(canvas1, _plotArea, _worldArea, DrawPrecision);
            //_auxiliaryEngine = new AuxiliaryDrawer(canvas1);
            _isMoving = false;
            _waZeroPointInPACoordinates = TransformCoordinates.WorldAreaToPlotArea(0, 0, _plotArea, _worldArea);

            _parser = new Parser();
            InitSplineLists();
            _canvasUtilities = new CanvasUtilities(_plotArea, _worldArea);

            _openFileDialog = new OpenFileDialog();
            _saveFileDialog = new SaveFileDialog();
            InitColors();
            FunctionSelect_ComboBox.SelectedIndex = 0;
            _dragInfoLabel = new DragInfoLabel(CANVAS_TEXT_COLOR);
            //_dragInfoLabel.Margin = new Thickness(20, 30, 0, 0);
            //_dragInfoLabel.Content = "SDAS";
            canvas1.Children.Add(_dragInfoLabel);
            _dragInfoLabel.Visibility = Visibility.Collapsed;
            VersionLabel.Content      = Version();

            try
            {
                this._saveFileDialog.DefaultExt  = ".spline";
                this._openFileDialog.Filter      = "Spline Files|*.spline";
                this._openFileDialog.FilterIndex = 2;
                this._saveFileDialog.Filter      = "Spline Files|*.spline";
                this._saveFileDialog.FilterIndex = 2;
                // this._saveFileDialog.DefaultFileName = "newSplines.spline";
            }
            catch (Exception)
            {
            }
            DefaultCanvas();
            //var s = BSpline.ServiceKnots(new double[] {2,3.75,5},3,true);

            // _engine.BellFunctionOfDegree3(0, 1, 2, 3, 4);
            // _engine.BSplineBasisFunctionsOfDegree3(0, 1, 2, 3, 4, 5, 6, 7);
            //_engine.BSplineBasisFunction(new double[]{0, 1, 2, 3, 4, 5, 6, 7});
            // double[] knots = new double[] {-1,1,2,2.5, 3, 4, 5, 6};
            // Tuple<double[][], double[]> A = GlobalBSplineMatrix(3, knots);
            // double[][] B = A.Item1; //MathMyUtils.MatrixInvert(A.Item1);
            // //double[][] F = MathMyUtils.MatrixInvert(B);
            //// double[][] C = MathMyUtils.TransposeMatrix(B);

            //// //double[][] D = MathMyUtils.MatrixInvert(MathMyUtils.MultiplyMatrices(C, B));
            //// //double[][] E = MathMyUtils.MultiplyMatrices(B, C);
            ////// double[][] YMatrix = MathMyUtils.ArrayToMatrix(knotsFunctionValues);
            // for (int i = 0; i < B.Length; i++)
            // {
            //     String s = "";
            //     for (int j = 0; j < B[i].Length; j++)
            //     {

            //         s += B[i][j].ToString() + " | ";
            //     }
            //     System.Diagnostics.Debug.WriteLine(s);
            // }
        }
示例#12
0
        public GlobalBSpline GlobalBSpline(int degree, double[] knots, double[] controlPoints, bool containsServiceKnots)
        {
            var lines = new List <Line>();

            int controlPointsCount = controlPoints.Length;


            bool isDegreeEven = degree % 2 == 0;

            int k = controlPointsCount - degree;

            //int numberOfEquations = knots.Length - 1;
            double[] auxKnots = containsServiceKnots ? knots : SilverlightApplication3.BSpline.ServiceKnots(knots, degree, true);
            var      intervalIndexesInLines = new List <int>(knots.Length);
            double   x        = 0;
            double   y        = 0;
            Point    previous = new Point();
            Point    current  = new Point();

            SetDefaultSplineColor_2();
            for (int i = 0; i < k; i++)
            {
                //  double[] usedControlPoints = new double[degree + 1];
                x = auxKnots[i + degree];
                //Array.Copy(controlPoints, i, usedControlPoints, 0, degree + 1);
                intervalIndexesInLines.Add(Math.Max(lines.Count - 1, 0));
                bool canDraw = false;
                while (x <= auxKnots[i + degree + 1])
                {
                    y = 0;
                    for (int j = 0; j <= degree; j++)
                    {
                        double[] momentarilyUsedKnots = new double[degree + 2];
                        Array.Copy(auxKnots, j + i, momentarilyUsedKnots, 0, degree + 2);
                        if (x >= auxKnots[i + degree + 1] - DrawPrecision)
                        {
                            x = auxKnots[i + degree + 1];
                        }
                        //y += usedControlPoints[j] * EngineUtils.Bell(momentarilyUsedKnots, x, degree, isDegreeEven, j + 1);
                        y += controlPoints[j + i] * _bSplineEngine.Bell(x, degree, momentarilyUsedKnots, isDegreeEven, j + 1);
                    }

                    //current = isDegreeEven ? TransformCoordinates.WorldAreaToPlotArea(x, y, PA, WA) : TransformCoordinates.WorldAreaToPlotArea(x, -y, PA, WA);
                    current = TransformCoordinates.WorldAreaToPlotArea(x, -y, _plotArea, _worldArea);
                    if (canDraw)
                    {
                        lines.Add(_auxiliaryEngine.DrawLine(previous, current, SPLINE_COLOR_2));
                    }
                    canDraw = true;
                    //else {
                    // _auxiliaryEngine.DrawEllipse(current.knots-W_DIV_2,current.controlPoints-H_DIV_2,_SplineColor);
                    //}

                    previous = current;
                    x       += DrawPrecision;
                }
                SwitchSplineColor_2();
            }
            intervalIndexesInLines.Add(lines.Count - 1);
            for (int i = 0; i < intervalIndexesInLines.Count; i++)
            {
                System.Diagnostics.Debug.WriteLine(intervalIndexesInLines[i].ToString());
            }
            return(new GlobalBSpline(degree, controlPoints.ToList(), knots.ToList(), lines));
        }
示例#13
0
        public void BSplineBasisFunctionsOfDegree3(double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8)
        {
            double x  = 0;
            double y1 = 0;
            double y2 = 0;
            double y3 = 0;
            double y4 = 0;

            Point previous1 = new Point();
            Point current1  = new Point();
            Point previous2 = new Point();
            Point current2  = new Point();
            Point previous3 = new Point();
            Point current3  = new Point();
            Point previous4 = new Point();
            Point current4  = new Point();

            bool canMakeLine = false;

            do
            {
                y1 = Math.Pow(x - v1, 3) - ((Math.Pow(x - v2, 3) * (v1 - v3) * (v1 - v4) * (v1 - v5)) / ((v2 - v3) * (v2 - v4) * (v2 - v5))) -
                     ((Math.Pow(x - v3, 3) * (v1 - v2) * (v1 - v4) * (v1 - v5)) / ((v3 - v2) * (v3 - v4) * (v3 - v5))) -
                     ((Math.Pow(x - v4, 3) * (v1 - v2) * (v1 - v3) * (v1 - v5)) / ((v4 - v2) * (v4 - v3) * (v4 - v5)));
                y2 = Math.Pow(x - v2, 3) - ((Math.Pow(x - v3, 3) * (v2 - v4) * (v2 - v5) * (v2 - v6)) / ((v3 - v4) * (v3 - v5) * (v3 - v6))) -
                     ((Math.Pow(x - v4, 3) * (v2 - v3) * (v2 - v5) * (v2 - v6)) / ((v4 - v3) * (v4 - v5) * (v4 - v6)));
                y3       = Math.Pow(x - v3, 3) - ((Math.Pow(x - v4, 3) * (v3 - v5) * (v3 - v6) * (v3 - v7)) / ((v4 - v5) * (v4 - v6) * (v4 - v7)));
                y4       = Math.Pow(x - v4, 3);
                current1 = TransformCoordinates.WorldAreaToPlotArea(x, y1, _plotArea, _worldArea);
                current2 = TransformCoordinates.WorldAreaToPlotArea(x, y2, _plotArea, _worldArea);
                current3 = TransformCoordinates.WorldAreaToPlotArea(x, y3, _plotArea, _worldArea);
                current4 = TransformCoordinates.WorldAreaToPlotArea(x, y4, _plotArea, _worldArea);

                if (canMakeLine)
                {
                    SolidColorBrush color1 = new SolidColorBrush();
                    SolidColorBrush color2 = new SolidColorBrush();
                    SolidColorBrush color3 = new SolidColorBrush();
                    SolidColorBrush color4 = new SolidColorBrush();
                    SolidColorBrush color  = new SolidColorBrush();
                    color1.Color = Color.FromArgb(200, 255, 0, 0);
                    _auxiliaryEngine.DrawLine(previous1.X, previous1.Y, current1.X, current1.Y, color1);

                    color2.Color = Color.FromArgb(200, 0, 255, 0);
                    _auxiliaryEngine.DrawLine(previous2.X, previous2.Y, current2.X, current2.Y, color2);

                    color3.Color = Color.FromArgb(200, 0, 0, 255);
                    _auxiliaryEngine.DrawLine(previous3.X, previous3.Y, current3.X, current3.Y, color3);

                    color4.Color = Color.FromArgb(200, 0, 255, 255);
                    _auxiliaryEngine.DrawLine(previous4.X, previous4.Y, current4.X, current4.Y, color4);
                }
                else
                {
                    canMakeLine = true;
                }
                previous1 = current1;
                previous2 = current2;
                previous3 = current3;
                previous4 = current4;

                x += DrawPrecision;
            } while (x <= 1);
        }