What is best way to get the highest point (z-axis) in a polydata?

If you’re looking for an easy way to do this in Python with VTK, check out PyVista which makes using VTK a bit more Pythonic. For example, here I load an existing vtkPolyData object of a large point cloud (3392091 points) and find the vertex with the highest Z value in like no time at all:

import pyvista as pv
from pyvista import examples

# This is vtkPolyData
poly = examples.download_lidar()

idx = np.argmax(poly.points[:,2])
print(idx)
1 Like