OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::Aabb Struct Reference

AoS (array of structures) version of ArrayAabb. More...

#include <OgreAabb.h>

+ Collaboration diagram for Ogre::Aabb:

Public Member Functions

 Aabb ()
 
 Aabb (const Vector3 &center, const Vector3 &halfSize)
 
bool contains (const Aabb &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...
 
Vector3 getMaximum () const
 Gets the maximum corner of the box. More...
 
Vector3 getMinimum () const
 Gets the minimum corner of the box. More...
 
Real getRadius () const
 Returns the radius of a sphere enclosing the aabb from the outside at center mCenter. More...
 
Real getRadiusOrigin () const
 Returns the radius of a sphere enclosing the aabb from origin as center. More...
 
Vector3 getSize (void) const
 Gets the size of the box. More...
 
Aabb intersection (const Aabb &b2) const
 Calculate the area of intersection of this box and another. More...
 
bool intersects (const Aabb &b2) const
 Returns whether or not this box intersects another. More...
 
void merge (const Aabb &rhs)
 Merges the passed in box into the current box. More...
 
void merge (const Vector3 &points)
 Extends the box to encompass the specified point (if needed). More...
 
void setExtents (const Vector3 &min, const Vector3 &max)
 Sets both minimum and maximum extents at once. More...
 
void transformAffine (const Matrix4 &matrix)
 Transforms the box according to the matrix supplied. More...
 
Real volume (void) const
 Calculate the volume of this box. More...
 

Static Public Member Functions

static Aabb newFromExtents (const Vector3 &min, const Vector3 &max)
 Sets both minimum and maximum extents at once (static version). More...
 

Public Attributes

Ogre::Vector3 mCenter
 
Ogre::Vector3 mHalfSize
 

Static Public Attributes

static const Aabb BOX_INFINITE
 
static const Aabb BOX_NULL
 
static const Aabb BOX_ZERO
 

Detailed Description

AoS (array of structures) version of ArrayAabb.

This class also deprecates AxisAlignedBox. It's A 3D box aligned with the x/y/z axes.

For performance reasons given the mathematical properties, this version stores the box in the form "center + halfSize" instead of the form "minimum, maximum" that is present in AxisAlignedBox: Merging is slightly more expensive intersects() is much cheaper Naturally deals with infinite boxes (no need for branches) Transform is cheaper (a common operation)
This class represents a simple box which is aligned with the axes. Internally it only stores 2 points as the center of the box, and the half of the width, height, and depth. This class is typically used for an axis-aligned bounding box (AABB) for collision and visibility determination.
Main differences with AxisAlignedBox: Aabb doesn't support null boxes as AxisAlignedBox did. Although if the center iszero and half size is set to negative infinity, it may mimic the behavior. Another possibility is to just use NaNs, because they would cause false on all tests. However this would be horrible slow. BOX_INFINITE represents a truly infinite box and behaves exactly the same as an infinite AxisAlignedBox. However, setting the latter to infinite still holds information in min & max variables, while aabb destroys all information present.
Note
This is a POD data structure.

Definition at line 78 of file C/OgreAabb.h.

Constructor & Destructor Documentation

Ogre::Aabb::Aabb ( )
inline

Definition at line 83 of file C/OgreAabb.h.

Ogre::Aabb::Aabb ( const Vector3 center,
const Vector3 halfSize 
)
inline

Definition at line 93 of file C/OgreAabb.h.

Member Function Documentation

bool Ogre::Aabb::contains ( const Aabb other) const
inline

Tests whether another box contained by this box.

bool Ogre::Aabb::contains ( const Vector3 v) const
inline

Tests whether the given point contained by this box.

Real Ogre::Aabb::distance ( const Vector3 v) const
inline

Returns the minimum distance between a given point and any part of the box.

Vector3 Ogre::Aabb::getMaximum ( ) const
inline

Gets the maximum corner of the box.

Vector3 Ogre::Aabb::getMinimum ( ) const
inline

Gets the minimum corner of the box.

Real Ogre::Aabb::getRadius ( ) const
inline

Returns the radius of a sphere enclosing the aabb from the outside at center mCenter.

Real Ogre::Aabb::getRadiusOrigin ( ) const
inline

Returns the radius of a sphere enclosing the aabb from origin as center.

Vector3 Ogre::Aabb::getSize ( void  ) const
inline

Gets the size of the box.

Aabb Ogre::Aabb::intersection ( const Aabb b2) const
inline

Calculate the area of intersection of this box and another.

bool Ogre::Aabb::intersects ( const Aabb b2) const
inline

Returns whether or not this box intersects another.

void Ogre::Aabb::merge ( const Aabb rhs)
inline

Merges the passed in box into the current box.

The result is the box which encompasses both.

void Ogre::Aabb::merge ( const Vector3 points)
inline

Extends the box to encompass the specified point (if needed).

static Aabb Ogre::Aabb::newFromExtents ( const Vector3 min,
const Vector3 max 
)
inlinestatic

Sets both minimum and maximum extents at once (static version).

void Ogre::Aabb::setExtents ( const Vector3 min,
const Vector3 max 
)
inline

Sets both minimum and maximum extents at once.

void Ogre::Aabb::transformAffine ( 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.
Note
The matrix must be an affine matrix.
See also
Matrix4::isAffine.
Real Ogre::Aabb::volume ( void  ) const
inline

Calculate the volume of this box.

Member Data Documentation

const Aabb Ogre::Aabb::BOX_INFINITE
static

Definition at line 159 of file C/OgreAabb.h.

const Aabb Ogre::Aabb::BOX_NULL
static

Definition at line 160 of file C/OgreAabb.h.

const Aabb Ogre::Aabb::BOX_ZERO
static

Definition at line 163 of file C/OgreAabb.h.

Ogre::Vector3 Ogre::Aabb::mCenter
Ogre::Vector3 Ogre::Aabb::mHalfSize

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