94 |
position.getZCoor()) |
position.getZCoor()) |
95 |
self.resetCamera() |
self.resetCamera() |
96 |
|
|
|
def zoom(self, factor): |
|
|
""" |
|
|
Zoom in and out of the rendered object. |
|
|
@type factor: Number |
|
|
@param factor: Amount to zoom in and out |
|
|
""" |
|
|
|
|
|
self.vtk_camera.Zoom(factor) |
|
|
self.resetCamera() |
|
|
|
|
97 |
def azimuth(self, angle): |
def azimuth(self, angle): |
98 |
""" |
""" |
99 |
Rotate the camera to the left and right. |
Rotate the camera to the left and right. |
112 |
""" |
""" |
113 |
|
|
114 |
self.vtk_camera.Elevation(angle) |
self.vtk_camera.Elevation(angle) |
115 |
|
# Recompute the view up vector. If not used the elevation angle cannot |
116 |
|
# cannot exceed 87/-87 degrees. Otherwise a warning resetting the |
117 |
|
# view up will be thrown and the rendered object may be incorrect. |
118 |
|
# With the view up recomputed, the elevation angle can reach between |
119 |
|
# 90/-90 degress. More than that, the rendered object may be incorrect. |
120 |
|
self.vtk_camera.OrthogonalizeViewUp() |
121 |
self.resetCamera() |
self.resetCamera() |
122 |
|
|
|
|
|
123 |
def roll(self, angle): |
def roll(self, angle): |
124 |
""" |
""" |
125 |
Roll the camera to the left and right. |
Roll the camera to the left and right. |
127 |
@param angle: Degree to turn the camera |
@param angle: Degree to turn the camera |
128 |
""" |
""" |
129 |
|
|
130 |
self.vtk_camera.Roll(angle) |
self.vtk_camera.Roll(-angle) |
|
self.resetCamera() |
|
|
|
|
|
def dolly(self, distance): |
|
|
""" |
|
|
Move the camera towards and away from the focal point along the normal. |
|
|
@type distance: Number |
|
|
@param distance: Amount to move towards and away |
|
|
""" |
|
|
|
|
|
self.vtk_camera(distance) |
|
131 |
self.resetCamera() |
self.resetCamera() |
132 |
|
|
133 |
def backView(self): |
def backView(self): |
143 |
View the top of the rendered object. |
View the top of the rendered object. |
144 |
""" |
""" |
145 |
|
|
146 |
self.elevation(90) |
self.elevation(90) |
147 |
self.resetCamera() |
self.resetCamera() |
148 |
|
|
149 |
def bottomView(self): |
def bottomView(self): |
151 |
View the bottom of the rendered object. |
View the bottom of the rendered object. |
152 |
""" |
""" |
153 |
|
|
154 |
self.elevation(-90) |
self.elevation(-90) |
155 |
self.resetCamera() |
self.resetCamera() |
156 |
|
|
157 |
def leftView(self): |
def leftView(self): |
170 |
self.azimuth(90) |
self.azimuth(90) |
171 |
self.resetCamera() |
self.resetCamera() |
172 |
|
|
173 |
|
def isometricView(self): |
174 |
|
""" |
175 |
|
View the isometric side of the rendered object. |
176 |
|
""" |
177 |
|
|
178 |
|
self.roll(-45) |
179 |
|
self.elevation(-45) |
180 |
|
|
181 |
def resetCamera(self): |
def resetCamera(self): |
182 |
""" |
""" |
183 |
Repositions the camera so that all actors can be seen. Needs to |
Repositions the camera so that all actors can be seen. Needs to |
187 |
self.scene.getRenderer().ResetCamera() |
self.scene.getRenderer().ResetCamera() |
188 |
|
|
189 |
|
|
|
#def isometricView(self): |
|
|
# self.elevation(-50) |
|
|
#self.roll(30) |
|
|
#self.azimuth(-90) |
|