Footpoints of streamline

Hi, I would like to extract the coordinate of the footprints of streamlines. Thanks in advance.

Um, what is a streamline footprint?

The endpoints of streamlines.

I can’t think of any existing filters that will do this easily. But I think a Programmable Filter with this script will extract the first and last point of each streamline:

input0 = inputs[0]
numCells = input0.GetNumberOfCells()

# Clear output
output.DeepCopy(vtk.vtkPolyData())

newPoints = vtk.vtkPoints()
newPoints.Resize(numCells * 2)

output.AllocateEstimate(0, 1, numCells, 2, 0, 0, 0, 0)

for cellIndex in range(numCells):
    cellPoints = input0.GetCell(cellIndex).GetPoints()
    firstPoint = cellPoints.GetPoint(0)
    lastPoint = cellPoints.GetPoint(cellPoints.GetNumberOfPoints() - 1)
    ptidx1 = newPoints.InsertNextPoint(firstPoint)
    ptidx2 = newPoints.InsertNextPoint(lastPoint)
    output.InsertNextCell(vtk.VTK_LINE, (ptidx1, ptidx2))

output.SetPoints(newPoints)

1 Like