Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

osg::BoundingBox Class Reference

General purpose axis-aligned bounding box class for enclosing objects/vertices. More...

List of all members.

Public Member Functions

 BoundingBox ()
 Creates an uninitialized bounding box.

 BoundingBox (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Creates a bounding box initialized to the given extents.

 BoundingBox (const Vec3 &min, const Vec3 &max)
 Creates a bounding box initialized to the given extents.

void init ()
 Clear the bounding box.

bool valid () const
 Returns true if the bounding box extents are valid, false otherwise.

void set (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Sets the bounding box extents.

void set (const Vec3 &min, const Vec3 &max)
 Sets the bounding box extents.

float & xMin ()
float xMin () const
float & yMin ()
float yMin () const
float & zMin ()
float zMin () const
float & xMax ()
float xMax () const
float & yMax ()
float yMax () const
float & zMax ()
float zMax () const
const Vec3 center () const
 Calculates and returns the bounding box center.

float radius () const
 Calculates and returns the bounding box radius.

float radius2 () const
 Calculates and returns the squared length of the bounding box radius.

const Vec3 corner (unsigned int pos) const
 Returns a specific corner of the bounding box.

void expandBy (const Vec3 &v)
 Expands the bounding box to include the given coordinate.

void expandBy (float x, float y, float z)
 Expands the bounding box to include the given coordinate.

void expandBy (const BoundingBox &bb)
 Expands this bounding box to include the given bounding box.

void expandBy (const BoundingSphere &sh)
 Expands this bounding box to include the given sphere.

BoundingBox intersect (const BoundingBox &bb) const
 Returns the intesection of this bounding box and the specified bounding box.

bool intersects (const BoundingBox &bb) const
 Return true if this bounding box intersects the specified bounding box.

bool contains (const Vec3 &v) const
 Returns true if this bounding box contains the specified coordinate.


Public Attributes

Vec3 _min
 Minimum extent.

Vec3 _max
 Maximum extent.


Detailed Description

General purpose axis-aligned bounding box class for enclosing objects/vertices.

Bounds leaf objects in a scene such as osg::Drawable objects. Used for frustum culling etc.


Constructor & Destructor Documentation

osg::BoundingBox::BoundingBox  )  [inline]
 

Creates an uninitialized bounding box.

osg::BoundingBox::BoundingBox float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax
[inline]
 

Creates a bounding box initialized to the given extents.

osg::BoundingBox::BoundingBox const Vec3 min,
const Vec3 max
[inline]
 

Creates a bounding box initialized to the given extents.


Member Function Documentation

const Vec3 osg::BoundingBox::center  )  const [inline]
 

Calculates and returns the bounding box center.

bool osg::BoundingBox::contains const Vec3 v  )  const [inline]
 

Returns true if this bounding box contains the specified coordinate.

const Vec3 osg::BoundingBox::corner unsigned int  pos  )  const [inline]
 

Returns a specific corner of the bounding box.

pos specifies the corner as a number between 0 and 7. Each bit selects an axis, X, Y, or Z from least- to most-significant. Unset bits select the minimum value for that axis, and set bits select the maximum.

void osg::BoundingBox::expandBy const BoundingSphere sh  ) 
 

Expands this bounding box to include the given sphere.

If this box is uninitialized, set it to include sh.

void osg::BoundingBox::expandBy const BoundingBox bb  ) 
 

Expands this bounding box to include the given bounding box.

If this box is uninitialized, set it equal to bb.

void osg::BoundingBox::expandBy float  x,
float  y,
float  z
[inline]
 

Expands the bounding box to include the given coordinate.

If the box is uninitialized, set its min and max extents to Vec3(x,y,z).

void osg::BoundingBox::expandBy const Vec3 v  )  [inline]
 

Expands the bounding box to include the given coordinate.

If the box is uninitialized, set its min and max extents to v.

void osg::BoundingBox::init  )  [inline]
 

Clear the bounding box.

Erases existing minimum and maximum extents.

BoundingBox osg::BoundingBox::intersect const BoundingBox bb  )  const [inline]
 

Returns the intesection of this bounding box and the specified bounding box.

bool osg::BoundingBox::intersects const BoundingBox bb  )  const [inline]
 

Return true if this bounding box intersects the specified bounding box.

float osg::BoundingBox::radius  )  const [inline]
 

Calculates and returns the bounding box radius.

float osg::BoundingBox::radius2  )  const [inline]
 

Calculates and returns the squared length of the bounding box radius.

Note, radius2() is faster to calculate than radius().

void osg::BoundingBox::set const Vec3 min,
const Vec3 max
[inline]
 

Sets the bounding box extents.

void osg::BoundingBox::set float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax
[inline]
 

Sets the bounding box extents.

bool osg::BoundingBox::valid  )  const [inline]
 

Returns true if the bounding box extents are valid, false otherwise.

float osg::BoundingBox::xMax  )  const [inline]
 

float& osg::BoundingBox::xMax  )  [inline]
 

float osg::BoundingBox::xMin  )  const [inline]
 

float& osg::BoundingBox::xMin  )  [inline]
 

float osg::BoundingBox::yMax  )  const [inline]
 

float& osg::BoundingBox::yMax  )  [inline]
 

float osg::BoundingBox::yMin  )  const [inline]
 

float& osg::BoundingBox::yMin  )  [inline]
 

float osg::BoundingBox::zMax  )  const [inline]
 

float& osg::BoundingBox::zMax  )  [inline]
 

float osg::BoundingBox::zMin  )  const [inline]
 

float& osg::BoundingBox::zMin  )  [inline]
 


Member Data Documentation

Vec3 osg::BoundingBox::_max
 

Maximum extent.

(Greatest X, Y, and Z values of all coordinates.)

Vec3 osg::BoundingBox::_min
 

Minimum extent.

(Smallest X, Y, and Z values of all coordinates.)


The documentation for this class was generated from the following file:
Generated at Thu Nov 24 16:22:47 2005 for the OpenSceneGraph by doxygen 1.3.6.