pysdic.PointCloud.bounding_box#

PointCloud.bounding_box()[source]#

Compute the axis-aligned bounding box of the point cloud.

The bounding box is defined by the minimum and maximum coordinates along each axis \((x, y, z, ...)\).

Note

The non-finite values (NaN, Inf) are ignored in the computation. If the point cloud is empty or contains only non-finite values, a ValueError is raised.

Returns:

  • numpy.ndarray – The minimum coordinates of the bounding box as a NumPy array of shape \((E,)\) representing (min_x, min_y, min_z, …).

  • numpy.ndarray – The maximum coordinates of the bounding box as a NumPy array of shape \((E,)\) representing (max_x, max_y, max_z, …).

Raises:

ValueError – If the point cloud is empty or contains only non-finite values.

Return type:

Tuple[ndarray, ndarray]

Examples

Create a tetrahedron point cloud and compute its bounding box.

1import numpy as np
2from pysdic import PointCloud
3
4# Create a tetrahedron point cloud
5tetrahedron_points = np.array([[0, 0, 0], [1, 0, 0], [0, 2, 0], [0, 0, 3]])  # shape (4, 3)
6point_cloud = PointCloud.from_array(tetrahedron_points)

Compute the bounding box using the bounding_box method.

1# Compute the bounding box of the point cloud
2min_coords, max_coords = point_cloud.bounding_box()
3print("Min coordinates:", min_coords)
4print("Max coordinates:", max_coords)
5# Output:
6# Min coordinates: [0. 0. 0.]
7# Max coordinates: [1. 2. 3.]