[vtkusers] vtkTubeFilter doesn't create a closed loop

Maximilian Wormser max.wormser at gmx.de
Tue Jul 19 06:38:29 EDT 2016


Good idea, but SetCappingOff or SetCappingOn do not change the underlying problem.

 

Von: lihouxing [mailto:lihouxing at yeah.net] 
Gesendet: Dienstag, 19. Juli 2016 11:02
An: max.wormser at gmx.de; vtkusers at vtk.org
Betreff: Re:[vtkusers] vtkTubeFilter doesn't create a closed loop

 

maybe you should set "capping off"

 

 

 

发自我的小米手机

在 Maximilian Wormser <max.wormser at gmx.de <mailto:max.wormser at gmx.de> >,2016年7月19日 下午3:51写道:

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-vtktubefilter

 

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/05a7e787/attachment.html>


More information about the vtkusers mailing list