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)
Vector3 getMinimum (void) const
 Gets the minimum corner of the box. More...

Vector3 getMaximum (void) const
 Gets the maximum corner of the box. More...

void setMinimum (const Vector3 &vec)
 Sets the minimum corner of the box. More...

void setMinimum (Real x, Real y, Real z)
void setMaximum (const Vector3 &vec)
 Sets the maximum corner of the box. More...

void setMaximum (Real x, Real y, Real z)
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)
const Vector3getAllCorners (void) const
 Returns a pointer to an array of 8 corner points, useful for collision vs. More...

void merge (const AxisAlignedBox &rhs)
 Merges the passed in box into the current box. More...

void transform (const Matrix4 &matrix)
 Transforms the box according to the matrix supplied. More...

void setNull ()
 Sets the box to a 'null' value i.e. More...

bool isNull (void) const
 Returns true if the box is null i.e. More...


Protected Methods

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


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.


Constructor & Destructor Documentation

Ogre::AxisAlignedBox::AxisAlignedBox   [inline]
 

Ogre::AxisAlignedBox::AxisAlignedBox const Vector3   min,
const Vector3   max
[inline]
 

Ogre::AxisAlignedBox::AxisAlignedBox Real    mx,
Real    my,
Real    mz,
Real    Mx,
Real    My,
Real    Mz
[inline]
 


Member Function Documentation

const Vector3* Ogre::AxisAlignedBox::getAllCorners void    const [inline]
 

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
			    

Vector3 Ogre::AxisAlignedBox::getMaximum void    const [inline]
 

Gets the maximum corner of the box.

Vector3 Ogre::AxisAlignedBox::getMinimum void    const [inline]
 

Gets the minimum corner of the box.

bool Ogre::AxisAlignedBox::isNull void    const [inline]
 

Returns true if the box is null i.e.

empty.

void Ogre::AxisAlignedBox::merge const AxisAlignedBox &    rhs [inline]
 

Merges the passed in box into the current box.

The result is the box which encompasses both.

void Ogre::AxisAlignedBox::setExtents Real    mx,
Real    my,
Real    mz,
Real    Mx,
Real    My,
Real    Mz
[inline]
 

void Ogre::AxisAlignedBox::setExtents const Vector3   min,
const Vector3   max
[inline]
 

Sets both minimum and maximum extents at once.

void Ogre::AxisAlignedBox::setMaximum Real    x,
Real    y,
Real    z
[inline]
 

void Ogre::AxisAlignedBox::setMaximum const Vector3   vec [inline]
 

Sets the maximum corner of the box.

void Ogre::AxisAlignedBox::setMinimum Real    x,
Real    y,
Real    z
[inline]
 

void Ogre::AxisAlignedBox::setMinimum const Vector3   vec [inline]
 

Sets the minimum corner of the box.

void Ogre::AxisAlignedBox::setNull   [inline]
 

Sets the box to a 'null' value i.e.

not a box.

void Ogre::AxisAlignedBox::transform const Matrix4   matrix [inline]
 

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.

void Ogre::AxisAlignedBox::updateCorners void    [inline, protected]
 

Internal method for updating corner points.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &    o,
AxisAlignedBox    aab
[friend]
 


Member Data Documentation

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

Vector3 Ogre::AxisAlignedBox::mMaximum [protected]
 

Vector3 Ogre::AxisAlignedBox::mMinimum [protected]
 

bool Ogre::AxisAlignedBox::mNull [protected]
 

Copyright © 2002 by The OGRE Team