# How to get the cell ids of mesh intersected with line using vtk ?

**URL:** https://discourse.vtk.org/t/how-to-get-the-cell-ids-of-mesh-intersected-with-line-using-vtk/6798
**Category:** VR/AR
**Created:** [October 11, 2021, 1:01pm UTC](https://discourse.vtk.org/t/how-to-get-the-cell-ids-of-mesh-intersected-with-line-using-vtk/6798 "2021-10-11T13:01:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Muhammad\_Ahmed](https://discourse.vtk.org/user_avatar/discourse.vtk.org/muhammad_ahmed/32/4056_2.png) [@Muhammad\_Ahmed](https://discourse.vtk.org/u/Muhammad_Ahmed)
#### Post date: [October 11, 2021, 1:01pm UTC](https://discourse.vtk.org/t/how-to-get-the-cell-ids-of-mesh-intersected-with-line-using-vtk/6798/1 "2021-10-11T13:01:22Z")

</div>

I have a code for mesh generated myself and I have a defined line too. I want to use vtk to extract all the cells which are intersected with line. How do I access my data in vtk and what functions should I use to find intersection condition ?

---

<div class="post-metadata">

### Author: ![thegbiv](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thegbiv/32/2784_2.png) [@thegbiv](https://discourse.vtk.org/u/thegbiv)
#### Post date: [October 13, 2021, 4:04am UTC](https://discourse.vtk.org/t/how-to-get-the-cell-ids-of-mesh-intersected-with-line-using-vtk/6798/2 "2021-10-13T04:04:52Z")

</div>

Hi Muhammad,  
I think vtkCellLocator can help you out.  
Take a look at the [Find Cell Intersections](https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/FindCellIntersections/) example.

Gerrick
