I know that it is possible to extract boundary edges using
vtkFeatureEdges. See this example. The edges are returned as a new
vtkPolyData consisting of one or more
However, I require the point ids of the input surface, and not an independent poly with new points and edges. How to achieve that?
I tried to use
vtkIdFilter (in the hope that
vtkFeatureEdges preserves point data), to no avail. Alternatively, I could use a point locator to find the boundary points again in the original surface. However, this looks a bit awkward to me. Is there a simpler way to achieve this?
My first attempt would be to assign the id’s to a scalar field (to the vertexes) in the original mesh as
vtkFeatureEdges is supposed to preserve scalars in the output. This would be a little less awkward, IMO, than performing a spatial search.
I totally agree. Using
vtkIdFilter is the right way (it creates such a scalar array with the ids as point data). I had messed up something in my tests. The following works:
idFilter = vtk.vtkIdFilter()
# Available for vtk>=8.3:
edges = vtk.vtkFeatureEdges()
array = edges.GetOutput().GetPointData().GetArray("ids")
n = edges.GetOutput().GetNumberOfPoints()
boundaryIds = 
for i in range(n):