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

Diff of /trunk/pyvisi/py_src/transform.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/pyvisi/py_src/transform.py revision 1147 by ksteube, Wed May 16 06:39:11 2007 UTC temp_trunk_copy/pyvisi/py_src/transform.py revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC
# Line 1  Line 1 
1  """  """
2  @author: John NGUI  @var __author__: name of author
3    @var __copyright__: copyrights
4    @var __license__: licence agreement
5    @var __url__: url entry point on documentation
6    @var __version__: version
7    @var __date__: date of the version
8  """  """
9    
10    __author__="John Ngui, john.ngui@uq.edu.au"
11    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
12                        http://www.access.edu.au
13                    Primary Business: Queensland, Australia"""
14    __license__="""Licensed under the Open Software License version 3.0
15                 http://www.opensource.org/licenses/osl-3.0.php"""
16    __url__="http://www.iservo.edu.au/esys"
17    __version__="$Revision$"
18    __date__="$Date$"
19    
20    
21  import vtk  import vtk
22    
23  class Transform:  class Transform:
# Line 12  class Transform: Line 28  class Transform:
28      followed by translation, and performing translation first followed      followed by translation, and performing translation first followed
29      by rotation.      by rotation.
30    
31      @attention: VTK's coordinate system and translation is NOT 100% accurate.      @attention: VTK's coordinate system and translation is NOT 100% precise.
32      Consequently, performing maximum rotation and translation can potentially      Consequently, performing maximum rotation and translation can potentially
33      yield incorrect results. For instance, rotating a XY plane along the x-axis      yield incorrect results. For instance, rotating a XY plane along the x-axis
34      90 degrees may NOT produce any results (as it is possible that the XY      90 degrees may NOT produce any results (as it is possible that the XY
35      plane has just fallen outside the visible range). However, rotating the      plane has just fallen outside the visible range). Therefore, rotating the
36      XY plane 89.9 degrees instead should produce the correct resutls.      XY plane 89.9 degrees instead, should be a better option in order to
37        produce the correct results.
38      """      """
39    
40      def __init__(self):      def __init__(self):
# Line 25  class Transform: Line 42  class Transform:
42          Initialise the transform object.          Initialise the transform object.
43          """          """
44    
45          # NOTE: VTK's coordinates are not 100% accurate. The origin is not          # NOTE: VTK's coordinates are not 100% precise. The origin is not
46          # exaclty (0,0,0) and the normal is not exactly (0, 0, 1). There is a          # exaclty (0,0,0) and the normal is not exactly (0, 0, 1). There is a
47          # slight variance. As a result, a slight alteration has to be done          # slight variance. As a result, a slight alteration has to be done
48          # in order for the plane to be displayed correctly. Otherwise, the          # in order for the plane to be displayed correctly. Otherwise, the
# Line 67  class Transform: Line 84  class Transform:
84          """          """
85    
86          self.__vtk_transform.RotateY(angle)          self.__vtk_transform.RotateY(angle)
                   
87    
88      def rotateZ(self, angle):      def rotateZ(self, angle):
89          """          """
# Line 134  class TransformFilter: Line 150  class TransformFilter:
150      Class that defines a transform poly data filter.      Class that defines a transform poly data filter.
151      """      """
152    
153      def __init__(self, plane_source, transform):      def __init__(self):
154          """          """
155          Initialise the transoform poly data filter.          Initialise the transoform poly data filter.
156            """
157    
158            self.__vtk_transform_filter = vtk.vtkTransformPolyDataFilter()
159    
160        def _setupTransformFilter(self, plane_source, transform):
161            """
162            Setup the transform filter.
163    
164          @type plane_source: vtkPolyData          @type plane_source: vtkPolyData
165          @param plane_source: Polygonal data          @param plane_source: Polygonal data
# Line 147  class TransformFilter: Line 170  class TransformFilter:
170          self.__plane_source = plane_source          self.__plane_source = plane_source
171          self.__transform = transform          self.__transform = transform
172    
173          self.__vtk_transform_filter = vtk.vtkTransformPolyDataFilter()          self.__setInput()
174            self.__setTransform()
         self._setInput()  
         self._setTransform()  
175    
176      def _setInput(self):      def __setInput(self):
177          """          """
178          Set the input for the transform poly data filter.          Set the input for the transform poly data filter.
179          """          """
180    
181          self.__vtk_transform_filter.SetInput(self.__plane_source)          self.__vtk_transform_filter.SetInput(self.__plane_source)
182    
183      def _setTransform(self):      def __setTransform(self):
184          """          """
185          Set the transformation of the plane source.          Set the transformation of the plane source.
186          """          """
187    
188          self.__vtk_transform_filter.SetTransform(self.__transform)          self.__vtk_transform_filter.SetTransform(self.__transform)
189    
190      def _getOutput(self):      def _getTransformFilterOutput(self):
191          """          """
192          Return the output of the transform poly data filter.          Return the output of the transform poly data filter.
193          """          """
# Line 175  class TransformFilter: Line 196  class TransformFilter:
196    
197    
198    
   
   
   

Legend:
Removed from v.1147  
changed lines
  Added in v.1384

  ViewVC Help
Powered by ViewVC 1.1.26