[find_faces] handle empty poly

This commit is contained in:
Jan Petykiewicz 2026-03-31 23:29:18 -07:00
commit 35bced6e55

View file

@ -106,6 +106,8 @@ def find_faces(neighbors: NDArray[numpy.integer]) -> list[NDArray[numpy.intp]]:
face, starting with the lowest index in the face. face, starting with the lowest index in the face.
""" """
num_verts = neighbors.shape[0] num_verts = neighbors.shape[0]
if num_verts == 0:
return []
edge_id = numpy.arange(3 * num_verts) edge_id = numpy.arange(3 * num_verts)
v_start, nxt_edge = numpy.divmod(edge_id, 3) # arange % 3 is faster than tile v_start, nxt_edge = numpy.divmod(edge_id, 3) # arange % 3 is faster than tile