vtkTubeFilter with rounded corners

Hello,

I believe you’re better off if you round the corners of the input polyline (see graphics - How to "soften" the edges of a polyline? - Stack Overflow) before processing it with the tube filter. This way you’ll likely get tubes with round elbows. Here (https://public.kitware.com/pipermail/vtkusers/2014-May/083921.html) you can find an algorithm in Python to produce rounded corners given an input 3D path/polyline.

Alternativelly, you can use the following pipeline: edges → implicit modeler → distance field → compute isosurface (e.g. for 1") → a smooth tube around the edges with 1" radius. Here’s a Python code illustrating that:

def polylineToTube(edges, radius, resolution=10, sampling=400):
    modeller = vtk.vtkImplicitModeller()
    modeller.SetSampleDimensions(sampling, sampling, sampling)
    modeller.SetInputData(edges)
    contours = vtk.vtkContourFilter()
    contours.SetInputConnection(modeller.GetOutputPort())
    contours.SetValue(0, radius) # generate iso-surface at radius
    contours.Update()
    return contours

source: https://discourse.vtk.org/t/how-to-show-a-polyline-with-arbitrary-width-and-nice-joins-between-the-nodes

I hope this helps,

PC