Ejemplo n.º 1
0
        /// <summary>
        /// Gets the average distance of the passed points from the center.
        /// </summary>
        /// <param name="center">Center to calculate distance from.</param>
        /// <param name="points">Points to average distance for.</param>
        /// <returns></returns>
        public static float GetAvgDistanceFromCenter(PointF center, PointF[] points)
        {
            if (points.Length == 0)
            {
                return(0f);
            }

            float avgDist = 0f;

            for (int i = 0; i < points.Length; i++)
            {
                PointF p = points[i];
                avgDist += PointTransform.GetDistance(center, p);
            }
            avgDist /= points.Length;

            return(avgDist);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the distance of the passed point from the center.
        /// </summary>
        /// <param name="center">Center to calculate distance from.</param>
        /// <param name="points">Point to distance for.</param>
        /// <returns></returns>
        public static float GetDistanceFromCenter(PointF center, PointF point)
        {
            float dist = PointTransform.GetDistance(center, point);

            return(dist);
        }