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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1148 - (hide annotations)
Wed May 16 22:45:33 2007 UTC (13 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1622 byte(s)
Added the updated files for pyvisi and removed some incorrect reference images.
1 ksteube 1147 """
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 jongui 1148 def __init__(self):
13 ksteube 1147 """
14     Initialise the tube.
15     """
16    
17     self.__vtk_tube = vtk.vtkTubeFilter()
18    
19 jongui 1148 def _setupTube(self, object):
20 ksteube 1147 """
21     Setup the tube.
22 jongui 1148
23     @type object: vtkPolyData, etc
24     @param object: Input for the tube
25 ksteube 1147 """
26    
27 jongui 1148 self.__object = object
28    
29 ksteube 1147 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 jongui 1148 def _getTubeOutput(self):
79 ksteube 1147 """
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