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

Python vtk.vtkArrowSource函数代码示例

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

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



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

示例1: __init__

 def __init__ (self, mod_m): 
     debug ("In VelocityVector::__init__ ()")
     Common.state.busy ()
     Base.Objects.Module.__init__ (self, mod_m)
     self.glyph2d_src = vtk.vtkGlyphSource2D ()
     self.cone = vtk.vtkConeSource ()
     self.arrow = vtk.vtkArrowSource ()
     self.glyph_src = self.cone
     self.glyph3d = vtk.vtkGlyph3D ()
     self.mapper = self.map = vtk.vtkPolyDataMapper ()
     self.actor = self.act = vtk.vtkActor ()
     # used to orient the cone properly
     self.glph_trfm = vtk.vtkTransformFilter ()
     self.glph_trfm.SetTransform (vtk.vtkTransform ())
     self.data_out = self.mod_m.GetOutput ()
     
     # Point of glyph that is attached -- -1 is tail, 0 is center,
     # 1 is head.
     self.glyph_pos = -1 
     self.scale = 1.0
     self.color_mode = 2 #2 is vector, 1 is scalar, -1 none
     self._initialize ()
     self._gui_init ()
     self.renwin.Render ()
     Common.state.idle ()
开发者ID:sldion,项目名称:DNACC,代码行数:25,代码来源:VelocityVector.py


示例2: __init__

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


示例3: setupGlyph

  def setupGlyph(self,fUnitConv= 1.0):
    self.polydata= self.getPolydata(fUnitConv)
    # Generate the arrow for the glyphs
    arrow = vtk.vtkArrowSource()
    #arrow.SetRadius(0.1)
    #arrow.SetHeight(0.5)
    self.glyph = vtk.vtkGlyph3D()
    self.glyph.SetInputData(self.polydata)
    self.glyph.SetSourceConnection(arrow.GetOutputPort())
    self.glyph.ScalingOn()
    self.glyph.SetScaleModeToScaleByScalar()
    self.glyph.SetVectorModeToUseVector()
    self.glyph.OrientOn()
    # Tell the filter to "clamp" the scalar range
    #self.glyph.ClampingOn()  
    # Set the overall (multiplicative) scaling factor
    self.glyph.SetScaleFactor(self.scaleFactor)

    # Set the Range to "clamp" the data to 
    #   -- see equations above for nonintuitive definition of "clamping"
    # The fact that I'm setting the minimum value of the range below
    #   the minimum of my data (real min=0.0) with the equations above
    #   forces a minimum non-zero glyph size.

    #self.glyph.SetRange(-10, 10)    # Change these values to see effect on cone sizes

    # Tell glyph which attribute arrays to use for what
    self.glyph.SetInputArrayToProcess(0,0,0,0,self.lenghtsName)	# scalars
    self.glyph.SetInputArrayToProcess(1,0,0,0,self.vectorsName) # vectors
    # self.glyph.SetInputArrayToProcess(2,0,0,0,'nothing')	# normals
    #self.glyph.SetInputArrayToProcess(3,0,0,0,self.lenghtsName) # colors

    # Calling update because I'm going to use the scalar range to set the color map range
    self.glyph.Update()
开发者ID:lcpt,项目名称:xc,代码行数:34,代码来源:vector_field_data.py


示例4: __init__

    def __init__(self, scale=0.01, **kwargs):
        kwargs["scale"] = scale

        self.poly_data = vtk.vtkPolyData()

        self.arrow_source = vtk.vtkArrowSource()

        self.transform = vtk.vtkTransform()
        
        self.transform_poly_data_filter = vtk.vtkTransformPolyDataFilter()
        self.transform_poly_data_filter.SetTransform(self.transform)
        self.transform_poly_data_filter.SetInputConnection(self.arrow_source.GetOutputPort())

        self.glyph = vtk.vtkGlyph3D()
        self.glyph.OrientOn()
        self.glyph.SetVectorModeToUseNormal()
        self.glyph.SetInput(self.poly_data)
        self.glyph.SetSourceConnection(self.transform_poly_data_filter.GetOutputPort())

        self.mapper = vtk.vtkPolyDataMapper()
        self.mapper.SetInputConnection(self.glyph.GetOutputPort())

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

        self._process_kwargs(**kwargs)
开发者ID:gbaydin,项目名称:autodiff,代码行数:26,代码来源:troupe.py


示例5: drawVtkSymb

def drawVtkSymb(symbType,renderer, RGBcolor, vPos, vDir, scale):
    '''Adds to the renderer a symbol of type 'arrow', 'doubleArrow',
    'cone', 'doubleCone', 'sphere', 'doubleSphere','cube' , 'doubleCube',
    'cylinder', 'doubleCylinder'

    :param symbType: type of symbol (available types: 'arrow', 'doubleArrow',
           'cone', 'doubleCone', 'sphere', 'doubleSphere','cube' ,
           'doubleCube', 'cylinder', 'doubleCylinder')
    :param renderer: vtk renderer
    :param RGBcolor: list [R,G,B] with the 3 components of color
    :param vPos: list [x,y,z] with the 3 coordinates of the point where
           to place the symbol.
    :param vDir: director vector to orient the symbol
    :param scale: scale to be applied to the symbol representation
    '''
    symTpLow=symbType.lower()
    if 'arrow' in symTpLow:
        symbSource=vtk.vtkArrowSource()
    elif 'cone' in symTpLow:
        symbSource=vtk.vtkConeSource()
    elif 'sphere' in symTpLow:
        symbSource=vtk.vtkSphereSource()
    elif 'cube' in symTpLow:
        symbSource=vtk.vtkCubeSource()
    elif 'cylinder' in symTpLow:
        symbSource=vtk.vtkCylinderSource()
    vPosVx=[vPos[i]-scale/2.0*vDir[i] for i in range(3)] #vertex position
    addSymb(symbSource,renderer, RGBcolor, vPosVx, vDir, scale)
    if 'double' in symTpLow:
        vPosVx=[vPosVx[i]-scale*vDir[i] for i in range(3)] #vertex position
        addSymb(symbSource,renderer, RGBcolor, vPosVx, vDir, scale)
开发者ID:lcpt,项目名称:xc_utils,代码行数:31,代码来源:utilsVtk.py


示例6: create_glyph

    def create_glyph(self,plane_mapper):
        #in here we do the arrows
        arrows = vtk.vtkArrowSource()


        ptMask = vtk.vtkMaskPoints()
        ptMask.SetInputConnection(plane_mapper.GetOutputPort())
        ptMask.SetOnRatio(10)
        ptMask.RandomModeOn()

        #in here we do the glyohs
        glyph = vtk.vtkGlyph3D()
        glyph.SetSourceConnection(arrows.GetOutputPort())
        glyph.SetInputConnection(ptMask.GetOutputPort())
        glyph.SetColorModeToColorByVector()
        glyph.SetScaleFactor(20)


        #Glyph mapper
        gly_mapper = vtk.vtkPolyDataMapper()
        gly_mapper.SetInputConnection(glyph.GetOutputPort())
        gly_mapper.SetLookupTable(self.arrowColor)


        #glyph actor
        gly_actor = vtk.vtkActor()
        gly_actor.SetMapper(gly_mapper)

        return gly_actor
开发者ID:svelezsaffon,项目名称:vector_field_visualization_vtk,代码行数:29,代码来源:three_planes.py


示例7: __init__

    def __init__(self,data_reader):
        self.lut=vtk.vtkLookupTable()
        self.lut.SetNumberOfColors(256)

        self.lut.SetTableRange(data_reader.get_scalar_range())
        self.lut.SetHueRange(0,1)
        self.lut.SetRange(data_reader.get_scalar_range())
        self.lut.SetRange(data_reader.get_scalar_range())
        self.lut.Build()

        self.arrow=vtk.vtkArrowSource()
        self.arrow.SetTipResolution(6)
        self.arrow.SetTipRadius(0.1)
        self.arrow.SetTipLength(0.35)
        self.arrow.SetShaftResolution(6)
        self.arrow.SetShaftRadius(0.03)
        
        self.glyph=vtk.vtkGlyph3D()

        self.glyph.SetInput(data_reader.get_data_set())
        self.glyph.SetSource(self.arrow.GetOutput())
        self.glyph.SetVectorModeToUseVector()
        self.glyph.SetColorModeToColorByScalar()
        self.glyph.SetScaleModeToScaleByVector()
        self.glyph.OrientOn()
        self.glyph.SetScaleFactor(0.002)
		
        mapper=vtk.vtkPolyDataMapper()
        mapper.SetInput(self.glyph.GetOutput())
        mapper.SetLookupTable(self.lut)
        mapper.ScalarVisibilityOn()
        mapper.SetScalarRange(data_reader.get_scalar_range())
        self.actor=vtk.vtkActor()
        self.actor.SetMapper(mapper)	
开发者ID:bitcoinsoftware,项目名称:3D-Scientific-Visualization,代码行数:34,代码来源:Vector_Field.py


示例8: __init__

 def __init__(self):
     super(Arrow, self).__init__()
     self.arrow = vtk.vtkArrowSource()
     self.prim = vtk.vtkTransformPolyDataFilter()
     self.end_point = [0, 0, 0]
     self.start_point = [1, 0, 0]
     self.shaft_radius = 0.03
     self.tip_radius = 0.1
     self.length_ratio = 0.35
开发者ID:vryy,项目名称:O2FEMpp,代码行数:9,代码来源:primitives.py


示例9: create_arrow

 def create_arrow(self):
     source = vtk.vtkArrowSource()
     # Create a mapper and actor
     mapper = vtk.vtkPolyDataMapper()
     mapper.SetInputConnection(source.GetOutputPort())
     
     actor = vtk.vtkActor()
     actor.SetMapper(mapper)
     
     self.render.AddActor(actor)
开发者ID:ricleal,项目名称:PythonCode,代码行数:10,代码来源:vtk1.py


示例10: __init__

    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)
        InputArrayChoiceMixin.__init__(self)

        self._config.scaling = True
        self._config.scaleFactor = 1
        self._config.scaleMode = glyphScaleMode.index('SCALE_BY_VECTOR')
        self._config.colourMode = glyphColourMode.index('COLOUR_BY_VECTOR')
        self._config.vectorMode = glyphVectorMode.index('USE_VECTOR')
        self._config.mask_on_ratio = 5
        self._config.mask_random = True


        configList = [
            ('Scale glyphs:', 'scaling', 'base:bool', 'checkbox',
             'Should the size of the glyphs be scaled?'),
            ('Scale factor:', 'scaleFactor', 'base:float', 'text',
             'By how much should the glyph size be scaled if scaling is '
             'active?'),
            ('Scale mode:', 'scaleMode', 'base:int', 'choice',
             'Should scaling be performed by vector, scalar or only factor?',
             glyphScaleModeTexts),
            ('Colour mode:', 'colourMode', 'base:int', 'choice',
             'Colour is determined based on scalar or vector magnitude.',
             glyphColourModeTexts),
            ('Vector mode:', 'vectorMode', 'base:int', 'choice',
             'Should vectors or normals be used for scaling and orientation?',
             glyphVectorModeTexts),
            ('Vectors selection:', 'vectorsSelection', 'base:str', 'choice',
             'The attribute that will be used as vectors for the warping.',
             (input_array_choice_mixin.DEFAULT_SELECTION_STRING,)),
            ('Mask on ratio:', 'mask_on_ratio', 'base:int', 'text',
             'Every Nth point will be glyphed.'),
            ('Random masking:', 'mask_random', 'base:bool', 'checkbox',
             'Pick random distribution of Nth points.')]

        self._mask_points = vtk.vtkMaskPoints()
        module_utils.setup_vtk_object_progress(self,
                self._mask_points, 'Masking points.')

        self._glyphFilter = vtk.vtkGlyph3D()
        asrc = vtk.vtkArrowSource()
        self._glyphFilter.SetSource(0, asrc.GetOutput())

        self._glyphFilter.SetInput(self._mask_points.GetOutput())
        
        module_utils.setup_vtk_object_progress(self, self._glyphFilter,
                                           'Creating glyphs.')

        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)' : self,
             'vtkGlyph3D' : self._glyphFilter})

        self.sync_module_logic_with_config()
开发者ID:fvpolpeta,项目名称:devide,代码行数:55,代码来源:glyphs.py


示例11: draw

    def draw(self, graphics):
        cell, pointnums = super(Arrow, self).draw(graphics)
        assert len(pointnums) == 2

        arrow = vtk.vtkArrowSource()
        p1, p2 = graphics.get_points(*pointnums)
        transform = vtk.vtkTransform()
        transform.Translate(p1)
        length = norm(p2-p1)
        transform.Scale(length, length, length)
        pass
开发者ID:ajroque,项目名称:OpenGlider,代码行数:11,代码来源:Functions.py


示例12: render

 def render(self, pointsData, scalarsArray, vectorsArray, nspecies, colouringOptions, vectorsOptions, lut,
            invert=False):
     """
     Render vectors.
     
     """
     self._logger.debug("Rendering vectors")
     
     # points
     points = vtk.vtkPoints()
     points.SetData(pointsData.getVTK())
     
     # polydata
     arrowPolyData = vtk.vtkPolyData()
     arrowPolyData.SetPoints(points)
     arrowPolyData.GetPointData().SetScalars(scalarsArray.getVTK())
     arrowPolyData.GetPointData().SetVectors(vectorsArray.getVTK())
 
     # arrow source
     arrowSource = vtk.vtkArrowSource()
     arrowSource.SetShaftResolution(vectorsOptions.vectorResolution)
     arrowSource.SetTipResolution(vectorsOptions.vectorResolution)
     if invert:
         arrowSource.InvertOn()
     arrowSource.Update()
     
     # glyph mapper
     arrowGlyph = vtk.vtkGlyph3DMapper()
     arrowGlyph.OrientOn()
     if vtk.vtkVersion.GetVTKMajorVersion() <= 5:
         arrowGlyph.SetInputConnection(arrowPolyData.GetProducerPort())
     else:
         arrowGlyph.SetInputData(arrowPolyData)
     arrowGlyph.SetSourceConnection(arrowSource.GetOutputPort())
     arrowGlyph.SetScaleModeToScaleByMagnitude()
     arrowGlyph.SetScaleArray("vectors")
     arrowGlyph.SetScalarModeToUsePointFieldData()
     arrowGlyph.SelectColorArray("colours")
     arrowGlyph.SetScaleFactor(vectorsOptions.vectorScaleFactor)
     arrowMapper = arrowGlyph
     arrowMapper.SetLookupTable(lut)
     utils.setMapperScalarRange(arrowMapper, colouringOptions, nspecies)
 
     # actor
     arrowActor = vtk.vtkActor()
     arrowActor.SetMapper(arrowMapper)
     
     # store attributes
     self._actor = utils.ActorObject(arrowActor)
     self._data["Points"] = pointsData
     self._data["Scalars"] = scalarsArray
     self._data["Vectors"] = vectorsArray
     self._data["LUT"] = lut
     self._data["Scale factor"] = vectorsOptions.vectorScaleFactor
开发者ID:brunoduran,项目名称:Atoman,代码行数:54,代码来源:vectorRenderer.py


示例13: addarrow

def addarrow(pos=(0,0,0),color=(1,0,0),opacity=1):
    
    arrow = vtk.vtkArrowSource()
    arrowm = vtk.vtkPolyDataMapper()
    arrowm.SetInput(arrow.GetOutput())
    
    arrowa= vtk.vtkActor()
    arrowa.SetMapper(arrowm)
    arrowa.GetProperty().SetColor(color)
    arrowa.GetProperty().SetOpacity(opacity)
    
    return arrowa
开发者ID:Garyfallidis,项目名称:trn,代码行数:12,代码来源:diffusion.py


示例14: attach_vel

    def attach_vel(self):

        vel = self._vel * 1e-2
        rad = self._rad

        if vel is not None and rad is not None:

            velMag = norm(vel, axis=1)
            velMag_vtk = numpy_support.numpy_to_vtk(num_array=velMag.ravel(), deep=True, array_type=vtk.VTK_FLOAT)
            velMag_vtk.SetName("veloMag")

            vecVel = vtk.vtkFloatArray()
            vecVel.SetNumberOfComponents(3)

            for i, v in enumerate(vel):
                vecVel.InsertTuple3(i, v[0], v[1], v[2])

            #Put an arrow (vector) at each ball
            arrow = vtk.vtkArrowSource()
            arrow.SetTipRadius(rad.mean() * 10)
            arrow.SetShaftRadius(rad.mean() * 10)

            poly = vtk.vtkPolyData()
            poly.SetPoints(self._points)

            poly.GetPointData().AddArray(velMag_vtk)
            poly.GetPointData().SetActiveScalars("veloMag")

            arrowGlyph = vtk.vtkGlyph3D()
            
            arrowGlyph.SetInputData(poly)
            arrowGlyph.SetSourceConnection(arrow.GetOutputPort())
            arrowGlyph.SetVectorModeToUseVector()

            poly.GetPointData().SetVectors(vecVel)

            # If we do not want the Arrow's size to depend on the Scalar
            # then arrowGlyph.SetScaleModeToDataScalingOff() must be called
            arrowMapper = vtk.vtkPolyDataMapper()
            arrowMapper.SetInputConnection(arrowGlyph.GetOutputPort())

            self._addScalarBar(velMag)
            arrowMapper.SetLookupTable(self._colorTransferFunction)

            arrowActor = vtk.vtkActor()
            arrowActor.SetMapper(arrowMapper)
            arrowActor.GetProperty().SetColor(1,1,0)

            self._ren.AddActor(arrowActor)
        else:
            print("No particles found. Make sure the particles loaded have velocities and radii.")
开发者ID:Andrew-AbiMansour,项目名称:PyDEM,代码行数:51,代码来源:visualize.py


示例15: renderthis

        def renderthis(self):
            # open a window and create a renderer
            self.ren = vtk.vtkRenderer()
            self.widget.GetRenderWindow().AddRenderer(self.ren)
            # to generate polygonal data for a arrow.
            Arrow = vtk.vtkArrowSource()
            Arrow.SetShaftResolution(100)
            Arrow.SetTipResolution(100)
            #invert arrow so the point which is referenced is the top of the point
            Arrow.InvertOn()
 
            # take the polygonal data from the vtkArrowSource and assign to variable arrowmapper 
            ArrowMapper = vtk.vtkPolyDataMapper()
            ArrowMapper.SetInputConnection(Arrow.GetOutputPort())
 
            # create an actor for our scene (arrowactor)
            self.ArrowActor = vtk.vtkActor()
            self.ArrowActor.SetMapper(ArrowMapper)
            self.ArrowActor.GetProperty().SetColor(1,1,0)
            self.ArrowActor.GetProperty().SetOpacity(0.60)
            self.ArrowActor.GetProperty().EdgeVisibilityOn()
            self.ArrowActor.GetProperty().SetColor(0.1,0.1,0.1)
            # set tip position to (0,0,0)
            self.position=(0,0,0)
            self.ArrowActor.SetPosition(self.position)
            # get and print arrow position
            self.ArrowPos = self.ArrowActor.GetPosition()
            #print self.ArrowPos 
                         
            # Add actor to renderer window
            #self.ren.AddActor(self.ArrowActor)
            # Background colour lightgrey
            self.ren.SetBackground(0.9,0.9,0.9)
            
#create a X,Y,Z axes to show 3d position:
            # create axes variable and load vtk axes actor
            self.axes = vtk.vtkAxesActor()
            self.marker = vtk.vtkOrientationMarkerWidget()
            # set the interactor. self.widget._Iren is inbuilt python mechanism for current renderer window.
            self.marker.SetInteractor(self.widget._Iren )
            self.marker.SetOrientationMarker(self.axes )
            # set size and position of window (Xmin,Ymin,Xmax,Ymax)
            self.marker.SetViewport(0.75,0,1,0.25)
            #Allow user input
            self.marker.SetEnabled(1)

            # #settings for renderer window 
            self.ren.ResetCamera()
            self.ren.ResetCameraClippingRange()         
            self.isplotted = True
            self.p=0
开发者ID:aledj2,项目名称:MedPhysPython,代码行数:51,代码来源:Automatedlinedrawfromacceldata.py


示例16: __init__

    def __init__(self, maxnorm, scale=1):
        vtkClampedGlyphSource.__init__(self, scale, vtkArrowSource(),
                                       range_min=0.0, range_max=maxnorm)

        self.vtk_property.SetColor(1.0, 0.25, 0.25) # forces are red
        self.vtk_property.SetInterpolationToPhong()
        self.vtk_property.SetDiffuse(0.7)
        self.vtk_property.SetSpecular(0.4)
        self.vtk_property.SetSpecularPower(20)

        self.vtk_glyph_source.SetShaftResolution(12)
        self.vtk_glyph_source.SetShaftRadius(0.03*avg_radius) #default 0.03
        self.vtk_glyph_source.SetTipResolution(20)
        self.vtk_glyph_source.SetTipLength(0.3*avg_radius) #default 0.35
        self.vtk_glyph_source.SetTipRadius(0.1*avg_radius) #default 0.1
开发者ID:JConwayAWT,项目名称:PGSS14CC,代码行数:15,代码来源:sources.py


示例17: _arrow

def _arrow(pos=(0,0,0),color=(1,0,0),scale=(1,1,1),opacity=1):
    ''' Internal function for generating arrow actors.    
    '''
    arrow = vtk.vtkArrowSource()
    #arrow.SetTipLength(length)
    
    arrowm = vtk.vtkPolyDataMapper()
    arrowm.SetInput(arrow.GetOutput())
    
    arrowa= vtk.vtkActor()
    arrowa.SetMapper(arrowm)
    
    arrowa.GetProperty().SetColor(color)
    arrowa.GetProperty().SetOpacity(opacity)
    arrowa.SetScale(scale)
    
    return arrowa
开发者ID:arokem,项目名称:Fos,代码行数:17,代码来源:fos.py


示例18: draw_arrow

def draw_arrow(startPoint,length,direction,renderer,invert,color):
	"""
	Draws and scales an arrow with a defined starting point, direction and length, adds to the renderer, returns the actor.
	"""
	arrowSource=vtk.vtkArrowSource()
	arrowSource.SetShaftRadius(0.024)
	arrowSource.SetTipRadius(0.07)
	arrowSource.SetTipLength(0.14)
	if invert:
		arrowSource.InvertOn()
	else: arrowSource.InvertOff()
	endPoint=startPoint+length*direction
	normalizedX=(endPoint-startPoint)/length

	
	arbitrary=np.array([1,1,1]) #can be replaced with a random vector
	normalizedZ=np.cross(normalizedX,arbitrary/np.linalg.norm(arbitrary))
	normalizedY=np.cross(normalizedZ,normalizedX)
	
	# Create the direction cosine matrix by writing values directly to an identity matrix
	matrix = vtk.vtkMatrix4x4()
	matrix.Identity()
	for i in range(3):
		matrix.SetElement(i, 0, normalizedX[i])
		matrix.SetElement(i, 1, normalizedY[i])
		matrix.SetElement(i, 2, normalizedZ[i])
		
	#Apply transforms
	transform = vtk.vtkTransform()
	transform.Translate(startPoint)
	transform.Concatenate(matrix)
	transform.Scale(length, length, length)
 
	# Transform the polydata
	transformPD = vtk.vtkTransformPolyDataFilter()
	transformPD.SetTransform(transform)
	transformPD.SetInputConnection(arrowSource.GetOutputPort())
	
	#Create mapper and actor
	mapper = vtk.vtkPolyDataMapper()
	mapper.SetInputConnection(transformPD.GetOutputPort())
	actor = vtk.vtkActor()
	actor.SetMapper(mapper)
	actor.GetProperty().SetColor(color)
	renderer.AddActor(actor)
	return actor
开发者ID:majroy,项目名称:pyCM,代码行数:46,代码来源:pyCMcommon.py


示例19: MakeGlyphs

def MakeGlyphs(src, reverseNormals):
    '''
    Glyph the normals on the surface.

    You may need to adjust the parameters for maskPts, arrow and glyph for a
    nice appearance.

    :param: src - the surface to glyph.
    :param: reverseNormals - if True the normals on the surface are reversed.
    :return: The glyph object.

    '''
    # Sometimes the contouring algorithm can create a volume whose gradient
    # vector and ordering of polygon (using the right hand rule) are
    # inconsistent. vtkReverseSense cures this problem.
    reverse = vtk.vtkReverseSense()

    # Choose a random subset of points.
    maskPts = vtk.vtkMaskPoints()
    maskPts.SetOnRatio(5)
    maskPts.RandomModeOn()
    if reverseNormals:
        reverse.SetInputData(src)
        reverse.ReverseCellsOn()
        reverse.ReverseNormalsOn()
        maskPts.SetInputConnection(reverse.GetOutputPort())
    else:
        maskPts.SetInputData(src)

    # Source for the glyph filter
    arrow = vtk.vtkArrowSource()
    arrow.SetTipResolution(16)
    arrow.SetTipLength(0.3)
    arrow.SetTipRadius(0.1)

    glyph = vtk.vtkGlyph3D()
    glyph.SetSourceConnection(arrow.GetOutputPort())
    glyph.SetInputConnection(maskPts.GetOutputPort())
    glyph.SetVectorModeToUseNormal()
    glyph.SetScaleFactor(1)
    glyph.SetColorModeToColorByVector()
    glyph.SetScaleModeToScaleByVector()
    glyph.OrientOn()
    glyph.Update()
    return glyph
开发者ID:dlrdave,项目名称:VTKWikiExamples,代码行数:45,代码来源:CurvatureBandsWithGlyphs.py


示例20: update

    def update(self):
        # Source for the glyph filter
        arrow = vtkArrowSource()
        arrow.SetTipResolution(8)
        arrow.SetTipLength(0.3)
        arrow.SetTipRadius(0.1)

        glyph = vtkGlyph3D()
        glyph.SetSourceConnection(arrow.GetOutputPort())
        glyph.SetInput(self.input_)
        glyph.SetVectorModeToUseNormal()
        glyph.SetScaleFactor(0.1)
        #glyph.SetColorModeToColorByVector()
        #glyph.SetScaleModeToScaleByVector()
        glyph.OrientOn()
        glyph.Update()

        self.output_ = glyph.GetOutput()
开发者ID:mmolero,项目名称:pcloudpy,代码行数:18,代码来源:DisplayNormals.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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