Axis aligned bounding box in 3d dimensional space. More...
#include <aabbox3d.h>
Public Member Functions | |
aabbox3d () | |
Default Constructor. | |
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 (T minx, T miny, T minz, T maxx, T maxy, T maxz) | |
Constructor with min edge and max edge as single values, not vectors. | |
void | addInternalBox (const aabbox3d< T > &b) |
Adds another bounding box. | |
void | addInternalPoint (const vector3d< T > &p) |
Adds a point to the bounding box. | |
void | addInternalPoint (T x, T y, T z) |
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 line3d< T > &line) const |
Tests if the box intersects with a line. | |
bool | intersectsWithLine (const vector3d< T > &linemiddle, const vector3d< T > &linevect, T halflength) 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 aabbox3d< T > &initValue) |
Resets the bounding box. | |
void | reset (const vector3d< T > &initValue) |
Resets the bounding box to a one-point 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. | |
Axis aligned bounding box in 3d dimensional space.
Has some useful methods used with occlusion culling or clipping.
Definition at line 21 of file aabbox3d.h.
|
inline |
Default Constructor.
Definition at line 26 of file aabbox3d.h.
Referenced by irr::core::CMatrix4< T >::buildAxisAlignedBillboard(), irr::core::CMatrix4< T >::buildCameraLookAtMatrixLH(), irr::core::CMatrix4< T >::buildCameraLookAtMatrixRH(), irr::core::CMatrix4< T >::buildNDCToDCMatrix(), irr::core::CMatrix4< T >::buildProjectionMatrixOrthoLH(), irr::core::CMatrix4< T >::buildProjectionMatrixOrthoRH(), irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveFovInfinityLH(), irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveFovLH(), irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveFovRH(), irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveLH(), irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveRH(), irr::core::CMatrix4< T >::buildRotateFromTo(), irr::core::CMatrix4< T >::buildShadowMatrix(), irr::core::CMatrix4< T >::buildTextureTransform(), irr::core::aabbox3d< T >::classifyPlaneRelation(), irr::core::line2d< T >::getClosestPoint(), irr::core::CMatrix4< T >::getDefinitelyIdentityMatrix(), irr::core::aabbox3d< T >::getInterpolated(), irr::core::CMatrix4< T >::getInverse(), irr::core::CMatrix4< T >::getInversePrimitive(), irr::core::CMatrix4< T >::getRotationDegrees(), irr::core::CMatrix4< T >::getScale(), irr::core::vector3d< T >::getSphericalCoordinateAngles(), irr::core::CMatrix4< T >::getTranslation(), irr::core::CMatrix4< T >::getTransposed(), irr::core::CMatrix4< T >::getTransposed(), irr::core::CMatrix4< T >::interpolate(), irr::core::aabbox3d< T >::intersectsWithLine(), irr::core::CMatrix4< T >::inverseRotateVect(), irr::core::CMatrix4< T >::makeIdentity(), irr::core::CMatrix4< T >::makeInverse(), irr::core::CMatrix4< T >::operator!=(), irr::core::CMatrix4< T >::operator*(), irr::core::CMatrix4< T >::operator*(), irr::core::CMatrix4< T >::operator*=(), irr::core::CMatrix4< T >::operator*=(), irr::core::CMatrix4< T >::operator+(), irr::core::CMatrix4< T >::operator-(), irr::core::vector3d< T >::operator/=(), irr::core::CMatrix4< T >::operator=(), irr::core::CMatrix4< T >::rotateVect(), irr::core::CMatrix4< T >::setDefinitelyIdentityMatrix(), irr::core::CMatrix4< T >::setInverseRotationRadians(), irr::core::CMatrix4< T >::setM(), irr::core::CMatrix4< T >::setRotationAxisRadians(), irr::core::CMatrix4< T >::setRotationCenter(), irr::core::CMatrix4< T >::setRotationRadians(), irr::core::CMatrix4< T >::setTextureRotationCenter(), irr::core::CMatrix4< T >::setTextureScale(), irr::core::CMatrix4< T >::setTextureScaleCenter(), irr::core::CMatrix4< T >::setTextureTranslate(), irr::core::CMatrix4< T >::setTextureTranslateTransposed(), irr::core::CMatrix4< T >::transformBoxEx(), irr::core::CMatrix4< T >::transformPlane(), and irr::core::CMatrix4< T >::transformPlane().
Constructor with min edge and max edge.
Definition at line 28 of file aabbox3d.h.
Constructor with only one point.
Definition at line 30 of file aabbox3d.h.
Constructor with min edge and max edge as single values, not vectors.
Definition at line 32 of file aabbox3d.h.
Adds another bounding box.
The box grows bigger, if the new box was outside of the box.
b | Other bounding box to add into this box. |
Definition at line 82 of file aabbox3d.h.
References irr::core::aabbox3d< T >::addInternalPoint(), irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::scene::IMeshManipulator::apply(), irr::scene::SAnimatedMesh::recalculateBoundingBox(), and irr::scene::SMesh::recalculateBoundingBox().
Adds a point to the bounding box.
The box grows bigger, if point was outside of the box.
p | Point to add into the box. |
Definition at line 74 of file aabbox3d.h.
References irr::core::aabbox3d< T >::addInternalPoint(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.
Referenced by irr::core::aabbox3d< T >::addInternalBox(), irr::core::aabbox3d< T >::addInternalPoint(), irr::scene::CMeshBuffer< T >::append(), irr::scene::IMeshManipulator::apply_(), irr::scene::CDynamicMeshBuffer::recalculateBoundingBox(), irr::scene::CMeshBuffer< T >::recalculateBoundingBox(), irr::scene::SSharedMeshBuffer::recalculateBoundingBox(), irr::scene::SSkinMeshBuffer::recalculateBoundingBox(), and irr::scene::SViewFrustum::recalculateBoundingBox().
Adds a point to the bounding box.
The box grows bigger, if point is outside of the box.
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 93 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
|
inline |
Classifies a relation with a plane.
plane | Plane to classify relation to. |
Definition at line 284 of file aabbox3d.h.
References irr::core::aabbox3d< T >::aabbox3d(), irr::core::ISREL3D_BACK, irr::core::ISREL3D_CLIPPED, irr::core::ISREL3D_FRONT, irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
|
inline |
Get the surface area of the box in squared units.
Definition at line 134 of file aabbox3d.h.
References irr::core::aabbox3d< T >::getExtent(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.
Referenced by irr::core::rect< T >::operator<().
Get center of the bounding box.
Definition at line 106 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::core::aabbox3d< T >::getEdges(), and irr::core::aabbox3d< T >::intersectsWithLine().
Stores all 8 edges of the box into an array.
edges | Pointer to array of 8 edges. |
Definition at line 142 of file aabbox3d.h.
References irr::core::aabbox3d< T >::getCenter(), irr::core::aabbox3d< T >::MaxEdge, irr::core::vector3d< T >::set(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.
Get extent of the box (maximal distance of two points in the box)
Definition at line 113 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::core::aabbox3d< T >::getArea(), irr::core::aabbox3d< T >::getVolume(), and irr::core::aabbox3d< T >::intersectsWithLine().
|
inline |
Calculates a new interpolated bounding box.
d=0 returns other, d=1 returns this, all other values blend between the two boxes.
other | Other box to interpolate between |
d | Value between 0.0f and 1.0f. |
Definition at line 190 of file aabbox3d.h.
References irr::core::aabbox3d< T >::aabbox3d(), irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::scene::SViewFrustum::clipLine().
|
inline |
Get the volume enclosed by the box in cubed units.
Definition at line 127 of file aabbox3d.h.
References irr::core::aabbox3d< T >::getExtent(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.
Determines if the axis-aligned box intersects with another axis-aligned box.
other | Other box to check a intersection with. |
Definition at line 233 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Tests if the box intersects with a line.
line | Line to test intersection with. |
Definition at line 242 of file aabbox3d.h.
References irr::core::aabbox3d< T >::intersectsWithLine().
Referenced by irr::core::aabbox3d< T >::intersectsWithLine().
|
inline |
Tests if the box intersects with a line.
linemiddle | Center of the line. |
linevect | Vector of the line. |
halflength | Half length of the line. |
Definition at line 253 of file aabbox3d.h.
References irr::core::aabbox3d< T >::aabbox3d(), irr::core::aabbox3d< T >::getCenter(), and irr::core::aabbox3d< T >::getExtent().
|
inline |
Check if the box is empty.
This means that there is no space between the min and max edge.
Definition at line 121 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Check if this box is completely inside the 'other' box.
other | Other box to check against. |
Definition at line 223 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Determines if a point is within this box.
Border is included (IS part of the box)!
p | Point to check. |
Definition at line 201 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::core::triangle3d< T >::isTotalInsideBox().
Determines if a point is within this box and not its borders.
Border is excluded (NOT part of the box)!
p | Point to check. |
Definition at line 212 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
|
inline |
Inequality operator.
other | box to compare with. |
Definition at line 42 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
|
inline |
Equality operator.
other | box to compare with. |
Definition at line 38 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
|
inline |
Repairs the box.
Necessary if for example MinEdge and MaxEdge are swapped.
Definition at line 172 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::core::CMatrix4< T >::transformBox().
Resets the bounding box.
initValue | New box to set this one to. |
Definition at line 58 of file aabbox3d.h.
Resets the bounding box to a one-point box.
initValue | New point. |
Definition at line 65 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Resets the bounding box to a one-point box.
x | X coord of the point. |
y | Y coord of the point. |
z | Z coord of the point. |
Definition at line 50 of file aabbox3d.h.
References irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.
Referenced by irr::scene::IMeshManipulator::apply(), irr::scene::IMeshManipulator::apply_(), irr::scene::SMesh::clear(), irr::scene::CDynamicMeshBuffer::recalculateBoundingBox(), irr::scene::CMeshBuffer< T >::recalculateBoundingBox(), irr::scene::SAnimatedMesh::recalculateBoundingBox(), irr::scene::SMesh::recalculateBoundingBox(), irr::scene::SSharedMeshBuffer::recalculateBoundingBox(), irr::scene::SSkinMeshBuffer::recalculateBoundingBox(), and irr::scene::SViewFrustum::recalculateBoundingBox().
The far edge.
Definition at line 320 of file aabbox3d.h.
Referenced by irr::core::aabbox3d< T >::addInternalBox(), irr::core::aabbox3d< T >::addInternalPoint(), irr::core::aabbox3d< T >::classifyPlaneRelation(), irr::core::aabbox3d< T >::getCenter(), irr::core::aabbox3d< T >::getEdges(), irr::core::aabbox3d< T >::getExtent(), irr::core::aabbox3d< T >::getInterpolated(), irr::core::aabbox3d< T >::intersectsWithBox(), irr::core::aabbox3d< T >::isEmpty(), irr::core::aabbox3d< T >::isFullInside(), irr::core::aabbox3d< T >::isPointInside(), irr::core::aabbox3d< T >::isPointTotalInside(), irr::core::triangle3d< T >::isTotalOutsideBox(), irr::core::aabbox3d< T >::operator!=(), irr::core::aabbox3d< T >::operator==(), irr::core::aabbox3d< T >::repair(), irr::core::aabbox3d< T >::reset(), irr::core::aabbox3d< T >::reset(), irr::core::CMatrix4< T >::transformBox(), and irr::core::CMatrix4< T >::transformBoxEx().
The near edge.
Definition at line 317 of file aabbox3d.h.
Referenced by irr::core::aabbox3d< T >::addInternalBox(), irr::core::aabbox3d< T >::addInternalPoint(), irr::core::aabbox3d< T >::classifyPlaneRelation(), irr::core::aabbox3d< T >::getCenter(), irr::core::aabbox3d< T >::getExtent(), irr::core::aabbox3d< T >::getInterpolated(), irr::core::aabbox3d< T >::intersectsWithBox(), irr::core::aabbox3d< T >::isEmpty(), irr::core::aabbox3d< T >::isFullInside(), irr::core::aabbox3d< T >::isPointInside(), irr::core::aabbox3d< T >::isPointTotalInside(), irr::core::triangle3d< T >::isTotalOutsideBox(), irr::core::aabbox3d< T >::operator!=(), irr::core::aabbox3d< T >::operator==(), irr::core::aabbox3d< T >::repair(), irr::core::aabbox3d< T >::reset(), irr::core::aabbox3d< T >::reset(), irr::core::CMatrix4< T >::transformBox(), and irr::core::CMatrix4< T >::transformBoxEx().