/[escript]/trunk/pyvisi/py_src/carpet.py
ViewVC logotype

Annotation of /trunk/pyvisi/py_src/carpet.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 860 - (hide annotations)
Thu Sep 28 08:17:29 2006 UTC (14 years, 1 month ago) by jongui
File MIME type: text/x-python
File size: 1596 byte(s)
- added sample drivers on how to use all of the currently available modules.
- completed the epydocs for all the currently available modules.
- added the rotation feature for camera and plane cutting.


1 jongui 847 import vtk
2 jongui 852 from plane import Plane
3     from common import Common
4 gross 792
5 jongui 852 class Carpet(Common, Plane):
6     """
7 jongui 860 Class that represents scalar data as plane deformated along the plane
8     normal and proportional to the scalar value on the plane.
9 jongui 852 """
10 jongui 847
11 jongui 860 def __init__(self, scene, data_collector, transform, lut = None):
12     """
13     @type scene: L{Scene <scene.Scene>} object
14     @param scene: Scene in which components are to be added to
15     @type data_collector: L{DataCollector <datacollector.DataCollector>}
16     object
17     @type transform: L{Transform <geo.Transform>} object
18     @param transform: Orientation of the plane
19     @type lut: L{BlueToRed <colormap.BlueToRed>} or
20     L{RedToBlue <colormap.RedToBlue>} object
21     @param lut: Lookup table to be used by the mapper
22     """
23    
24 jongui 852 Common.__init__(self, scene, data_collector)
25 jongui 860 # Declared because needed by the setPlane method.
26 jongui 852 self.vtk_plane = vtk.vtkPlane()
27     self.vtk_cutter = vtk.vtkCutter()
28 jongui 860 self.transform = transform.getTransform()
29 jongui 852 self.vtk_warp = vtk.vtkWarpScalar()
30    
31     Plane.setPlane(self)
32     Plane.setCutter(self, data_collector.getReader().GetOutput())
33     self.warpScalar()
34    
35 jongui 860 Common.setMapperInput(self, self.vtk_warp.GetOutput(), lut)
36 jongui 852 Common.setActorInput(self)
37     Common.addActor(self)
38    
39     def warpScalar(self):
40 jongui 860 """
41     Set up the war scalar and deform the plane with scalar data.
42     """
43    
44 jongui 852 self.vtk_warp.SetInput(self.vtk_cutter.GetOutput())
45    
46 jongui 860 def setScaleFactor(self, scale_factor):
47     """
48     Set the displacement scale factor.
49     @type scale_factor: Number
50     @param scale_factor: Size of the displacement
51     """
52 jongui 852
53 jongui 860 self.vtk_warp.SetScaleFactor(scale_factor)

  ViewVC Help
Powered by ViewVC 1.1.26