vtkTubeFilter is not able to produce closed loops; behaves unexpectedly if first and last point meet
I already pointed this out on stackoverflow. There somebody said I should probably submit this as a bug.
The issue: Imagine four points in space forming a square. Assign these points to a line that has 5 points, where the last point is the same as the first, thus creating a closed loop. Here is a python code snipped:
pts = vtk.vtkPoints() pts.SetNumberOfPoints(4) pts.SetPoint(0, 0.5, 0, 0) pts.SetPoint(1, 1, 0.5, 0) pts.SetPoint(2, 0.5, 1, 0) pts.SetPoint(3, 0, 0.5, 0) lines = vtk.vtkCellArray() lines.InsertNextCell(5) lines.InsertCellPoint(0) lines.InsertCellPoint(1) lines.InsertCellPoint(2) lines.InsertCellPoint(3) lines.InsertCellPoint(0) poly = vtk.vtkPolyData() poly.SetPoints(pts) poly.SetLines(lines) tubes = vtk.vtkTubeFilter() tubes.SetInputData(poly) tubes.CappingOn() tubes.SidesShareVerticesOff() tubes.SetNumberOfSides(4) tubes.SetRadius(0.1) tubes.Update()
Result. The tubes do not connect,
CappingOn() does not change anything. The width of the tubes varies at the end points.
Even if the last and the first point meet on a straight line (by adding a 5th point that lies on one of the sides of the square) the width of the tube changes and it just doesn't look right.