本文整理匯總了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())