OGRE-Next
3.0.0
Object-Oriented Graphics Rendering Engine
|
A 3D box aligned with the x/y/z axes. More...
#include <OgreAxisAlignedBox.h>
Public Types | |
enum | CornerEnum { FAR_LEFT_BOTTOM = 0 , FAR_LEFT_TOP = 1 , FAR_RIGHT_TOP = 2 , FAR_RIGHT_BOTTOM = 3 , NEAR_RIGHT_BOTTOM = 7 , NEAR_LEFT_BOTTOM = 6 , NEAR_LEFT_TOP = 5 , NEAR_RIGHT_TOP = 4 } |
enum | Extent { EXTENT_NULL , EXTENT_FINITE , EXTENT_INFINITE } |
Public Member Functions | |
AxisAlignedBox () | |
AxisAlignedBox (const AxisAlignedBox &rkBox) | |
AxisAlignedBox (const Vector3 &min, const Vector3 &max) | |
AxisAlignedBox (Extent e) | |
AxisAlignedBox (Real mx, Real my, Real mz, Real Mx, Real My, Real Mz) | |
~AxisAlignedBox () | |
bool | contains (const AxisAlignedBox &other) const |
Tests whether another box contained by this box. More... | |
bool | contains (const Vector3 &v) const |
Tests whether the given point contained by this box. More... | |
Real | distance (const Vector3 &v) const |
Returns the minimum distance between a given point and any part of the box. More... | |
const Vector3 * | getAllCorners () const |
Returns a pointer to an array of 8 corner points, useful for collision vs. More... | |
Vector3 | getCenter () const |
Gets the centre of the box. More... | |
Vector3 | getCorner (CornerEnum cornerToGet) const |
Gets the position of one of the corners. More... | |
Vector3 | getHalfSize () const |
Gets the half-size of the box. More... | |
Vector3 & | getMaximum () |
Gets a modifiable version of the maximum corner of the box. More... | |
const Vector3 & | getMaximum () const |
Gets the maximum corner of the box. More... | |
Vector3 & | getMinimum () |
Gets a modifiable version of the minimum corner of the box. More... | |
const Vector3 & | getMinimum () const |
Gets the minimum corner of the box. More... | |
Vector3 | getSize () const |
Gets the size of the box. More... | |
AxisAlignedBox | intersection (const AxisAlignedBox &b2) const |
Calculate the area of intersection of this box and another. More... | |
bool | intersects (const AxisAlignedBox &b2) const |
Returns whether or not this box intersects another. More... | |
bool | intersects (const Plane &p) const |
Tests whether this box intersects a plane. More... | |
bool | intersects (const Sphere &s) const |
Tests whether this box intersects a sphere. More... | |
bool | intersects (const Vector3 &v) const |
Tests whether the vector point is within this box. More... | |
bool | isFinite () const |
Returns true if the box is finite. More... | |
bool | isInfinite () const |
Returns true if the box is infinite. More... | |
bool | isNull () const |
Returns true if the box is null i.e. More... | |
void | merge (const AxisAlignedBox &rhs) |
Merges the passed in box into the current box. More... | |
void | merge (const Vector3 &point) |
Extends the box to encompass the specified point (if needed). More... | |
bool | operator!= (const AxisAlignedBox &rhs) const |
Tests 2 boxes for inequality. More... | |
AxisAlignedBox & | operator= (const AxisAlignedBox &rhs) |
bool | operator== (const AxisAlignedBox &rhs) const |
Tests 2 boxes for equality. More... | |
void | scale (const Vector3 &s) |
Scales the AABB by the vector given. More... | |
void | setExtents (const Vector3 &min, const Vector3 &max) |
Sets both minimum and maximum extents at once. More... | |
void | setExtents (Real mx, Real my, Real mz, Real Mx, Real My, Real Mz) |
void | setInfinite () |
Sets the box to 'infinite'. More... | |
void | setMaximum (const Vector3 &vec) |
Sets the maximum corner of the box. More... | |
void | setMaximum (Real x, Real y, Real z) |
void | setMaximumX (Real x) |
Changes one of the components of the maximum corner of the box used to resize only one dimension of the box. More... | |
void | setMaximumY (Real y) |
void | setMaximumZ (Real z) |
void | setMinimum (const Vector3 &vec) |
Sets the minimum corner of the box. More... | |
void | setMinimum (Real x, Real y, Real z) |
void | setMinimumX (Real x) |
Changes one of the components of the minimum corner of the box used to resize only one dimension of the box. More... | |
void | setMinimumY (Real y) |
void | setMinimumZ (Real z) |
void | setNull () |
Sets the box to a 'null' value i.e. More... | |
Real | squaredDistance (const Vector3 &v) const |
Returns the squared minimum distance between a given point and any part of the box. More... | |
void | transform (const Matrix4 &matrix) |
Transforms the box according to the matrix supplied. More... | |
void | transformAffine (const Matrix4 &m) |
Transforms the box according to the affine matrix supplied. More... | |
Real | volume () const |
Calculate the volume of this box. More... | |
Static Public Attributes | |
static const AxisAlignedBox | BOX_INFINITE |
static const AxisAlignedBox | BOX_NULL |
A 3D box aligned with the x/y/z axes.
|
inline |
|
inline |
|
inline |
References isInfinite(), and isNull().
|
inline |
|
inline |
References Ogre::MEMCATEGORY_SCENE_CONTROL, and OGRE_FREE.
|
inline |
Tests whether another box contained by this box.
References isInfinite(), isNull(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Tests whether the given point contained by this box.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
Returns the minimum distance between a given point and any part of the box.
References Ogre::Math::Sqrt().
|
inline |
Returns a pointer to an array of 8 corner points, useful for collision vs.
non-aligned objects.
1-------2 /| /| / | / | 5-------4 | | 0----|--3 | / | / |/ |/ 6-------7
References Ogre::MEMCATEGORY_SCENE_CONTROL, OGRE_ALLOC_T, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Gets the centre of the box.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
Referenced by Ogre::PlaneBoundedVolume::intersects().
|
inline |
Gets the position of one of the corners.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Gets the half-size of the box.
References Ogre::Math::POS_INFINITY, and Ogre::Vector3::ZERO.
Referenced by Ogre::PlaneBoundedVolume::intersects().
|
inline |
Gets a modifiable version of the maximum corner of the box.
|
inline |
Gets the maximum corner of the box.
Referenced by intersection().
|
inline |
Gets a modifiable version of the minimum corner of the box.
|
inline |
Gets the minimum corner of the box.
Referenced by intersection().
|
inline |
Gets the size of the box.
References Ogre::Math::POS_INFINITY, and Ogre::Vector3::ZERO.
|
inline |
Calculate the area of intersection of this box and another.
References getMaximum(), getMinimum(), isInfinite(), isNull(), Ogre::Vector3::makeCeil(), Ogre::Vector3::makeFloor(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Returns whether or not this box intersects another.
References isInfinite(), isNull(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Tests whether this box intersects a plane.
References Ogre::Math::intersects().
|
inline |
Tests whether this box intersects a sphere.
References Ogre::Math::intersects().
|
inline |
Tests whether the vector point is within this box.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Returns true if the box is finite.
|
inline |
Returns true if the box is infinite.
Referenced by AxisAlignedBox(), contains(), intersection(), intersects(), Ogre::PlaneBoundedVolume::intersects(), and operator=().
|
inline |
Returns true if the box is null i.e.
empty.
Referenced by AxisAlignedBox(), contains(), intersection(), intersects(), Ogre::PlaneBoundedVolume::intersects(), and operator=().
|
inline |
Merges the passed in box into the current box.
The result is the box which encompasses both.
References Ogre::Vector3::makeCeil(), and Ogre::Vector3::makeFloor().
|
inline |
Extends the box to encompass the specified point (if needed).
References Ogre::Vector3::makeCeil(), and Ogre::Vector3::makeFloor().
|
inline |
Tests 2 boxes for inequality.
|
inline |
References isInfinite(), and isNull().
|
inline |
Tests 2 boxes for equality.
|
inline |
Scales the AABB by the vector given.
Sets both minimum and maximum extents at once.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Sets the box to 'infinite'.
|
inline |
Sets the maximum corner of the box.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Changes one of the components of the maximum corner of the box used to resize only one dimension of the box.
References Ogre::Vector3::x.
|
inline |
References Ogre::Vector3::y.
|
inline |
References Ogre::Vector3::z.
|
inline |
Sets the minimum corner of the box.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Changes one of the components of the minimum corner of the box used to resize only one dimension of the box.
References Ogre::Vector3::x.
|
inline |
References Ogre::Vector3::y.
|
inline |
References Ogre::Vector3::z.
|
inline |
Sets the box to a 'null' value i.e.
not a box.
Returns the squared minimum distance between a given point and any part of the box.
This is faster than distance since avoiding a squareroot, so use if you can.
References Ogre::Vector3::squaredLength(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Transforms the box according to the matrix supplied.
References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Transforms the box according to the affine matrix supplied.
References Ogre::Math::Abs(), Ogre::Matrix4::isAffine(), Ogre::Matrix4::transformAffine(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
inline |
Calculate the volume of this box.
References Ogre::Math::POS_INFINITY, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.
|
static |
|
static |