本文整理汇总了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