Irrlicht Engine: irr::core::aabbox3d< T > Class Template Reference

Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irr::core::aabbox3d< T > Class Template Reference

Axis aligned bounding box in 3d dimensional space. More...

`#include <aabbox3d.h>`

List of all members.

## Public Member Functions
| aabbox3d (T minx, T miny, T minz, T maxx, T maxy, T maxz)
| Constructor with min edge and max edge as single values, not vectors.
| aabbox3d (const vector3d< T > &init)
| Constructor with only one point.
| aabbox3d (const vector3d< T > &min, const vector3d< T > &max)
| Constructor with min edge and max edge.
| aabbox3d ()
| Default Constructor.
void | addInternalBox (const aabbox3d< T > &b)
| Adds another bounding box.
void | addInternalPoint (T x, T y, T z)
| Adds a point to the bounding box.
void | addInternalPoint (const vector3d< T > &p)
| Adds a point to the bounding box.
EIntersectionRelation3D | classifyPlaneRelation (const plane3d< T > &plane) const
| Classifies a relation with a plane.
T | getArea () const
| Get the surface area of the box in squared units.
vector3d< T > | getCenter () const
| Get center of the bounding box.
void | getEdges (vector3d< T > *edges) const
| Stores all 8 edges of the box into an array.
vector3d< T > | getExtent () const
| Get extent of the box (maximal distance of two points in the box).
aabbox3d< T > | getInterpolated (const aabbox3d< T > &other, f32 d) const
| Calculates a new interpolated bounding box.
T | getVolume () const
| Get the volume enclosed by the box in cubed units.
bool | intersectsWithBox (const aabbox3d< T > &other) const
| Determines if the axis-aligned box intersects with another axis-aligned box.
bool | intersectsWithLine (const vector3d< T > &linemiddle, const vector3d< T > &linevect, T halflength) const
| Tests if the box intersects with a line.
bool | intersectsWithLine (const line3d< T > &line) const
| Tests if the box intersects with a line.
bool | isEmpty () const
| Check if the box is empty.
bool | isFullInside (const aabbox3d< T > &other) const
| Check if this box is completely inside the 'other' box.
bool | isPointInside (const vector3d< T > &p) const
| Determines if a point is within this box.
bool | isPointTotalInside (const vector3d< T > &p) const
| Determines if a point is within this box and not its borders.
bool | operator!= (const aabbox3d< T > &other) const
| Inequality operator.
bool | operator== (const aabbox3d< T > &other) const
| Equality operator.
void | repair ()
| Repairs the box.
void | reset (const vector3d< T > &initValue)
| Resets the bounding box to a one-point box.
void | reset (const aabbox3d< T > &initValue)
| Resets the bounding box.
void | reset (T x, T y, T z)
| Resets the bounding box to a one-point box.
## Public Attributes
vector3d< T > | MaxEdge
| The far edge.
vector3d< T > | MinEdge
| The near edge.

## Detailed Description

### template<class T>
class irr::core::aabbox3d< T >

Axis aligned bounding box in 3d dimensional space.

Has some useful methods used with occlusion culling or clipping.

Definition at line 17 of file aabbox3d.h.

## Constructor & Destructor Documentation

template<class T>

irr::core::aabbox3d< T >::aabbox3d | ( |  | ) | `[inline]`

Default Constructor.

Definition at line 15 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::aabbox3d().

template<class T>

irr::core::aabbox3d< T >::aabbox3d | ( | const vector3d< T > & | min,
|  | const vector3d< T > & | max |
| ) |  |  | `[inline]`

Constructor with min edge and max edge.

Definition at line 17 of file aabbox3d.h.

template<class T>

irr::core::aabbox3d< T >::aabbox3d | ( | const vector3d< T > & | init | ) | `[inline]`

Constructor with only one point.

Definition at line 19 of file aabbox3d.h.

template<class T>

irr::core::aabbox3d< T >::aabbox3d | ( | T | minx,
|  | T | miny,
|  | T | minz,
|  | T | maxx,
|  | T | maxy,
|  | T | maxz |
| ) |  |  | `[inline]`

Constructor with min edge and max edge as single values, not vectors.

Definition at line 21 of file aabbox3d.h.

## Member Function Documentation

template<class T>

void irr::core::aabbox3d< T >::addInternalBox | ( | const aabbox3d< T > & | b | ) | `[inline]`

Adds another bounding box.

The box grows bigger, if the new box was outside of the box.

Parameters:

  | b,: | Other bounding box to add into this box.

Definition at line 71 of file aabbox3d.h.

Referenced by irr::scene::SMesh::recalculateBoundingBox(), and irr::scene::SAnimatedMesh::recalculateBoundingBox().

template<class T>

void irr::core::aabbox3d< T >::addInternalPoint | ( | T | x,
|  | T | y,
|  | T | z |
| ) |  |  | `[inline]`

Adds a point to the bounding box.

The box grows bigger, if point is outside of the box.

Parameters:

  | x | X coordinate of the point to add to this box.
  | y | Y coordinate of the point to add to this box.
  | z | Z coordinate of the point to add to this box.

Definition at line 82 of file aabbox3d.h.

template<class T>

void irr::core::aabbox3d< T >::addInternalPoint | ( | const vector3d< T > & | p | ) | `[inline]`

Adds a point to the bounding box.

The box grows bigger, if point was outside of the box.

Parameters:

  | p,: | Point to add into the box.

Definition at line 63 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::addInternalPoint(), irr::scene::CMeshBuffer< T >::append(), irr::scene::SViewFrustum::recalculateBoundingBox(), irr::scene::SSkinMeshBuffer::recalculateBoundingBox(), irr::scene::SSharedMeshBuffer::recalculateBoundingBox(), and irr::scene::CMeshBuffer< T >::recalculateBoundingBox().

template<class T>

EIntersectionRelation3D irr::core::aabbox3d< T >::classifyPlaneRelation | ( | const plane3d< T > & | plane | ) | const`[inline]`

Classifies a relation with a plane.

Parameters:

  | plane | Plane to classify relation to.

Returns:
  Returns ISREL3D_FRONT if the box is in front of the plane, ISREL3D_BACK if the box is behind the plane, and ISREL3D_CLIPPED if it is on both sides of the plane.

Definition at line 273 of file aabbox3d.h.

template<class T>

T irr::core::aabbox3d< T >::getArea | ( |  | ) | const`[inline]`

Get the surface area of the box in squared units.

Definition at line 123 of file aabbox3d.h.

template<class T>

vector3d<T> irr::core::aabbox3d< T >::getCenter | ( |  | ) | const`[inline]`

Get center of the bounding box.

Returns:
  Center of the bounding box.

Definition at line 95 of file aabbox3d.h.

template<class T>

void irr::core::aabbox3d< T >::getEdges | ( | vector3d< T > * | edges | ) | const`[inline]`

Stores all 8 edges of the box into an array.

Parameters:

  | edges,: | Pointer to array of 8 edges.

Definition at line 131 of file aabbox3d.h.

template<class T>

vector3d<T> irr::core::aabbox3d< T >::getExtent | ( |  | ) | const`[inline]`

Get extent of the box (maximal distance of two points in the box).

Returns:
  Extent of the bounding box.

Definition at line 102 of file aabbox3d.h.

template<class T>

aabbox3d<T> irr::core::aabbox3d< T >::getInterpolated | ( | const aabbox3d< T > & | other,
|  | f32 | d |
| ) |  |  | const`[inline]`

Calculates a new interpolated bounding box.

d=0 returns other, d=1 returns this, all other values blend between the two boxes.

Parameters:

  | other | Other box to interpolate between
  | d | Value between 0.0f and 1.0f.

Returns:
  Interpolated box.

Definition at line 179 of file aabbox3d.h.

template<class T>

T irr::core::aabbox3d< T >::getVolume | ( |  | ) | const`[inline]`

Get the volume enclosed by the box in cubed units.

Definition at line 116 of file aabbox3d.h.

template<class T>

bool irr::core::aabbox3d< T >::intersectsWithBox | ( | const aabbox3d< T > & | other | ) | const`[inline]`

Determines if the axis-aligned box intersects with another axis-aligned box.

Parameters:

  | other,: | Other box to check a intersection with.

Returns:
  True if there is an intersection with the other box, otherwise false.

Definition at line 222 of file aabbox3d.h.

template<class T>

bool irr::core::aabbox3d< T >::intersectsWithLine | ( | const vector3d< T > & | linemiddle,
|  | const vector3d< T > & | linevect,
|  | T | halflength |
| ) |  |  | const`[inline]`

Tests if the box intersects with a line.

Parameters:

  | linemiddle | Center of the line.
  | linevect | Vector of the line.
  | halflength | Half length of the line.

Returns:
  True if there is an intersection, else false.

Definition at line 242 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::intersectsWithLine().

template<class T>

bool irr::core::aabbox3d< T >::intersectsWithLine | ( | const line3d< T > & | line | ) | const`[inline]`

Tests if the box intersects with a line.

Parameters:

  | line,: | Line to test intersection with.

Returns:
  True if there is an intersection , else false.

Definition at line 231 of file aabbox3d.h.

template<class T>

bool irr::core::aabbox3d< T >::isEmpty | ( |  | ) | const`[inline]`

Check if the box is empty.

This means that there is no space between the min and max edge.

Returns:
  True if box is empty, else false.

Definition at line 110 of file aabbox3d.h.

template<class T>

bool irr::core::aabbox3d< T >::isFullInside | ( | const aabbox3d< T > & | other | ) | const`[inline]`

Check if this box is completely inside the 'other' box.

Parameters:

  | other,: | Other box to check against.

Returns:
  True if this box is completly inside the other box, otherwise false.

Definition at line 212 of file aabbox3d.h.

template<class T>

bool irr::core::aabbox3d< T >::isPointInside | ( | const vector3d< T > & | p | ) | const`[inline]`

Determines if a point is within this box.

Border is included (IS part of the box)!

Parameters:

  | p,: | Point to check.

Returns:
  True if the point is within the box and false if not

Definition at line 190 of file aabbox3d.h.

Referenced by irr::core::triangle3d< T >::isTotalInsideBox().

template<class T>

bool irr::core::aabbox3d< T >::isPointTotalInside | ( | const vector3d< T > & | p | ) | const`[inline]`

Determines if a point is within this box and not its borders.

Border is excluded (NOT part of the box)!

Parameters:

  | p,: | Point to check.

Returns:
  True if the point is within the box and false if not.

Definition at line 201 of file aabbox3d.h.

template<class T>

bool irr::core::aabbox3d< T >::operator!= | ( | const aabbox3d< T > & | other | ) | const`[inline]`

Inequality operator.

Parameters:

  | other | box to compare with.

Returns:
  True if both boxes are different, else false.

Definition at line 31 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::aabbox3d().

template<class T>

bool irr::core::aabbox3d< T >::operator== | ( | const aabbox3d< T > & | other | ) | const`[inline]`

Equality operator.

Parameters:

  | other | box to compare with.

Returns:
  True if both boxes are equal, else false.

Definition at line 27 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::aabbox3d().

template<class T>

void irr::core::aabbox3d< T >::repair | ( |  | ) | `[inline]`

Repairs the box.

Necessary if for example MinEdge and MaxEdge are swapped.

Definition at line 161 of file aabbox3d.h.

Referenced by irr::core::CMatrix4< T >::transformBox().

template<class T>

void irr::core::aabbox3d< T >::reset | ( | const vector3d< T > & | initValue | ) | `[inline]`

Resets the bounding box to a one-point box.

Parameters:

  | initValue | New point.

Definition at line 54 of file aabbox3d.h.

template<class T>

void irr::core::aabbox3d< T >::reset | ( | const aabbox3d< T > & | initValue | ) | `[inline]`

Resets the bounding box.

Parameters:

  | initValue | New box to set this one to.

Definition at line 47 of file aabbox3d.h.

template<class T>

void irr::core::aabbox3d< T >::reset | ( | T | x,
|  | T | y,
|  | T | z |
| ) |  |  | `[inline]`

Resets the bounding box to a one-point box.

Parameters:

  | x | X coord of the point.
  | y | Y coord of the point.
  | z | Z coord of the point.

Definition at line 39 of file aabbox3d.h.

Referenced by irr::scene::SViewFrustum::recalculateBoundingBox(), irr::scene::SSkinMeshBuffer::recalculateBoundingBox(), irr::scene::SSharedMeshBuffer::recalculateBoundingBox(), irr::scene::SMesh::recalculateBoundingBox(), irr::scene::SAnimatedMesh::recalculateBoundingBox(), and irr::scene::CMeshBuffer< T >::recalculateBoundingBox().

## Member Data Documentation

template<class T>

vector3d<T> irr::core::aabbox3d< T >::MaxEdge

The far edge.

Definition at line 309 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::aabbox3d(), irr::core::aabbox3d< f32 >::addInternalPoint(), irr::core::aabbox3d< f32 >::isEmpty(), irr::core::aabbox3d< f32 >::isPointInside(), irr::core::triangle3d< T >::isTotalOutsideBox(), irr::core::aabbox3d< f32 >::reset(), irr::core::CMatrix4< T >::transformBox(), and irr::core::CMatrix4< T >::transformBoxEx().

template<class T>

vector3d<T> irr::core::aabbox3d< T >::MinEdge

The near edge.

Definition at line 306 of file aabbox3d.h.

Referenced by irr::core::aabbox3d< f32 >::aabbox3d(), irr::core::aabbox3d< f32 >::addInternalPoint(), irr::core::aabbox3d< f32 >::getInterpolated(), irr::core::aabbox3d< f32 >::isEmpty(), irr::core::aabbox3d< f32 >::isFullInside(), irr::core::aabbox3d< f32 >::isPointInside(), irr::core::aabbox3d< f32 >::isPointTotalInside(), irr::core::triangle3d< T >::isTotalOutsideBox(), irr::core::aabbox3d< f32 >::reset(), irr::core::CMatrix4< T >::transformBox(), and irr::core::CMatrix4< T >::transformBoxEx().

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

- aabbox3d.h

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Oct 24 12:42:03 2010 by Doxygen (1.6.2)