# Abnormal tube filter radius

**URL:** <https://discourse.vtk.org/t/abnormal-tube-filter-radius/7225>\
**Category:** Development\
**Created:** [November 19, 2021, 5:19pm UTC](https://discourse.vtk.org/t/abnormal-tube-filter-radius/7225 "2021-11-19T17:19:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcomusy](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marcomusy/32/95_2.png) [@marcomusy](https://discourse.vtk.org/u/marcomusy)\
**Post date:** [November 19, 2021, 5:19pm UTC](https://discourse.vtk.org/t/abnormal-tube-filter-radius/7225/1 "2021-11-19T17:19:46Z")

</div>

The `vtkTubeFilter` with fixed radius …is not constant:

```python
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](https://discourse.vtk.org/uploads/default/original/2X/7/77b465923e5c23f16b6e30db305391510b11192e.png)  
(looks fatter at [0,100])

---

<div class="post-metadata">

**Author:** ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)\
**Post date:** [November 20, 2021, 9:34pm UTC](https://discourse.vtk.org/t/abnormal-tube-filter-radius/7225/2 "2021-11-20T21:34:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcomusy](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marcomusy/32/95_2.png) [@marcomusy](https://discourse.vtk.org/u/marcomusy)\
**Post date:** [November 20, 2021, 11:42pm UTC](https://discourse.vtk.org/t/abnormal-tube-filter-radius/7225/3 "2021-11-20T23:42:32Z")

</div>

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.

 ![Screenshot 2021-11-21 at 00.37.51](https://discourse.vtk.org/uploads/default/original/2X/a/aec7a7753faabe5eb41537412caaf1938b0395fc.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)\
**Post date:** [November 21, 2021, 5:53am UTC](https://discourse.vtk.org/t/abnormal-tube-filter-radius/7225/4 "2021-11-21T05:53:20Z")

</div>

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.
