pyvista.DataSet.find_cells_intersecting_line

pyvista.DataSet.find_cells_intersecting_line#

DataSet.find_cells_intersecting_line(
pointa: VectorLike[float],
pointb: VectorLike[float],
tolerance: float = 0.0,
) NumpyArray[int][source]#

Find the index of cells that intersect a line.

Line is defined from pointa to pointb. This method requires vtk version >=9.2.0.

Parameters:
pointasequence[float]

Length 3 coordinate of the start of the line.

pointbsequence[float]

Length 3 coordinate of the end of the line.

tolerancefloat, default: 0.0

The absolute tolerance to use to find cells along line.

Returns:
numpy.ndarray

Index or indices of the cell(s) that intersect the line.

Examples

>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> mesh.find_cells_intersecting_line([0.0, 0, 0], [1.0, 0, 0])
array([  86, 1653])