/[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 1161 - (show annotations)
Wed May 23 04:17:52 2007 UTC (12 years, 1 month ago) by jongui
File MIME type: text/x-python
File size: 1623 byte(s)
Made some minor updates to the test.
1 """
2 @author: John NGUI
3 """
4
5 import vtk
6
7 class Tube:
8 """
9 Class that defines the tube wrapped around the streamlines.
10 """
11
12 def __init__(self):
13 """
14 Initialise the tube.
15 """
16
17 self.__vtk_tube = vtk.vtkTubeFilter()
18
19 def _setupTube(self, object):
20 """
21 Setup the tube.
22
23 @type object: vtkPolyData, etc
24 @param object: Input for the tube
25 """
26
27 self.__object = object
28
29 self.__setInput()
30 # Default radius of the tube is 0.02.
31 self.setTubeRadius(0.02)
32 # Default number of sides for the tube is 12.
33 self.setTubeNumberOfSides(12)
34 self.setTubeRadiusToVaryByVector()
35
36 def __setInput(self):
37 """
38 Set the input for the tube.
39 """
40
41 self.__vtk_tube.SetInput(self.__object)
42
43 def setTubeRadius(self, radius):
44 """
45 Set the radius of the tube.
46
47 @type radius: Number
48 @param radius: Radius of the tube
49 """
50
51 self.__vtk_tube.SetRadius(radius)
52
53 def setTubeNumberOfSides(self, sides):
54 """
55 Set the number of sides for the tube. Minimum number of sides is 3.
56 The larger the number of sides, the higher the quality.
57
58 @type sides: Number
59 @param sides: Number of sides for the tube
60 """
61
62 self.__vtk_tube.SetNumberOfSides(sides)
63
64 def setTubeRadiusToVaryByVector(self):
65 """
66 Set the radius to vary by vector data.
67 """
68
69 self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector()
70
71 def setTubeRadiusToVaryByScalar(self):
72 """
73 Set the radius to vary by scalar data.
74 """
75
76 self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar()
77
78 def _getTubeOutput(self):
79 """
80 Return the output of the tube.
81
82 @rtype: vtkPolyData
83 @return: Polygonal data
84 """
85
86 return self.__vtk_tube.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26