本文整理匯總了Python中vtk.vtkTriangleFilter方法的典型用法代碼示例。如果您正苦於以下問題:Python vtk.vtkTriangleFilter方法的具體用法?Python vtk.vtkTriangleFilter怎麽用?Python vtk.vtkTriangleFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vtk
的用法示例。
在下文中一共展示了vtk.vtkTriangleFilter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: volume_vtk
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTriangleFilter [as 別名]
def volume_vtk(self):
if self.VTK_installed is False:
raise VTK_Exception('VTK must be installed to access the volume_vtk property')
if self._volume_vtk is None:
tri_converter = vtk.vtkTriangleFilter()
tri_converter.SetInputDataObject(self.vtp_mesh)
tri_converter.Update()
tri_mesh = tri_converter.GetOutput()
mass_props = vtk.vtkMassProperties()
mass_props.SetInputDataObject(tri_mesh)
self._volume_vtk = mass_props.GetVolume()
print 'Calculated mesh volume using VTK library'
return self._volume_vtk
示例2: triangulate
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTriangleFilter [as 別名]
def triangulate(poly_data, inplace=False):
"""Return an all triangle mesh.
More complex polygons will be broken down into tetrahedrals.
Parameters
----------
inplace : bool, optional
Updates mesh in-place while returning nothing.
Return
------
mesh : pyvista.PolyData
Mesh containing only triangles. None when inplace=True
"""
trifilter = vtk.vtkTriangleFilter()
trifilter.SetInputData(poly_data)
trifilter.PassVertsOff()
trifilter.PassLinesOff()
trifilter.Update()
mesh = _get_output(trifilter)
if inplace:
poly_data.overwrite(mesh)
else:
return mesh
示例3: update
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTriangleFilter [as 別名]
def update(self):
delaunay = vtkDelaunay3D()
delaunay.SetInput(self.input_)
delaunay.SetTolerance(self.tolerance)
delaunay.SetAlpha(self.alpha)
delaunay.Update()
geom = vtkGeometryFilter()
geom.SetInputConnection(delaunay.GetOutputPort() )
triangle = vtkTriangleFilter()
triangle.SetInputConnection(geom.GetOutputPort())
triangle.Update()
self.output_ = triangle.GetOutput()
示例4: Text3D
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTriangleFilter [as 別名]
def Text3D(string, depth=0.5):
"""Create 3D text from a string."""
vec_text = vtk.vtkVectorText()
vec_text.SetText(string)
extrude = vtk.vtkLinearExtrusionFilter()
extrude.SetInputConnection(vec_text.GetOutputPort())
extrude.SetExtrusionTypeToNormalExtrusion()
extrude.SetVector(0, 0, 1)
extrude.SetScaleFactor(depth)
tri_filter = vtk.vtkTriangleFilter()
tri_filter.SetInputConnection(extrude.GetOutputPort())
tri_filter.Update()
return pyvista.wrap(tri_filter.GetOutput())
示例5: surface_area_vtk
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTriangleFilter [as 別名]
def surface_area_vtk(self):
if self.VTK_installed is False:
raise VTK_Exception('VTK must be installed to access the surface_area_vtk property')
if self._surface_area_vtk is None:
tri_converter = vtk.vtkTriangleFilter()
tri_converter.SetInputDataObject(self.vtp_mesh)
tri_converter.Update()
tri_mesh = tri_converter.GetOutput()
mass_props = vtk.vtkMassProperties()
mass_props.SetInputDataObject(tri_mesh)
self._surface_area_vtk = mass_props.GetSurfaceArea()
print 'Calculated mesh surface area using VTK Python bindings'
return self._surface_area_vtk