/[escript]/trunk/pyvisi/py_src/normals.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/normals.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2344 - (show annotations)
Mon Mar 30 02:13:58 2009 UTC (10 years, 5 months ago) by jfenwick
File MIME type: text/x-python
File size: 2049 byte(s)
Change __url__ to launchpad site

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 """
23 @var __author__: name of author
24 @var __copyright__: copyrights
25 @var __license__: licence agreement
26 @var __url__: url entry point on documentation
27 @var __version__: version
28 @var __date__: date of the version
29 """
30
31 __author__="John Ngui, john.ngui@uq.edu.au"
32
33
34 import vtk
35 from esys.escript import getMPISizeWorld
36
37 class Normals:
38 """
39 Class that defines normals. Normals are used to average the normals of
40 points in order to generate better sufaces (in the case of tensors, normals
41 avoids the tensors from appearing black in color).
42 """
43
44 def __init__(self):
45 """
46 Initialise the normals.
47 """
48 if getMPISizeWorld()>1:
49 raise ValueError,"pyvisi.Normals is not running on more than one processor."
50 self.__vtk_poly_data_normals = vtk.vtkPolyDataNormals()
51
52 def _setupNormals(self, object):
53 """
54 Setup the normals.
55
56 @type object: vtkPolyData, etc
57 @param object: Input for the normals
58 """
59
60 self.__object = object
61 self.__setInput()
62
63 def __setInput(self):
64 """
65 Set the input for the normals.
66 """
67
68 self.__vtk_poly_data_normals.SetInput(self.__object)
69
70 def _getNormalsOutput(self):
71 """
72 Return the output of the normals.
73
74 @rtype: vtkPolyData
75 @return: Polygonal data
76 """
77
78 return self.__vtk_poly_data_normals.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26