當前位置: 首頁>>代碼示例>>Python>>正文


Python vtk.vtkTriangleFilter方法代碼示例

本文整理匯總了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 
開發者ID:NREL,項目名稱:OpenWARP,代碼行數:18,代碼來源:mesh.py

示例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 
開發者ID:pyvista,項目名稱:pyvista,代碼行數:29,代碼來源:filters.py

示例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() 
開發者ID:mmolero,項目名稱:pcloudpy,代碼行數:16,代碼來源:Delaunay3D.py

示例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()) 
開發者ID:pyvista,項目名稱:pyvista,代碼行數:17,代碼來源:geometric_objects.py

示例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 
開發者ID:NREL,項目名稱:OpenWARP,代碼行數:17,代碼來源:mesh.py


注:本文中的vtk.vtkTriangleFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。