1 |
""" |
2 |
@author: John NGUI |
3 |
""" |
4 |
|
5 |
import vtk |
6 |
|
7 |
class Normals: |
8 |
""" |
9 |
Class that defines normals. Normals are used to average the normals of |
10 |
points in order to generate better sufaces (in the case of tensors, normals |
11 |
avoids the tensors from appearing black in color). |
12 |
""" |
13 |
|
14 |
def __init__(self): |
15 |
""" |
16 |
Initialise the normals. |
17 |
""" |
18 |
|
19 |
self.__vtk_poly_data_normals = vtk.vtkPolyDataNormals() |
20 |
|
21 |
def _setupNormals(self, object): |
22 |
""" |
23 |
Setup the normals. |
24 |
|
25 |
@type object: vtkPolyData, etc |
26 |
@param object: Input for the normals |
27 |
""" |
28 |
|
29 |
self.__object = object |
30 |
self.__setInput() |
31 |
|
32 |
def __setInput(self): |
33 |
""" |
34 |
Set the input for the normals. |
35 |
""" |
36 |
|
37 |
self.__vtk_poly_data_normals.SetInput(self.__object) |
38 |
|
39 |
def _getNormalsOutput(self): |
40 |
""" |
41 |
Return the output of the normals. |
42 |
|
43 |
@rtype: vtkPolyData |
44 |
@return: Polygonal data |
45 |
""" |
46 |
|
47 |
return self.__vtk_poly_data_normals.GetOutput() |