osg::BoundingBox Class Reference

List of all members.

Public Member Functions

 BoundingBox ()
 BoundingBox (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 BoundingBox (const Vec3 &min, const Vec3 &max)
void init ()
bool valid () const
void set (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
void set (const Vec3 &min, const Vec3 &max)
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
float radius () const
float radius2 () const
const Vec3 corner (unsigned int pos) const
void expandBy (const Vec3 &v)
void expandBy (float x, float y, float z)
void expandBy (const BoundingBox &bb)
void expandBy (const BoundingSphere &sh)
BoundingBox intersect (const BoundingBox &bb) const
bool intersects (const BoundingBox &bb) const
bool contains (const Vec3 &v) const

Public Attributes

Vec3 _min
Vec3 _max

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 on Sun Oct 1 13:17:05 2006 for openscenegraph by  doxygen 1.4.7