/// <summary> /// repositions the polygon so the Centroid is the origin. /// </summary> /// <param name="vertices">The vertices of the polygon.</param> /// <returns>The vertices of the polygon with the Centroid as the Origin.</returns> public static Vector2D[] MakeCentroidOrigin(Vector2D[] vertices) { Vector2D centroid; BoundingPolygon.GetCentroid(vertices, out centroid); return(OperationHelper.ArrayRefOp <Vector2D, Vector2D, Vector2D>(vertices, ref centroid, Vector2D.Subtract)); }
/// <summary> /// Calculates the Centroid of a polygon. /// </summary> /// <param name="vertices">The vertices of the polygon.</param> /// <returns>The Centroid of a polygon.</returns> /// <remarks> /// This is Also known as Center of Gravity/Mass. /// </remarks> public static Vector2D GetCentroid(Vector2D[] vertices) { Vector2D result; BoundingPolygon.GetCentroid(vertices, out result); return(result); }