本文整理汇总了Python中vtk.vtkDiskSource方法的典型用法代码示例。如果您正苦于以下问题:Python vtk.vtkDiskSource方法的具体用法?Python vtk.vtkDiskSource怎么用?Python vtk.vtkDiskSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk
的用法示例。
在下文中一共展示了vtk.vtkDiskSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Disc
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkDiskSource [as 别名]
def Disc(center=(0.,0.,0.), inner=0.25, outer=0.5, normal=(0,0,1), r_res=1,
c_res=6):
"""Create a polygonal disk with a hole in the center.
The disk has zero height. The user can specify the inner and outer radius
of the disk, and the radial and circumferential resolution of the polygonal
representation.
Parameters
----------
center : np.ndarray or list
Center in [x, y, z]. middle of the axis of the disc.
inner : float
The inner radius
outer : float
The outer radius
normal : np.ndarray or list
direction vector in [x, y, z]. orientation vector of the cone.
r_res: int
number of points in radius direction.
r_res: int
number of points in circumferential direction.
"""
src = vtk.vtkDiskSource()
src.SetInnerRadius(inner)
src.SetOuterRadius(outer)
src.SetRadialResolution(r_res)
src.SetCircumferentialResolution(c_res)
src.Update()
return pyvista.wrap(src.GetOutput())
示例2: getActorCircle
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkDiskSource [as 别名]
def getActorCircle(radius_inner=100, radius_outer=99, color=(1,0,0)):
""""""
# create source
source = vtk.vtkDiskSource()
source.SetInnerRadius(radius_inner)
source.SetOuterRadius(radius_outer)
source.SetRadialResolution(100)
source.SetCircumferentialResolution(100)
# Transformer
transform = vtk.vtkTransform()
transform.RotateWXYZ(90, 1, 0, 0)
transformFilter = vtk.vtkTransformPolyDataFilter()
transformFilter.SetTransform(transform)
transformFilter.SetInputConnection(source.GetOutputPort())
transformFilter.Update()
# mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(transformFilter.GetOutputPort())
# actor
actor = vtk.vtkActor()
actor.GetProperty().SetColor(color)
actor.SetMapper(mapper)
return actor
示例3: applyDiskGlyphs
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkDiskSource [as 别名]
def applyDiskGlyphs(polyData, computeNormals=True):
voxelGridLeafSize = 0.03
normalEstimationSearchRadius = 0.05
diskRadius = 0.015
diskResolution = 12
if computeNormals:
scanInput = polyData
pd = applyVoxelGrid(scanInput, leafSize=voxelGridLeafSize)
pd = labelOutliers(pd, searchRadius=normalEstimationSearchRadius, neighborsInSearchRadius=3)
pd = thresholdPoints(pd, 'is_outlier', [0, 0])
pd = normalEstimation(pd, searchRadius=normalEstimationSearchRadius, searchCloud=scanInput)
else:
pd = polyData
assert polyData.GetPointData().GetNormals()
disk = vtk.vtkDiskSource()
disk.SetOuterRadius(diskRadius)
disk.SetInnerRadius(0.0)
disk.SetRadialResolution(0)
disk.SetCircumferentialResolution(diskResolution)
disk.Update()
t = vtk.vtkTransform()
t.RotateY(90)
disk = transformPolyData(disk.GetOutput(), t)
glyph = vtk.vtkGlyph3D()
glyph.ScalingOff()
glyph.OrientOn()
glyph.SetSourceData(disk)
glyph.SetInputData(pd)
glyph.SetVectorModeToUseNormal()
glyph.Update()
return shallowCopy(glyph.GetOutput())
示例4: getActorCircle
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkDiskSource [as 别名]
def getActorCircle(radius_inner=100, radius_outer=99, color=(1, 0, 0)):
""""""
# create source
source = vtk.vtkDiskSource()
source.SetInnerRadius(radius_inner)
source.SetOuterRadius(radius_outer)
source.SetRadialResolution(100)
source.SetCircumferentialResolution(100)
# Transformer
transform = vtk.vtkTransform()
transform.RotateWXYZ(90, 1, 0, 0)
transformFilter = vtk.vtkTransformPolyDataFilter()
transformFilter.SetTransform(transform)
transformFilter.SetInputConnection(source.GetOutputPort())
transformFilter.Update()
# mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(transformFilter.GetOutputPort())
# actor
actor = vtk.vtkActor()
actor.GetProperty().SetColor(color)
actor.SetMapper(mapper)
return actor