• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python vtk.vtkPolyDataNormals函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vtk.vtkPolyDataNormals函数的典型用法代码示例。如果您正苦于以下问题:Python vtkPolyDataNormals函数的具体用法?Python vtkPolyDataNormals怎么用?Python vtkPolyDataNormals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了vtkPolyDataNormals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: OnExportSurface

    def OnExportSurface(self, pubsub_evt):
        filename, filetype = pubsub_evt.data
        if (filetype == const.FILETYPE_STL) or\
           (filetype == const.FILETYPE_VTP) or\
           (filetype == const.FILETYPE_PLY) or\
           (filetype == const.FILETYPE_STL_ASCII):

            # First we identify all surfaces that are selected
            # (if any)
            proj = prj.Project()
            polydata_list = []

            for index in proj.surface_dict:
                surface = proj.surface_dict[index]
                if surface.is_shown:
                    polydata_list.append(surface.polydata)

            if len(polydata_list) == 0:
                utl.debug("oops - no polydata")
                return
            elif len(polydata_list) == 1:
                polydata = polydata_list[0]
            else:
                polydata = pu.Merge(polydata_list)

            # Having a polydata that represents all surfaces
            # selected, we write it, according to filetype
            if filetype == const.FILETYPE_STL:
                writer = vtk.vtkSTLWriter()
                writer.SetFileTypeToBinary()
            elif filetype == const.FILETYPE_STL_ASCII:
                writer = vtk.vtkSTLWriter()
                writer.SetFileTypeToASCII()
            elif filetype == const.FILETYPE_VTP:
                writer = vtk.vtkXMLPolyDataWriter()
            #elif filetype == const.FILETYPE_IV:
            #    writer = vtk.vtkIVWriter()
            elif filetype == const.FILETYPE_PLY:
                writer = vtk.vtkPLYWriter()
                writer.SetFileTypeToASCII()
                writer.SetColorModeToOff()
                #writer.SetDataByteOrderToLittleEndian()
                #writer.SetColorModeToUniformCellColor()
                #writer.SetColor(255, 0, 0)

            if filetype in (const.FILETYPE_STL, const.FILETYPE_PLY):
                # Invert normals
                normals = vtk.vtkPolyDataNormals()
                normals.SetInputData(polydata)
                normals.SetFeatureAngle(80)
                normals.AutoOrientNormalsOn()
                #  normals.GetOutput().ReleaseDataFlagOn()
                normals.UpdateInformation()
                normals.Update()
                polydata = normals.GetOutput()

            filename = filename.encode(wx.GetDefaultPyEncoding())
            writer.SetFileName(filename)
            writer.SetInputData(polydata)
            writer.Write()
开发者ID:151706061,项目名称:invesalius3,代码行数:60,代码来源:surface.py


示例2: __init__

    def __init__(self, mesh):
        assert mesh != None
        
        self._mesh = mesh
        self._batch = None
        self._color = (0.0, 1.0, 0.0, 1.0)
        
        #smooth_loop = vtk.vtkLoopSubdivisionFilter()
        #smooth_loop.SetNumberOfSubdivisions(3)
        #smooth_loop.SetInput(cleanPolyData.GetOutput())
        #self.mesh = smooth_loop.GetOutput()

        normals = vtk.vtkPolyDataNormals()
        normals.SetInput(self._mesh)
        normals.ComputeCellNormalsOn()
        output = normals.GetOutput()
        output.Update();
        cellData = output.GetCellData();
        self._normals = cellData.GetNormals();

        self._caster = vtk.vtkOBBTree()
        #set the 'mesh' as the caster's dataset
        self._caster.SetDataSet(self._mesh)
        #build a caster locator
        self._caster.BuildLocator()
开发者ID:joshalbrecht,项目名称:shinyshell,代码行数:25,代码来源:mesh.py


示例3: _initialize

    def _initialize (self):
        debug ("In TensorGlyphs::_initialize ()")

        self.sphere.SetThetaResolution (8)
        self.sphere.SetPhiResolution (8)

        self.glyphs.SetInput (self.data_out)
        self.glyphs.SetSource (self.sphere.GetOutput())
        self.glyphs.SetScaleFactor (1.0)
        self.glyphs.ClampScalingOn ()
        self.glyphs.SetMaxScaleFactor (5.0)

        self.normals = vtk.vtkPolyDataNormals ()
        self.normals.SetInput (self.glyphs.GetOutput ())
        
        self.mapper.SetInput (self.normals.GetOutput ())
        self.actor.SetMapper (self.mapper)

        self.actor.GetProperty ().SetLineWidth (2)
        self.actor.GetProperty ().BackfaceCullingOff ()
        # self.actor.GetProperty ().FrontfaceCullingOff ()

        self.actor.GetProperty ().SetColor (*Common.config.fg_color)
        self.center = self.data_out.GetCenter ()
        self.renwin.add_actors (self.actor)
        # used for the pipeline browser
        self.pipe_objs = self.actor
开发者ID:sldion,项目名称:DNACC,代码行数:27,代码来源:TensorGlyphs.py


示例4: AddPolyData

    def AddPolyData(self, polyData, colorMap=None):
        """
        colorMap should be a vtkScalarsToColors (or derived class) object
        """
        if colorMap is None:
            colorMap = VTKViewer.GetDefaultColorMap(polyData.GetScalarRange())
        polyDataMapper = vtk.vtkPolyDataMapper()
        polyDataMapper.SetLookupTable(colorMap)

        if polyData.GetPointData().GetNormals() is None:
            polyDataNormals = vtk.vtkPolyDataNormals()
            try:
                polyDataNormals.SetInputData(polyData)
            except:
                polyDataNormals.SetInput(polyData)
            polyDataNormals.SetFeatureAngle(90.0)
            polyDataMapper.SetInputConnection(
                polyDataNormals.GetOutputPort())
        else:
            try:
                polyDataMapper.SetInputData(polyData)
            except:
                polyDataMapper.SetInput(polyData)
        actor = vtk.vtkActor()
        actor.GetProperty().SetPointSize(3)
        actor.SetMapper(polyDataMapper)
        self.renderer.AddActor(actor)
开发者ID:ccraddock,项目名称:mindboggle,代码行数:27,代码来源:vtkviewer.py


示例5: get_isosurface

    def get_isosurface(self, iso_value=500):

        if not self.flag_read:
            sys.stderr.write('No Image Loaded!\n')
            return

        contour = vtk.vtkContourFilter()
        normals = vtk.vtkPolyDataNormals()
        stripper = vtk.vtkStripper()
        mapper = vtk.vtkPolyDataMapper()

        contour.SetInputData(self.reader)
        contour.SetValue(0, iso_value)

        normals.SetInputConnection(contour.GetOutputPort())
        normals.SetFeatureAngle(60.0)
        normals.ReleaseDataFlagOn()

        stripper.SetInputConnection(normals.GetOutputPort())
        stripper.ReleaseDataFlagOn()

        mapper.SetInputConnection(stripper.GetOutputPort())
        mapper.SetScalarVisibility(False)

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)

        # Default colour, should be changed.
        actor.GetProperty().SetDiffuseColor(
            [247.0 / 255.0, 150.0 / 255.0, 155.0 / 255.0])  # Look like red
        actor.GetProperty().SetSpecular(0.3)
        actor.GetProperty().SetSpecularPower(20)

        return actor
开发者ID:quentan,项目名称:Work_Test_4,代码行数:34,代码来源:medical_object.py


示例6: __init__

 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(
         self, module_manager,
         vtk.vtkPolyDataNormals(), 'Processing.',
         ('vtkPolyData',), ('vtkPolyData',),
         replaceDoc=True,
         inputFunctions=None, outputFunctions=None)
开发者ID:fvpolpeta,项目名称:devide,代码行数:7,代码来源:vtkPolyDataNormals.py


示例7: MouseMove

    def MouseMove(self, data):
        print("Load Cache %s" % data )
        print ("Iren data")
        #print iren
        #addcube
        #print ren
        print ren.GetViewPoint()
        print ren.GetDisplayPoint()
        print ren.WorldToView()
        print ren.ComputeVisiblePropBounds()
        ysize = renWin.GetSize()[1]
        c.SetValue(0,ysize)
        c.Update()
        normals = vtk.vtkPolyDataNormals()
        normals.SetInputData(c.GetOutput())
        normals.SetFeatureAngle(25) #?
        normals.Update()

        normals.SetFeatureAngle(45) #?
        normals.Update()
        mapper2 = vtk.vtkPolyDataMapper()
        mapper2.SetInputData(normals.GetOutput())
        mapper2.ScalarVisibilityOn()
        mapper2.SetScalarRange(-.5,1)
        mapper2.SetScalarModeToUsePointFieldData()
        mapper2.ColorByArrayComponent("Velocity", 0)
        actor2 = vtk.vtkActor()
        actor2.SetMapper(mapper2)
        ren.AddActor(actor2)
开发者ID:sshamilton,项目名称:vtkscripts,代码行数:29,代码来源:tviewer.py


示例8: Contours

 def Contours(self, num, opacity=0.2):
     contour = vtk.vtkMarchingContourFilter()
     contour.SetInput(self.vtkgrid)
     r = max(abs(self.vmin), abs(self.vmax))
     if num % 2 == 0 or self.vmin * self.vmax >= 0:
         contour.GenerateValues(
             num, (self.vmin + r / num, self.vmax - r / num))
     elif num == 1:
         contour.SetValue(0, 0)
     else:
         r = r - r / num
         contour.GenerateValues(num, -r, r)
     contour.ComputeScalarsOn()
     contour.UseScalarTreeOn()
     contour.Update()
     normals = vtk.vtkPolyDataNormals()
     normals.SetInput(contour.GetOutput())
     mapper = vtk.vtkPolyDataMapper()
     mapper.SetInput(normals.GetOutput())
     mapper.SetLookupTable(self.lut)
     mapper.SetScalarRange(self.vmin, self.vmax)
     actor = vtk.vtkActor()
     actor.SetMapper(mapper)
     actor.GetProperty().SetOpacity(opacity)
     actor.GetProperty().SetLineWidth(3)
     return actor
开发者ID:siudej,项目名称:Steklov-eigenvalues,代码行数:26,代码来源:viper3d.py


示例9: __init__

    def __init__(self, reader):
        self.reader = reader
        sg = self.src_glyph = vtk.vtkSphereSource()
        sg.SetRadius(0.5)
        sg.SetCenter(0.5, 0.0, 0.0)
        g = self.glyph = vtk.vtkTensorGlyph()        
        g.SetInputConnection(self.reader.GetOutputPort())
        g.SetSource(self.src_glyph.GetOutput())
        g.SetScaleFactor(0.25)
        
        # The normals are needed to generate the right colors and if
        # not used some of the glyphs are black.        
        self.normals = vtk.vtkPolyDataNormals()
        self.normals.SetInputConnection(g.GetOutputPort())
        self.map = vtk.vtkPolyDataMapper()
        self.map.SetInputConnection(self.normals.GetOutputPort())        
        self.act = vtk.vtkActor()
        self.act.SetMapper(self.map)

        # An outline.
        self.of = vtk.vtkOutlineFilter()
        self.of.SetInputConnection(self.reader.GetOutputPort())
        self.out_map = vtk.vtkPolyDataMapper()
        self.out_map.SetInputConnection(self.of.GetOutputPort())
        self.out_act = vtk.vtkActor()
        self.out_act.SetMapper(self.out_map)        
开发者ID:Armand0s,项目名称:homemade_vtk,代码行数:26,代码来源:TestTensorGlyph.py


示例10: vertex_normal

def vertex_normal(dataset):
    "Returns the vertex normal of each point in a dataset."
    if not dataset:
        raise RuntimeError("Need a dataset to compute vertex_normal")

    ds = dataset.NewInstance()
    ds.UnRegister(None)
    ds.CopyStructure(dataset.VTKObject)

    filter = vtk.vtkPolyDataNormals()
    filter.SetInputData(ds)
    filter.ComputeCellNormalsOff()
    filter.ComputePointNormalsOn()

    filter.SetFeatureAngle(180)
    filter.SplittingOff()
    filter.ConsistencyOff()
    filter.AutoOrientNormalsOff()
    filter.FlipNormalsOff()
    filter.NonManifoldTraversalOff()
    filter.Update()

    varray = filter.GetOutput().GetPointData().GetNormals()
    ans = dsa.vtkDataArrayToVTKArray(varray, dataset)

    # The association information has been lost over the vtk filter
    # we must reconstruct it otherwise lower pipeline will be broken.
    ans.Association = dsa.ArrayAssociation.POINT

    return ans
开发者ID:RCBiczok,项目名称:VTK,代码行数:30,代码来源:internal_algorithms.py


示例11: polyNorm

def polyNorm(ren,obj):
    #@c Add vtkPolyDataNormals to the vtkPolyData viewing pipeline.
    #@note there is no proc to perform the reverse operation (i.e. remove
    #@note the normals).  This is because the caller can presumably just
    #@note turn off normal-based properties via the actor's vtkProperty.
    #@a ren: renderer
    #@a obj: object name
    if isinstance(obj,list):
        tag = "%s_%s" % (ren[0],obj[0])
        objName = obj[0]
    elif isinstance(obj,str):
        tag = "%s_%s" % (ren[0],obj)
        objName = obj
    else:
        raise ValueError("Argument type unsupported.")
    nrm = [None]*2
    
    try:
        Map = getattr(vis,"p_map_"+tag)
    except:
        raise ValueError(objName + " not currently being displayed in " + ren[0])
        
    act = getattr(vis,"p_act_"+tag)
    nrm[0] = "p_nrm_" + tag
    
    nrm[1] = vtk.vtkPolyDataNormals()
    nrm[1].SetInputDataObject(Map[1].GetInput())
    Map[1].SetInputDataObject(nrm[1].GetOutput())
    nrm[1].Update()
    
    setattr(vis,Map[0], Map)
    setattr(vis,act[0],act)
    setattr(vis,nrm[0],nrm)
    return act
开发者ID:osmsc,项目名称:SimVascular,代码行数:34,代码来源:poly.py


示例12: AddPolyData

    def AddPolyData(self, polyData, colorMap=None):
        """
        colorMap should be a vtkScalarsToColors (or derived class) object
        """
        if colorMap is None:
            colorMap = VTKViewer.GetDefaultColorMap(polyData.GetScalarRange())
        polyDataMapper = vtk.vtkPolyDataMapper()
        polyDataMapper.SetLookupTable(colorMap)

        if polyData.GetPointData().GetNormals() is None:
            polyDataNormals = vtk.vtkPolyDataNormals()

            # Migrate to VTK6:
            # http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput
            # Old: polyDataNormals.SetInput(polyData)
            polyDataNormals.SetInputData(polyData)

            polyDataNormals.SetFeatureAngle(90.0)
            polyDataMapper.SetInputConnection(polyDataNormals.GetOutputPort())
        else:
            # Migrate to VTK6:
            # http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput
            # Old: polyDataMapper.SetInput(polyData)
            polyDataMapper.SetInputData(polyData)

        actor = vtk.vtkActor()
        actor.GetProperty().SetPointSize(3)
        actor.SetMapper(polyDataMapper)
        self.renderer.AddActor(actor)
开发者ID:akeshavan,项目名称:mindboggle,代码行数:29,代码来源:vtkviewer.py


示例13: create_actors_for_skin_and_bone

def create_actors_for_skin_and_bone(reader):
    actors_list = []
    for contour_val, color, opacity in SKIN_BONE_LIST:
	contour = vtk.vtkContourFilter()
	contour.SetInput(reader.GetOutput())
	contour.SetNumberOfContours(1)
	contour.SetValue(contour_val[0], contour_val[1])

	normals = vtk.vtkPolyDataNormals()
	normals.SetInput(contour.GetOutput())
	normals.SetFeatureAngle(60)
	normals.ConsistencyOff()
	normals.SplittingOff()

	mapper = vtk.vtkPolyDataMapper()
	mapper.SetInput(normals.GetOutput())
	mapper.ScalarVisibilityOff()

	actor = vtk.vtkActor()
	actor.SetMapper(mapper)
	actor.GetProperty().SetColor(color)
        actor.GetProperty().SetOpacity(opacity)
	actor.RotateX(-90)
        actors_list.append(actor)
    return actors_list
开发者ID:arun04ceg,项目名称:3D-spatial-data,代码行数:25,代码来源:iso_surfacing.py


示例14: __init__

    def __init__(self, grid, vtkish_polydata=None, angle=15):

        vtkPolyDataPipeline.__init__(self, vtkish_polydata)

        # Make sure grid argument is correct type
        assert isinstance(grid, vtkVolumeGrid)
        self.grid = grid

        # Split polys with intersection angles greater than angle
        vtk_dnorm = vtkPolyDataNormals()
        vtk_dnorm.SetFeatureAngle(angle)
        vtk_dnorm.SplittingOn()
        vtk_dnorm.ComputeCellNormalsOff()
        vtk_dnorm.ComputePointNormalsOff()
        self.append(vtk_dnorm)

        relax = self.grid.get_relaxation_factor()

        if relax is not None:
            print 'relax=',relax
            #vtk_subdiv = vtkButterflySubdivisionFilter()
            vtk_subdiv = vtkLinearSubdivisionFilter()
            self.append(vtk_subdiv)
    
            # Smooth out some of the sharp points.
            vtk_smooth = vtkSmoothPolyDataFilter()
            vtk_smooth.SetRelaxationFactor(relax)
            self.append(vtk_smooth)
开发者ID:JConwayAWT,项目名称:PGSS14CC,代码行数:28,代码来源:pipeline.py


示例15: Execute

    def Execute(self):

        if self.Surface == None:
            self.PrintError('Error: No Surface.')

        if self.ReferenceSurface == None:
            self.PrintError('Error: No ReferenceSurface.')

        if self.SignedDistanceArrayName != '':
            normalsFilter = vtk.vtkPolyDataNormals()
            normalsFilter.SetInputData(self.ReferenceSurface)
            normalsFilter.AutoOrientNormalsOn()
            normalsFilter.SetFlipNormals(self.FlipNormals)
            normalsFilter.Update()
            self.ReferenceSurface.GetPointData().SetNormals(normalsFilter.GetOutput().GetPointData().GetNormals())

        if self.DistanceArrayName != '' or self.DistanceVectorsArrayName != '' or self.SignedDistanceArrayName != '':
            self.PrintLog('Computing distance.')
            surfaceDistance = vtkvmtk.vtkvmtkSurfaceDistance()
            surfaceDistance.SetInputData(self.Surface)
            surfaceDistance.SetReferenceSurface(self.ReferenceSurface)
            if self.DistanceArrayName != '':
                surfaceDistance.SetDistanceArrayName(self.DistanceArrayName)
            if self.DistanceVectorsArrayName != '':
                surfaceDistance.SetDistanceVectorsArrayName(self.DistanceVectorsArrayName)
            if self.SignedDistanceArrayName != '':
                surfaceDistance.SetSignedDistanceArrayName(self.SignedDistanceArrayName)
            surfaceDistance.Update()
            self.Surface = surfaceDistance.GetOutput()
开发者ID:samsmu,项目名称:vmtk,代码行数:29,代码来源:vmtksurfacedistance.py


示例16: LerSTL

    def LerSTL(self, path):
        mesh= vtk.vtkSTLReader()
        mesh.SetFileName(path)
        mesh.Update()

        #self.pd  = mesh.GetOutput()
        self.polydata  = mesh.GetOutput()

        normals = vtk.vtkPolyDataNormals()
        #normals.SetInput(polydata)
        normals.SetInputData(mesh.GetOutput())
        normals.ComputeCellNormalsOn()
        normals.Update()

        #mudanças para aumentar a normal
        

        self.vertices =pontos(normals.GetOutput())
        self.normalsp = get_normals(normals.GetOutput())

        

        stlMapper = vtk.vtkPolyDataMapper()
        stlMapper.SetInputConnection(normals.GetOutputPort())
        
        stlActor = vtk.vtkLODActor()
        stlActor.SetMapper(stlMapper)


        self.renderer.AddActor(stlActor)
        self.Interactor.Render()
开发者ID:jcdinis,项目名称:POMES,代码行数:31,代码来源:app.py


示例17: PlaneSphereActors

def PlaneSphereActors():
    ps = vtk.vtkPlaneSource()
    ps.SetXResolution(10)
    ps.SetYResolution(10)

    ss = vtk.vtkSphereSource()
    ss.SetRadius (0.3)

    group = vtk.vtkMultiBlockDataGroupFilter()
    group.AddInputConnection(ps.GetOutputPort())
    group.AddInputConnection(ss.GetOutputPort())

    ag = vtk.vtkRandomAttributeGenerator()
    ag.SetInputConnection(group.GetOutputPort())
    ag.GenerateCellScalarsOn()
    ag.AttributesConstantPerBlockOn()

    n = vtk.vtkPolyDataNormals()
    n.SetInputConnection(ag.GetOutputPort())
    n.Update ();

    actors = []
    it = n.GetOutputDataObject(0).NewIterator()
    it.InitTraversal()
    while not it.IsDoneWithTraversal():
        pm = vtk.vtkPolyDataMapper()
        pm.SetInputData(it.GetCurrentDataObject())

        a = vtk.vtkActor()
        a.SetMapper(pm)
        actors.append (a)
        it.GoToNextItem()
    return actors
开发者ID:timkrentz,项目名称:SunTracker,代码行数:33,代码来源:TestRandomAttributeGeneratorScalar.py


示例18: setUp

    def setUp(self):
        self.vtk_iso = vtkContourFilter()
        # self.vtk_iso.SetInput(...)

        self.vtk_dnorm = vtkPolyDataNormals()
        self.vtk_subdiv = vtkLinearSubdivisionFilter()
        self.vtk_dmap = vtkPolyDataMapper()
开发者ID:ryancoleman,项目名称:lotsofcoresbook2code,代码行数:7,代码来源:vtk_pipeline.py


示例19: create_mesh

def create_mesh(M,P,T):
	n_naca_pts = 50
	write_test_file(M,P,T,-5.,5.,nsections=5)
	wing=create_wing('current_wing','output')
	n_sections=len(wing)
	n_section_pts = 2*n_naca_pts-1

	# build mesh
	vtk_model = vtk.vtkStructuredGrid()
	vtk_model.SetDimensions(n_section_pts,n_sections,1)
	# build points
	vtk_points = vtk.vtkPoints()

	for j in xrange(n_sections):
	    upper_pts = numpy.array([wing[j][1],wing[j][3]]).T
	    lower_pts = numpy.array([wing[j][2],wing[j][4]]).T
	    section_pts = numpy.concatenate((lower_pts[::-1],upper_pts[1:]))
	    for i in xrange(n_section_pts):
		vtk_points.InsertNextPoint(section_pts[i,0],wing[j][0],section_pts[i,1])
	# set points
	vtk_model.SetPoints(vtk_points)

	# convert to poly data    
	pdata_filter = vtk.vtkGeometryFilter()
	if vtk.VTK_MAJOR_VERSION <= 5:
	    pdata_filter.SetInput(vtk_model)
	else:
	    pdata_filter.SetInputData(vtk_model)
	pdata_filter.Update()
	poly_data = pdata_filter.GetOutput()

	# compute normals
	norms = vtk.vtkPolyDataNormals()
	if vtk.VTK_MAJOR_VERSION <= 5:
	    norms.SetInput(poly_data)
	else:
	    norms.SetInputData(poly_data)
	norms.ComputePointNormalsOff()
	norms.ComputeCellNormalsOn()
	norms.ConsistencyOn()
	norms.Update()

	# clean poly data
	clean_poly = vtk.vtkCleanPolyData()
	clean_poly.ToleranceIsAbsoluteOn()
	clean_poly.SetAbsoluteTolerance(1.e-6)
	if vtk.VTK_MAJOR_VERSION <= 5:
	    clean_poly.SetInput(norms.GetOutput())
	else:
	    clean_poly.SetInputData(norms.GetOutput())
	clean_poly.Update()

	# write output mesh
	writer = vtk.vtkXMLPolyDataWriter()
	if vtk.VTK_MAJOR_VERSION <= 5:
	    writer.SetInput(clean_poly.GetOutput())
	else:
	    writer.SetInputData(clean_poly.GetOutput())
	writer.SetFileName('output.vtp')
	writer.Write()
开发者ID:ymerillac,项目名称:Optim_INSA_5GMM,代码行数:60,代码来源:build_mesh.py


示例20: __draw_sphere

    def __draw_sphere(self,radius,center,color,resolution=20):
        source = vtk.vtkSphereSource()
        source.SetCenter(*center)
        source.SetRadius(radius)
        source.SetPhiResolution(resolution)
        source.SetThetaResolution(resolution)

        normals = vtk.vtkPolyDataNormals()
        normals.SetInputConnection(source.GetOutputPort())

        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(normals.GetOutputPort())

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        prop = actor.GetProperty()
        prop.SetColor(color)
        #prop.SetInterpolationToPhong()
        brightness = np.max(color)
        specular_color = np.array(color)/brightness
        prop.SetSpecularColor(specular_color)
        prop.SetSpecular(0.1)
        prop.SetDiffuse(1)
        prop.SetAmbient(0)

        info = vtk.vtkInformation()
        info.Set(vtk.vtkShadowMapBakerPass.RECEIVER(),0)
        info.Set(vtk.vtkShadowMapBakerPass.OCCLUDER(),0)
        actor.SetPropertyKeys(info)

        self.ren.AddActor(actor)
开发者ID:deherinu,项目名称:TmsViewer,代码行数:31,代码来源:vtk_tms_widget.py



注:本文中的vtk.vtkPolyDataNormals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkPolyDataReader函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkPolyDataMapper2D函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap