diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape.py b/src/ifcopenshell-python/ifcopenshell/util/shape.py index 62cdb0d0f0..77c28ee1ab 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape.py @@ -417,7 +417,7 @@ def get_element_top_elevation(element: ifcopenshell.entity_instance, geometry: S return max([v[2] for v in get_element_vertices(element, geometry)]) -def get_bbox(vertices: Iterable[VECTOR_3D]) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: +def get_bbox(vertices: npt.NDArray[np.float64]) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: """Gets the bounding box of vertices :param vertices: An iterable of vertices @@ -426,16 +426,7 @@ def get_bbox(vertices: Iterable[VECTOR_3D]) -> tuple[npt.NDArray[np.float64], np right. E.g. (np.array([minx, miny, minz]), np.array([maxx, maxy, maxz])) """ - x_values = [v[0] for v in vertices] - y_values = [v[1] for v in vertices] - z_values = [v[2] for v in vertices] - minx = min(x_values) - maxx = max(x_values) - miny = min(y_values) - maxy = max(y_values) - minz = min(z_values) - maxz = max(z_values) - return (np.array([minx, miny, minz]), np.array([maxx, maxy, maxz])) + return (np.min(vertices, axis=0), np.max(vertices, axis=0)) def get_area_vf(vertices: npt.NDArray[np.float64], faces: npt.NDArray[np.int32]) -> float: