1 |
""" |
2 |
@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 |
22 |
|
23 |
class CubeSource: |
24 |
""" |
25 |
Class that defines a cube source. The center of the cube souce defines |
26 |
the point from which the cube is to be generated and the X, Y |
27 |
and Z lengths define the length of the cube from the center point. If |
28 |
X length is 3, then the X length to the left and right of the center |
29 |
point is 1.5 respectively. |
30 |
""" |
31 |
|
32 |
def __init__(self): |
33 |
""" |
34 |
Initialise the cube source. |
35 |
""" |
36 |
|
37 |
self.__vtk_cube_source = vtk.vtkCubeSource() |
38 |
|
39 |
def setCenter(self, center): |
40 |
""" |
41 |
Set the cube source center. |
42 |
|
43 |
@type center: L{GlobalPosition <position.GlobalPosition>} object |
44 |
@param center: Cube source center |
45 |
""" |
46 |
|
47 |
self.__vtk_cube_source.SetCenter(center._getGlobalPosition()) |
48 |
|
49 |
def setXLength(self, length): |
50 |
""" |
51 |
Set the cube source length along the x-axis. |
52 |
|
53 |
@type length: Number |
54 |
@param length: Cube source length along the x-axis |
55 |
""" |
56 |
self.__vtk_cube_source.SetXLength(length) |
57 |
|
58 |
def setYLength(self, length): |
59 |
""" |
60 |
Set the cube source length along the y-axis. |
61 |
|
62 |
@type length: Number |
63 |
@param length: Cube source length along the y-axis |
64 |
""" |
65 |
|
66 |
self.__vtk_cube_source.SetYLength(length) |
67 |
|
68 |
def setZLength(self, length): |
69 |
""" |
70 |
Set the cube source length along the z-axis. |
71 |
|
72 |
@type length: Number |
73 |
@param length: Cube source length along the z-axis |
74 |
""" |
75 |
|
76 |
self.__vtk_cube_source.SetZLength(length) |
77 |
|
78 |
def _getCubeSourceOutput(self): |
79 |
""" |
80 |
Return the output of the cube source |
81 |
|
82 |
@rtype: vtkPolyData |
83 |
@return: Polygonal data |
84 |
""" |
85 |
|
86 |
return self.__vtk_cube_source.GetOutput() |
87 |
|
88 |
|
89 |
|