1 |
""" |
2 |
@author: John NGUI |
3 |
""" |
4 |
|
5 |
import vtk |
6 |
|
7 |
class Cutter: |
8 |
""" |
9 |
Class that defines a cutter. |
10 |
""" |
11 |
|
12 |
def __init__(self): |
13 |
""" |
14 |
Initialise the cutter. |
15 |
""" |
16 |
|
17 |
self.__vtk_cutter = vtk.vtkCutter() |
18 |
|
19 |
def _setupCutter(self, object, plane): |
20 |
""" |
21 |
Setup the cutter. |
22 |
|
23 |
@type object: vtkUnstructuredGrid, etc |
24 |
@param object: Input for the cutter |
25 |
@type plane: vtkPlane |
26 |
@param plane: Plane to cut the object |
27 |
""" |
28 |
|
29 |
self.__object = object |
30 |
self.__plane = plane |
31 |
|
32 |
self.__setInput() |
33 |
self.__setCutFunction() |
34 |
|
35 |
def __setInput(self): |
36 |
""" |
37 |
Set the input for the cutter. |
38 |
""" |
39 |
|
40 |
self.__vtk_cutter.SetInput(self.__object) |
41 |
|
42 |
def __setCutFunction(self): |
43 |
""" |
44 |
Set the cut function (using a plane). |
45 |
""" |
46 |
|
47 |
self.__vtk_cutter.SetCutFunction(self.__plane) |
48 |
|
49 |
def _getCutterOutput(self): |
50 |
""" |
51 |
Return the output of the cutter. |
52 |
|
53 |
@rtype: vtkPolyData |
54 |
@return: Polygonal data |
55 |
""" |
56 |
|
57 |
return self.__vtk_cutter.GetOutput() |