1
2 """ Base class for the wrapping of graphical objects
3
4 The actual object is accessed via the member variable src.
5 Just adds some simple things like bounding boxes etc"""
6
7 from math import sqrt
8
9 from PyFoam.Basics.DataStructures import Vector
10
12 """Base class for the sources
13
14 The member src is the actual source object"""
15
17 """@param src: the actual source proxy"""
18 self.src = src
19
21 """Get the bounding box of the object"""
22 bnds=self.src.GetDataInformation().GetBounds()
23
24 return (bnds[0:2],bnds[2:4],bnds[4:6])
25
27 """Get the minimum-vector of the bounds"""
28 bnd=self.getBounds()
29 return Vector(bnd[0][0],bnd[1][0],bnd[2][0])
30
32 """Get the minimum-vector of the bounds"""
33 bnd=self.getBounds()
34 return Vector(bnd[0][1],bnd[1][1],bnd[2][1])
35
37 """Return the center of the object"""
38 return 0.5*(self.getMax()+self.getMin())
39
40 - def getExtent(self):
41 """Return the center of the object"""
42 return self.getMax()-self.getMin()
43
45 """The characteristic length of the object"""
46
47 return abs(self.getExtent())
48
50 """Convert a list or a tuple of length 3 to a vector for easier calculations"""
51
52 return Vector(orig[0],orig[1],orig[2])
53