cee::BoundingBox Class Reference

Axis-aligned bounding box. More...

Public Member Functions

 BoundingBox ()
 Constructs an empty bounding box object. More...
 
 BoundingBox (const Vec3d &min, const Vec3d &max)
 Constructs a bounding box defined by min and max. More...
 
 BoundingBox (const BoundingBox &other)
 Constructs a bounding box as a copy of other. More...
 
BoundingBoxoperator= (const BoundingBox &rhs)
 Assigns rhs to this bounding box and returns a reference to this bounding box. More...
 
BoundingBox operator+ (const BoundingBox &rhs)
 Adds rhs with this and return the product bounding box, leaving this unchanged. More...
 
void reset ()
 Resets the bounding box. More...
 
bool isValid () const
 Returns false if no input has been given. More...
 
void add (const Vec3d &vertex)
 Adds a point to the bounding box area. More...
 
void add (const BoundingBox &bb)
 Adds another bounding box to this bounding box area. More...
 
Vec3d minimum () const
 Returns the bounding box's minimum point. More...
 
Vec3d maximum () const
 Returns the bounding box's maximum point. More...
 
Vec3d center () const
 Returns the computed center of the bounding box. More...
 
Vec3d extent () const
 Returns the total size of the bounding box. More...
 
double radius () const
 Returns the radius as half the length of the box's diagonal. More...
 
void transform (const Mat4d &matrix)
 Transforms the bounding box according to matrix. More...
 

Detailed Description

Axis-aligned bounding box.

The BoundingBox class defines an axis-aligned bounding box. The bounding box is defined as the smallest possible box surrounding a collection of points. There must be at least two separate points set for a valid bounding box.

When adding points to an existing bounding box, it will grow to surround the newly added points in addition to the existing. Single points or other bounding boxes can be added.

You can query an existing bounding box for minimum, maximum, center point, extent and radius.

The views bounding box can be retrieved by View::boundingBox().

See also
View

Constructor & Destructor Documentation

cee::BoundingBox::BoundingBox ( )

Constructs an empty bounding box object.

cee::BoundingBox::BoundingBox ( const Vec3d min,
const Vec3d max 
)

Constructs a bounding box defined by min and max.

cee::BoundingBox::BoundingBox ( const BoundingBox other)

Constructs a bounding box as a copy of other.

Member Function Documentation

void cee::BoundingBox::add ( const Vec3d point)

Adds a point to the bounding box area.

The bounding box will grow to include the added point.

void cee::BoundingBox::add ( const BoundingBox bb)

Adds another bounding box to this bounding box area.

The bounding box will grow to include the added bounding box.

Vec3d cee::BoundingBox::center ( ) const

Returns the computed center of the bounding box.

Vec3d cee::BoundingBox::extent ( ) const

Returns the total size of the bounding box.

bool cee::BoundingBox::isValid ( ) const

Returns false if no input has been given.

Vec3d cee::BoundingBox::maximum ( ) const

Returns the bounding box's maximum point.

Vec3d cee::BoundingBox::minimum ( ) const

Returns the bounding box's minimum point.

cee::BoundingBox cee::BoundingBox::operator+ ( const BoundingBox rhs)

Adds rhs with this and return the product bounding box, leaving this unchanged.

BoundingBox & cee::BoundingBox::operator= ( const BoundingBox rhs)

Assigns rhs to this bounding box and returns a reference to this bounding box.

double cee::BoundingBox::radius ( ) const

Returns the radius as half the length of the box's diagonal.

void cee::BoundingBox::reset ( )

Resets the bounding box.

void cee::BoundingBox::transform ( const Mat4d matrix)

Transforms the bounding box according to matrix.