Abnormal tube filter radius

The vtkTubeFilter with fixed radius …is not constant:

import vtk
from vedo import Line, show

pts = [[100,0], [200,0], [200,200], [0,200], [0,0]]
poly = Line(pts, closed=True).polydata()

tuf = vtk.vtkTubeFilter()
tuf.SetNumberOfSides(10)
tuf.SetInputData(poly)
tuf.SetRadius(5)
tuf.Update()

show(tuf.GetOutput(), axes=1)

Screenshot from 2021-11-19 18-12-21
(looks fatter at [0,100])

1 Like

It might be just camera distortion. Does it happen if you make the camera use parallel projection?

Number of sides is also quite low, you could try 30 or 60 to see if it makes a difference.

1 Like

I tried to change both things but it seems nothing happens…
If I increase the radius to 25 the radius at [100,0,0] is indeed 25 the rest of the tube radius is about 18.

I just realized that you created the rectangle with just 4 points!

The tube filter narrows the tube at sharp elbow points. I have never checked why, always just assumed that it is a feature that reduces self-intersection.

Therefore, if you want constant radius then you need to subdivide the line. For a 90 degree corner and a large tube radius you may need to subdivide each line segment using 50-100 points, but for most cases a few dozens of points should be sufficient.

1 Like