I have mesh grid and there is a line passing through several cells. I want to get all the cells which are intersected by line. I have start and end points of line and I have mesh vertexes coordinates. What is the fastest way to compute this condition, is there any way, I could use vtk class ?
Asked
Active
Viewed 180 times
1 Answers
0
You can check the vtk class vtkOBBTree
, and the method IntersectWithLine
. This is python, but you get the idea of how it works here
from vedo import dataurl, Mesh, Line, show
m = Mesh(dataurl+'bunny.obj')
l = Line([-0.15,0.1,0], [0.1,0.1,0], c='k', lw=3)
pts_cellids = m.intersectWithLine(l, returnIds=True)
print(pts_cellids)
show(m, l, axes=1)
You should get cells ids: [3245 1364]

mmusy
- 1,292
- 9
- 10