#include <BBox2C.h>
Public Methods | |
BBox2C () | |
Default constructor. | |
BBox2C (const Vector2C &rMin, const Vector2C &rMax) | |
Initialises the bounds of the box from specified maximum and minimum values. | |
BBox2C (const BBox2C &rBBox) | |
Copy constructor. | |
virtual | ~BBox2C () |
Destructor. | |
float32 | width () const |
Returns the width of the bounding box. | |
float32 | height () const |
Returns the height of the bounding box. | |
Vector2C | center () const |
Returns the center of the bounding box. | |
Vector2C | size () const |
Returns the size of the bounding box. | |
bool | contains (const Vector2C &rVec) const |
Determines wheter the specified point is inside the bounding box. | |
bool | contains (const BBox2C &rBBox) const |
Determines wheter the specified bounding box is inside the bounding box. | |
BBox2C | trim (const BBox2C &rBBox) const |
Trims the bounding box by the specified bounding box. | |
BBox2C | normalize () const |
Normalizes the bounding box so that the minimum and maximum values are correct. | |
BBox2C | offset (const Vector2C &rOffset) const |
Moves the bounding box by specified offset. | |
BBox2C | combine (const BBox2C &rBBox) const |
Combines two bounding boxes. | |
Vector2C & | operator[] (int i) |
Returns either minimum or maximum of the box. | |
const Vector2C & | operator[] (int i) const |
Returns either minimum or maximum of the box. | |
bool | operator== (const BBox2C &rBBox) const |
Compares two boxes and returns true if they are equal. | |
bool | operator!= (const BBox2C &rBBox) const |
Compares two boxes and returns true if they are non-equal. |
BBox2C class implements two dimensional box used as bounding box. When specifying a bounding box you must be careful to construct it so that it is normalized. In other words, the minimum values and maximum values has to be correct. If the bounding box is not normalized many methods will return incorrect results. If a method needs the box ot be normalized it is mentioned. To normalize non-normalized bounding box use the normalize method.
|
Default constructor.
|
|
Initialises the bounds of the box from specified maximum and minimum values.
|
|
Copy constructor.
|
|
Destructor.
|
|
Returns the center of the bounding box.
|
|
Combines two bounding boxes. Makes the dimension of a bounding box equal to the union of the bounding box and the other specified bounding box, and returns the union. The union is the smallest bounding box containing both bounding boxes.
|
|
Determines wheter the specified bounding box is inside the bounding box. Both boxes have to be normalized or this method may fail. You may normalize the box by calling the normalize() method.
|
|
Determines wheter the specified point is inside the bounding box. The box has to be normalized or this method may fail. You may normalize the box by calling the normalize() method.
|
|
Returns the height of the bounding box.
|
|
Normalizes the bounding box so that the minimum and maximum values are correct. This method is useful when dealing with bounding boxes which may be inverted.
|
|
Moves the bounding box by specified offset.
|
|
Compares two boxes and returns true if they are non-equal. Both boxes have to be normalized or this method may fail. You may normalize the box by calling the normalize() method.
|
|
Compares two boxes and returns true if they are equal. Both boxes have to be normalized or this method may fail. You may normalize the box by calling the normalize() method.
|
|
Returns either minimum or maximum of the box. The returns value depends on the given index: 0 for minimum, 1 for maximum. The box has to be normalized or this method may return incorrect values. You may normalize the box by calling the normalize()> method. There are two versions of this method, this version is for retrieving the values.
|
|
Returns either minimum or maximum of the box. The returns value depends on the given index: 0 for minimum, 1 for maximum. The box has to be normalized or this method may return incorrect values. You may normalize the box by calling the normalize() method. There are two versions of this method, this version enables to assign values using the assignment operator.
|
|
Returns the size of the bounding box.
|
|
Trims the bounding box by the specified bounding box. After trimming the bounding box will fit inside the trimming box.
|
|
Returns the width of the bounding box.
|