1 |
ksteube |
1147 |
""" |
2 |
|
|
@author: John NGUI |
3 |
|
|
""" |
4 |
|
|
|
5 |
|
|
import vtk |
6 |
|
|
|
7 |
|
|
class Sphere: |
8 |
|
|
""" |
9 |
|
|
Class that defines a sphere. |
10 |
|
|
""" |
11 |
|
|
|
12 |
|
|
def __init__(self): |
13 |
|
|
""" |
14 |
|
|
Initialise the sphere. |
15 |
|
|
""" |
16 |
|
|
|
17 |
|
|
self.__vtk_sphere = vtk.vtkSphereSource() |
18 |
|
|
|
19 |
|
|
def setThetaResolution(self, resolution): |
20 |
|
|
""" |
21 |
|
|
Set the theta resolution of the sphere. |
22 |
|
|
|
23 |
|
|
@type resolution: Number |
24 |
|
|
@param resolution: Theta resolution |
25 |
|
|
""" |
26 |
|
|
|
27 |
|
|
self.__vtk_sphere.SetThetaResolution(resolution) |
28 |
|
|
|
29 |
|
|
def setPhiResolution(self, resolution): |
30 |
|
|
""" |
31 |
|
|
Set the phi resolution of the sphere. |
32 |
|
|
|
33 |
|
|
@type resolution: Number |
34 |
|
|
@param resolution: Phi resolution |
35 |
|
|
""" |
36 |
|
|
|
37 |
|
|
self.__vtk_sphere.SetPhiResolution(resolution) |
38 |
|
|
|
39 |
jongui |
1148 |
def _getSphereOutput(self): |
40 |
ksteube |
1147 |
""" |
41 |
|
|
Return the output of the sphere. |
42 |
|
|
|
43 |
|
|
@rtype: vtkPolyData |
44 |
|
|
@return: Polygonal data |
45 |
|
|
""" |
46 |
|
|
|
47 |
|
|
return self.__vtk_sphere.GetOutput() |
48 |
|
|
|