def applyTubeFilter(polyData, radius, numberOfSides=24): tube = vtk.vtkTubeFilter() tube.SetRadius(radius) tube.SetNumberOfSides(numberOfSides) tube.CappingOn() tube.SetInputData(polyData) tube.Update() return tube.GetOutput()
def createAxesPolyData(scale, useTube, tubeWidth=0.002): axes = vtk.vtkAxes() axes.SetComputeNormals(0) axes.SetScaleFactor(scale) axes.Update() if useTube: tube = vtk.vtkTubeFilter() tube.SetInputConnection(axes.GetOutputPort()) tube.SetRadius(tubeWidth) tube.SetNumberOfSides(12) tube.Update() axes = tube return shallowCopy(axes.GetOutput())
def _createAxes(self, scale, useTube): axes = vtk.vtkAxes() axes.SetComputeNormals(0) axes.SetScaleFactor(scale) axes.Update() if useTube: tube = vtk.vtkTubeFilter() tube.SetInput(axes.GetOutput()) tube.SetRadius(0.002) tube.SetNumberOfSides(12) tube.Update() axes = tube return shallowCopy(axes.GetOutput())
def addLine(self, p1, p2, radius=0.0, color=[1,1,1]): line = vtk.vtkLineSource() line.SetPoint1(p1) line.SetPoint2(p2) line.Update() if radius == 0.0: self.addPolyData(line.GetOutput(), color) else: tube = vtk.vtkTubeFilter() tube.SetRadius(radius) tube.SetNumberOfSides(24) tube.CappingOn() tube.SetInputConnection(line.GetOutputPort()) tube.Update() self.addPolyData(tube.GetOutput(), color)
def addLine(self, p1, p2, radius=0.0, color=[1, 1, 1]): line = vtk.vtkLineSource() line.SetPoint1(p1) line.SetPoint2(p2) line.Update() if radius == 0.0: self.addPolyData(line.GetOutput(), color) else: tube = vtk.vtkTubeFilter() tube.SetRadius(radius) tube.SetNumberOfSides(24) tube.CappingOn() tube.SetInputConnection(line.GetOutputPort()) tube.Update() self.addPolyData(tube.GetOutput(), color)