Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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 Methods

 BoundingBox ()
 construct to invalid values to represent an unset bounding box.

 BoundingBox (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 construct to with specified min and max values.

 BoundingBox (const Vec3 &min, const Vec3 &max)
 construct to with specified min and max values.

void init ()
 initialize to invalid values to represent an unset bounding box.

const 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)
 construct to with specified min and max values.

float & xMin ()
const float xMin () const
float & yMin ()
const float yMin () const
float & zMin ()
const float zMin () const
float & xMax ()
const float xMax () const
float & yMax ()
const float yMax () const
float & zMax ()
const float zMax () const
const Vec3 center () const
 Calculate and return the center of the bounding box.

const float radius () const
 Calculate and return the radius of the bounding box.

const float radius2 () const
 Calculate and return the radius squared of the bounding box.

const Vec3 corner (unsigned int pos) const
 return the corner of the bounding box.

void expandBy (const Vec3 &v)
 If the vertex is out-with the box expand to encompass vertex.

void expandBy (float x, float y, float z)
 If the vertex is out-with the box expand to encompass vertex.

void expandBy (const BoundingBox &bb)
 If incoming box is out-with the box expand to encompass incoming box.

void expandBy (const BoundingSphere &sh)
 If incoming sphere is out-with the box expand to encompass incoming sphere.

const bool contains (const Vec3 &v) const
 return true is vertex v is within the box.


Public Attributes

Vec3 _min
 The corner with the smallest values for each coordinate of the bounding box.

Vec3 _max
 The corner with the largest values for each coordinate of the bounding box.


Detailed Description

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

Used to bounding the leaf objects in the scene, i.e. osg::Drawable's to assist in view frustum culling etc.


Constructor & Destructor Documentation

osg::BoundingBox::BoundingBox   [inline]
 

construct to invalid values to represent an unset bounding box.

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

construct to with specified min and max values.

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

construct to with specified min and max values.


Member Function Documentation

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

Calculate and return the center of the bounding box.

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

return true is vertex v is within the box.

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

return the corner of the bounding box.

Position (pos) is specified by a number between 0 and 7, the first bit toggles between x min and x max, second bit toggles between y min and y max, third bit toggles between z min and z max.

void osg::BoundingBox::expandBy const BoundingSphere   sh
 

If incoming sphere is out-with the box expand to encompass incoming sphere.

If this box is empty then move set this box to encompass the sphere.

void osg::BoundingBox::expandBy const BoundingBox &    bb
 

If incoming box is out-with the box expand to encompass incoming box.

If this box is empty then move set this box to incoming box.

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

If the vertex is out-with the box expand to encompass vertex.

If this box is empty then move set this box's min max to vertex.

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

If the vertex is out-with the box expand to encompass vertex.

If this box is empty then move set this box's min max to vertex.

void osg::BoundingBox::init   [inline]
 

initialize to invalid values to represent an unset bounding box.

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

Calculate and return the radius of the bounding box.

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

Calculate and return the radius squared of the bounding box.

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

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

construct to with specified min and max values.

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Member Data Documentation

Vec3 osg::BoundingBox::_max
 

The corner with the largest values for each coordinate of the bounding box.

Vec3 osg::BoundingBox::_min
 

The corner with the smallest values for each coordinate of the bounding box.


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:26 2002 for the Open Scene Graph by doxygen 1.2.16.