I naively thought that the vtkDistancePolyDataFilter
would work with point clouds, but I’m getting this error message:
2021-11-05 19:05:03.577 ( 0.200s) [ 9E35740]vtkDistancePolyDataFilt:87 ERR| vtkDistancePolyDataFilter (0x562ec60a9af0): No points/cells to difference from
import numpy as np
import vtk
from vedo import Points
def dist(poly1, poly2):
df = vtk.vtkDistancePolyDataFilter()
df.ComputeSecondDistanceOff()
df.SetInputData(0, poly1)
df.SetInputData(1, poly2)
df.SignedDistanceOff()
df.Update()
return df.GetOutput()
pts1 = Points(np.random.randn(1000,3))
pts2 = Points(np.random.randn(1000,3))
poly1 = pts1.polydata() # vtkPolyData
poly2 = pts2.polydata()
print(poly1.GetNumberOfPoints(), poly1.GetNumberOfCells()) # 1000,1000
dist(poly1, poly2)
what am I doing wrong?