[vtkusers] vtkTubeFilter doesn't create a closed loop
Andras Lasso
lasso at queensu.ca
Tue Jul 19 09:46:35 EDT 2016
If start and end points of the tube are the same then http://www.vtk.org/doc/nightly/html/classvtkCleanPolyData.html will merge them.
Andras
From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Maximilian Wormser
Sent: July 19, 2016 9:09
To: 'David Gobbi' <david.gobbi at gmail.com>
Cc: 'VTK Users' <vtkusers at vtk.org>
Subject: Re: [vtkusers] vtkTubeFilter doesn't create a closed loop
Oh what a shame :( do you know where the best place is to submit this as a feature request?
Von: David Gobbi [mailto:david.gobbi at gmail.com]
Gesendet: Dienstag, 19. Juli 2016 14:58
An: Maximilian Wormser <max.wormser at gmx.de<mailto:max.wormser at gmx.de>>
Cc: VTK Users <vtkusers at vtk.org<mailto:vtkusers at vtk.org>>
Betreff: Re: [vtkusers] vtkTubeFilter doesn't create a closed loop
Hi Maximilian,
I did a quick read-through of the code for vtkTubeFilter, and it doesn't check to see if the first and last points are the same point. So unless someone provides a fix, you might be out of luck.
- David
On Tue, Jul 19, 2016 at 4:38 AM, Maximilian Wormser <max.wormser at gmx.de<mailto:max.wormser at gmx.de>> wrote:
Good idea, but SetCappingOff or SetCappingOn do not change the underlying problem.
Von: lihouxing [mailto:lihouxing at yeah.net<mailto:lihouxing at yeah.net>]
Gesendet: Dienstag, 19. Juli 2016 11:02
An: max.wormser at gmx.de<mailto:max.wormser at gmx.de>; vtkusers at vtk.org<mailto: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/20192934/attachment.html>
More information about the vtkusers
mailing list