[util] add get_aabb
This commit is contained in:
parent
0bed641d08
commit
d9a9eebe8b
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue