Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Ogre::AxisAlignedBox Class Reference

A 3D box aligned with the x/y/z axes. More...

`#include <OgreAxisAlignedBox.h>`

List of all members.

## Public Methods

| AxisAlignedBox ()
| AxisAlignedBox (const Vector3 &min, const Vector3 &max)
| AxisAlignedBox (Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
const Vector3 & | getMinimum (void) const
| Gets the minimum corner of the box.
const Vector3 & | getMaximum (void) const
| Gets the maximum corner of the box.
void | setMinimum (const Vector3 &vec)
| Sets the minimum corner of the box.
void | setMinimum (Real x, Real y, Real z)
void | setMaximum (const Vector3 &vec)
| Sets the maximum corner of the box.
void | setMaximum (Real x, Real y, Real z)
void | setExtents (const Vector3 &min, const Vector3 &max)
| Sets both minimum and maximum extents at once.
void | setExtents (Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
const Vector3 * | getAllCorners (void) const
| Returns a pointer to an array of 8 corner points, useful for collision vs.
void | merge (const AxisAlignedBox &rhs)
| Merges the passed in box into the current box.
void | merge (const Vector3 &point)
| Extends the box to encompass the specified point (if needed).
void | transform (const Matrix4 &matrix)
| Transforms the box according to the matrix supplied.
void | setNull ()
| Sets the box to a 'null' value i.e.
bool | isNull (void) const
| Returns true if the box is null i.e.
bool | intersects (const AxisAlignedBox &b2) const
| Returns whether or not this box intersects another.
void | scale (const Vector3 &s)
| Scales the AABB by the vector given.
bool | intersects (const Sphere &s) const
| Tests whether this box intersects a sphere.
bool | intersects (const Plane &p) const
| Tests whether this box intersects a plane.
bool | intersects (const Vector3 &v) const
| Tests whether the vector point is within this box.
Vector3 | getCenter (void) const
| Gets the centre of the box.

## Protected Methods

void | updateCorners (void)
| Internal method for updating corner points.

## Protected Attributes

Vector3 | mMinimum
Vector3 | mMaximum
bool | mNull
Vector3 | mCorners [8]

## Friends

std::ostream & | operator<< (std::ostream &o, AxisAlignedBox aab)

## Detailed Description

A 3D box aligned with the x/y/z axes.

Remarks:
  This class represents a simple box which is aligned with the axes. Internally it only stores 2 points as the extremeties of the box, one which is the minima of all 3 axes, and the other which is the maxima of all 3 axes. This class is typically used for an axis-aligned bounding box (AABB) for collision and visibility determination.

Definition at line 45 of file OgreAxisAlignedBox.h.

## Constructor & Destructor Documentation

Ogre::AxisAlignedBox::AxisAlignedBox | ( |  | ) |

| Definition at line 75 of file OgreAxisAlignedBox.h.

Ogre::AxisAlignedBox::AxisAlignedBox | ( | const Vector3 & | min,
|  | const Vector3 & | max
| ) |

| Definition at line 83 of file OgreAxisAlignedBox.h.

Ogre::AxisAlignedBox::AxisAlignedBox | ( | Real | mx,
|  | Real | my,
|  | Real | mz,
|  | Real | Mx,
|  | Real | My,
|  | Real | Mz
| ) |

| Definition at line 88 of file OgreAxisAlignedBox.h. References Ogre::Real.

## Member Function Documentation

const Vector3* Ogre::AxisAlignedBox::getAllCorners | ( | void |  | ) | const

Returns a pointer to an array of 8 corner points, useful for collision vs.

non-aligned objects.

Remarks:
  If the order of these corners is important, they are as follows: The 4 points of the minimum Z face (note that because Ogre uses right-handed coordinates, the minimum Z is at the 'back' of the box) starting with the minimum point of all, then anticlockwise around this face (if you are looking onto the face from outside the box). Then the 4 points of the maximum Z face, starting with maximum point of all, then anticlockwise around this face (looking onto the face from outside the box). Like this:

      			       1-----2
      			      /|    /|
      			     / |   / |
      			    5-----4  |
      			    |  0--|--3
      			    | /   | /
      			    |/    |/
      			    6-----7

Definition at line 195 of file OgreAxisAlignedBox.h.

Referenced by Ogre::OctreeSceneManager::_addOctreeNode(), Ogre::Octree::_getCullBounds(), Ogre::Octree::_isTwiceSize(), Ogre::ParticleSystem::_updateBounds(), Ogre::ShadowCaster::extrudeBounds(), Ogre::TerrainPage::getTerrainTile(), Ogre::OctreeCamera::getVisibility(), Ogre::intersect(), Ogre::PlaneBoundedVolume::intersects(), Ogre::Math::intersects(), Ogre::TerrainRenderable::intersectSegment(), and Ogre::Frustum::isVisible().

Vector3 Ogre::AxisAlignedBox::getCenter | ( | void |  | ) | const

| Gets the centre of the box. Definition at line 370 of file OgreAxisAlignedBox.h.

const Vector3& Ogre::AxisAlignedBox::getMaximum | ( | void |  | ) | const

Gets the maximum corner of the box.

Definition at line 104 of file OgreAxisAlignedBox.h.

Referenced by Ogre::Octree::_getChildIndexes(), Ogre::OctreeNode::_isIn(), Ogre::Mesh::_setBounds(), Ogre::ShadowCaster::extrudeBounds(), Ogre::OctreeSceneManager::getOption(), Ogre::WireBoundingBox::getSquaredViewDepth(), Ogre::OctreeSceneManager::init(), Ogre::Math::intersects(), Ogre::WireBoundingBox::setupBoundingBoxVertices(), and Ogre::MeshSerializerImpl::writeBoundsInfo().

const Vector3& Ogre::AxisAlignedBox::getMinimum | ( | void |  | ) | const

Gets the minimum corner of the box.

Definition at line 97 of file OgreAxisAlignedBox.h.

Referenced by Ogre::Octree::_getChildIndexes(), Ogre::OctreeNode::_isIn(), Ogre::Mesh::_setBounds(), Ogre::ShadowCaster::extrudeBounds(), Ogre::OctreeSceneManager::getOption(), Ogre::WireBoundingBox::getSquaredViewDepth(), Ogre::OctreeSceneManager::init(), Ogre::Math::intersects(), Ogre::WireBoundingBox::setupBoundingBoxVertices(), and Ogre::MeshSerializerImpl::writeBoundsInfo().

bool Ogre::AxisAlignedBox::intersects | ( | const Vector3 & | v | ) | const

| Tests whether the vector point is within this box. Definition at line 363 of file OgreAxisAlignedBox.h. References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

bool Ogre::AxisAlignedBox::intersects | ( | const Plane & | p | ) | const

| Tests whether this box intersects a plane. Definition at line 358 of file OgreAxisAlignedBox.h.

bool Ogre::AxisAlignedBox::intersects | ( | const Sphere & | s | ) | const

| Tests whether this box intersects a sphere. Definition at line 353 of file OgreAxisAlignedBox.h.

bool Ogre::AxisAlignedBox::intersects | ( | const AxisAlignedBox & | b2 | ) | const

Returns whether or not this box intersects another.

Definition at line 317 of file OgreAxisAlignedBox.h.

References isNull(), mMaximum, mMinimum, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by Ogre::DefaultAxisAlignedBoxSceneQuery::execute(), Ogre::DefaultIntersectionSceneQuery::execute(), Ogre::OctreeAxisAlignedBoxSceneQuery::execute(), Ogre::OctreeIntersectionSceneQuery::execute(), and Ogre::BspIntersectionSceneQuery::execute().

bool Ogre::AxisAlignedBox::isNull | ( | void |  | ) | const

Returns true if the box is null i.e.

empty.

Definition at line 311 of file OgreAxisAlignedBox.h.

Referenced by Ogre::ParticleSystem::_updateBounds(), Ogre::OctreeNode::_updateBounds(), Ogre::OctreeSceneManager::_updateOctreeNode(), Ogre::MeshSerializerImpl::exportMesh(), Ogre::OctreeCamera::getVisibility(), Ogre::intersect(), Ogre::PlaneBoundedVolume::intersects(), Ogre::Math::intersects(), intersects(), and Ogre::Frustum::isVisible().

void Ogre::AxisAlignedBox::merge | ( | const Vector3 & | point | ) |

| Extends the box to encompass the specified point (if needed). Definition at line 248 of file OgreAxisAlignedBox.h. References Ogre::Vector3::makeCeil(), and Ogre::Vector3::makeFloor().

void Ogre::AxisAlignedBox::merge | ( | const AxisAlignedBox & | rhs | ) |

Merges the passed in box into the current box.

The result is the box which encompasses both.

Definition at line 221 of file OgreAxisAlignedBox.h.

References Ogre::Vector3::makeCeil(), Ogre::Vector3::makeFloor(), mMaximum, mMinimum, and mNull.

Referenced by Ogre::SceneNode::_updateBounds(), Ogre::OctreeNode::_updateBounds(), Ogre::Entity::getBoundingBox(), and Ogre::Entity::getChildObjectsBoundingBox().

void Ogre::AxisAlignedBox::scale | ( | const Vector3 & | s | ) |

| Scales the AABB by the vector given. Definition at line 344 of file OgreAxisAlignedBox.h.

void Ogre::AxisAlignedBox::setExtents | ( | Real | mx,
|  | Real | my,
|  | Real | mz,
|  | Real | Mx,
|  | Real | My,
|  | Real | Mz
| ) |

| Definition at line 155 of file OgreAxisAlignedBox.h. References Ogre::Real, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::AxisAlignedBox::setExtents | ( | const Vector3 & | min,
|  | const Vector3 & | max
| ) |

Sets both minimum and maximum extents at once.

Definition at line 147 of file OgreAxisAlignedBox.h.

Referenced by Ogre::OctreeSceneManager::_addOctreeNode(), Ogre::Mesh::_setBounds(), Ogre::ParticleSystem::_updateBounds(), Ogre::BillboardSet::_updateBounds(), Ogre::PatchSurface::defineSurface(), Ogre::ShadowCaster::extrudeBounds(), Ogre::SceneManager::findShadowCastersForLight(), Ogre::TerrainRenderable::initialise(), Ogre::Rectangle2D::setCorners(), and Ogre::Frustum::updateFrustum().

void Ogre::AxisAlignedBox::setMaximum | ( | Real | x,
|  | Real | y,
|  | Real | z
| ) |

| Definition at line 136 of file OgreAxisAlignedBox.h. References Ogre::Real, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::AxisAlignedBox::setMaximum | ( | const Vector3 & | vec | ) |

| Sets the maximum corner of the box. Definition at line 129 of file OgreAxisAlignedBox.h. Referenced by Ogre::BspLevel::loadQuake3Level().

void Ogre::AxisAlignedBox::setMinimum | ( | Real | x,
|  | Real | y,
|  | Real | z
| ) |

| Definition at line 118 of file OgreAxisAlignedBox.h. References Ogre::Real, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::AxisAlignedBox::setMinimum | ( | const Vector3 & | vec | ) |

| Sets the minimum corner of the box. Definition at line 111 of file OgreAxisAlignedBox.h. Referenced by Ogre::BspLevel::loadQuake3Level().

void Ogre::AxisAlignedBox::setNull | ( |  | ) |

| Sets the box to a 'null' value i.e. not a box. Definition at line 304 of file OgreAxisAlignedBox.h. Referenced by Ogre::SceneNode::_updateBounds(), Ogre::OctreeNode::_updateBounds(), Ogre::BillboardSet::_updateBounds(), Ogre::Entity::getChildObjectsBoundingBox(), and Ogre::MovableObject::MovableObject().

void Ogre::AxisAlignedBox::transform | ( | const Matrix4 & | matrix | ) |

Transforms the box according to the matrix supplied.

Remarks:
  By calling this method you get the axis-aligned box which surrounds the transformed version of this box. Therefore each corner of the box is transformed by the matrix, then the extents are mapped back onto the axes to produce another AABB. Useful when you have a local AABB for an object which is then transformed.

Definition at line 268 of file OgreAxisAlignedBox.h.

References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by Ogre::Entity::getChildObjectsBoundingBox(), and Ogre::MovableObject::getWorldBoundingBox().

void Ogre::AxisAlignedBox::updateCorners | ( | void |  | ) | `[protected]`

| Internal method for updating corner points. Definition at line 56 of file OgreAxisAlignedBox.h. References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | o,
|  | AxisAlignedBox | aab
| ) | `[friend]`

| Definition at line 201 of file OgreAxisAlignedBox.h.

## Member Data Documentation

Vector3 Ogre::AxisAlignedBox::mCorners[8]`[protected]`

| Definition at line 52 of file OgreAxisAlignedBox.h.

Vector3 Ogre::AxisAlignedBox::mMaximum`[protected]`

| Definition at line 49 of file OgreAxisAlignedBox.h. Referenced by intersects(), and merge().

Vector3 Ogre::AxisAlignedBox::mMinimum`[protected]`

| Definition at line 48 of file OgreAxisAlignedBox.h. Referenced by intersects(), and merge().

bool Ogre::AxisAlignedBox::mNull`[protected]`

| Definition at line 50 of file OgreAxisAlignedBox.h. Referenced by merge().

The documentation for this class was generated from the following file:

- OgreAxisAlignedBox.h

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:47 2004