magnet.geometric_utils.polygon_centroid#
- magnet.geometric_utils.polygon_centroid(v: ndarray) ndarray #
Compute the centroid of a 2D polygon.
- Parameters:
v (np.ndarray of float) – array of shape (N, 2), where N is the number of vertices of the polygon, containing the coordinates of its vertices ordered as they are encountered on the perimeter (clockwise or not is indifferent).
- Returns:
The computed area.
- Return type:
float