当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkLight函数代码示例

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


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

示例1: __init__

    def __init__(self):
        """
        Initializes VTK objects for rendering.
        """
        # vtk objects for rendering
        self.vtkrenderer = vtk.vtkRenderer()
        
        self.vtkcamera = vtk.vtkCamera()
        self.vtkcamera.SetPosition(self.camera_pos)
        self.vtkcamera.SetFocalPoint(0, 0, 0)
        self.vtkcamera.SetViewUp(self.camera_up)
 
        # lighting
        self.light1 = vtk.vtkLight()
        self.light1.SetIntensity(.4)
        self.light1.SetPosition(10, -10, 10)
        self.light1.SetDiffuseColor(1, 1, 1)
        self.light2 = vtk.vtkLight()
        self.light2.SetIntensity(.4)
        self.light2.SetPosition(-10, -10, 10)
        self.light2.SetDiffuseColor(1, 1, 1)
        self.light3 = vtk.vtkLight()
        self.light3.SetIntensity(.4)
        self.light3.SetPosition(10, -10, -10)
        self.light3.SetDiffuseColor(1, 1, 1)
        self.light4 = vtk.vtkLight()
        self.light4.SetIntensity(.4)
        self.light4.SetPosition(-10, -10, -10)
        self.light4.SetDiffuseColor(1, 1, 1)
        self.vtkrenderer.AddLight(self.light1)
        self.vtkrenderer.AddLight(self.light2)
        self.vtkrenderer.AddLight(self.light3)
        self.vtkrenderer.AddLight(self.light4)
        self.vtkrenderer.SetBackground(0.1, 0.1, 0.1) # Background color

        self.vtkrender_window = vtk.vtkRenderWindow()
        self.vtkrender_window.AddRenderer(self.vtkrenderer)
        self.vtkrender_window.SetSize(self.render_size)
        self.vtkrender_window_interactor = vtk.vtkRenderWindowInteractor()
        self.vtkrender_window_interactor.SetRenderWindow(self.vtkrender_window)

        # vtk objects for reading, and rendering object parts
        self.part_source = vtk.vtkCubeSource()
        self.part_output = self.part_source.GetOutput()
        self.part_mapper = vtk.vtkPolyDataMapper()
        self.part_mapper.SetInput(self.part_output)

        # exporters
        self.vtkvrml_exporter = vtk.vtkVRMLExporter()
        self.vtkobj_exporter = vtk.vtkOBJExporter()
        self.stl_writer = vtk.vtkSTLWriter()
开发者ID:gokererdogan,项目名称:BDAoOSS_ShapeGrammar,代码行数:51,代码来源:bdaooss_vision_forward_model.py

示例2: setup_renderer

def setup_renderer(renderer, actors, bboxpolydata=None):
    ren = renderer
    for actor in actors:
        # assign actor to the renderer
        ren.AddActor(actor)
    ############################################
    # Create a vtkOutlineFilter to draw the bounding box of the data set.
    # Also create the associated mapper and actor.
    if bboxpolydata is not None:
        outline = vtk.vtkOutlineFilter()
        outline.SetInput(bboxpolydata.GetOutput())
        mapOutline = vtk.vtkPolyDataMapper()
        mapOutline.SetInputConnection(outline.GetOutputPort())
        outlineActor = vtk.vtkActor()
        outlineActor.SetMapper(mapOutline)
        outlineActor.GetProperty().SetColor(100, 100, 100)
        ren.AddViewProp(outlineActor)
        ren.AddActor(outlineActor)
    

    # Create a vtkLight, and set the light parameters.
    light = vtk.vtkLight()
    light.SetFocalPoint(0.21406, 1.5, 0)
    light.SetPosition(8.3761, 4.94858, 4.12505)
    ren.AddLight(light)
    return ren
开发者ID:HerrMuellerluedenscheid,项目名称:seismerize,代码行数:26,代码来源:vtk_focmec.py

示例3: takeScreenShort

 def takeScreenShort(self):
     graphics_factory = vtk.vtkGraphicsFactory();
     graphics_factory.SetOffScreenOnlyMode(1);
     graphics_factory.SetUseMesaClasses(1);
     windows = vtk.vtkRenderWindow();
     #Do not open the window!!
     windows.SetOffScreenRendering(True);
     windows.SetSize(self.width,self.height);
     mapper = vtk.vtkPolyDataMapper();
     mapper.SetInputData(self.data);
     for d in ("X","Y",):
         for degree in range(0,100,90):
             actor = vtk.vtkActor()
             actor.SetMapper(mapper);
             getattr(actor,"Rotate{}".format(d))(degree);
             actor.GetProperty().SetColor(0,0,0)
             ren = vtk.vtkRenderer();
             windows.AddRenderer(ren);
             ren.AddActor(actor);
             ren.SetBackground(255.0, 255.0, 255.0);
             ren.ResetCamera();
             cen = ren.GetActiveCamera().GetFocalPoint();
             bounds = actor.GetBounds();
             lightOne = vtk.vtkLight();
             lightOne.SetFocalPoint(cen);
             lightOne.SetPosition(cen);
             lightOne.PositionalOff();
             lightTwo = vtk.vtkLight();
             lightTwo.SetFocalPoint(cen);
             lightTwo.SetPosition(bounds[0],bounds[2],bounds[4]);
             lightTwo.PositionalOn();
             lightThree = vtk.vtkLight();
             lightThree.SetFocalPoint(cen);
             lightThree.SetPosition(bounds[1],bounds[3],bounds[5]);
             lightThree.PositionalOn();
             ren.AddLight(lightOne);
             ren.AddLight(lightTwo);
             ren.AddLight(lightThree);
             windows.Render();
             self.saveToImage(windows,"{}_{}_{}".format(self.fileName,d,degree));
             windows.RemoveRenderer(ren);
开发者ID:avontd2868,项目名称:OU_Final_Year,代码行数:41,代码来源:vtkOperations.py

示例4: importLight

 def importLight(self, l):
     print 'importing light...'
     light = vtk.vtkLight()
     
     a = str(l.get('AmbientColor')).split(" ")
     light.SetAmbientColor(float(a[0]), float(a[1]), float(a[2]))
     a = str(l.get('SpecularColor')).split(" ")
     light.SetSpecularColor(float(a[0]), float(a[1]), float(a[2]))
     a = str(l.get('DiffuseColor')).split(" ")
     light.SetDiffuseColor(float(a[0]), float(a[1]), float(a[2]))
     light.SetIntensity(float(l.get('Intensity')))
     light.SetPositional(int(l.get('Positional')))
     light.SetConeAngle(float(l.get('ConeAngle')))
     
     if(l.get('Type') == "Scene"):
         light.SetLightTypeToSceneLight()
     elif(l.get('Type') == "Head"):
         light.SetLightTypeToHeadlight()
     elif(l.get('Type') == "Camera"):
         light.SetLightTypeToCameraLight()
     
     return light
开发者ID:Motiva,项目名称:vtkESQui,代码行数:22,代码来源:SRMLImporter.py

示例5: Light

    def Light(self, currentElement):
        self.logger.debug('  inside a <Light> element: "%s"' % currentElement.get('name'))
        light = vtk.vtkLight()

        try:
            light.SetPosition( coordsFromString(currentElement.get('SetPosition')) )
        except:
            self.logger.error("  .. <Light> failed to SetPosition")
        try:
            light.SetFocalPoint( coordsFromString(currentElement.get('SetFocalPoint')) )
        except:
            self.logger.error("  .. <Light> failed to SetFocalPoint")
        if 'SetPositional' in currentElement.keys():
            try:
                light.SetPositional( int(currentElement.get('SetPositional')) )
            except:
                self.logger.error("  .. <Light> failed to SetPositional")
        if 'SetColor' in currentElement.keys():
            try:
                light.SetColor( coordsFromString(currentElement.get('SetColor')) )
            except:
                self.logger.error("  .. <Light> failed to SetColor")
        if 'color' in currentElement.keys():  # give people the option of using HTML-style color:
            try:
                light.SetColor( webColorToVtkColor(currentElement.get('color')) )
            except:
                self.logger.error("  .. <Light> failed to set HTML-style color")
        if 'SetConeAngle' in currentElement.keys():
            try:
                light.SetConeAngle( float(currentElement.get('SetConeAngle')) )
            except:
                self.logger.error("  .. <Light> failed to SetConeAngle")
        if 'SetIntensity' in currentElement.keys():
            try:
                light.SetIntensity( float(currentElement.get('SetIntensity')) )
            except:
                self.logger.error("  .. <Light> failed to SetIntensity")
        return light
开发者ID:mfassler,项目名称:jaivis,代码行数:38,代码来源:xmlReader.py

示例6: vtkAttachProp

quadric = vtk.vtkQuadric()
quadric.SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0)

sample = vtk.vtkSampleFunction()
sample.SetSampleDimensions(50,50,50)
sample.SetImplicitFunction(quadric)

contours = vtk.vtkContourFilter()
contours.SetInputConnection(sample.GetOutputPort())
contours.GenerateValues(6, 0.0, 2)

normals = vtk.vtkPolyDataNormals()
normals.SetInputConnection(contours.GetOutputPort())
normals.SetFeatureAngle(270.0)

contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputConnection(normals.GetOutputPort())
contMapper.SetScalarRange(0.0, 1.2)
contMapper.SetScalarVisibility(1)
actor = vtk.vtkActor()
actor.SetMapper(contMapper)

vtkAttachProp(actor, vtkNode)

l = vtk.vtkLight()
vtkAddLight(l)
#l.PositionalOn()
l.SetPosition(0, 4, 0)
l.SetColor(1,1,1)
开发者ID:omega-hub,项目名称:omegaVtk,代码行数:29,代码来源:Sample.py

示例7: vtkGetDataRoot

#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
lgt = vtk.vtkLight()
# create pipeline
#
locator = vtk.vtkMergePoints()
locator.SetDivisions(32,32,46)
locator.SetNumberOfPointsPerBucket(2)
locator.AutomaticOff()
v16 = vtk.vtkVolume16Reader()
v16.SetDataDimensions(64,64)
v16.GetOutput().SetOrigin(0.0,0.0,0.0)
v16.SetDataByteOrderToLittleEndian()
v16.SetFilePrefix("" + str(VTK_DATA_ROOT) + "/Data/headsq/quarter")
v16.SetImageRange(1,93)
v16.SetDataSpacing(3.2,3.2,1.5)
iso = vtk.vtkMarchingCubes()
iso.SetInputConnection(v16.GetOutputPort())
iso.SetValue(0,1150)
iso.ComputeGradientsOn()
开发者ID:151706061,项目名称:VTK,代码行数:31,代码来源:headBone.py

示例8: main


#.........这里部分代码省略.........
  # Visualization model
  vis_l_lever_r = vtkesqui.vtkVisualizationModel()
  vis_l_lever_r.SetName("vis_l_lever_r")
  vis_l_lever_r.SetFileName(fn1)
  vis_l_lever_r.SetTextureFileName(fn0t)
  vis_l_lever_r.SetOpacity(1.0)
  vis_l_lever_r.SetColor(0.0, 1.0, 0.0)
  
  # Collision model
  col_l_lever_r = vtkesqui.vtkCollisionModel()
  col_l_lever_r.SetName("col_l_lever_r_vtkbioeng")
  col_l_lever_r.SetFileName(fn1c)
  col_l_lever_r.SetOpacity(1.0)
  col_l_lever_r.SetColor(1.0, 1.0, 1.0)
  
  # Second tool element (l_lever_r)
  l_lever_r = vtkesqui.vtkScenarioElement()
  l_lever_r.SetName("l_lever_r")
  l_lever_r.SetPosition(3.0, 0.0, 0.0)
  l_lever_r.SetOrientation(0, 0, -20)
  l_lever_r.SetOrigin(0,0,6)
  l_lever_r.SetVisualizationModel(vis_l_lever_r)
  l_lever_r.SetCollisionModel(col_l_lever_r)
  
    # Visualization model
  vis_r_lever_r = vtkesqui.vtkVisualizationModel()
  vis_r_lever_r.SetName("vis_r_lever_r")
  vis_r_lever_r.SetFileName(fn2)
  vis_r_lever_r.SetTextureFileName(fn0t)
  vis_r_lever_r.SetOpacity(1.0)
  vis_r_lever_r.SetColor(0.0, 1.0, 0.0)
  
  # Collision model
  col_r_lever_r = vtkesqui.vtkCollisionModel()
  col_r_lever_r.SetName("col_r_lever_r_vtkbioeng")
  col_r_lever_r.SetFileName(fn2c)
  col_r_lever_r.SetOpacity(1.0)
  col_r_lever_r.SetColor(1.0, 1.0, 1.0)
  
  # Second tool element (r_lever_r)
  r_lever_r = vtkesqui.vtkScenarioElement()
  r_lever_r.SetName("r_lever_r")
  r_lever_r.SetPosition(3.0, 0.0, 0.0)
  r_lever_r.SetOrientation(0, 0, -20)
  r_lever_r.SetOrigin(0,0,6)
  r_lever_r.SetVisualizationModel(vis_r_lever_r)
  r_lever_r.SetCollisionModel(col_r_lever_r)
  
  grasper_r = vtkesqui.vtkToolGrasper()
  grasper_r.SetStick(stick_r)
  grasper_r.SetLeftLever(l_lever_r)
  grasper_r.SetRightLever(r_lever_r)
  
    # Add objects to the scenario
  scenario.AddObject(probe_l)
  scenario.AddObject(grasper_r)

  #for i in range(2):
  #i = 0
  
  b = createBall(0)
  scenario.AddObject(b)
  
  # Scenario camera
  camera = vtk.vtkCamera()
  camera.SetPosition(0, 0, 6)
  camera.SetFocalPoint(0, 0, -6)
  camera.Yaw(0)
  camera.Elevation(20)
  camera.Pitch(-15)
  camera.ParallelProjectionOff()
  camera.SetViewAngle(70)
  scenario.SetCamera(camera)
  
  #/********** Lights  **********/
  headLight = vtk.vtkLight()
  headLight.SetLightTypeToHeadlight()
  headLight.PositionalOn()
  headLight.SetIntensity(0.8)
  headLight.SetConeAngle(20)
  scenario.AddLight(headLight)
  
  ambientLight = vtk.vtkLight()
  ambientLight.SetIntensity(0.8)
  ambientLight.SetLightTypeToHeadlight()
  ambientLight.PositionalOff()
  scenario.AddLight(ambientLight)

  # Force the scenario to initialize
  scenario.Update()
  
  # Sign up to receive TimerEvent
  iren = scenario.GetRenderWindowInteractor()
  cb = vtkTimerCallback()
  iren.AddObserver('TimerEvent', cb.execute)
  # 1ms timer
  timerId = iren.CreateRepeatingTimer(1);
  cb.scenario = scenario
  
  iren.Start()
开发者ID:Motiva,项目名称:vtkESQui,代码行数:101,代码来源:Scenario.py

示例9: main


#.........这里部分代码省略.........
  probe_r.AddElement(stick_r)
  probe_r.AddElement(tip_r)
  scenario.AddObject(probe_r)
  
  # Add an Organ (Cavity)
  # Visualization model
  vis_cavity = vtkesqui.vtkVisualizationModel()
  vis_cavity.SetName("vis_cavity")
  vis_cavity.SetFileName(fn5)
  vis_cavity.SetTextureFileName(fn5t)
  vis_cavity.SetOpacity(1.0)
  
  # Organ element (cavity)
  e_cavity = vtkesqui.vtkScenarioElement()
  e_cavity.SetName("e_cavity")
  e_cavity.SetPosition(0.0, 0.0, -1.0)
  e_cavity.SetOrientation(-45, 0, 0)
  e_cavity.SetVisualizationModel(vis_cavity)
  
  cavity = vtkesqui.vtkOrgan()
  cavity.SetName("cavity")
  cavity.AddElement(e_cavity)
  scenario.AddObject(cavity)
  
   # Add a ball
  # Visualization model
  vis_ball = vtkesqui.vtkVisualizationModel()
  vis_ball.SetName("vis_ball")
  vis_ball.SetFileName(fn4)
  vis_ball.SetColor(1.0,1.0,0.2)
  vis_ball.SetOpacity(1.0)
  
  # Collision model
  col_ball = vtkesqui.vtkCollisionModel()
  col_ball.SetName("col_ball_vtkbioeng")
  col_ball.SetFileName(fn4c)
  col_ball.SetVisibility(0.0)
  col_ball.SetOpacity(0.0)

  # Organ element (ball)
  e_ball = vtkesqui.vtkScenarioElement()
  e_ball.SetName("e_ball")
  e_ball.SetVisualizationModel(vis_ball)
  e_ball.SetCollisionModel(col_ball)
  
  ball = vtkesqui.vtkOrgan()
  ball.SetName("ball")
  ball.AddElement(e_ball)
 
  scenario.AddObject(ball)

  # Scenario camera
  camera = vtk.vtkCamera()
  camera.SetPosition(0, 0, 6)
  camera.SetFocalPoint(0, 0, -6)
  camera.Yaw(0)
  camera.Elevation(20)
  camera.Pitch(-15)
  camera.ParallelProjectionOff()
  camera.SetViewAngle(70)
  camera.Dolly(1.2)
  scenario.SetCamera(camera)
  
  #/********** Lights  **********/
  headLight = vtk.vtkLight()
  headLight.SetLightTypeToHeadlight()
  headLight.PositionalOn()
  headLight.SetIntensity(0.7)
  headLight.SetConeAngle(90)
  scenario.AddLight(headLight)
  
  ambientLight = vtk.vtkLight()
  ambientLight.SetLightTypeToSceneLight()
  ambientLight.PositionalOff()
  ambientLight.SetPosition(0,1,1)
  ambientLight.SetIntensity(0.5)
  scenario.AddLight(ambientLight)

  simulation = vtkesqui.vtkSimulation()
  simulation.SetScenario(scenario)
  simulation.SetRenderTimerRate(30)
  simulation.SetSimulationTimerRate(1)
  simulation.SetInteractionTimerRate(1)
  simulation.InteractionOn()
  simulation.CollisionOn()
  simulation.Initialize()
  
  #Wait for initialization to set collision mode
  simulation.SetCollisionModeToSimple()
  
  # Sign up to receive TimerEvent
  iren = scenario.GetRenderWindowInteractor()
  cb = vtkTimerCallback()
  iren.AddObserver('TimerEvent', cb.execute)
  # 100ms timer
  timerId = iren.CreateRepeatingTimer(100);
  cb.simulation = simulation
  cb.target = ball
  
  simulation.Run()
开发者ID:Motiva,项目名称:vtkESQui,代码行数:101,代码来源:LapCoordination.py

示例10:

renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# 将多边形渲染导入场景渲染器,并设置场景和窗口的初始参数
ren.AddActor(cylinderActor)
ren.SetBackground(0.1, 0.2, 0.4)
renWin.SetSize(200, 200)

# 普通的鼠标交互控件
style = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)


# 这一段用于设置照明,一共两个,蓝色和绿色
myLight = vtk.vtkLight()
myLight.SetColor(0, 1,0)
myLight.SetPosition(0, 0, 1)
myLight.SetFocalPoint(ren.GetActiveCamera().GetFocalPoint())
ren.AddLight(myLight)

myLight2 = vtk.vtkLight()
myLight2.SetColor(0, 0, 1)
myLight2.SetPosition(0, 0, -1)
myLight2.SetFocalPoint(ren.GetActiveCamera().GetFocalPoint())
ren.AddLight(myLight2)


# 开始进行可视化的开始
iren.Initialize()
开发者ID:EntropyAran,项目名称:GraduationProjectOnVTK,代码行数:30,代码来源:初始化例子.py

示例11:

outline.SetInputConnection(normals.GetOutputPort())
mapOutline = vtk.vtkPolyDataMapper()
mapOutline.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(mapOutline)
outlineActor.GetProperty().SetColor(0, 0, 0)

# Create a vtkCamera, and set the camera parameters.
camera = vtk.vtkCamera()
camera.SetClippingRange(1.60187, 20.0842)
camera.SetFocalPoint(0.21406, 1.5, 0)
camera.SetPosition(8.3761, 4.94858, 4.12505)
camera.SetViewUp(0.180325, 0.549245, -0.815974)

# Create a vtkLight, and set the light parameters.
light = vtk.vtkLight()
light.SetFocalPoint(0.21406, 1.5, 0)
light.SetPosition(8.3761, 4.94858, 4.12505)

# Create the Renderers.  Assign them the appropriate viewport
# coordinates, active camera, and light.
ren = vtk.vtkRenderer()
ren.SetViewport(0, 0, 0.5, 1.0)
ren.SetActiveCamera(camera)
ren.AddLight(light)
ren2 = vtk.vtkRenderer()
ren2.SetViewport(0.5, 0, 1.0, 1.0)
ren2.SetActiveCamera(camera)
ren2.AddLight(light)

# Create the RenderWindow and RenderWindowInteractor.
开发者ID:timkrentz,项目名称:SunTracker,代码行数:31,代码来源:cubeAxes.py

示例12: FringeSimulator

    def FringeSimulator(self, file_name, file_output):
        
 
        reader = vtk.vtkPLYReader()
        reader.SetFileName(file_name)
        reader.Update()

        smooth = vtk.vtkWindowedSincPolyDataFilter()   
        smooth.SetInput(reader.GetOutput())
        smooth.Update()
  
        normals = vtk.vtkPolyDataNormals()
        normals.SetInput(smooth.GetOutput())
        normals.SetComputePointNormals(1)
        normals.SetComputeCellNormals(1)
        normals.Update()

        mapper=vtk.vtkDataSetMapper()
        mapper.SetInput(smooth.GetOutput())
        mapper.SetScalarVisibility(1)

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

        self.renderer.AddActor(actor)

        key_properties = vtk.vtkInformation()
        key_properties.Set(vtk.vtkShadowMapBakerPass.OCCLUDER(),0) #// dummy val.
        key_properties.Set(vtk.vtkShadowMapBakerPass.RECEIVER(),0) #// dummy val.

        actor.SetPropertyKeys(key_properties)
        actor.SetVisibility(1)

        self.renderer.ResetCamera()
        cam = self.renderer.GetActiveCamera()

        cam_pos = cam.GetPosition()
        cam_f =  cam.GetFocalPoint()

        vcam_pos = numpy.array([float(cam_pos[0]), float(cam_pos[1]), float(cam_pos[2])])
        vcam_f = numpy.array([float(cam_f[0]),float(cam_f[1]),float(cam_f[2])])

        v = vcam_f - vcam_pos 
        d = numpy.linalg.norm(v)
        vn = v/d

        ap = vtk.vtkAppendPolyData()
        dist_fringes = cam_pos - vn * -250

        for x in xrange(-220, 220):
            cube_source= vtk.vtkCubeSource()
            cube_source.SetXLength(0.20)
            cube_source.SetYLength(80)
            cube_source.SetZLength(0.1)

            xfm = vtk.vtkTransform()
            xfm.Translate(float(x) * 0.40, 0, 0) 

            xfmPd = vtk.vtkTransformPolyDataFilter()
            xfmPd.SetInput(cube_source.GetOutput())
            xfmPd.SetTransform(xfm)

            ap.AddInput(xfmPd.GetOutput())

        ap.Update()


        xfm = vtk.vtkTransform()
        xfm.Translate(200, dist_fringes[1], dist_fringes[2])

        xfmPd = vtk.vtkTransformPolyDataFilter()
        xfmPd.SetInput(ap.GetOutput())
        xfmPd.SetTransform(xfm)

        cube_mapper=vtk.vtkPolyDataMapper()
        cube_mapper.SetInput(xfmPd.GetOutput())


        fringes_actor = vtk.vtkActor()
        fringes_actor.SetMapper(cube_mapper)
        fringes_actor.GetProperty().SetColor(1,0,0)

        fringesKeyProperties=vtk.vtkInformation()
        fringesKeyProperties.Set(vtk.vtkShadowMapBakerPass.OCCLUDER(),0) #// dummy val.
        fringesKeyProperties.Set(vtk.vtkShadowMapBakerPass.RECEIVER(),0) #// dummy val.
        fringes_actor.SetPropertyKeys(fringesKeyProperties)

        self.renderer.AddActor(fringes_actor)
        
        self.renderer.LightFollowCameraOff()
        self.renderer.AutomaticLightCreationOff()
        self.renderer.RemoveAllLights()
        self.renderer.UpdateLights()

        l = vtk.vtkLight()
        l.SetLightTypeToSceneLight()

        dist_light = cam_pos - vn * 6

#.........这里部分代码省略.........
开发者ID:paulojamorim,项目名称:fgrc-tools,代码行数:101,代码来源:fringe_projection.py

示例13:

ren.AddActor(actor)
ren.AddActor(titleActor)
ren.AddActor(outlineActor)
ren.AddActor(axes)

### need to make a camera object in pyvisi!!!
ren.ResetCamera()
cam = ren.GetActiveCamera()
cam.Azimuth(0)
cam.Elevation(-90)
cam.SetFocalPoint(centre)
ren.SetActiveCamera(cam)
ren.ResetCameraClippingRange()

# play around with lighting
light = vtk.vtkLight()
light.SetFocalPoint(centre)
light.SetPosition(centre[0]-bounds[1],
	centre[1]-bounds[3],
	centre[2]+bounds[5])
ren.AddLight(light)

light2 = vtk.vtkLight()
light2.SetFocalPoint(centre)
light2.SetPosition(centre[0]+bounds[1],
	 centre[1]+bounds[3],
	 centre[2]-bounds[5])
ren.AddLight(light2)

# set up stuff for interactive viewing
iren = vtk.vtkRenderWindowInteractor()
开发者ID:paultcochrane,项目名称:pyvisi,代码行数:31,代码来源:isosurfacePlot.py

示例14:

sphereKeyProperty = vtk.vtkInformation()
sphereKeyProperty.Set(vtk.vtkShadowMapBakerPass.OCCLUDER(),0)
sphereKeyProperty.Set(vtk.vtkShadowMapBakerPass.RECEIVER(),0)
sphereActor.SetPropertyKeys(sphereKeyProperty)
sphereActor.SetMapper(sphereMapper)

sphereActor.SetVisibility(1)
sphereActor.SetPosition(2,2,-1)
sphereActor.GetProperty().SetColor(1,1,0)

renderer.AddViewPro(rectActor)
renderer.AddViewPro(boxActor)
renderer.AddViewPro(coneActor)
renderer.AddViewPro(sphereActor)

l1 = vtk.vtkLight()
l1.SetPosition(-4,4,-1)
l1.SetFocalPOint(boxActor.GetPosition())
l1.SetColor(1,1,1)
l1.SetPositional(1)
renderer.AddLight(l1)
l1.SetSwitch(1)

l2 = vtk.vtkLight()
l2.SetPosition(-4,5,1)
l2.SetFocalPOint(sphereActor.GetPosition())
l2.SetColor(1,0,1)
l2.SetPositional(1)
renderer.AddLight(l2)
l2.SetSwitch(1)
开发者ID:Beastmaster,项目名称:itk-python-example,代码行数:30,代码来源:vtkCreateShadows.py

示例15: __init__


#.........这里部分代码省略.........
        self.sim_layout = QtGui.QVBoxLayout( self.widget )
        self.sim_layout.setObjectName( 'sim_layout' )
    
        self.logo_label = QtGui.QLabel( self.widget )
        self.logo_label.setPixmap( QtGui.QPixmap( 'icons/application_logo.png' ) )
        self.logo_label.setObjectName( 'logo_label' )
    
        self.sim_layout.addWidget( self.logo_label )
    
        self.qvtk_widget = QVTKRenderWindowInteractor.QVTKRenderWindowInteractor( self.widget )
        self.qvtk_widget.setObjectName( 'qvtk_widget' )
        
        self.sphere = vtk.vtkSphereSource()
        self.sphere.SetRadius( 1.0 )
        self.sphere.SetPhiResolution( 100 )
        self.sphere.SetThetaResolution( 100 )
        
        self.sphereMapper = vtk.vtkPolyDataMapper()
        self.sphereMapper.SetInputConnection( self.sphere.GetOutputPort() )
        
        self.sphereActor = vtk.vtkActor()
        self.sphereActor.SetMapper( self.sphereMapper )
        
        self.sphereActorCentral = vtk.vtkActor()
        self.sphereActorCentral.SetMapper( self.sphereMapper )
        
        self.sphereActorCentral.GetProperty().SetDiffuseColor(1, 1, 0)
        
        self.ren1 = vtk.vtkRenderer()
        self.ren1.AddActor( self.sphereActor )
        self.ren1.AddActor( self.sphereActorCentral )
        self.ren1.SetBackground( 0.1, 0.2, 0.4 )
        
        self.light = vtk.vtkLight()
        self.light.SetPosition( - 200, - 200, 200 )
        
        self.ren1.AddLight( self.light )
        
        self.cam = self.ren1.GetActiveCamera()
        self.cam.SetPosition( 0, - 50, 50 )
        self.cam.SetFocalPoint( 0, 0, 0 )
        self.cam.SetViewUp( 0, 1, 0 )
        self.cam.SetViewAngle( 40 )
        
        self.ren1.SetActiveCamera( self.cam )

        self.sphere.SetRadius( 2 )
        
        self.renderWindow = self.qvtk_widget.GetRenderWindow()
        self.renderWindow.AddRenderer( self.ren1 )
    
        self.sim_layout.addWidget( self.qvtk_widget )
    
        self.setCentralWidget( self.centralwidget )
        
        # ===
        # MainWindow MenuBar
        # ===
        self.menubar = QtGui.QMenuBar( self )
        self.menubar.setGeometry( QtCore.QRect( 0, 0, 800, 21 ) )
        self.menubar.setObjectName( 'menubar' )
    
        self.menu_simulation = QtGui.QMenu( self.menubar )
        self.menu_simulation.setObjectName( 'menu_simulation' )
    
        self.menu_help = QtGui.QMenu( self.menubar )
开发者ID:fatality,项目名称:hsa-repo,代码行数:67,代码来源:Client.py


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