Hi
Have a look at the sample below. I’ve got a polyline and want to show that line with an arbitrary width.
In the sample, I essentially follow this example to achieve this, for a polyline that I extracted with vtkFeatureEdges. It appears that the line is drawn using quads per line-segment, however the result doesn’t look satisfactory.
Is it possible to create a polyline with nice joins? I found the ribbon filter, but it requires me to set a normal. Instead, I would rather like to see a tube that goes along that line.
I could possibly use vmtkcenterlinemodeller, but wondered if there is a pure VTK option. I need this just for visualization.
Thanks
Update: I found vtkTubeFilter that does the job much better. But still, it lacks the possibility to create nice joins.
def polylineToTube(edges, radius, resolution=10):
tube = vtk.vtkTubeFilter()
tube.SetInputData(edges)
tube.SetRadius(radius)
tube.SetNumberOfSides(resolution)
tube.SidesShareVerticesOff()
tube.Update()
return tube
Update 2: If really desperate, one could use implicit functions to compute the tube. It’s super slow, but it works
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