//-----------------------------------------------------------------------------------------------
 //Расстояния между точками массива и заданной точкой
 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);
        }