DataSet.find_cells_along_line#
- DataSet.find_cells_along_line( ) NumpyArray[int][source]#
Find the index of cells whose bounds intersect a line.
Line is defined from
pointatopointb.Warning
This filter internally builds and caches a vtkStaticCellLocator. If the mesh’s geometry is modified, the cache will no longer be valid.
- Parameters:
- pointa
VectorLike Length 3 coordinate of the start of the line.
- pointb
VectorLike Length 3 coordinate of the end of the line.
- tolerance
float,optional The absolute tolerance to use to find cells along line. The default value is the epsilon (
eps) offloat32dtype usingnumpy.finfo.
- pointa
- Returns:
numpy.ndarrayIndex or indices of the cell(s) whose bounds intersect the line.
Warning
This method returns cells whose bounds intersect the line. This means that the line may not intersect the cell itself. To obtain cells that intersect the line, use
pyvista.DataSet.find_cells_intersecting_line().See also
Examples
>>> import pyvista as pv >>> mesh = pv.Sphere() >>> cell_ids = mesh.find_cells_along_line([0.0, 0, 0], [1.0, 0, 0]) >>> sorted(cell_ids.tolist()) [86, 87, 1652, 1653]