private void DrawGraph(SKCanvas Canvas, SKPoint[] Points, object[] Parameters, SKPoint[] PrevPoints, object[] PrevParameters,
                               DrawingArea DrawingArea)
        {
            SKPaint Brush = null;
            SKPath  Path  = null;

            try
            {
                Brush = new SKPaint()
                {
                    Style = SKPaintStyle.Fill,
                    Color = Graph.ToColor(Parameters[0])
                };
                Path = new SKPath();

                Path = Plot2DCurve.CreateSpline(Points);

                if (PrevPoints is null)
                {
                    IElement Zero;
                    ISet     Set = DrawingArea.MinY.AssociatedSet;

                    if (Set is IGroup Group)
                    {
                        Zero = Group.AdditiveIdentity;
                    }
                    else
                    {
                        Zero = new DoubleNumber(0);
                    }

                    IVector XAxis = VectorDefinition.Encapsulate(new IElement[] { DrawingArea.MinX, DrawingArea.MaxX }, false, this) as IVector;
                    IVector YAxis = VectorDefinition.Encapsulate(new IElement[] { Zero, Zero }, false, this) as IVector;

                    PrevPoints = DrawingArea.Scale(XAxis, YAxis);

                    if (DrawingArea.MinX is StringValue && DrawingArea.MaxX is StringValue)
                    {
                        PrevPoints[0].X = Points[0].X;
                        PrevPoints[1].X = Points[Points.Length - 1].X;
                    }
                }

                PrevPoints = (SKPoint[])PrevPoints.Clone();
                Array.Reverse(PrevPoints);
                Plot2DCurve.CreateSpline(Path, PrevPoints);

                Path.LineTo(Points[0]);

                Canvas.DrawPath(Path, Brush);
            }
            finally
            {
                if (Brush != null)
                {
                    Brush.Dispose();
                }

                if (Path != null)
                {
                    Path.Dispose();
                }
            }
        }
Exemple #2
0
 public static void GetCubicBezierCoefficients(double[] V, out double[] A, out double[] B)
 {
     Plot2DCurve.GetCubicBezierCoefficients(V, out A, out B);
 }