find_cells_along_line#

UnstructuredGrid.find_cells_along_line(pointa: Iterable[float], pointb: Iterable[float], tolerance=0.0) ndarray#

Find the index of cells in this mesh along a line.

Line is defined from pointa to pointb.

Parameters:
pointaiterable(float)

Length 3 coordinate of the start of the line.

pointbiterable(float)

Length 3 coordinate of the end of the line.

tolerancefloat, optional

The absolute tolerance to use to find cells along line.

Returns:
numpy.ndarray

Index or indices of the cell in this mesh that are closest to the given point.

Examples

>>> import pyvista
>>> mesh = pyvista.Sphere()
>>> index = mesh.find_cells_along_line([0, 0, 0], [0, 0, 1.0])