#include <BoundingBox.h>
Public Member Functions | |
BoundingBox () | |
BoundingBox (const Vector3 &min, const Vector3 &max) | |
BoundingBox (float minX, float minY, float minZ, float maxX, float maxY, float maxZ) | |
BoundingBox (const BoundingBox ©) | |
~BoundingBox () | |
Vector3 | getCenter () const |
void | getCenter (Vector3 *dst) const |
void | getCorners (Vector3 *dst) const |
bool | intersects (const BoundingBox &box) const |
bool | intersects (const BoundingSphere &sphere) const |
bool | intersects (const Frustum &frustum) const |
float | intersects (const Plane &plane) const |
float | intersects (const Ray &ray) const |
bool | isEmpty () const |
void | merge (const BoundingSphere &sphere) |
void | merge (const BoundingBox &box) |
void | set (const Vector3 &min, const Vector3 &max) |
void | set (float minX, float minY, float minZ, float maxX, float maxY, float maxZ) |
void | set (const BoundingBox &box) |
void | set (const BoundingSphere &sphere) |
void | transform (const Matrix &matrix) |
BoundingBox & | operator*= (const Matrix &matrix) |
Static Public Member Functions | |
static const BoundingBox & | empty () |
Public Attributes | |
Vector3 | min |
Vector3 | max |
Defines a 3-dimensional axis-aligned bounding box.
Constructs an empty bounding box at the origin.
gameplay::BoundingBox::BoundingBox | ( | const Vector3 & | min, |
const Vector3 & | max | ||
) |
Constructs a new bounding box from the specified values.
min | The minimum point of the bounding box. |
max | The maximum point of the bounding box. |
gameplay::BoundingBox::BoundingBox | ( | float | minX, |
float | minY, | ||
float | minZ, | ||
float | maxX, | ||
float | maxY, | ||
float | maxZ | ||
) |
Constructs a new bounding box from the specified values.
minX | The x coordinate of the minimum point of the bounding box. |
minY | The y coordinate of the minimum point of the bounding box. |
minZ | The z coordinate of the minimum point of the bounding box. |
maxX | The x coordinate of the maximum point of the bounding box. |
maxY | The y coordinate of the maximum point of the bounding box. |
maxZ | The z coordinate of the maximum point of the bounding box. |
gameplay::BoundingBox::BoundingBox | ( | const BoundingBox & | copy | ) |
Constructs a new bounding box from the given bounding box.
copy | The bounding box to copy. |
Destructor.
static const BoundingBox& gameplay::BoundingBox::empty | ( | ) | [static] |
Returns an empty bounding box.
Vector3 gameplay::BoundingBox::getCenter | ( | ) | const |
Gets the center point of the bounding box.
This method computes the center point of the box from its min and max.
void gameplay::BoundingBox::getCenter | ( | Vector3 * | dst | ) | const |
Gets the center point of the bounding box.
This method computes the center point of the box from its min and max points and stores the result in dst.
dst | The vector to store the result in. |
void gameplay::BoundingBox::getCorners | ( | Vector3 * | dst | ) | const |
Gets the corners of the bounding box in the specified array.
The corners are returned as follows: 0 to 3 specify the near face starting at the upper left point when looking towards the origin from the positive z-axis in a counter-clockwise fashion; 4 to 7 specify the far face starting at the upper left point when looking towards the origin from the negative z-axis in a counter-clockwise fashion.
dst | The array to store the corners in. Must be size 8. |
bool gameplay::BoundingBox::intersects | ( | const BoundingBox & | box | ) | const |
Tests whether this bounding box intersects the specified bounding object.
box | The bounding box to test intersection with. |
bool gameplay::BoundingBox::intersects | ( | const BoundingSphere & | sphere | ) | const |
Tests whether this bounding box intersects the specified bounding sphere.
sphere | The bounding sphere to test intersection with. |
bool gameplay::BoundingBox::intersects | ( | const Frustum & | frustum | ) | const |
Tests whether this bounding box intersects the specified frustum.
frustum | The frustum to test intersection with. |
float gameplay::BoundingBox::intersects | ( | const Plane & | plane | ) | const |
Tests whether this bounding box intersects the specified plane.
plane | The plane to test intersection with. |
float gameplay::BoundingBox::intersects | ( | const Ray & | ray | ) | const |
Tests whether this bounding box intersects the specified ray.
ray | The ray to test intersection with. |
bool gameplay::BoundingBox::isEmpty | ( | ) | const |
Determines if this bounding box is empty.
void gameplay::BoundingBox::merge | ( | const BoundingSphere & | sphere | ) |
Sets this bounding box to the smallest bounding box that contains both this bounding box and the specified bounding sphere.
sphere | The bounding sphere to merge with. |
void gameplay::BoundingBox::merge | ( | const BoundingBox & | box | ) |
Sets this bounding box to the smallest bounding box that contains both this bounding object and the specified bounding box.
box | The bounding box to merge with. |
BoundingBox& gameplay::BoundingBox::operator*= | ( | const Matrix & | matrix | ) | [inline] |
Transforms this bounding box by the given matrix.
matrix | The matrix to transform by. |
void gameplay::BoundingBox::set | ( | const Vector3 & | min, |
const Vector3 & | max | ||
) |
Sets this bounding box to the specified values.
min | The minimum point of the bounding box. |
max | The maximum point of the bounding box. |
void gameplay::BoundingBox::set | ( | float | minX, |
float | minY, | ||
float | minZ, | ||
float | maxX, | ||
float | maxY, | ||
float | maxZ | ||
) |
Sets this bounding box to the specified values.
minX | The x coordinate of the minimum point of the bounding box. |
minY | The y coordinate of the minimum point of the bounding box. |
minZ | The z coordinate of the minimum point of the bounding box. |
maxX | The x coordinate of the maximum point of the bounding box. |
maxY | The y coordinate of the maximum point of the bounding box. |
maxZ | The z coordinate of the maximum point of the bounding box. |
void gameplay::BoundingBox::set | ( | const BoundingBox & | box | ) |
Sets this bounding box to the specified bounding box.
box | The bounding box to set to. |
void gameplay::BoundingBox::set | ( | const BoundingSphere & | sphere | ) |
Sets this box to tightly contain the specified bounding sphere.
sphere | The sphere to contain. |
void gameplay::BoundingBox::transform | ( | const Matrix & | matrix | ) |
Transforms the bounding box by the given transformation matrix.
matrix | The transformation matrix to transform by. |
The maximum point.
The minimum point.