/// <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); }
/// <summary> /// Returns the angle in degrees from the passed point in comparision /// to the x-axis of the centerpoint passed. /// </summary> /// <param name="centerPoint">Center point for the x-axis to calculate the angle against.</param> /// <param name="point">The point to compare against the x-axis.</param> /// <returns>Degrees between the point and the center point.</returns> public static float GetAngle(PointF centerPoint, PointF point) { return(ExtMaths.RadiansToDegrees(PointTransform.GetAngleRadiansTan(centerPoint, point))); }
/// <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); }