mosaic.utils.compute_cell_centroid

mosaic.utils.compute_cell_centroid#

mosaic.utils.compute_cell_centroid(cell_patches, verticesOnCell)#

Compute Centroid of cell patch using shoelace formula

https://en.wikipedia.org/wiki/Centroid#Of_a_polygon

Parameters:
  • cell_patches (np.ndarray) – cell patches to calculate the centroids of (nCells, maxEdges, 2)

  • verticesOnCell (ArrayLike) – mesh connectivity array with ragged cells denoted by -1

Returns:

cx, cy – Patch centroids where each array is of length nCells

Return type:

(np.ndarray, np.ndarray)