How to pick a cell from vtkPolyData by coordinate

1- use vtkCellPicker
2- get picked cell then loop the edges
3- calculate distance between “clickedcoord” and each edge and find minimum
4- use minimum edge points to get ids from edge data using FindPoint function
5- use GetPointCells function on edge data to get cells of point 1 and 2 of the selected edge
6- the common cell id is the line id in your edge data

1 Like