porepy.geometry.bounding_box module

Compute bounding boxes of geometric objects.

from_grid(g)[source]

Return the bounding box of the grid.

Parameters

g (Grid) – The grid for which the bounding box is to be computed.

Returns

A 2-tuple containing

ndrarray: shape=(3,)

Minimum node coordinates in each direction.

ndrarray: shape=(3,)

Maximum node coordinates in each direction.

Return type

tuple[numpy.ndarray, numpy.ndarray]

from_md_grid(mdg, as_dict=False)[source]

Return the bounding box of a mixed-dimensional grid.

Parameters
  • mdg (MixedDimensionalGrid) – Mixed-dimensional grid for which the bounding box is to be computed.

  • as_dict (bool) –

    default=False

    If True, the bounding box is returned as a dictionary, if False, it is represented by arrays with max and min values.

Returns

If as_dict is True, the bounding box is represented as a dictionary with keys xmin, xmax, ymin, ymax, zmin, and zmax.

Else, two ndarrays are returned, containing the min and max values of the coordinates, respectively.

Return type

Union[dict[str, float], tuple[numpy.ndarray, numpy.ndarray]]

from_points(pts, overlap=0)[source]

Obtain a bounding box for a point cloud.

Parameters
  • pts (ndarray) –

    shape=(nd, np)

    Point cloud. nd should be 2 or 3.

  • overlap (float) –

    default=0

    Extension of the bounding box outside the point cloud. Scaled with extent of the point cloud in the respective dimension.

Returns

The domain represented as a dictionary with keywords xmin, xmax, ymin, ymax, and (if nd == 3) zmin and zmax.

Return type

dict[str, float]

make_bounding_planes_from_box(box)[source]

Translate the bounding box into fractures. Tag them as boundaries.

For now the domain specification is limited to a box consisting of six planes.

Parameters

box (dict[str, float]) – Dictionary containing max and min coordinates in three dimensions. The dictionary should contain the keys xmin, xmax, ymin, ymax, zmin, and zmax.

Returns

List of the six bounding planes defined by 3 x 4 coordinate values.

Return type

list[numpy.ndarray]