OgreAxisAlignedBox.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __AxisAlignedBox_H_
#define __AxisAlignedBox_H_
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreVector3.h"
#include "OgreMatrix4.h"
namespace Ogre {
class _OgreExport AxisAlignedBox
{
public:
enum Extent
{
EXTENT_NULL,
EXTENT_FINITE,
EXTENT_INFINITE
};
protected:
Vector3 mMinimum;
Vector3 mMaximum;
Extent mExtent;
mutable Vector3* mCorners;
public:
/*
1-------2
/| /|
/ | / |
5-------4 |
| 0----|--3
| / | /
|/ |/
6-------7
*/
typedef enum {
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
} CornerEnum;
inline AxisAlignedBox() : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
{
// Default to a null box
setMinimum( -0.5, -0.5, -0.5 );
setMaximum( 0.5, 0.5, 0.5 );
mExtent = EXTENT_NULL;
}
inline AxisAlignedBox(Extent e) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
{
setMinimum( -0.5, -0.5, -0.5 );
setMaximum( 0.5, 0.5, 0.5 );
mExtent = e;
}
inline AxisAlignedBox(const AxisAlignedBox & rkBox) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
{
if (rkBox.isNull())
setNull();
else if (rkBox.isInfinite())
setInfinite();
else
setExtents( rkBox.mMinimum, rkBox.mMaximum );
}
inline AxisAlignedBox( const Vector3& min, const Vector3& max ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
{
setExtents( min, max );
}
inline AxisAlignedBox(
Real mx, Real my, Real mz,
Real Mx, Real My, Real Mz ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
{
setExtents( mx, my, mz, Mx, My, Mz );
}
AxisAlignedBox& operator=(const AxisAlignedBox& rhs)
{
// Specifically override to avoid copying mCorners
if (rhs.isNull())
setNull();
else if (rhs.isInfinite())
setInfinite();
else
setExtents(rhs.mMinimum, rhs.mMaximum);
return *this;
}
~AxisAlignedBox()
{
if (mCorners)
OGRE_FREE(mCorners, MEMCATEGORY_SCENE_CONTROL);
}
inline const Vector3& getMinimum(void) const
{
return mMinimum;
}
inline Vector3& getMinimum(void)
{
return mMinimum;
}
inline const Vector3& getMaximum(void) const
{
return mMaximum;
}
inline Vector3& getMaximum(void)
{
return mMaximum;
}
inline void setMinimum( const Vector3& vec )
{
mExtent = EXTENT_FINITE;
mMinimum = vec;
}
inline void setMinimum( Real x, Real y, Real z )
{
mExtent = EXTENT_FINITE;
mMinimum.x = x;
mMinimum.y = y;
mMinimum.z = z;
}
inline void setMinimumX(Real x)
{
mMinimum.x = x;
}
inline void setMinimumY(Real y)
{
mMinimum.y = y;
}
inline void setMinimumZ(Real z)
{
mMinimum.z = z;
}
inline void setMaximum( const Vector3& vec )
{
mExtent = EXTENT_FINITE;
mMaximum = vec;
}
inline void setMaximum( Real x, Real y, Real z )
{
mExtent = EXTENT_FINITE;
mMaximum.x = x;
mMaximum.y = y;
mMaximum.z = z;
}
inline void setMaximumX( Real x )
{
mMaximum.x = x;
}
inline void setMaximumY( Real y )
{
mMaximum.y = y;
}
inline void setMaximumZ( Real z )
{
mMaximum.z = z;
}
inline void setExtents( const Vector3& min, const Vector3& max )
{
assert( (min.x <= max.x && min.y <= max.y && min.z <= max.z) &&
"The minimum corner of the box must be less than or equal to maximum corner" );
mExtent = EXTENT_FINITE;
mMinimum = min;
mMaximum = max;
}
inline void setExtents(
Real mx, Real my, Real mz,
Real Mx, Real My, Real Mz )
{
assert( (mx <= Mx && my <= My && mz <= Mz) &&
"The minimum corner of the box must be less than or equal to maximum corner" );
mExtent = EXTENT_FINITE;
mMinimum.x = mx;
mMinimum.y = my;
mMinimum.z = mz;
mMaximum.x = Mx;
mMaximum.y = My;
mMaximum.z = Mz;
}
inline const Vector3* getAllCorners(void) const
{
assert( (mExtent == EXTENT_FINITE) && "Can't get corners of a null or infinite AAB" );
// The order of these items is, using right-handed co-ordinates:
// Minimum Z face, starting with Min(all), then anticlockwise
// around face (looking onto the face)
// Maximum Z face, starting with Max(all), then anticlockwise
// around face (looking onto the face)
// Only for optimization/compatibility.
if (!mCorners)
mCorners = OGRE_ALLOC_T(Vector3, 8, MEMCATEGORY_SCENE_CONTROL);
mCorners[0] = mMinimum;
mCorners[1].x = mMinimum.x; mCorners[1].y = mMaximum.y; mCorners[1].z = mMinimum.z;
mCorners[2].x = mMaximum.x; mCorners[2].y = mMaximum.y; mCorners[2].z = mMinimum.z;
mCorners[3].x = mMaximum.x; mCorners[3].y = mMinimum.y; mCorners[3].z = mMinimum.z;
mCorners[4] = mMaximum;
mCorners[5].x = mMinimum.x; mCorners[5].y = mMaximum.y; mCorners[5].z = mMaximum.z;
mCorners[6].x = mMinimum.x; mCorners[6].y = mMinimum.y; mCorners[6].z = mMaximum.z;
mCorners[7].x = mMaximum.x; mCorners[7].y = mMinimum.y; mCorners[7].z = mMaximum.z;
return mCorners;
}
Vector3 getCorner(CornerEnum cornerToGet) const
{
switch(cornerToGet)
{
case FAR_LEFT_BOTTOM:
return mMinimum;
case FAR_LEFT_TOP:
return Vector3(mMinimum.x, mMaximum.y, mMinimum.z);
case FAR_RIGHT_TOP:
return Vector3(mMaximum.x, mMaximum.y, mMinimum.z);
case FAR_RIGHT_BOTTOM:
return Vector3(mMaximum.x, mMinimum.y, mMinimum.z);
case NEAR_RIGHT_BOTTOM:
return Vector3(mMaximum.x, mMinimum.y, mMaximum.z);
case NEAR_LEFT_BOTTOM:
return Vector3(mMinimum.x, mMinimum.y, mMaximum.z);
case NEAR_LEFT_TOP:
return Vector3(mMinimum.x, mMaximum.y, mMaximum.z);
case NEAR_RIGHT_TOP:
return mMaximum;
default:
return Vector3();
}
}
_OgreExport friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox &aab )
{
switch (aab.mExtent)
{
case EXTENT_NULL:
o << "AxisAlignedBox(null)";
return o;
case EXTENT_FINITE:
o << "AxisAlignedBox(min=" << aab.mMinimum << ", max=" << aab.mMaximum << ")";
return o;
case EXTENT_INFINITE:
o << "AxisAlignedBox(infinite)";
return o;
default: // shut up compiler
assert( false && "Never reached" );
return o;
}
}
void merge( const AxisAlignedBox& rhs )
{
// Do nothing if rhs null, or this is infinite
if ((rhs.mExtent == EXTENT_NULL) || (mExtent == EXTENT_INFINITE))
{
return;
}
// Otherwise if rhs is infinite, make this infinite, too
else if (rhs.mExtent == EXTENT_INFINITE)
{
mExtent = EXTENT_INFINITE;
}
// Otherwise if current null, just take rhs
else if (mExtent == EXTENT_NULL)
{
setExtents(rhs.mMinimum, rhs.mMaximum);
}
// Otherwise merge
else
{
Vector3 min = mMinimum;
Vector3 max = mMaximum;
max.makeCeil(rhs.mMaximum);
min.makeFloor(rhs.mMinimum);
setExtents(min, max);
}
}
inline void merge( const Vector3& point )
{
switch (mExtent)
{
case EXTENT_NULL: // if null, use this point
setExtents(point, point);
return;
case EXTENT_FINITE:
mMaximum.makeCeil(point);
mMinimum.makeFloor(point);
return;
case EXTENT_INFINITE: // if infinite, makes no difference
return;
}
assert( false && "Never reached" );
}
inline void transform( const Matrix4& matrix )
{
// Do nothing if current null or infinite
if( mExtent != EXTENT_FINITE )
return;
Vector3 oldMin, oldMax, currentCorner;
// Getting the old values so that we can use the existing merge method.
oldMin = mMinimum;
oldMax = mMaximum;
// reset
setNull();
// We sequentially compute the corners in the following order :
// 0, 6, 5, 1, 2, 4 ,7 , 3
// This sequence allows us to only change one member at a time to get at all corners.
// For each one, we transform it using the matrix
// Which gives the resulting point and merge the resulting point.
// First corner
// min min min
currentCorner = oldMin;
merge( matrix * currentCorner );
// min,min,max
currentCorner.z = oldMax.z;
merge( matrix * currentCorner );
// min max max
currentCorner.y = oldMax.y;
merge( matrix * currentCorner );
// min max min
currentCorner.z = oldMin.z;
merge( matrix * currentCorner );
// max max min
currentCorner.x = oldMax.x;
merge( matrix * currentCorner );
// max max max
currentCorner.z = oldMax.z;
merge( matrix * currentCorner );
// max min max
currentCorner.y = oldMin.y;
merge( matrix * currentCorner );
// max min min
currentCorner.z = oldMin.z;
merge( matrix * currentCorner );
}
void transformAffine(const Matrix4& m)
{
assert(m.isAffine());
// Do nothing if current null or infinite
if ( mExtent != EXTENT_FINITE )
return;
Vector3 centre = getCenter();
Vector3 halfSize = getHalfSize();
Vector3 newCentre = m.transformAffine(centre);
Vector3 newHalfSize(
Math::Abs(m[0][0]) * halfSize.x + Math::Abs(m[0][1]) * halfSize.y + Math::Abs(m[0][2]) * halfSize.z,
Math::Abs(m[1][0]) * halfSize.x + Math::Abs(m[1][1]) * halfSize.y + Math::Abs(m[1][2]) * halfSize.z,
Math::Abs(m[2][0]) * halfSize.x + Math::Abs(m[2][1]) * halfSize.y + Math::Abs(m[2][2]) * halfSize.z);
setExtents(newCentre - newHalfSize, newCentre + newHalfSize);
}
inline void setNull()
{
mExtent = EXTENT_NULL;
}
inline bool isNull(void) const
{
return (mExtent == EXTENT_NULL);
}
bool isFinite(void) const
{
return (mExtent == EXTENT_FINITE);
}
inline void setInfinite()
{
mExtent = EXTENT_INFINITE;
}
bool isInfinite(void) const
{
return (mExtent == EXTENT_INFINITE);
}
inline bool intersects(const AxisAlignedBox& b2) const
{
// Early-fail for nulls
if (this->isNull() || b2.isNull())
return false;
// Early-success for infinites
if (this->isInfinite() || b2.isInfinite())
return true;
// Use up to 6 separating planes
if (mMaximum.x < b2.mMinimum.x)
return false;
if (mMaximum.y < b2.mMinimum.y)
return false;
if (mMaximum.z < b2.mMinimum.z)
return false;
if (mMinimum.x > b2.mMaximum.x)
return false;
if (mMinimum.y > b2.mMaximum.y)
return false;
if (mMinimum.z > b2.mMaximum.z)
return false;
// otherwise, must be intersecting
return true;
}
inline AxisAlignedBox intersection(const AxisAlignedBox& b2) const
{
if (this->isNull() || b2.isNull())
{
return AxisAlignedBox();
}
else if (this->isInfinite())
{
return b2;
}
else if (b2.isInfinite())
{
return *this;
}
Vector3 intMin = mMinimum;
Vector3 intMax = mMaximum;
intMin.makeCeil(b2.getMinimum());
intMax.makeFloor(b2.getMaximum());
// Check intersection isn't null
if (intMin.x < intMax.x &&
intMin.y < intMax.y &&
intMin.z < intMax.z)
{
return AxisAlignedBox(intMin, intMax);
}
return AxisAlignedBox();
}
Real volume(void) const
{
switch (mExtent)
{
case EXTENT_NULL:
return 0.0f;
case EXTENT_FINITE:
{
Vector3 diff = mMaximum - mMinimum;
return diff.x * diff.y * diff.z;
}
case EXTENT_INFINITE:
return Math::POS_INFINITY;
default: // shut up compiler
assert( false && "Never reached" );
return 0.0f;
}
}
inline void scale(const Vector3& s)
{
// Do nothing if current null or infinite
if (mExtent != EXTENT_FINITE)
return;
// NB assumes centered on origin
Vector3 min = mMinimum * s;
Vector3 max = mMaximum * s;
setExtents(min, max);
}
bool intersects(const Sphere& s) const
{
return Math::intersects(s, *this);
}
bool intersects(const Plane& p) const
{
return Math::intersects(p, *this);
}
bool intersects(const Vector3& v) const
{
switch (mExtent)
{
case EXTENT_NULL:
return false;
case EXTENT_FINITE:
return(v.x >= mMinimum.x && v.x <= mMaximum.x &&
v.y >= mMinimum.y && v.y <= mMaximum.y &&
v.z >= mMinimum.z && v.z <= mMaximum.z);
case EXTENT_INFINITE:
return true;
default: // shut up compiler
assert( false && "Never reached" );
return false;
}
}
Vector3 getCenter(void) const
{
assert( (mExtent == EXTENT_FINITE) && "Can't get center of a null or infinite AAB" );
return Vector3(
(mMaximum.x + mMinimum.x) * 0.5f,
(mMaximum.y + mMinimum.y) * 0.5f,
(mMaximum.z + mMinimum.z) * 0.5f);
}
Vector3 getSize(void) const
{
switch (mExtent)
{
case EXTENT_NULL:
return Vector3::ZERO;
case EXTENT_FINITE:
return mMaximum - mMinimum;
case EXTENT_INFINITE:
return Vector3(
Math::POS_INFINITY,
Math::POS_INFINITY,
Math::POS_INFINITY);
default: // shut up compiler
assert( false && "Never reached" );
return Vector3::ZERO;
}
}
Vector3 getHalfSize(void) const
{
switch (mExtent)
{
case EXTENT_NULL:
return Vector3::ZERO;
case EXTENT_FINITE:
return (mMaximum - mMinimum) * 0.5;
case EXTENT_INFINITE:
return Vector3(
Math::POS_INFINITY,
Math::POS_INFINITY,
Math::POS_INFINITY);
default: // shut up compiler
assert( false && "Never reached" );
return Vector3::ZERO;
}
}
bool contains(const Vector3& v) const
{
if (isNull())
return false;
if (isInfinite())
return true;
return mMinimum.x <= v.x && v.x <= mMaximum.x &&
mMinimum.y <= v.y && v.y <= mMaximum.y &&
mMinimum.z <= v.z && v.z <= mMaximum.z;
}
Real squaredDistance(const Vector3& v) const
{
if (this->contains(v))
return 0;
else
{
Vector3 maxDist(0,0,0);
if (v.x < mMinimum.x)
maxDist.x = mMinimum.x - v.x;
else if (v.x > mMaximum.x)
maxDist.x = v.x - mMaximum.x;
if (v.y < mMinimum.y)
maxDist.y = mMinimum.y - v.y;
else if (v.y > mMaximum.y)
maxDist.y = v.y - mMaximum.y;
if (v.z < mMinimum.z)
maxDist.z = mMinimum.z - v.z;
else if (v.z > mMaximum.z)
maxDist.z = v.z - mMaximum.z;
return maxDist.squaredLength();
}
}
Real distance (const Vector3& v) const
{
return Ogre::Math::Sqrt(squaredDistance(v));
}
bool contains(const AxisAlignedBox& other) const
{
if (other.isNull() || this->isInfinite())
return true;
if (this->isNull() || other.isInfinite())
return false;
return this->mMinimum.x <= other.mMinimum.x &&
this->mMinimum.y <= other.mMinimum.y &&
this->mMinimum.z <= other.mMinimum.z &&
other.mMaximum.x <= this->mMaximum.x &&
other.mMaximum.y <= this->mMaximum.y &&
other.mMaximum.z <= this->mMaximum.z;
}
bool operator== (const AxisAlignedBox& rhs) const
{
if (this->mExtent != rhs.mExtent)
return false;
if (!this->isFinite())
return true;
return this->mMinimum == rhs.mMinimum &&
this->mMaximum == rhs.mMaximum;
}
bool operator!= (const AxisAlignedBox& rhs) const
{
return !(*this == rhs);
}
// special values
static const AxisAlignedBox BOX_NULL;
static const AxisAlignedBox BOX_INFINITE;
};
} // namespace Ogre
#endif
Ogre::Vector3::z
Real z
Definition: OgreVector3.h:54
Ogre::AxisAlignedBox::merge
void merge(const Vector3 &point)
Extends the box to encompass the specified point (if needed).
Definition: OgreAxisAlignedBox.h:411
Ogre::AxisAlignedBox::mMinimum
Vector3 mMinimum
Definition: OgreAxisAlignedBox.h:65
Ogre::AxisAlignedBox::setMaximumY
void setMaximumY(Real y)
Definition: OgreAxisAlignedBox.h:237
Ogre::Vector3::squaredLength
Real squaredLength() const
Returns the square of the length(magnitude) of the vector.
Definition: OgreVector3.h:371
Ogre::AxisAlignedBox::~AxisAlignedBox
~AxisAlignedBox()
Definition: OgreAxisAlignedBox.h:141
Ogre::AxisAlignedBox::getMaximum
Vector3 & getMaximum(void)
Gets a modifiable version of the maximum corner of the box.
Definition: OgreAxisAlignedBox.h:173
Ogre::AxisAlignedBox::getHalfSize
Vector3 getHalfSize(void) const
Gets the half-size of the box.
Definition: OgreAxisAlignedBox.h:726
Ogre::AxisAlignedBox::setInfinite
void setInfinite()
Sets the box to &#39;infinite&#39;.
Definition: OgreAxisAlignedBox.h:550
Ogre::AxisAlignedBox::setExtents
void setExtents(Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
Definition: OgreAxisAlignedBox.h:259
Ogre::AxisAlignedBox::AxisAlignedBox
AxisAlignedBox(Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
Definition: OgreAxisAlignedBox.h:121
Ogre::AxisAlignedBox::mExtent
Extent mExtent
Definition: OgreAxisAlignedBox.h:67
Ogre::AxisAlignedBox::AxisAlignedBox
AxisAlignedBox(Extent e)
Definition: OgreAxisAlignedBox.h:98
Ogre::AxisAlignedBox::getCenter
Vector3 getCenter(void) const
Gets the centre of the box.
Definition: OgreAxisAlignedBox.h:694
OgreVector3.h
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::AxisAlignedBox::BOX_NULL
static const AxisAlignedBox BOX_NULL
Definition: OgreAxisAlignedBox.h:838
Ogre::AxisAlignedBox::getMaximum
const Vector3 & getMaximum(void) const
Gets the maximum corner of the box.
Definition: OgreAxisAlignedBox.h:165
Ogre::AxisAlignedBox::setMaximum
void setMaximum(Real x, Real y, Real z)
Definition: OgreAxisAlignedBox.h:221
Ogre::Sphere
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:51
Ogre::MEMCATEGORY_SCENE_CONTROL
Nodes, control data.
Definition: OgreMemoryAllocatorConfig.h:168
Ogre::AxisAlignedBox::intersection
AxisAlignedBox intersection(const AxisAlignedBox &b2) const
Calculate the area of intersection of this box and another.
Definition: OgreAxisAlignedBox.h:594
Ogre::AxisAlignedBox::getSize
Vector3 getSize(void) const
Gets the size of the box.
Definition: OgreAxisAlignedBox.h:704
Ogre::AxisAlignedBox::transformAffine
void transformAffine(const Matrix4 &m)
Transforms the box according to the affine matrix supplied.
Definition: OgreAxisAlignedBox.h:507
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::AxisAlignedBox::contains
bool contains(const Vector3 &v) const
Tests whether the given point contained by this box.
Definition: OgreAxisAlignedBox.h:750
OGRE_ALLOC_T
#define OGRE_ALLOC_T(T, count, category)
Allocate a block of memory for a primitive type, and indicate the category of usage.
Definition: OgreMemoryAllocatorConfig.h:428
Ogre::AxisAlignedBox::volume
Real volume(void) const
Calculate the volume of this box.
Definition: OgreAxisAlignedBox.h:627
Ogre::AxisAlignedBox::isNull
bool isNull(void) const
Returns true if the box is null i.e.
Definition: OgreAxisAlignedBox.h:536
Ogre::AxisAlignedBox::AxisAlignedBox
AxisAlignedBox()
Definition: OgreAxisAlignedBox.h:91
Ogre::AxisAlignedBox::setMinimum
void setMinimum(Real x, Real y, Real z)
Definition: OgreAxisAlignedBox.h:187
Ogre::AxisAlignedBox::transform
void transform(const Matrix4 &matrix)
Transforms the box according to the matrix supplied.
Definition: OgreAxisAlignedBox.h:440
Ogre::AxisAlignedBox::intersects
bool intersects(const Plane &p) const
Tests whether this box intersects a plane.
Definition: OgreAxisAlignedBox.h:668
Ogre::AxisAlignedBox::CornerEnum
CornerEnum
Definition: OgreAxisAlignedBox.h:81
Ogre::Plane
Defines a plane in 3D space.
Definition: OgrePlane.h:61
Ogre::AxisAlignedBox::intersects
bool intersects(const AxisAlignedBox &b2) const
Returns whether or not this box intersects another.
Definition: OgreAxisAlignedBox.h:563
Ogre::Math::Abs
static Real Abs(Real fValue)
Absolute value function.
Definition: OgreMath.h:258
Ogre::Matrix4::transformAffine
Vector3 transformAffine(const Vector3 &v) const
3-D Vector transformation specially for an affine matrix.
Definition: OgreMatrix4.h:617
Ogre::AxisAlignedBox::setMinimumZ
void setMinimumZ(Real z)
Definition: OgreAxisAlignedBox.h:208
Ogre::AxisAlignedBox::setMaximumZ
void setMaximumZ(Real z)
Definition: OgreAxisAlignedBox.h:242
Ogre::AxisAlignedBox::BOX_INFINITE
static const AxisAlignedBox BOX_INFINITE
Definition: OgreAxisAlignedBox.h:839
Ogre::AxisAlignedBox::squaredDistance
Real squaredDistance(const Vector3 &v) const
Returns the squared minimum distance between a given point and any part of the box.
Definition: OgreAxisAlignedBox.h:764
Ogre::Matrix4
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
Ogre::Vector3
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Ogre::AxisAlignedBox::setMinimumX
void setMinimumX(Real x)
Changes one of the components of the minimum corner of the box used to resize only one dimension of t...
Definition: OgreAxisAlignedBox.h:198
OgrePrerequisites.h
Ogre::AxisAlignedBox::contains
bool contains(const AxisAlignedBox &other) const
Tests whether another box contained by this box.
Definition: OgreAxisAlignedBox.h:800
Ogre::AxisAlignedBox::setMinimumY
void setMinimumY(Real y)
Definition: OgreAxisAlignedBox.h:203
Ogre::Vector3::y
Real y
Definition: OgreVector3.h:54
Ogre::Math::POS_INFINITY
static const Real POS_INFINITY
Definition: OgreMath.h:704
OGRE_FREE
#define OGRE_FREE(ptr, category)
Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to en...
Definition: OgreMemoryAllocatorConfig.h:430
Ogre::AxisAlignedBox::merge
void merge(const AxisAlignedBox &rhs)
Merges the passed in box into the current box.
Definition: OgreAxisAlignedBox.h:379
Ogre::operator!=
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
Definition: OgreMemorySTLAllocator.h:202
Ogre::Vector3::makeCeil
void makeCeil(const Vector3 &cmp)
Sets this vector&#39;s components to the maximum of its own and the ones of the passed in vector...
Definition: OgreVector3.h:552
Ogre::Math::Sqrt
static Real Sqrt(Real fValue)
Square root function.
Definition: OgreMath.h:405
OgreMatrix4.h
Ogre::AxisAlignedBox::Extent
Extent
Definition: OgreAxisAlignedBox.h:57
Ogre::AxisAlignedBox::getCorner
Vector3 getCorner(CornerEnum cornerToGet) const
Gets the position of one of the corners.
Definition: OgreAxisAlignedBox.h:329
Ogre::AxisAlignedBox::distance
Real distance(const Vector3 &v) const
Returns the minimum distance between a given point and any part of the box.
Definition: OgreAxisAlignedBox.h:793
Ogre::Vector3::makeFloor
void makeFloor(const Vector3 &cmp)
Sets this vector&#39;s components to the minimum of its own and the ones of the passed in vector...
Definition: OgreVector3.h:538
Ogre::AxisAlignedBox::getMinimum
Vector3 & getMinimum(void)
Gets a modifiable version of the minimum corner of the box.
Definition: OgreAxisAlignedBox.h:158
Ogre::AxisAlignedBox::AxisAlignedBox
AxisAlignedBox(const Vector3 &min, const Vector3 &max)
Definition: OgreAxisAlignedBox.h:116
Ogre::AxisAlignedBox::AxisAlignedBox
AxisAlignedBox(const AxisAlignedBox &rkBox)
Definition: OgreAxisAlignedBox.h:105
Ogre::AxisAlignedBox::operator=
AxisAlignedBox & operator=(const AxisAlignedBox &rhs)
Definition: OgreAxisAlignedBox.h:128
Ogre::AxisAlignedBox::scale
void scale(const Vector3 &s)
Scales the AABB by the vector given.
Definition: OgreAxisAlignedBox.h:650
Ogre::AxisAlignedBox::setExtents
void setExtents(const Vector3 &min, const Vector3 &max)
Sets both minimum and maximum extents at once.
Definition: OgreAxisAlignedBox.h:249
Ogre::AxisAlignedBox::operator<<
_OgreExport friend std::ostream & operator<<(std::ostream &o, const AxisAlignedBox &aab)
Definition: OgreAxisAlignedBox.h:354
Ogre::Vector3::x
Real x
Definition: OgreVector3.h:54
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::AxisAlignedBox::setMaximum
void setMaximum(const Vector3 &vec)
Sets the maximum corner of the box.
Definition: OgreAxisAlignedBox.h:215
Ogre::AxisAlignedBox::isFinite
bool isFinite(void) const
Returns true if the box is finite.
Definition: OgreAxisAlignedBox.h:543
Ogre::AxisAlignedBox::mMaximum
Vector3 mMaximum
Definition: OgreAxisAlignedBox.h:66
Ogre::Math::intersects
static std::pair< bool, Real > intersects(const Ray &ray, const Plane &plane)
Ray / plane intersection, returns boolean result and distance.
Ogre::AxisAlignedBox::EXTENT_NULL
Definition: OgreAxisAlignedBox.h:59
Ogre::operator==
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
Definition: OgreMemorySTLAllocator.h:184
Ogre::AxisAlignedBox::getAllCorners
const Vector3 * getAllCorners(void) const
Returns a pointer to an array of 8 corner points, useful for collision vs.
Definition: OgreAxisAlignedBox.h:301
Ogre::AxisAlignedBox::setMaximumX
void setMaximumX(Real x)
Changes one of the components of the maximum corner of the box used to resize only one dimension of t...
Definition: OgreAxisAlignedBox.h:232
Ogre::AxisAlignedBox::intersects
bool intersects(const Vector3 &v) const
Tests whether the vector point is within this box.
Definition: OgreAxisAlignedBox.h:673
Ogre::AxisAlignedBox::intersects
bool intersects(const Sphere &s) const
Tests whether this box intersects a sphere.
Definition: OgreAxisAlignedBox.h:663
Ogre::AxisAlignedBox::EXTENT_FINITE
Definition: OgreAxisAlignedBox.h:60
Ogre::Matrix4::isAffine
bool isAffine(void) const
Check whether or not the matrix is affine matrix.
Definition: OgreMatrix4.h:572
Ogre::AxisAlignedBox::isInfinite
bool isInfinite(void) const
Returns true if the box is infinite.
Definition: OgreAxisAlignedBox.h:557
Ogre::AxisAlignedBox::setMinimum
void setMinimum(const Vector3 &vec)
Sets the minimum corner of the box.
Definition: OgreAxisAlignedBox.h:181
Ogre::AxisAlignedBox::setNull
void setNull()
Sets the box to a &#39;null&#39; value i.e.
Definition: OgreAxisAlignedBox.h:529
Ogre::AxisAlignedBox
A 3D box aligned with the x/y/z axes.
Definition: OgreAxisAlignedBox.h:54
Ogre::AxisAlignedBox::getMinimum
const Vector3 & getMinimum(void) const
Gets the minimum corner of the box.
Definition: OgreAxisAlignedBox.h:150
Ogre::AxisAlignedBox::mCorners
Vector3 * mCorners
Definition: OgreAxisAlignedBox.h:68
Ogre::Vector3::ZERO
static const Vector3 ZERO
Definition: OgreVector3.h:800

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.