[vtkusers] vtkTubeFilter doesn't create a closed loop

Maximilian Wormser max.wormser at gmx.de
Tue Jul 19 03:45:14 EDT 2016


Hey all,

 

I want to create closed loops with vtkTubeFilter, but at the point where the
first and the last point meet there is always a misconnection. vtkStripper
and vtkCleanPolyData do not help in this case. I already posted my problem
to stackoverflow, but without any solutions so far. Here is a link to my
submission:
http://stackoverflow.com/questions/38266711/creating-a-closed-loop-with-vtkt
ubefilter

 

Here's a minimal working example to reproduce the behavior:

 

import vtk

 

 

def rendering(mapper):

    """Takes mapper and handles the rendering."""

    actor = vtk.vtkActor()

    actor.SetMapper(mapper)

 

    # Create a renderer, render window, and interactor

    renderer = vtk.vtkRenderer()

    renderWindow = vtk.vtkRenderWindow()

    renderWindow.AddRenderer(renderer)

    renderWindowInteractor = vtk.vtkRenderWindowInteractor()

    renderWindowInteractor.SetRenderWindow(renderWindow)

    # Add the actors to the scene

    renderer.AddActor(actor)

    # Render and interact

    renderWindow.Render()

    renderWindowInteractor.Start()

    return

 

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()

 

mapper = vtk.vtkPolyDataMapper()

mapper.SetInputData(tubes.GetOutput())

rendering(mapper)

 

Thanks in advance for any help!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160719/426b03dd/attachment.html>


More information about the vtkusers mailing list