vtkDistancePolyDataFilter not working with contours?

Dear VTK experts,

I am trying to use a vtkDistancePolyDataFilter out of python (using vtk==8.1.2 pkg). This seems to work fine for triangle meshes.

  reader1 = vtk.vtkPolyDataReader()
  reader1.SetFileName('E:/temp/meshEstimated.vtk')
  reader1.Update()
  meshEstimated = reader1.GetOutput()

  reader2 = vtk.vtkPolyDataReader()
  reader2.SetFileName('E:/temp/meshGT.vtk')
  reader2.Update()
  meshGT = reader2.GetOutput()

  # compute distance between both meshes
  distanceFilter = vtk.vtkDistancePolyDataFilter()
  distanceFilter.SignedDistanceOff()
  distanceFilter.SetInputData(0, meshEstimated)
  distanceFilter.SetInputData(1, meshGT)
  distanceFilter.Update()

However the same piece of code fails with contours (i.e. points connected by line segments, not triangles) as the filter complains there are supposedly no points / cells to operate on (see also error msg from VTK/vtkDistancePolyDataFilter.cxx at master · Kitware/VTK · GitHub).

I am able to get 100+ number of points and cells and also can render the same object - why does the vtkDistancePolyDataFilter not work in this case? How can I debug / fix / work this around? Swapping the order of which the contours as input to the distance filter or inputting two times the same always gives me the same result …



That filter only works with triangles, not line segments. It would be great if someone added support for line segments, but I’m not aware of plans to add that support.