//-----------------------------------------------------------------------------------------------
        //Перемещение точек в первый квадрант
        public static Point2D[] DisplacePointsToFirstQuadrant(Point2D[] points)
        {
            double[] minimalCoordinates = PlaneManager.GetMinimalCoordinates(points);
            double   displacementX      = minimalCoordinates[0];
            double   displacementY      = minimalCoordinates[1];

            Point2D[] newPoints = PlaneManager.DisplacePoints(points, -displacementX, -displacementY);
            return(newPoints);
        }
        //-----------------------------------------------------------------------------------------------
        //Минимальные координаты точек
        public static double[] GetMinimalCoordinates(Point2D[] points)
        {
            double[] coordinatesX = PlaneManager.GetCoordinatesX(points);
            double[] coordinatesY = PlaneManager.GetCoordinatesY(points);

            double minX = coordinatesX.Min();
            double minY = coordinatesY.Min();

            double[] minimalCoordinates = new double[] { minX, minY };
            return(minimalCoordinates);
        }
 //-----------------------------------------------------------------------------------------------
 //Расстояния между точками массива и заданной точкой
 public static double[] GetDistances(Point2D[] points, Point2D targetPoint)
 {
     double[] distances = new double[points.Length];
     for (int index = 0; index < points.Length; index++)
     {
         Point2D point    = points[index];
         double  distance = PlaneManager.DistanceBetweenTwoPoints(point, targetPoint);
         distances[index] = distance;
     }
     return(distances);
 }
        //-----------------------------------------------------------------------------------------------
        //-----------------------------------------------------------------------------------------------
        //Выбрать ближайшую к данной точке точку из массива
        public static Point2D GetNearestPoint(Point2D point, Point2D[] points)
        {
            if (points.Length == 1)
            {
                return(points[0]);
            }
            Point2D nearestPoint = points[0];
            double  minDistance  = PlaneManager.DistanceBetweenTwoPoints(point, nearestPoint);

            for (int index = 1; index < points.Length; index++)
            {
                Point2D currentPoint = points[index];
                double  distance     = PlaneManager.DistanceBetweenTwoPoints(point, currentPoint);
                if (distance < minDistance)
                {
                    minDistance  = distance;
                    nearestPoint = currentPoint;
                }
            }
            return(nearestPoint);
        }
        //-------------------------------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------------------------------
        private static void GraphInfoCollectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SwordfishXYLineChartControl chartControl        = d as SwordfishXYLineChartControl;
            IList <GraphInfo>           graphInfoCollection = (IList <GraphInfo>)e.NewValue;

            if (graphInfoCollection == null)
            {
                return;
            }

            chartControl.xyLineChart.Reset();

            for (int index = 0; index < graphInfoCollection.Count; index++)
            {
                GraphInfo graphInfo = graphInfoCollection[index];
                double[]  xValues   = PlaneManager.GetCoordinatesX(graphInfo.GraphPoints);
                double[]  yValues   = PlaneManager.GetCoordinatesY(graphInfo.GraphPoints);

                chartControl.DrawChart
                    (xValues, yValues, graphInfo.GraphColor, graphInfo.GraphName, graphInfo.LineVisibility, graphInfo.PointsVisibility, false);
            }
        }