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

Contents of /trunk/pyvisi/py_src/warp.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1147 - (show annotations)
Wed May 16 06:39:11 2007 UTC (12 years, 3 months ago) by ksteube
File MIME type: text/x-python
File size: 1220 byte(s)
Added back in some files that were accidentally deleted.

1 """
2 @author: John NGUI
3 """
4
5 import vtk
6 from constant import WarpMode
7
8 class Warp:
9 """
10 Class that defines the deformation of a scalar field.
11 """
12
13 def __init__(self, object, warp_mode):
14 """
15 Initialise the warp scalar/vector.
16
17 @type object: vtkPolyData, etc
18 @param object: Input for the warp scalar/vector
19 @type warp_mode: L{WarpMode <constant.WarpMode>} constant
20 @param warp_mode: Mode in which to deform the data
21 """
22
23 self.__object = object
24
25 if(warp_mode == WarpMode.SCALAR): # Deform data with scalar data.
26 self.__vtk_warp = vtk.vtkWarpScalar()
27 elif(warp_mode == WarpMode.VECTOR): # Deform data with vector data.
28 self.__vtk_warp = vtk.vtkWarpVector()
29
30 self.__setInput()
31
32 def __setInput(self):
33 """
34 Set the input for the warp scalar/vector.
35 """
36
37 self.__vtk_warp.SetInput(self.__object)
38
39 def setScaleFactor(self, scale_factor):
40 """
41 Set the displacement scale factor.
42
43 @type scale_factor: Number
44 @param scale_factor: Scale factor of the displacement
45 """
46
47 self.__vtk_warp.SetScaleFactor(scale_factor)
48
49 def _getOutput(self):
50 """
51 Return the output of the deformed data.
52
53 @rtype: vtkPointSet
54 @return: PointSet data
55 """
56
57 return self.__vtk_warp.GetOutput()
58

  ViewVC Help
Powered by ViewVC 1.1.26