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

Python vtk.vtkInteractorStyleTrackballCamera函数代码示例

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

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



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

示例1: visualize

def visualize(meshFname = None, dumpFname = None, nFrames = 100):

    # Create a rendering window and renderer
    transform = vtk.vtkTransform()
    transform.Scale(10.0, 10.0, 10.0)
     
    axes = vtk.vtkAxesActor()
    axes.SetUserTransform(transform)

    transform.Translate(2.0, -1.0, 0.0)
    axes.SetUserTransform(transform)

    renderer = vtk.vtkRenderer()
    renderer.AddActor(axes)
    
    camera = vtk.vtkCamera()
    camera.SetFocalPoint(0, 0, 0);
    renderer.SetActiveCamera(camera);

    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(renderer)

     # Create a RenderWindowInteractor to permit manipulating the camera
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)

    scale = 0.1

    if dumpFname is not None:
	   with open(dumFname) as fp:
		lines = (line for line in fp if not line.strip()[:3].isalpha())
		sphereData = np.array(lines)

	   Natoms = len(sphereData) - nFrames

	   for i in range(nFrames):
		for data in sphereData[Natoms * nFrames: Natoms * (nFrames+1)]:
			plotSpheres(ren, data[1] * scale, data[2] * scale, data[3] * scale, 0.001)

    if meshFname is not None:
        polydata = loadStl(meshFname)
        renderer.AddActor(polyDataToActor(polydata))
        renderer.SetBackground(0.1, 0.1, 0.1)

    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)
    renderer.ResetCamera()

    iren.Initialize()
    renWin.Render()
    iren.Start()
开发者ID:Andrew-AbiMansour,项目名称:PyDEM,代码行数:53,代码来源:visualize.py


示例2: initVTKWidget

	def initVTKWidget(self,frame):
		
		"""Sets up vtkWidget inside frame.
		
		Also sets up corresponding renderer and interactor.
		
		Args:
			frame (QtGui.QFrame): Parenting frame.
			
		Returns:
			tuple: Tuple containing:
			
				* vtkWidget (vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor): Qt vtk window interactor.
				* ren (vtk.vtkRenderer)
				* iren (vtk.vtkRenderWindowInteractor)
				
		"""
		
		vtkWidget = QVTKRenderWindowInteractor(frame)
		ren = vtk.vtkRenderer()
		vtkWidget.GetRenderWindow().AddRenderer(ren)
		iren = vtkWidget.GetRenderWindow().GetInteractor()
		iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
		ren.ResetCamera()
		
		return vtkWidget, ren, iren
开发者ID:alexblaessle,项目名称:PyFRAP,代码行数:26,代码来源:pyfrp_gui_vtk.py


示例3: show

def show(ren,title='Fos',size=(300,300)):
    ''' Show window 
    
    Parameters
    ----------
    ren : vtkRenderer() object 
            as returned from function ren()
    title : string 
            a string for the window title bar
    size : (int, int) 
            (width,height) of the window
    
    Examples
    --------    
    >>> from dipy.viz import fos
    >>> r=fos.ren()    
    >>> lines=[np.random.rand(10,3),np.random.rand(20,3)]    
    >>> colors=[0.2,0.8]
    >>> c=fos.line(lines,colors)    
    >>> fos.add(r,c)
    >>> l=fos.label(r)
    >>> fos.add(r,l)
    >>> fos.show(r)
    '''
    ren.ResetCamera()        
    window = vtk.vtkRenderWindow()
    window.AddRenderer(ren)
    window.SetWindowName(title) 
    window.SetSize(size)
    style=vtk.vtkInteractorStyleTrackballCamera()        
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(window)
    iren.SetInteractorStyle(style)
    iren.Start()
开发者ID:mohini,项目名称:dipy,代码行数:34,代码来源:fos.py


示例4: __init__

    def __init__(self, parent=None, fix_camera=True,
        background=None, size=None):
        '''
        fix_camera : more sensible default
        '''
        if parent is not None:
            self.renWin = parent.GetRenderWindow()
            self.iren = self.renWin.GetInteractor()
        else:
            self.renWin = vtk.vtkRenderWindow()
            if size is None:
                self.renWin.SetSize(800, 600)
            self.iren = vtk.vtkRenderWindowInteractor()
            self.iren.SetRenderWindow(self.renWin)

        self.ren = vtk.vtkRenderer()
        if background == 'white':
            self.ren.SetBackground(1, 1, 1)
        self.renWin.AddRenderer(self.ren)

        if fix_camera:
            camera = vtk.vtkInteractorStyleTrackballCamera()
            camera.SetCurrentRenderer(self.ren)
            self.iren.SetInteractorStyle(camera)

        self.picker = vtk.vtkCellPicker()
        self.iren.SetPicker(self.picker)
        self.picker.AddObserver("EndPickEvent", self.handle_pick)
开发者ID:RodericDay,项目名称:MiniPNM,代码行数:28,代码来源:graphics.py


示例5: setupInteractor

	def setupInteractor(self,changeStyle=True):
		#Setup interactor
		self.iren = vtk.vtkTkRenderWindowInteractor()
		self.iren.SetRenderWindow(self.renWin)
		if changeStyle:
				style = vtk.vtkInteractorStyleTrackballCamera()
				self.iren.SetInteractorStyle(style)
开发者ID:kvkenyon,项目名称:projects,代码行数:7,代码来源:assignment1.py


示例6: __init__

	def __init__(self):
		self.outputs=[]
		self.paint=rgbPainter()
		self.scalingFactor=1.0
		self.showAxes=True
		self.showScalarBar=True
		self.showCaption=True
		self.showXYPlane=True
		self.showYZPlane=True
		self.showZXPlane=True
		self.nbSize=80
		self.sampleSpacing=8.0
	
		self.camera = vtk.vtkCamera()

		self.ren = vtk.vtkRenderer();
		self.renWin = vtk.vtkRenderWindow();
		self.renWin.AddRenderer(self.ren);
		self.renWin.SetWindowName("DESICOS-viewer v0.1 ")
		self.iren = vtk.vtkRenderWindowInteractor();
		self.iren.SetRenderWindow(self.renWin);
		style1 = vtk.vtkInteractorStyleTrackballCamera()
		self.iren.SetInteractorStyle(style1)
		self.ren.SetBackground(1, 1, 1);
		self.renWin.SetSize(800, 600);
开发者ID:desicos,项目名称:desicos,代码行数:25,代码来源:viewer23062013.py


示例7: SetInteractorStyle

    def SetInteractorStyle(self, state):
        action = {
            const.STATE_PAN: {
                "MouseMoveEvent": self.OnPanMove,
                "LeftButtonPressEvent": self.OnPanClick,
                "LeftButtonReleaseEvent": self.OnReleasePanClick,
            },
            const.STATE_ZOOM: {
                "MouseMoveEvent": self.OnZoomMove,
                "LeftButtonPressEvent": self.OnZoomClick,
                "LeftButtonReleaseEvent": self.OnReleaseZoomClick,
            },
            const.STATE_SPIN: {
                "MouseMoveEvent": self.OnSpinMove,
                "LeftButtonPressEvent": self.OnSpinClick,
                "LeftButtonReleaseEvent": self.OnReleaseSpinClick,
            },
            const.STATE_WL: {
                "MouseMoveEvent": self.OnWindowLevelMove,
                "LeftButtonPressEvent": self.OnWindowLevelClick,
                "LeftButtonReleaseEvent": self.OnWindowLevelRelease,
            },
            const.STATE_DEFAULT: {},
            const.VOLUME_STATE_SEED: {"LeftButtonPressEvent": self.OnInsertSeed},
            const.STATE_MEASURE_DISTANCE: {"LeftButtonPressEvent": self.OnInsertLinearMeasurePoint},
            const.STATE_MEASURE_ANGLE: {"LeftButtonPressEvent": self.OnInsertAngularMeasurePoint},
        }

        if self._last_state in (const.STATE_MEASURE_DISTANCE, const.STATE_MEASURE_ANGLE):
            if self.measures and not self.measures[-1].text_actor:
                del self.measures[-1]

        if state == const.STATE_WL:
            self.on_wl = True
            if self.raycasting_volume:
                self.text.Show()
                self.interactor.Render()
        else:
            self.on_wl = False
            self.text.Hide()
            self.interactor.Render()

        if state in (const.STATE_MEASURE_DISTANCE, const.STATE_MEASURE_ANGLE):
            self.interactor.SetPicker(self.measure_picker)

        if state == const.STATE_ZOOM_SL:
            style = vtk.vtkInteractorStyleRubberBandZoom()
            self.interactor.SetInteractorStyle(style)
            self.style = style
        else:
            style = vtk.vtkInteractorStyleTrackballCamera()
            self.interactor.SetInteractorStyle(style)
            self.style = style

            # Check each event available for each mode
            for event in action[state]:
                # Bind event
                style.AddObserver(event, action[state][event])

        self._last_state = state
开发者ID:lynch829,项目名称:invesalius3,代码行数:60,代码来源:viewer_volume.py


示例8: createRenderWindow

    def createRenderWindow( self, **args ):
        blocking = args.get( 'blocking', False )
        renWin = args.get( 'renwin', None ) 
        if renWin == None:
            renWin = vtk.vtkRenderWindow()
            
        rendWinInteractor = renWin.GetInteractor()
        if rendWinInteractor == None:                
            rendWinInteractor = vtk.vtkRenderWindowInteractor() if blocking else vtk.vtkGenericRenderWindowInteractor()
            renWin.SetInteractor( rendWinInteractor )
            rendWinInteractor.SetRenderWindow(renWin)  
        
        self.renderWindowInteractor =  rendWinInteractor              
        self.renderer = vtk.vtkRenderer()
        renWin.AddRenderer( self.renderer )

        self.interactorStyle = vtk.vtkInteractorStyleTrackballCamera( )
        self.renderWindowInteractor.SetInteractorStyle( self.interactorStyle )
        self.interactorStyle.KeyPressActivationOff( )
        self.interactorStyle.SetEnabled(1)
                     
        if self.useDepthPeeling:
            self.renderer.UseDepthPeelingOn( )
            self.renderer.SetOcclusionRatio( 0.2 )       
            renWin.SetAlphaBitPlanes( 1 )
            renWin.SetMultiSamples( 0 )
            
        self.renderer.SetBackground(1.0, 1.0, 1.0)
        self.renderer.SetNearClippingPlaneTolerance( 0.0001 )    
        self.renderWindow = renWin
开发者ID:arulalant,项目名称:uvcdat,代码行数:30,代码来源:DV3DPlot.py


示例9: init

    def init(self):
        """
        """

        # Symbol behaviour initialisation
        self.draw_forward = ['F', 'B', 'G', 'R']
        self.move_forward = ['M']
        self.rotation = ['+', '-', '&', '^', '<', '>', '|']
        self.push_pop = ['[', ']']
        self.do_nothing = ['X']

        # Init heap / stack to remember position
        self.saved_pos = []
        self.saved_vector = []

        # VTK init
        self.renWin = vtk.vtkRenderWindow()
        self.renWin.SetSize(800, 600)
        self.renWin.SetWindowName("L-System : " + self.lsystem.name + " ( " + self.viewer_type + " )")

        self.iren = vtk.vtkRenderWindowInteractor()
        self.iren.SetRenderWindow(self.renWin)

        self.style = vtk.vtkInteractorStyleTrackballCamera()
        self.iren.SetInteractorStyle(self.style)

        # Branch initial parameters
        self.radius = self.lsystem.radius
        self.length = self.lsystem.width
        self.angle = self.lsystem.angle
开发者ID:hadim,项目名称:lsysdrawer,代码行数:30,代码来源:vviewer.py


示例10: main

def main(pairs):

    import __main__ as _main_module

    renderer = vtk.vtkRenderer()

    for op, file in pairs:
        handler_name = g_op_map[op]
        handler = _main_module.__dict__[handler_name]
        fname = file
        if not os.access(fname, os.R_OK):
            print "Missing file %s" % (fname)
            sys.exit(1)
        else:
            handler(fname, renderer)

    show_axes(renderer)

    # Create the usual rendering stuff.
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(renderer)
    renWin.SetSize(1000, 750)
    iren = vtk.vtkRenderWindowInteractor()
    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)
    iren.SetRenderWindow(renWin)

    # color
    renderer.SetBackground(.1, .2, .4)

    # Render the scene and start interaction.
    iren.Initialize()
    renWin.Render()
    iren.Start()
开发者ID:JDonner,项目名称:gabbleduck,代码行数:34,代码来源:sse.py


示例11: __test_adjust_sphere

def __test_adjust_sphere():
    import vtk

    n_points = 4
    points = []
    for i in xrange(n_points):
        p = np.random.random(3) * 100
        points.append(p)
    r, ctr = adjust_sphere(points)
    r2 = r / 10
    ren_win = vtk.vtkRenderWindow()
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
    iren.SetRenderWindow(ren_win)
    ren = vtk.vtkRenderer()
    ren_win.AddRenderer(ren)
    # draw points
    for p in points:
        __add_sphere_to_ren(p, r2, ren)
    #draw big sphere
    ac = __add_sphere_to_ren(ctr, r, ren)
    ac.GetProperty().SetColor((1, 0, 0))

    iren.Initialize()
    iren.Start()
开发者ID:deherinu,项目名称:TmsViewer,代码行数:25,代码来源:tms_geom.py


示例12: updateContents

    def updateContents(self, inputPorts):
        if self.view==None:
            self.view = pvsp.CreateRenderView()
            renWin = self.view.GetRenderWindow()
            self.SetRenderWindow(renWin)
            iren = renWin.GetInteractor()
            iren.SetNonInteractiveRenderDelay(0)
            iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())

        del self.view.Representations[:]

        # Fetch variables from the input port
        (location, representations) = inputPorts
        
        for rep in representations:
            rep.set_view(self.view)
            rep.execute()

        # Set view specific properties
        self.view.CenterAxesVisibility = 0
        self.view.Background = [0.5, 0.5, 0.5]

        self.view.ResetCamera()
        self.view.StillRender()

        QCellWidget.updateContents(self, inputPorts)
开发者ID:imclab,项目名称:vistrails,代码行数:26,代码来源:pvgenericcell.py


示例13: __test_normalize

def __test_normalize():
    import vtk

    ref_point = PointWithRef()
    point2 = PointWithRef()
    for p in (ref_point, point2):
        p.point_pos = np.random.random(3) * 15 / 100
        p.ref_pos = np.random.random(3) * 15 / 100
        p.point_or = tuple(Quaternion.from_v_theta(np.random.random(3), np.random.random()).x)
        p.ref_or = tuple(Quaternion.from_v_theta(np.random.random(3), np.random.random()).x)

    ren_win = vtk.vtkRenderWindow()
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
    iren.SetRenderWindow(ren_win)
    ren = vtk.vtkRenderer()
    ren_win.AddRenderer(ren)

    # draw ref
    __draw_point_and_uni(ref_point, (1, 1, 1), ren)

    # draw original point
    __draw_point_and_uni(point2, (0, 1, 0), ren)

    #normalize
    point2_n = normalize_point_to_ref(point2, ref_point)
    __draw_point_and_uni(point2_n, (1, 0, 0), ren)

    iren.Initialize()
    iren.Start()
开发者ID:deherinu,项目名称:TmsViewer,代码行数:30,代码来源:read_and_transform.py


示例14: __init__

    def __init__(self, threadLock, actorWrapper, axis=True,):
        super(VTKVisualisation, self).__init__()

        self.threadLock = threadLock

        self.ren = vtk.vtkRenderer()
        self.ren.AddActor(actorWrapper.actor)

        self.axesActor = vtk.vtkAxesActor()
        self.axesActor.AxisLabelsOff()
        self.axesActor.SetTotalLength(1, 1, 1)
        self.ren.AddActor(self.axesActor)

        self.renWin = vtk.vtkRenderWindow()
        self.renWin.AddRenderer(self.ren)

        ## IREN
        self.iren = vtk.vtkRenderWindowInteractor()
        self.iren.SetRenderWindow(self.renWin)
        self.iren.Initialize()

        self.style = vtk.vtkInteractorStyleTrackballCamera()
        self.iren.SetInteractorStyle(self.style)

        self.iren.AddObserver("TimerEvent", self.update_visualisation)
        dt = 30 # ms
        timer_id = self.iren.CreateRepeatingTimer(dt)
开发者ID:pointcontrols,项目名称:pyrealsense,代码行数:27,代码来源:show_vtk.py


示例15: create_render_window

def create_render_window(actors, callbacks, **kwargs):
    """ Creates VTK render window with an interactor.

    :param actors: list of VTK actors
    :type actors: list, tuple
    :param callbacks: callback functions for registering custom events
    :type callbacks: dict
    """
    # Get keyword arguments
    figure_size = kwargs.get('figure_size', (800, 600))
    camera_position = kwargs.get('camera_position', (0, 0, 100))

    # Find camera focal point
    center_points = []
    for actor in actors:
        center_points.append(actor.GetCenter())
    camera_focal_point = linalg.vector_mean(*center_points)

    # Create camera
    camera = vtk.vtkCamera()
    camera.SetPosition(*camera_position)
    camera.SetFocalPoint(*camera_focal_point)

    # Create renderer
    renderer = vtk.vtkRenderer()
    renderer.SetActiveCamera(camera)
    renderer.SetBackground(1.0, 1.0, 1.0)

    # Add actors to the scene
    for actor in actors:
        renderer.AddActor(actor)

    # Render window
    render_window = vtk.vtkRenderWindow()
    render_window.AddRenderer(renderer)
    render_window.SetSize(*figure_size)

    # Render window interactor
    window_interactor = vtk.vtkRenderWindowInteractor()
    window_interactor.SetRenderWindow(render_window)

    # Add event observers
    for cb in callbacks:
        window_interactor.AddObserver(cb, callbacks[cb][0], callbacks[cb][1])  # cb name, cb function ref, cb priority

    # Render actors
    render_window.Render()

    # Set window name after render() is called
    render_window.SetWindowName("geomdl")

    # Use trackball camera
    interactor_style = vtk.vtkInteractorStyleTrackballCamera()
    window_interactor.SetInteractorStyle(interactor_style)

    # Start interactor
    window_interactor.Start()

    # Return window interactor instance
    return window_interactor
开发者ID:orbingol,项目名称:NURBS-Python,代码行数:60,代码来源:vtk_helpers.py


示例16: show

def show(ren, title="pvtk", size=(300, 300)):
    """ Show window

    Parameters
    ----------
    ren: vtkRenderer() object
        as returned from function ren().
    title: string
        a string for the window title bar.
    size: (int, int)
        (width, height) of the window.
    """
    ren.ResetCameraClippingRange()

    window = vtk.vtkRenderWindow()
    window.AddRenderer(ren)
    window.SetWindowName(title)
    window.SetSize(size)

    style = vtk.vtkInteractorStyleTrackballCamera()
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(window)
    iren.SetInteractorStyle(style)
    iren.Initialize()

    window.Render()
    iren.Start()
开发者ID:AGrigis,项目名称:caps-clindmri,代码行数:27,代码来源:pvtk.py


示例17: __init__

	def __init__(self, parent):
		super(pnt_interactor,self).__init__(parent)
		self.ui = pt_main_window()
		self.ui.setupUi(self)
		self.ren = vtk.vtkRenderer()
		self.ren.SetBackground(0.1, 0.2, 0.4)
		self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
		self.iren = self.ui.vtkWidget.GetRenderWindow().GetInteractor()
		style=vtk.vtkInteractorStyleTrackballCamera()
		style.AutoAdjustCameraClippingRangeOn()
		self.iren.SetInteractorStyle(style)
		self.ren.GetActiveCamera().ParallelProjectionOn()
		self.cp=self.ren.GetActiveCamera().GetPosition()
		self.fp=self.ren.GetActiveCamera().GetFocalPoint()
		self.iren.AddObserver("KeyPressEvent", self.keypress)
		
		self.PointSize=2
		self.LineWidth=1
		self.Zaspect=1.0
		self.limits=np.empty(6)
		self.picking=False
		self.refWritten = False
		self.floatWritten = False
		
		self.ui.reloadButton.clicked.connect(lambda: self.get_input_data(None,None))
		self.ui.undoLastPickButton.clicked.connect(lambda: self.undo_pick())
		self.ui.writeButton.clicked.connect(lambda: self.write_new())
		self.ui.revertButton.clicked.connect(lambda: self.undo_revert())
		self.ui.reduceButton.clicked.connect(lambda: self.reduce_pnts())
		self.ui.levelButton.clicked.connect(lambda: self.level_pnts())
		self.ui.rxButton_pos.clicked.connect(lambda: self.svd('x',False))
		self.ui.ryButton_pos.clicked.connect(lambda: self.svd('y',False))
		self.ui.rxButton_neg.clicked.connect(lambda: self.svd('x',True))
		self.ui.ryButton_neg.clicked.connect(lambda: self.svd('y',True))
		self.ui.showButton.clicked.connect(lambda: self.load_mat())
开发者ID:majroy,项目名称:pyCM,代码行数:35,代码来源:point_cloud.py


示例18: initialize

def initialize():

    # Create a rendering window and renderer
    transform = vtk.vtkTransform()
    transform.Scale(10.0, 10.0, 10.0)
     
    axes = vtk.vtkAxesActor()
    axes.SetUserTransform(transform)

    transform.Translate(3.0, -2.0, 0.0)
    axes.SetUserTransform(transform)

    ren = vtk.vtkRenderer()
    ren.AddActor(axes)
    ren.ResetCamera()

    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)

    # Create a RenderWindowInteractor to permit manipulating the camera
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)

    # enable user interface interactor
    iren.Initialize()
    renWin.Render()
    iren.Start()

    return ren, iren, renWin
开发者ID:Andrew-AbiMansour,项目名称:PyDEM,代码行数:31,代码来源:visualize.py


示例19: DisplayVTKMesh

def DisplayVTKMesh(meshi,windowname):
    
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputData(meshi)
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    actor.GetProperty().SetInterpolationToPhong()
    actor.GetProperty().SetAmbient(0.2)
    actor.GetProperty().SetDiffuse(0.7)
    actor.GetProperty().SetSpecular(0.6)
    actor.GetProperty().SetSpecularPower(100)
    actor.GetProperty().SetColor(0.8,0.8,1)
    ren1 = vtk.vtkRenderer()
    ren1.AddActor(actor)
    ren1.SetBackground(0, 0, 0)
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren1)
    renWin.SetSize(300, 300)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)
    iren.Initialize()
    renWin.SetWindowName(windowname)
    iren.Start()
开发者ID:rogertrullo,项目名称:Surface_Segmentation,代码行数:25,代码来源:Surface_Utilities.py


示例20: PlotGrids_wFEM

def PlotGrids_wFEM(grids):
    """ Plots CFD structured grids with a single FEM """

    N = len(grids)
    HSV_tuples = [(x*1.0/N, 0.5, 0.5) for x in range(N)]
    RGB_tuples = map(lambda x: colorsys.hsv_to_rgb(*x), HSV_tuples)
    
    actors = []
    for i in range(len(grids)):
        
        # Create mapper
        mapper = vtk.vtkDataSetMapper()
        if vtk.vtkVersion().GetVTKMajorVersion() >5:
            mapper.SetInput(grids[i])
        else:
            mapper.SetInputData(grids[i])
        
        # Create actor
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().EdgeVisibilityOn()
        if i != 0:
            actor.GetProperty().SetRepresentationToWireframe()
            actor.GetProperty().SetColor(RGB_tuples[i])
        actor.GetProperty().LightingOff()
        actors.append(actor)
        
    # Add FEM Actor to renderer window
    ren = vtk.vtkRenderer()
#    ren.SetBackground(0.3, 0.3, 0.3)
    ren.SetBackground(0.8, 0.8, 0.8)
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    
    # Allow user to interact
    istyle = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(istyle)
    

    
    # Add actor
    for actor in actors:
        ren.AddActor(actor)
    
    axes = vtk.vtkAxesActor()
    widget = vtk.vtkOrientationMarkerWidget()
#    widget.SetOutlineColor( 0.9300, 0.5700, 0.1300 )
    widget.SetOrientationMarker( axes )
    widget.SetInteractor( iren )
    widget.SetViewport( 0.0, 0.0, 0.4, 0.4 )
    widget.SetEnabled( 1 )
    widget.InteractiveOn()
    
    # Render
    iren.Initialize()
    renWin.Render()
    iren.Start()
开发者ID:akaszynski,项目名称:PyACVD,代码行数:59,代码来源:VTK_Plotting.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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