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 Rotation: |
24 |
""" |
25 |
Class that sweeps 2D data around the z-axis to create a 3D looking effect. |
26 |
""" |
27 |
|
28 |
def __init__(self): |
29 |
""" |
30 |
Initialise the rotation. |
31 |
""" |
32 |
|
33 |
self.__vtk_rotational_extrusion_filter = \ |
34 |
vtk.vtkRotationalExtrusionFilter() |
35 |
|
36 |
def _setupRotationExtrusionFilter(self, object): |
37 |
""" |
38 |
Setup the rotation. |
39 |
|
40 |
@type object: vtkUnstructuredGrid, etc |
41 |
@param object: Input for the clipper |
42 |
""" |
43 |
|
44 |
self.__object = object |
45 |
self.__setInput() |
46 |
|
47 |
def __setInput(self): |
48 |
""" |
49 |
Set the input for the rotation. |
50 |
""" |
51 |
|
52 |
self.__vtk_rotational_extrusion_filter.SetInput(self.__object) |
53 |
self.__vtk_rotational_extrusion_filter.Update() |
54 |
|
55 |
def setResolution(self, resolution): |
56 |
""" |
57 |
Set the resolution of the sweep for the rotation, which controls the |
58 |
number of intermediate points |
59 |
|
60 |
@type resolution: Number |
61 |
@param resolution: Resolution of the rotation |
62 |
""" |
63 |
|
64 |
self.__vtk_rotational_extrusion_filter.SetResolution(resolution) |
65 |
|
66 |
def setAngle(self, angle): |
67 |
""" |
68 |
Set the angle of rotation. |
69 |
|
70 |
@type angle: Number |
71 |
@param angle: Angle of rotation |
72 |
""" |
73 |
|
74 |
self.__vtk_rotational_extrusion_filter.SetAngle(angle) |
75 |
|
76 |
def _getRotationOutput(self): |
77 |
""" |
78 |
Return the output of the rotation. |
79 |
|
80 |
@rtype: vtkPolyData |
81 |
@return: Polygonal data |
82 |
""" |
83 |
|
84 |
return self.__vtk_rotational_extrusion_filter.GetOutput() |
85 |
|