[util] add get_aabb

This commit is contained in:
jan 2026-03-07 07:08:36 -08:00
commit d9a9eebe8b

View file

@ -310,6 +310,14 @@ def check_poly(poly: poly_t, check_connectivity: bool = True) -> None:
raise AdzeError('Vertex graph is not 3-vertex-connected')
def get_aabb(poly: poly_t) -> tuple[NDArray, NDArray]:
"""
Get the axis-aligned bounding box of a polyhedron.
"""
if poly['vertices'].shape[0] == 0:
return numpy.zeros(3), numpy.zeros(3)
return poly['vertices'].min(axis=0), poly['vertices'].max(axis=0)
def plot_brep(brep: Sequence[dict[str, NDArray]]) -> None:
"""
Plot a boundary representation