本文整理汇总了Python中vtk.vtkConeSource方法的典型用法代码示例。如果您正苦于以下问题:Python vtk.vtkConeSource方法的具体用法?Python vtk.vtkConeSource怎么用?Python vtk.vtkConeSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk
的用法示例。
在下文中一共展示了vtk.vtkConeSource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_render_window
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkConeSource [as 别名]
def make_render_window():
#cone actor
cone = vtk.vtkConeSource()
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
#text actor following camera
text = vtk.vtkVectorText()
text.SetText("Origin")
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInputConnection(text.GetOutputPort())
textActor = vtk.vtkFollower()
textActor.SetMapper(textMapper)
ren = vtk.vtkRenderer()
ren.AddActor(coneActor)
ren.AddActor(textActor)
textActor.SetCamera(ren.GetActiveCamera())
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
return renWin
示例2: QVTKRenderWidgetConeExample
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkConeSource [as 别名]
def QVTKRenderWidgetConeExample():
"""A simple example that uses the QVTKRenderWindowInteractor class."""
# every QT app needs an app
app = QtGui.QApplication(['QVTKRenderWindowInteractor'])
# create the widget
widget = QVTKRenderWindowInteractor()
widget.Initialize()
widget.Start()
# if you dont want the 'q' key to exit comment this.
widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
ren = vtkRenderer()
widget.GetRenderWindow().AddRenderer(ren)
cone = vtkConeSource()
cone.SetResolution(8)
coneMapper = vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneActor = vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
# show the widget
widget.show()
# start event processing
app.exec_()
示例3: QVTKRenderWidgetConeExample
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkConeSource [as 别名]
def QVTKRenderWidgetConeExample():
"""A simple example that uses the QVTKRenderWindowInteractor class."""
# every QT app needs an app
app = QApplication(['QVTKRenderWindowInteractor'])
# create the widget
widget = QVTKRenderWindowInteractor()
widget.Initialize()
widget.Start()
# if you don't want the 'q' key to exit comment this.
widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
ren = vtk.vtkRenderer()
widget.GetRenderWindow().AddRenderer(ren)
cone = vtk.vtkConeSource()
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
# show the widget
widget.show()
# start event processing
app.exec_()
示例4: QVTKRenderWidgetConeExample
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkConeSource [as 别名]
def QVTKRenderWidgetConeExample():
"""A simple example that uses the QVTKRenderWindowInteractor class."""
# every QT app needs an app
app = QApplication(["QVTKRenderWindowInteractor"])
# create the widget
widget = QVTKRenderWindowInteractor()
widget.Initialize()
widget.Start()
# if you dont want the 'q' key to exit comment this.
widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
ren = vtk.vtkRenderer()
widget.GetRenderWindow().AddRenderer(ren)
cone = vtk.vtkConeSource()
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
# show the widget
widget.show()
# start event processing
app.exec_()
示例5: Cone
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkConeSource [as 别名]
def Cone(center=(0.,0.,0.), direction=(1.,0.,0.), height=1.0, radius=None,
capping=True, angle=None, resolution=6):
"""Create a cone.
Parameters
----------
center : np.ndarray or list
Center in [x, y, z]. middle of the axis of the cone.
direction : np.ndarray or list
direction vector in [x, y, z]. orientation vector of the cone.
height : float
height along the cone in its specified direction.
radius : float
base radius of the cone
capping : bool
Turn on/off whether to cap the base of the cone with a polygon.
angle : float
The angle degrees between the axis of the cone and a generatrix.
resolution : int
number of facets used to represent the cone
"""
src = vtk.vtkConeSource()
src.SetCapping(capping)
src.SetDirection(direction)
src.SetCenter(center)
src.SetHeight(height)
# Contributed by @kjelljorner in #249:
if angle and radius:
raise ValueError("Both radius and angle specified. They are mutually exclusive.")
elif angle and not radius:
src.SetAngle(angle)
elif not angle and radius:
src.SetRadius(radius)
elif not angle and not radius:
src.SetRadius(0.5)
src.SetResolution(resolution)
src.Update()
return pyvista.wrap(src.GetOutput())