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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 946 - (show annotations)
Wed Jan 31 03:08:04 2007 UTC (12 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1513 byte(s)
added colouring option to use either scalar data or vector data.
1 """
2 @author: John NGUI
3 """
4
5 import vtk
6
7 class Tube:
8 """
9 Class that defines the tubes around streamlines.
10 """
11
12 def __init__(self, object):
13 """
14 Initialise the tube.
15 """
16
17 self.__object = object
18 self.__vtk_tube = vtk.vtkTubeFilter()
19
20 self.__setupTube()
21
22 def __setupTube(self):
23 """
24 Setup the tube.
25 """
26
27 self.__setInput()
28 # Default radius of the tube is 0.02.
29 self.setTubeRadius(0.02)
30 # Default number of sides for the tube is 12.
31 self.setTubeNumberOfSides(12)
32 #self.setRadiusToVaryByVector()
33 self.__vtk_tube.Update()
34
35 def __setInput(self):
36 """
37 Set the input for the tube.
38 """
39
40 self.__vtk_tube.SetInput(self.__object)
41
42 def setTubeRadius(self, radius):
43 """
44 Set the radius of the tube.
45
46 @type radius: Number
47 @param radius: Radius of the tube
48 """
49
50 self.__vtk_tube.SetRadius(radius)
51
52 def setTubeNumberOfSides(self, sides):
53 """
54 Set the number of sides for the tube. Minimum number of sides is 3.
55
56 @type sides: Number
57 @param sides: Number of sides for the tube
58 """
59
60 self.__vtk_tube.SetNumberOfSides(sides)
61
62 def setTubeRadiusToVaryByVector(self):
63 """
64 Set the radius to vary by vector value.
65 """
66
67 self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector()
68
69 def setTubeRadiusToVaryByScalar(self):
70 """
71 Set the radius to vary by scalar value.
72 """
73
74 self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar()
75
76 def _getOutput(self):
77 """
78 Return the tube.
79
80 @rtype: vtkPolyData
81 @return: Polygonal data
82 """
83
84 return self.__vtk_tube.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26