aabb¶
-
class
guerilla.aabb¶ Bases:
objectAn axis aligned bounding box (aabb) class
Exemple :
>>> Document().new() >>> # Load a sphere from the library >>> Document().loadfile("$(LIBRARY)/primitives/sphere.glocator") [<guerilla.Primitive object at ... >>> b = aabb () >>> b.isempty () True >>> # Iterates on every primitives in the scene >>> for p in listchildren (Document (), "Primitive", "", True): ... b = b.getextended (p.WAABB.get ()) >>> b.isempty () False
-
getcenter()¶ Returns the center of the aabb
Return type: point3Exemple :
>>> a = aabb (0,0,0,0,0,0) >>> a = a.getextended (point3 (1,2,3)) >>> c = a.getcenter () >>> c.getx(), c.gety(), c.getz() (0.5, 1.0, 1.5)
-
getextended(extension)¶ Returns an extended aabb
The aabb will be extended in order to contain the old aabb and the extension. The extension can be a point3 or a aabb.
Parameters: extension ( aabborpoint3) – The aabb or the point that the aabb should contain after the extension.Return type: aabbExemple :
>>> a = aabb () >>> b = aabb () >>> a = a.getextended (point3 (1,2,3)) >>> b = b.getextended (point3 (-1,-2,-3)) >>> a = a.getextended (b) >>> s = a.getsize () >>> s.getx(), s.gety(), s.getz() (2.0, 4.0, 6.0)
-
getextendedsize(*args)¶ Returns an aabb with an extended size
The aabb will be extended in the directions i, j, k, -i ,-j ,-k by respectively x, x, x, -x, -x, -x.
Available arguments:
Parameters: x (float) – extension on i, j and k or
Parameters: or
Parameters: p ( point3) – extension on i, j and kReturn type: aabbExemple :
>>> a = aabb (0,0,0,0,0,0) >>> a = a.getextendedsize (1) >>> a = a.getextendedsize (point3 (0,1,2)) >>> a = a.getextendedsize (0,1,2) >>> s = a.getsize () >>> s.getx(), s.gety(), s.getz() (2.0, 6.0, 10.0)
-
getmax()¶ Return the max values on axis i, j, k
Return type: point3Exemple :
>>> a = aabb (0,0,0,0,0,0) >>> a = a.getextended (point3 (1,2,3)) >>> s = a.getmax () >>> s.getx(), s.gety(), s.getz() (1.0, 2.0, 3.0)
-
getmin()¶ Return the min values on axis i, j, k
Return type: point3Exemple :
>>> a = aabb (0,0,0,0,0,0) >>> a = a.getextended (point3 (1,2,3)) >>> s = a.getmin () >>> s.getx(), s.gety(), s.getz() (0.0, 0.0, 0.0)
-
getradius()¶ Returns the radius of the bounding sphere of the aabb
The center of the sphere is returned by getcenter ().
Return type: float Exemple :
>>> a = aabb (0,0,0,0,0,0) >>> a = a.getextended (point3 (1,2,3)) >>> a.getradius () 1.8708287477493286
-
getsize()¶ Return the size of the aabb on i, j, k
Return type: point3Exemple :
>>> a = aabb (0,0,0,0,0,0) >>> a = a.getextended (point3 (1,2,3)) >>> s = a.getsize () >>> s.getx(), s.gety(), s.getz() (1.0, 2.0, 3.0)
-