#include <math.h>
Represents a bounding box whose axes are aligned with the coordinate system.
The box is usually referred by two corners, the start corner means the one whose coordinates are the smallest, while the end corner means the opposite.
Public Member Functions | |
AxisAlignedBoundingBox (void) | |
Creates an empty bounding box. More... | |
AxisAlignedBoundingBox (const Vector &vStart, const Vector &vEnd) | |
Creates an object by specifying two corners of the box. More... | |
AxisAlignedBoundingBox (const Vector &vCenter, float fSize) | |
Creates an object by specifying the center of it and the distance of the sides from the center. More... | |
AxisAlignedBoundingBox (const AxisAlignedBoundingBox &cA) | |
Creates an object by cloning another one. More... | |
AxisAlignedBoundingBox & | operator= (const AxisAlignedBoundingBox &cBB) |
Assigns the value of a box object to another one. More... | |
AxisAlignedBoundingBox & | operator+= (const AxisAlignedBoundingBox &cBB) |
Extends the box to contain another one. More... | |
bool | operator== (const AxisAlignedBoundingBox &cBB) const |
Returns true if two boxes are identical, false otherwise. More... | |
void | Reset (void) |
Makes the box empty. More... | |
void | Serialize (Stream &s) |
Writes/reads the object data to/from a stream. More... | |
bool | operator!= (const AxisAlignedBoundingBox &cBox) const |
returns true if the two boxes are different, false otherwise. More... | |
void | Extend (const Vector &cV) throw () |
Extends the box to contain the passed point. More... | |
void | Extend (const AxisAlignedBoundingBox &bb) |
Extends the box to contain another one. More... | |
void | ExpandBy (float f) throw () |
Expands the AABB by a specified amount in all directions. More... | |
void | Transform (const class Matrix &mMatrix) |
Transforms the box with the passed-in matrix, and returns the smallest box which contains the result. More... | |
Vector | operator[] (int iCornerIndex) const |
Returns the corners of the box. Valid indexes are 0-7. More... | |
float | Size (void) const |
Returns the maximum edge length of the box. More... | |
float | XSize (void) const |
Returns the length of the box along the X axis. More... | |
float | YSize (void) const |
Returns the length of the box along the Y axis. More... | |
float | ZSize (void) const |
Returns the length of the box along the Y axis. More... | |
float | Volume (void) const |
Returns the volume of the box. More... | |
Vector | Center (void) const |
Returns the center of the box. More... | |
bool | IsPartOf (const AxisAlignedBoundingBox &cBB) const |
Returns true if the passed-in box contains this box. More... | |
bool | IsTouching (const AxisAlignedBoundingBox &cBB) const |
Returns true if the two boxes intersect at all. More... | |
bool | IsTouching (const Vector &vStart, const Vector &vEnd, float &fPlace) const |
Returns true if the box intersects any part of a specified line. More... | |
bool | IsContaining (const Vector &cV) const |
Returns true if the box contains the specified point. More... | |
bool | IsContaining (const AxisAlignedBoundingBox &b) const |
Returns true if the box contains the specified box. More... | |
AxisAlignedBoundingBox | Intersection (const AxisAlignedBoundingBox &cOther) const |
Returns the intersection between this box and cOther. More... | |
bool | IsEmpty (void) const |
Returns true if the box is empy. More... | |
AxisAlignedBoundingBox | operator* (float fFactor) |
Multiplies the box coordinates with a scalar value. More... | |
Static Public Member Functions | |
static AxisAlignedBoundingBox | SphereBoundingBox (const Vector &cCenter, float fRadius, const Matrix &mTransform) |
Returns the bounding box of the given sphere, in the given coordinate space. More... | |
Public Attributes | |
Vector | m_vStart |
Vector | m_vEnd |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Extends the box to contain another one.
Definition at line 872 of file math.h.
|
inline |
|
inline |
returns true if the two boxes are different, false otherwise.
Definition at line 896 of file math.h.
Extends the box to contain the passed point.
Definition at line 901 of file math.h.
|
inline |
Extends the box to contain another one.
Definition at line 916 of file math.h.
|
inline |
Transforms the box with the passed-in matrix, and returns the smallest box which contains the result.
This is usually larger than the original box, because the transformation might rotate the box out of axis alignment.
|
inline |
Returns the maximum edge length of the box.
Definition at line 942 of file math.h.
|
inline |
|
inline |
|
inline |
|
inline |
Returns the volume of the box.
Definition at line 954 of file math.h.
|
inline |
|
inline |
Returns true if the box intersects any part of a specified line.
If there is an intersection, then a point guaranteed to be inside the box is returned in the third argument (fPlace). That argument represents a location along the line from vStart to vEnd. (Location = vStart + fPlace*vEnd)
|
inline |
|
inline |
Returns true if the box contains the specified box.
Definition at line 1002 of file math.h.
|
inline |
Returns the intersection between this box and cOther.
Returned bounding box will be empty if this box does not intersect cOther.
Definition at line 1007 of file math.h.
|
inline |
|
inline |
Multiplies the box coordinates with a scalar value.
Definition at line 1027 of file math.h.
|
static |
Returns the bounding box of the given sphere, in the given coordinate space.