Core Library
A simple library for handling 3D scenes
Box Class Reference

The Box class represents an axis-aligned box in 3D space (usually a bounding box). More...

#include <box.h>

Public Member Functions

 Box (const Point &point=Point())
 
 Box (const Point &minimum, const Point &maximum)
 
void expand (const Point &p)
 
void expand (const Box &b)
 
Point center () const
 
float radius () const
 
Point min () const
 
Point max () const
 

Detailed Description

The Box class represents a box in 3D space through its (min, max) corners. This class is suitable for representing axis-aligned boxes (but not oriented boxes). A typical use is for representing the bounding box of an object or group of objects.

Constructor & Destructor Documentation

Box::Box ( const Point point = Point())

Constructs a box containing a single point (minimum=maximum=point).

Box::Box ( const Point minimum,
const Point maximum 
)

Constructs a box from two points (minimum, maximum).

Member Function Documentation

Point Box::center ( ) const

Draws the box (wireframe).

Returns the center of the box.

void Box::expand ( const Point p)

Expands the box so that it includes point p.

void Box::expand ( const Box b)

Expands the box so that it includes box b.

Point Box::max ( ) const

Returns the maximum corner of the box.

Point Box::min ( ) const

Returns the minimum corner of the box.

float Box::radius ( ) const

Returns half the box's diagonal, that is, the radius of a sphere bounding the box.