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

Python vtk.vtkLine函数代码示例

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

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



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

示例1: __init__

    def __init__(self, parent = None):
        super(VTKFrame, self).__init__(parent)

        self.vtkWidget = QVTKRenderWindowInteractor(self)
        vl = QtGui.QVBoxLayout(self)
        vl.addWidget(self.vtkWidget)
        vl.setContentsMargins(0, 0, 0, 0)
 
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.3, 0.4, 0.5)
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
 
        # Create lines.
        points = vtk.vtkPoints()
        points.InsertPoint(0, 0, 0, 1)
        points.InsertPoint(1, 1, 0, 0)
        points.InsertPoint(2, 0, 1, 0)
        points.InsertPoint(3, 1, 1, 1)

        line1 = vtk.vtkLine()
        line1.GetPointIds().SetId(0, 0)
        line1.GetPointIds().SetId(1, 1)

        line2 = vtk.vtkLine()
        line2.GetPointIds().SetId(0, 2)
        line2.GetPointIds().SetId(1, 3)

        lines = vtk.vtkCellArray()
        lines.InsertNextCell(line1)
        lines.InsertNextCell(line2)

        polyData = vtk.vtkPolyData()
        polyData.SetPoints(points)
        polyData.SetLines(lines)

        ruledSurfaceFilter = vtk.vtkRuledSurfaceFilter()
        ruledSurfaceFilter.SetInputConnection(polyData.GetProducerPort())

        ruledSurfaceFilter.SetResolution(21, 21)
        ruledSurfaceFilter.SetRuledModeToResample()
 
        # Create a mapper
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(ruledSurfaceFilter.GetOutputPort())
 
        # Create an actor
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().SetColor(0.89, 0.81, 0.34)
 
        self.ren.AddActor(actor)
        self.ren.ResetCamera()

        self._initialized = False
开发者ID:dbzhang800,项目名称:VTKDemoForPyQt,代码行数:55,代码来源:ruledsurfacefilter.py


示例2: edges

def edges(indices):
    """
    Maps a numpy ndarray to an vtkCellArray of vtkLines

    Args:
        indices (numpy.ndarray<int>): A numpy.ndarray of shape (n,2) of indices that define n edges

    Returns:
        vtk_lines (vtk.vtkCellArray): VTK representation of the edges
    """
    if not isinstance(indices, numpy.ndarray):
        raise Numpy2VtkFormatException(
            'lines needs numpy array as input'
        )
    if len(indices.shape) != 2 or indices.shape[1] != 2:
        raise Numpy2VtkFormatException(
            'lines needs a nx2 ndarray as input'
        )
    if indices.dtype != numpy.int:
        raise Numpy2VtkFormatException(
            'lines needs to be numpy array of type numpy.int'
        )
    vtk_lines = vtk.vtkCellArray()
    for e in indices:
        line = vtk.vtkLine()
        line.GetPointIds().SetId(0, e[0])
        line.GetPointIds().SetId(1, e[1])
        vtk_lines.InsertNextCell(line)
    return vtk_lines
开发者ID:selaux,项目名称:numpy2vtk,代码行数:29,代码来源:raw.py


示例3: __init__

    def __init__(self, parent = None):
        super(VTKFrame, self).__init__(parent)

        self.vtkWidget = QVTKRenderWindowInteractor(self)
        vl = QtGui.QVBoxLayout(self)
        vl.addWidget(self.vtkWidget)
        vl.setContentsMargins(0, 0, 0, 0)
 
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.1, 0.2, 0.4)
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
 
        # Create source
        # Create five points. 
        origin = [0.0, 0.0, 0.0]
        p0 = [1.0, 0.0, 0.0]
        p1 = [0.0, 1.0, 0.0]
        p2 = [0.0, 1.0, 2.0]
        p3 = [1.0, 2.0, 3.0]
        p4 = [1.0, 2.0, 8.0]
         
        # Create a vtkPoints object and store the points in it
        points = vtk.vtkPoints()
        points.InsertNextPoint(origin)
        points.InsertNextPoint(p0)
        points.InsertNextPoint(p1)
        points.InsertNextPoint(p2)
        points.InsertNextPoint(p3)
        points.InsertNextPoint(p4)
         
        # Create a cell array to store the lines in and add the lines to it
        lines = vtk.vtkCellArray()
         
        for i in range(4):
          line = vtk.vtkLine()
          line.GetPointIds().SetId(0,i)
          line.GetPointIds().SetId(1,i+1)
          lines.InsertNextCell(line)
         
        # Create a polydata to store everything in
        linesPolyData = vtk.vtkPolyData()
         
        # Add the points to the dataset
        linesPolyData.SetPoints(points)
         
        # Add the lines to the dataset
        linesPolyData.SetLines(lines)
         
        # Setup actor and mapper
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInput(linesPolyData)
         
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
 
        self.ren.AddActor(actor)
        self.ren.ResetCamera()

        self._initialized = False
开发者ID:dbzhang800,项目名称:VTKDemoForPyQt,代码行数:60,代码来源:polylines.py


示例4: __init__

    def __init__(self,center=(0,0,0) , radius=1, color=(0,1,1), resolution=50 ):   
        """ create circle """
        lines =vtk.vtkCellArray()
        id = 0
        points = vtk.vtkPoints()
        for n in xrange(0,resolution):
            line = vtk.vtkLine()
            angle1 = (float(n)/(float(resolution)))*2*math.pi
            angle2 = (float(n+1)/(float(resolution)))*2*math.pi
            p1 = (center[0]+radius*math.cos(angle1), center[1]+radius*math.sin(angle1), center[2])
            p2 = (center[0]+radius*math.cos(angle2), center[1]+radius*math.sin(angle2), center[2])
            points.InsertNextPoint(p1)
            points.InsertNextPoint(p2)
            line.GetPointIds().SetId(0,id)
            id=id+1
            line.GetPointIds().SetId(1,id)
            id=id+1
            lines.InsertNextCell(line)
            

        self.pdata = vtk.vtkPolyData()
        self.pdata.SetPoints(points)
        self.pdata.SetLines(lines)
        
        self.mapper = vtk.vtkPolyDataMapper()
        self.mapper.SetInput(self.pdata)
        self.SetMapper(self.mapper)
        self.SetColor(color)
开发者ID:aewallin,项目名称:randompolygon,代码行数:28,代码来源:ovdvtk.py


示例5: GetNormalLines

def GetNormalLines(vtx, normals, scale):
    """
    Returns polydata with lines to visualize normals.
    This can be used for either vertex or face normals;
    just specify the normals start points with "vtx".
    """
    linePoints = vtk.vtkPoints()
    aLine = vtk.vtkLine()
    aLineGrid = vtk.vtkUnstructuredGrid()
    aLineGrid.Allocate(1, 1)
    aLineGrid.SetPoints(linePoints)

    for i in xrange(vtx.GetNumberOfTuples()):
        xyz0 = vtx.GetTuple3(i)
        nxyz = normals.GetTuple3(i)
        linePoints.InsertNextPoint(xyz0[0], xyz0[1], xyz0[2])
        linePoints.InsertNextPoint(xyz0[0]+nxyz[0]*scale,
                                   xyz0[1]+nxyz[1]*scale,
                                   xyz0[2]+nxyz[2]*scale)
        aLine.GetPointIds().SetId(0, 2*i)
        aLine.GetPointIds().SetId(1, 2*i+1)
        aLineGrid.InsertNextCell(aLine.GetCellType(),
                                 aLine.GetPointIds())
    
    return aLineGrid
开发者ID:redpawfx,项目名称:importVTK,代码行数:25,代码来源:MakeTestFiles.py


示例6: setEdgesPolydata

 def setEdgesPolydata(self, vd):
     self.edges = []
     self.edges = vd.getEdgesGenerators()
     self.epts = vtk.vtkPoints()
     nid = 0
     lines=vtk.vtkCellArray()
     for e in self.edges:
         p1 = self.scale*e[0]
         p2 = self.scale*e[1] 
         self.epts.InsertNextPoint( p1.x, p1.y, p1.z)
         self.epts.InsertNextPoint( p2.x, p2.y, p2.z)
         line = vtk.vtkLine()
         line.GetPointIds().SetId(0,nid)
         line.GetPointIds().SetId(1,nid+1)
         nid = nid+2
         lines.InsertNextCell(line)
     
     linePolyData = vtk.vtkPolyData()
     linePolyData.SetPoints(self.epts)
     linePolyData.SetLines(lines)
     
     mapper = vtk.vtkPolyDataMapper()
     mapper.SetInput(linePolyData)
     
     self.edge_actor = vtk.vtkActor()
     self.edge_actor.SetMapper(mapper)
     self.edge_actor.GetProperty().SetColor( camvtk.cyan )
     myscreen.addActor( self.edge_actor )
     myscreen.render() 
开发者ID:Matty-Downing2169,项目名称:opencamlib,代码行数:29,代码来源:voronoi_9_graphviz.py


示例7: drawCurve2

def drawCurve2(myscreen, curve, curvecolor):
    oPoints = vtk.vtkPoints()
    lineCells=vtk.vtkCellArray()
    idx = 0
    last_idx = 0
    segs=[]
    first = 1
    print " curve with ", len(curve)," points"
    for p in curve:
        oPoints.InsertNextPoint( p[0], p[1], 0)
        if first==0:
            seg = [last_idx,idx]
            segs.append(seg)
        first = 0
        last_idx = idx
        idx = idx + 1

    # create line and cells
    for seg in segs:
        line = vtk.vtkLine()
        line.GetPointIds().SetId(0, seg[0])
        line.GetPointIds().SetId(1, seg[1])
        lineCells.InsertNextCell(line)
    
    linePolyData = vtk.vtkPolyData()
    linePolyData.SetPoints(oPoints)
    linePolyData.SetLines(lineCells)
    linePolyData.Modified() 
    linePolyData.Update()
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInput(linePolyData)
    edge_actor = vtk.vtkActor()
    edge_actor.SetMapper(mapper)
    edge_actor.GetProperty().SetColor( curvecolor )
    myscreen.addActor( edge_actor )
开发者ID:TanayGahlot,项目名称:openvoronoi,代码行数:35,代码来源:hilbert_curve_0_draw.py


示例8: draw_lines

def draw_lines(nodes, color):
    points = vtk.vtkPoints()
    lines = vtk.vtkCellArray()
    nodecnt = 0
    colors = vtk.vtkUnsignedCharArray()
    colors.SetNumberOfComponents(3)
    colors.SetName("Colors")
    
    for node in nodes: 
        edges = node.getedges()
       
        for edge in edges:
            x0,y0,z0 = edge[0]
            x1,y1,z1 = edge[1]

            points.InsertNextPoint(edge[0])
            points.InsertNextPoint(edge[1])

            line = vtk.vtkLine()
            line.GetPointIds().SetId(0,nodecnt)
            line.GetPointIds().SetId(1,nodecnt+1)
            lines.InsertNextCell(line)
            nodecnt += 2
            colors.InsertNextTupleValue(color)
            
    # Create a polydata to store everything in
    linesPolyData = vtk.vtkPolyData()
    # Add the points to the dataset
    linesPolyData.SetPoints(points)
    # Add the lines to the dataset
    linesPolyData.SetLines(lines)
    linesPolyData.GetCellData().SetScalars(colors)
    return linesPolyData
开发者ID:squeakus,项目名称:octree,代码行数:33,代码来源:stltree.py


示例9: insertLine

def insertLine(lines, id0, id1):
    line = vtk.vtkLine()
    lPointIds = line.GetPointIds()
    lPointIds.SetId( 0, id0)
    lPointIds.SetId( 1, id1)
    
    if( containsLine(lines, line) == 0):
        lines.InsertNextCell( line )
开发者ID:Motiva,项目名称:vtkESQui,代码行数:8,代码来源:BuildMassSpringMesh3D.py


示例10: ndarray_to_vtkcellarray

def ndarray_to_vtkcellarray(array):
    bonds=vtk.vtkCellArray()
    for data in array:
        line = vtk.vtkLine()
        line.GetPointIds().SetId(0,int(data[0]))
        line.GetPointIds().SetId(1,int(data[1]))
        bonds.InsertNextCell(line)

    return bonds
开发者ID:mark-johnson-1966,项目名称:MDANSE,代码行数:9,代码来源:MolecularViewerPlugin.py


示例11: _create_cart3d_free_edegs

    def _create_cart3d_free_edegs(self, model, nodes, elements):
        free_edges = model.get_free_edges(elements)
        nfree_edges = len(free_edges)
        if nfree_edges:
            # yellow = (1., 1., 0.)
            pink = (0.98, 0.4, 0.93)
            npoints = 2 * nfree_edges
            if 'free_edges' not in self.alt_grids:
                self.create_alternate_vtk_grid('free_edges', color=pink, line_width=3, opacity=1.0,
                                               representation='surface')

            j = 0
            points = vtk.vtkPoints()
            points.SetNumberOfPoints(npoints)

            self.alt_grids['free_edges'].Allocate(nfree_edges, 1000)

            elem = vtk.vtkLine()
            # elem.GetPointIds().SetId(0, nidMap[nodeIDs[0]])
            # elem.GetPointIds().SetId(1, nidMap[nodeIDs[1]])

            etype = vtk.vtkLine().GetCellType()
            for free_edge in free_edges:
                # (p1, p2) = free_edge
                for ipoint, node_id in enumerate(free_edge):
                    point = nodes[node_id, :]
                    points.InsertPoint(j + ipoint, *point)

                elem = vtk.vtkLine()
                elem.GetPointIds().SetId(0, j)
                elem.GetPointIds().SetId(1, j + 1)
                self.alt_grids['free_edges'].InsertNextCell(etype, elem.GetPointIds())
                j += 2
            self.alt_grids['free_edges'].SetPoints(points)

        else:
            # TODO: clear free edges
            pass

        if 'free_edges' in self.alt_grids:
            self._add_alt_actors(self.alt_grids)
            self.geometry_actors['free_edges'].Modified()
            if hasattr(self.geometry_actors['free_edges'], 'Update'):
                self.geometry_actors['free_edges'].Update()
开发者ID:marcinch18,项目名称:pyNastran,代码行数:44,代码来源:cart3dIO.py


示例12: RenderRay

def RenderRay(start, end, rayNumber):
	print '* * * RenderRay: ', rayNumber
	print 'ray coords start: ', start
	print 'ray coords end: ', end
	p_rays.InsertNextPoint(start)
	p_rays.InsertNextPoint(end)
	ray = vtk.vtkLine()
	ray.GetPointIds().SetId(0,(rayNumber -1)*2)
	ray.GetPointIds().SetId(1,(rayNumber-1)*2+1)
	rays.InsertNextCell(ray)
开发者ID:annaleida,项目名称:raybender,代码行数:10,代码来源:raybender.py


示例13: _createline

 def _createline(self, pointnumbers):
     if depth(pointnumbers) >= 3:
         for p in pointnumbers:
             self._createline(p)
     else:
         for i in range(len(pointnumbers) - 1):
             line = vtk.vtkLine()
             line.GetPointIds().SetId(0, pointnumbers[i])
             line.GetPointIds().SetId(1, pointnumbers[i + 1])
             self.lines.InsertNextCell(line)
             i = i + 1
开发者ID:karl-friedrich,项目名称:OpenGlider,代码行数:11,代码来源:Functions.py


示例14: RenderTriangleAsLine

def RenderTriangleAsLine(points, triangleNumber):
	print '* * * RenderTriangle: ', triangleNumber
	print 'Triangle points: ', tri
	print (triangleNumber-1)*3
	p_triangles.InsertNextPoint(points[0])
	p_triangles.InsertNextPoint(points[1])
	p_triangles.InsertNextPoint(points[2])
	
	line1 = vtk.vtkLine();
	line1.GetPointIds().SetId(0, 0+(triangleNumber-1)*3);
	line1.GetPointIds().SetId(1, 1+(triangleNumber-1)*3);
	line2 = vtk.vtkLine();
	line2.GetPointIds().SetId(0, 0+(triangleNumber-1)*3);
	line2.GetPointIds().SetId(1, 2+(triangleNumber-1)*3);
	line3 = vtk.vtkLine();
	line3.GetPointIds().SetId(0, 1+(triangleNumber-1)*3);
	line3.GetPointIds().SetId(1, 2+(triangleNumber-1)*3);
	triangles.InsertNextCell(line1);
	triangles.InsertNextCell(line2);
	triangles.InsertNextCell(line3);
开发者ID:annaleida,项目名称:raybender,代码行数:20,代码来源:raybender.py


示例15: draw_lines

def draw_lines(nodes, color):
    colors = vtk.vtkUnsignedCharArray()
    colors.SetNumberOfComponents(3)
    colors.SetName("Colors")
    cnt = 0
    noderange = 100
    mod = 1
    edges = nodes[0].getedges()
    points = vtk.vtkPoints()
    lines = vtk.vtkCellArray()
    nodecnt = 0

    while cnt < len(nodes):
        node = nodes[cnt]
        cnt += 1
        edges = node.getedges()
        for edge in edges:
            x0,y0,z0 = edge[0]
            x1,y1,z1 = edge[1]

            points.InsertNextPoint(edge[0])
            points.InsertNextPoint(edge[1])

            line = vtk.vtkLine()
            line.GetPointIds().SetId(0,nodecnt)
            line.GetPointIds().SetId(1,nodecnt+1)
            lines.InsertNextCell(line)
            nodecnt += 2
            colors.InsertNextTupleValue(color)

        if cnt % mod == 0:
            print "noderange", noderange, "cnt", cnt, "mod",mod
            # Create a polydata to store everything in
            linesPolyData = vtk.vtkPolyData()
            # Add the points to the dataset
            linesPolyData.SetPoints(points)
            # Add the lines to the dataset
            linesPolyData.SetLines(lines)
            linesPolyData.GetCellData().SetScalars(colors)

            mapper = vtk.vtkPolyDataMapper()
            mapper.SetInput(linesPolyData)
            actor = vtk.vtkActor()
            actor.SetMapper(mapper)
            renderer.AddActor(actor)
            points = vtk.vtkPoints()
            lines = vtk.vtkCellArray()
            nodecnt = 0    
            renderWindow.Render()
            camera = renderer.GetActiveCamera()
            camera.Azimuth(0.1)

    print "done!"
开发者ID:squeakus,项目名称:octree,代码行数:53,代码来源:animatetree.py


示例16: draw

    def draw(self, graphics):
        cell, pointnums = super(Line, self).draw(graphics)
        # colour bugfix for polylines
        for __ in range(len(pointnums) - 2):
            graphics.colours.InsertNextTupleValue(self.colour or graphics.default_colour)

        for i in range(len(pointnums) - 1):
            line = vtk.vtkLine()
            line.GetPointIds().SetId(0, pointnums[i])
            line.GetPointIds().SetId(1, pointnums[i + 1])
            cell.InsertNextCell(line)

        graphics.data.SetLines(cell)
开发者ID:ajroque,项目名称:OpenGlider,代码行数:13,代码来源:Functions.py


示例17: write_vtk_file

def write_vtk_file( filename, point_data ):
   ''' Writes a line into a VTK file with given points

       :param filename:      Name of the file e.g. "test.vtk"
       :param points:        Points in a line in array format

       .. code-block:: python

          # Example usage:
          import pytools as pt
          filename = "test.vtk"
          point_data = [[0.,0.,0.], [1.,1.,1.], [2.,2.,2.], [3.,3.,3.], [4.,4.,4.]]
          pt.miscellaneous.write_vtk_file( filename=filename, point_data=point_data )

   '''
   import vtk
   
   # Create a line object
   #######################################
   # Create a vtkPoints object and store the points in it
   points = vtk.vtkPoints()
   for point in point_data:
      points.InsertNextPoint(point)
   
   # Create a cell array to store the lines in and add the lines to it
   lines = vtk.vtkCellArray()
   
   for i in range(len(point_data)-1):
     line = vtk.vtkLine()
     line.GetPointIds().SetId(0,i)
     line.GetPointIds().SetId(1,i+1)
     lines.InsertNextCell(line)
   
   # Create a polydata to store everything in
   linesPolyData = vtk.vtkPolyData()
   
   # Add the points to the dataset
   linesPolyData.SetPoints(points)
   
   # Add the lines to the dataset
   linesPolyData.SetLines(lines)
   #######################################
   
   
   # Write the Line object
   #######################################
   polyDataWriter = vtk.vtkPolyDataWriter()
   polyDataWriter.SetFileName(filename)
   polyDataWriter.SetInput(linesPolyData)
   polyDataWriter.Write()
开发者ID:fmihpc,项目名称:analysator,代码行数:50,代码来源:vtkwriter.py


示例18: create_actor_polygon

def create_actor_polygon(pts, color, **kwargs):
    """ Creates a VTK actor for rendering polygons.

    :param pts: points
    :type pts: vtkFloatArray
    :param color: actor color
    :type color: list
    :return: a VTK actor
    :rtype: vtkActor
    """
    # Keyword arguments
    array_name = kwargs.get('name', "")
    array_index = kwargs.get('index', 0)
    line_width = kwargs.get('size', 1.0)

    # Create points
    points = vtk.vtkPoints()
    points.SetData(pts)

    # Number of points
    num_points = points.GetNumberOfPoints()

    # Create lines
    cells = vtk.vtkCellArray()
    for i in range(num_points - 1):
        line = vtk.vtkLine()
        line.GetPointIds().SetId(0, i)
        line.GetPointIds().SetId(1, i + 1)
        cells.InsertNextCell(line)

    # Create a PolyData object and add points & lines
    polydata = vtk.vtkPolyData()
    polydata.SetPoints(points)
    polydata.SetLines(cells)

    # Map poly data to the graphics primitives
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputDataObject(polydata)
    mapper.SetArrayName(array_name)
    mapper.SetArrayId(array_index)

    # Create an actor and set its properties
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    actor.GetProperty().SetColor(*color)
    actor.GetProperty().SetLineWidth(line_width)

    # Return the actor
    return actor
开发者ID:orbingol,项目名称:NURBS-Python,代码行数:49,代码来源:vtk_helpers.py


示例19: unstructuredgrid

  def unstructuredgrid( self, points, npars=None ):
    """add unstructured grid"""

    points = _nansplit( points )
    #assert isinstance( points, (list,tuple,numpy.ndarray) ), 'Expected list of point arrays'

    import vtk

    vtkPoints = vtk.vtkPoints()
    vtkPoints.SetNumberOfPoints( sum(pts.shape[0] for pts in points) )

    cnt = 0
    for pts in points:

      np, ndims = pts.shape
      if not npars:
        npars = ndims

      vtkelem   = None

      if np == 2:
        vtkelem = vtk.vtkLine()
      elif np == 3:
        vtkelem = vtk.vtkTriangle()
      elif np == 4:  
        if npars == 2:
          vtkelem = vtk.vtkQuad()
        elif npars == 3:
          vtkelem = vtk.vtkTetra()
      elif np == 8:
        vtkelem = vtk.vtkVoxel() # TODO hexahedron for not rectilinear NOTE ordering changes!

      if not vtkelem:
        raise Exception( 'not sure what to do with cells with ndims=%d and npoints=%d' % (ndims,np) )

      if ndims < 3:
        pts = numpy.concatenate([pts,numpy.zeros(shape=(pts.shape[0],3-ndims))],axis=1)

      cellpoints = vtkelem.GetPointIds()

      for i,point in enumerate(pts):
        vtkPoints .SetPoint( cnt, point )
        cellpoints.SetId( i, cnt )
        cnt +=1
    
      self.vtkMesh.InsertNextCell( vtkelem.GetCellType(), cellpoints )

    self.vtkMesh.SetPoints( vtkPoints )
开发者ID:SinghN,项目名称:nutils,代码行数:48,代码来源:plot.py


示例20: drawLineBetweenPoints

  def drawLineBetweenPoints(self, point1, point2):        
    # Create a vtkPoints object and store the points in it
    points = vtk.vtkPoints()
    points.InsertNextPoint(point1)
    points.InsertNextPoint(point2)

    # Create line
    line = vtk.vtkLine()
    line.GetPointIds().SetId(0,0) 
    line.GetPointIds().SetId(1,1)
    lineCellArray = vtk.vtkCellArray()
    lineCellArray.InsertNextCell(line)
    
    # Update model data
    self.line.GetPolyData().SetPoints(points)
    self.line.GetPolyData().SetLines(lineCellArray)
开发者ID:dgmato,项目名称:PercutaneousNavigation,代码行数:16,代码来源:PercutaneousNavigation.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkLineSource函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkLight函数代码示例发布时间: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