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

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

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

revision 839 by jongui, Wed Sep 6 04:53:50 2006 UTC revision 845 by jongui, Fri Sep 8 07:13:01 2006 UTC
# Line 54  class Position: Line 54  class Position:
54          return self.z_coor          return self.z_coor
55    
56    
57    from common import *
58    
59  #def Position(object):  class Plane(Common):
60        """
61        Class that performs cutting using a plane as its implicit function.
62        """
63    
64        def __init__(self, scene, data_collector, component):
65            """
66            @type scene: L{Scene <scene.Scene>} object
67            @param scene: Scene in which components are to be added to
68            @type data_collector: L{DataCollector <datacollector.DataCollector>}
69                object
70            @param data_collector: Source of data for visualization
71            @type component: String
72            @param component: Component to be cut using the plane
73            """
74    
75            Common.__init__(self, scene, data_collector)
76            self.vtk_plane = None
77            self.vtk_cutter = None
78            self.setPlane()
79            self.setCutter(component)
80    
81            Common.setMapper(self, "self.vtk_cutter.GetOutput()")
82            Common.setActor(self)
83            Common.addActor(self)
84    
85        def setPlane(self):
86            """
87            Setup the plane.
88            """
89    
90            self.vtk_plane = vtk.vtkPlane()
91            # Default origin
92            #self.vtk_plane.SetOrigin(
93            #self.data_collector.getReader().GetOutput().GetCenter())
94            self.vtk_plane.SetOrigin(0,0,0)
95            # Default normal
96            self.vtk_plane.SetNormal(-1.2, 0.0, 0.9)
97    
98    
99        def setPlaneOrigin(self, x_coor, y_coor, z_coor):
100            """
101            Set the plane origin.
102    
103            @type x_coor: Number
104            @param x_coor: X coordinate in global position
105            @type y_coor: Number
106            @param y_coor: Y coordinate in global position
107            @type z_coor: Number
108            @param z_coor: Z coordinate in global position
109            """
110    
111            self.vtk_plane.SetOrigin(x_coor, y_coor, z_coor)
112    
113        def setPlaneNormal(self, x_coor, y_coor, z_coor):
114            """
115            Set the plance normal.
116    
117            @type x_coor: Number
118            @param x_coor: X coordinate in global position
119            @type y_coor: Number
120            @param y_coor: Y coordinate in global position
121            @type z_coor: Number
122            @param z_coor: Z coordinate in global position
123            """
124    
125            self.vtk_plane.SetNormal(x_coor, y_coor, z_coor)
126    
127        def setCutter(self, component):
128            """
129            Setup the cutter
130    
131            @type component: String
132            @param component: Component to be cut using the plane
133            """
134    
135            self.vtk_cutter = vtk.vtkCutter()
136            eval("self.vtk_cutter.SetInput(%s)" % component)
137            self.vtk_cutter.SetCutFunction(self.vtk_plane)
138    
139    #def Plane(object):
140  """  """
141  A position in global coordinates  A plane in global coordinates
142  """  """
143  pass  pass
144    
# Line 91  def ZAxis(Direction): Line 172  def ZAxis(Direction):
172      """      """
173      pass      pass
174    
 def Plane(object):  
     """  
     A plane in global coordinates  
     """  
     pass  
175    
176  def XYPlane(Plane):  def XYPlane(Plane):
177      """      """

Legend:
Removed from v.839  
changed lines
  Added in v.845

  ViewVC Help
Powered by ViewVC 1.1.26