/[escript]/trunk/pyvisi/py_src/renderers/gnuplot/camera.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/renderers/gnuplot/camera.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 605 - (show annotations)
Mon Mar 20 07:16:27 2006 UTC (13 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 4820 byte(s)
pyvisi with vtk runs noe on the altix
1 # Copyright (C) 2004-2005 Paul Cochrane
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # $Id: camera.py,v 1.11 2005/11/02 04:52:08 paultcochrane Exp $
18
19 ## @file camera.py
20
21 """
22 Class and functions associated with a pyvisi Camera object
23 """
24
25 # generic imports
26 from common import debugMsg
27
28 from item import Item
29
30 __revision__ = '$Revision: 1.11 $'
31
32 class Camera(Item):
33 """
34 Camera class
35 """
36 def __init__(self, scene):
37 """
38 Initialisation of the Camera object
39
40 @param scene: The Scene object to add the Camera object to
41 """
42 debugMsg("Called Camera.__init__()")
43 Item.__init__(self)
44
45 # default x,y,z positions of Camera (specific to vtk)
46 self.xPos = 0.0
47 self.yPos = 0.0
48 self.zPos = 3.0
49
50 # default x,y,z positions of the Camers's focal point (specific to vtk)
51 self.xFocalPoint = 0.0
52 self.yFocalPoint = 0.0
53 self.zFocalPoint = 0.0
54
55 # default elevation and azimuth
56 # these need to be set to the matlab defaults
57 self.elevation = 30
58 self.azimuth = 30
59
60 # keep a reference to the renderer so we can send stuff to it
61 self.renderer = scene.renderer
62
63 # initialise the position of the Camera
64 self.setPosition(self.xPos, self.yPos, self.zPos)
65 self.setFocalPoint(self.xFocalPoint, self.yFocalPoint, self.zFocalPoint)
66
67 def setPosition(self, *pos):
68 """
69 Set position of camera within scene
70
71 @param pos: Position to set camera in terms of x,y,z coordinates
72 """
73 debugMsg("Called Camera.setPosition()")
74
75 # I need to do some mucking around in here with coordinate systems
76 # and so on, but at present, we'll just use vtk's coord system
77
78 self.xPos = pos[0]
79 self.yPos = pos[1]
80 self.zPos = pos[2]
81
82 # now to set the position
83 self.renderer.runString("# Camera.setPosition()")
84
85 return
86
87 def getPosition(self):
88 """
89 Get the position of Camera within Scene
90
91 Returns the position in a tuple of form (xPos, yPos, zPos)
92 """
93 debugMsg("Called Camera.getPosition()")
94
95 return (self.xPos, self.yPos, self.zPos)
96
97 def setFocalPoint(self, *pos):
98 """
99 Sets the focal point of the Camera with the Scene
100
101 @param pos: Position to set the focal point
102 """
103 debugMsg("Called Camera.setFocalPoint()")
104
105 # I need to do some mucking around in here with coordinate systems
106 # and so on, but at present, we'll just use vtk's coord system
107
108 self.xFocalPoint = pos[0]
109 self.yFocalPoint = pos[1]
110 self.zFocalPoint = pos[2]
111
112 # now set the focal point position
113 self.renderer.runString("#Camera.setFocalPoint()")
114
115 return
116
117 def getFocalPoint(self):
118 """
119 Get the position of the focal point of the Camera
120
121 Returns the position of the focal point in a tuple of form
122 (xPos, yPos, zPos)
123 """
124 debugMsg("Called Camera.getFocalPoint()")
125
126 return (self.xFocalPoint, self.yFocalPoint, self.zFocalPoint)
127
128 def setElevation(self, elevation):
129 """
130 Set the elevation angle (in degrees) of the Camera
131
132 @param elevation: The elevation angle (in degrees) of the Camera
133 """
134 debugMsg("Called Camera.setElevation()")
135
136 self.elevation = elevation
137
138 return
139
140 def getElevation(self):
141 """
142 Gets the elevation angle (in degrees) of the Camera
143 """
144 debugMsg("Called Camera.getElevation()")
145
146 return self.elevation
147
148 def setAzimuth(self, azimuth):
149 """
150 Set the azimuthal angle (in degrees) of the Camera
151
152 @param azimuth: The azimuthal angle (in degrees) of the Camera
153 """
154 debugMsg("Called Camera.setAzimuth()")
155
156 self.azimuth = azimuth
157
158 return
159
160 def getAzimuth(self):
161 """
162 Get the azimuthal angle (in degrees) of the Camera
163 """
164 debugMsg("Called Camera.getAzimuth()")
165
166 return self.azimuth
167
168 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26