OGRE-Next  3.0.0
Object-Oriented Graphics Rendering Engine
Ogre::ArrayAabb Class Reference

Cache-friendly array of Aabb represented as a SoA array. More...

#include <OgreArrayAabb.h>

Public Member Functions

 ArrayAabb ()
 
 ArrayAabb ()
 
 ArrayAabb ()
 
 ArrayAabb (const ArrayVector3 &center, const ArrayVector3 &halfSize)
 
 ArrayAabb (const ArrayVector3 &center, const ArrayVector3 &halfSize)
 
 ArrayAabb (const ArrayVector3 &center, const ArrayVector3 &halfSize)
 
ArrayMaskR contains (const ArrayAabb &other) const
 Tests whether another box contained by this box. More...
 
ArrayMaskR contains (const ArrayAabb &other) const
 Tests whether another box contained by this box. More...
 
ArrayMaskR contains (const ArrayAabb &other) const
 Tests whether another box contained by this box. More...
 
ArrayMaskR contains (const ArrayVector3 &v) const
 Tests whether the given point contained by this box. More...
 
ArrayMaskR contains (const ArrayVector3 &v) const
 Tests whether the given point contained by this box. More...
 
ArrayMaskR contains (const ArrayVector3 &v) const
 Tests whether the given point contained by this box. More...
 
ArrayReal distance (const ArrayVector3 &v) const
 Returns the minimum distance between a given point and any part of the box. More...
 
ArrayReal distance (const ArrayVector3 &v) const
 Returns the minimum distance between a given point and any part of the box. More...
 
ArrayReal distance (const ArrayVector3 &v) const
 Returns the minimum distance between a given point and any part of the box. More...
 
void getAsAabb (Aabb &out, size_t index) const
 
void getAsAabb (Aabb &out, size_t index) const
 
void getAsAabb (Aabb &out, size_t index) const
 
Aabb getAsAabb (size_t index) const
 Prefer using. More...
 
Aabb getAsAabb (size_t index) const
 Prefer using. More...
 
Aabb getAsAabb (size_t index) const
 Prefer using. More...
 
ArrayVector3 getMaximum () const
 Gets the maximum corner of the box. More...
 
ArrayVector3 getMaximum () const
 Gets the maximum corner of the box. More...
 
ArrayVector3 getMaximum () const
 Gets the maximum corner of the box. More...
 
ArrayVector3 getMinimum () const
 Gets the minimum corner of the box. More...
 
ArrayVector3 getMinimum () const
 Gets the minimum corner of the box. More...
 
ArrayVector3 getMinimum () const
 Gets the minimum corner of the box. More...
 
ArrayAabb intersection (const ArrayAabb &b2) const
 Calculate the area of intersection of this box and another. More...
 
ArrayAabb intersection (const ArrayAabb &b2) const
 Calculate the area of intersection of this box and another. More...
 
ArrayAabb intersection (const ArrayAabb &b2) const
 Calculate the area of intersection of this box and another. More...
 
ArrayMaskR intersects (const ArrayAabb &b2) const
 Returns whether or not this box intersects another. More...
 
ArrayMaskR intersects (const ArrayAabb &b2) const
 Returns whether or not this box intersects another. More...
 
ArrayMaskR intersects (const ArrayAabb &b2) const
 Returns whether or not this box intersects another. More...
 
void merge (const ArrayAabb &rhs)
 Merges the passed in box into the current box. More...
 
void merge (const ArrayAabb &rhs)
 Merges the passed in box into the current box. More...
 
void merge (const ArrayAabb &rhs)
 Merges the passed in box into the current box. More...
 
void merge (const ArrayVector3 &points)
 Extends the box to encompass the specified point (if needed). More...
 
void merge (const ArrayVector3 &points)
 Extends the box to encompass the specified point (if needed). More...
 
void merge (const ArrayVector3 &points)
 Extends the box to encompass the specified point (if needed). More...
 
void setAll (const Aabb &aabb)
 
void setAll (const Aabb &aabb)
 
void setAll (const Aabb &aabb)
 
void setFromAabb (const Aabb &aabb, size_t index)
 
void setFromAabb (const Aabb &aabb, size_t index)
 
void setFromAabb (const Aabb &aabb, size_t index)
 
ArrayReal squaredDistance (const ArrayVector3 &v) const
 Returns the square of the minimum distance between a given point and any part of the box. More...
 
ArrayReal squaredDistance (const ArrayVector3 &v) const
 Returns the square of the minimum distance between a given point and any part of the box. More...
 
ArrayReal squaredDistance (const ArrayVector3 &v) const
 Returns the square of the minimum distance between a given point and any part of the box. More...
 
void transformAffine (const ArrayMatrix4 &matrix)
 Transforms the box according to the matrix supplied. More...
 
void transformAffine (const ArrayMatrix4 &matrix)
 Transforms the box according to the matrix supplied. More...
 
void transformAffine (const ArrayMatrix4 &matrix)
 Transforms the box according to the matrix supplied. More...
 
ArrayReal volume () const
 Calculate the volume of this box. More...
 
ArrayReal volume () const
 Calculate the volume of this box. More...
 
ArrayReal volume () const
 Calculate the volume of this box. More...
 

Public Attributes

ArrayVector3 mCenter
 
ArrayVector3 mHalfSize
 

Static Public Attributes

static const ArrayAabb BOX_INFINITE
 
static const ArrayAabb BOX_ZERO
 

Detailed Description

Cache-friendly array of Aabb represented as a SoA array.

Remarks
ArrayAabb is a SIMD & cache-friendly version of AxisAlignedBox. (AABB = Axis aligned bounding box) See ArrayVector3 for more information.
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)
Extracting one aabb needs 84 bytes, while all 4 aabbs need 96 bytes, both cases are always two cache lines. Architectures where the cache line == 32 bytes may want to set ARRAY_PACKED_REALS = 2 depending on their needs
Remarks
ArrayAabb is a SIMD & cache-friendly version of AxisAlignedBox. (AABB = Axis aligned bounding box) See ArrayVector3 for more information.
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)
Extracting one aabb needs 84 bytes, while all 4 aabbs need 96 bytes, both cases are always two cache lines. Architectures where the cache line == 32 bytes may want to set ARRAY_PACKED_REALS = 2 depending on their needs

Constructor & Destructor Documentation

◆ ArrayAabb() [1/6]

Ogre::ArrayAabb::ArrayAabb ( )
inline

◆ ArrayAabb() [2/6]

Ogre::ArrayAabb::ArrayAabb ( const ArrayVector3 center,
const ArrayVector3 halfSize 
)
inline

◆ ArrayAabb() [3/6]

Ogre::ArrayAabb::ArrayAabb ( )
inline

◆ ArrayAabb() [4/6]

Ogre::ArrayAabb::ArrayAabb ( const ArrayVector3 center,
const ArrayVector3 halfSize 
)
inline

◆ ArrayAabb() [5/6]

Ogre::ArrayAabb::ArrayAabb ( )
inline

◆ ArrayAabb() [6/6]

Ogre::ArrayAabb::ArrayAabb ( const ArrayVector3 center,
const ArrayVector3 halfSize 
)
inline

Member Function Documentation

◆ contains() [1/6]

ArrayMaskR Ogre::ArrayAabb::contains ( const ArrayAabb other) const
inline

Tests whether another box contained by this box.

◆ contains() [2/6]

ArrayMaskR Ogre::ArrayAabb::contains ( const ArrayAabb other) const
inline

Tests whether another box contained by this box.

◆ contains() [3/6]

ArrayMaskR Ogre::ArrayAabb::contains ( const ArrayAabb other) const
inline

Tests whether another box contained by this box.

◆ contains() [4/6]

ArrayMaskR Ogre::ArrayAabb::contains ( const ArrayVector3 v) const
inline

Tests whether the given point contained by this box.

◆ contains() [5/6]

ArrayMaskR Ogre::ArrayAabb::contains ( const ArrayVector3 v) const
inline

Tests whether the given point contained by this box.

◆ contains() [6/6]

ArrayMaskR Ogre::ArrayAabb::contains ( const ArrayVector3 v) const
inline

Tests whether the given point contained by this box.

◆ distance() [1/3]

ArrayReal Ogre::ArrayAabb::distance ( const ArrayVector3 v) const
inline

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

◆ distance() [2/3]

ArrayReal Ogre::ArrayAabb::distance ( const ArrayVector3 v) const
inline

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

◆ distance() [3/3]

ArrayReal Ogre::ArrayAabb::distance ( const ArrayVector3 v) const
inline

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

◆ getAsAabb() [1/6]

void Ogre::ArrayAabb::getAsAabb ( Aabb out,
size_t  index 
) const
inline

◆ getAsAabb() [2/6]

void Ogre::ArrayAabb::getAsAabb ( Aabb out,
size_t  index 
) const
inline

◆ getAsAabb() [3/6]

void Ogre::ArrayAabb::getAsAabb ( Aabb out,
size_t  index 
) const
inline

◆ getAsAabb() [4/6]

Aabb Ogre::ArrayAabb::getAsAabb ( size_t  index) const
inline

Prefer using.

See also
getAsAabb() because this function may have more overhead (the other one is faster)

◆ getAsAabb() [5/6]

Aabb Ogre::ArrayAabb::getAsAabb ( size_t  index) const
inline

Prefer using.

See also
getAsAabb() because this function may have more overhead (the other one is faster)

◆ getAsAabb() [6/6]

Aabb Ogre::ArrayAabb::getAsAabb ( size_t  index) const
inline

Prefer using.

See also
getAsAabb() because this function may have more overhead (the other one is faster)

◆ getMaximum() [1/3]

ArrayVector3 Ogre::ArrayAabb::getMaximum ( ) const
inline

Gets the maximum corner of the box.

Referenced by Ogre::ArrayRay::intersects().

◆ getMaximum() [2/3]

ArrayVector3 Ogre::ArrayAabb::getMaximum ( ) const
inline

Gets the maximum corner of the box.

◆ getMaximum() [3/3]

ArrayVector3 Ogre::ArrayAabb::getMaximum ( ) const
inline

Gets the maximum corner of the box.

◆ getMinimum() [1/3]

ArrayVector3 Ogre::ArrayAabb::getMinimum ( ) const
inline

Gets the minimum corner of the box.

Referenced by Ogre::ArrayRay::intersects().

◆ getMinimum() [2/3]

ArrayVector3 Ogre::ArrayAabb::getMinimum ( ) const
inline

Gets the minimum corner of the box.

◆ getMinimum() [3/3]

ArrayVector3 Ogre::ArrayAabb::getMinimum ( ) const
inline

Gets the minimum corner of the box.

◆ intersection() [1/3]

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

Calculate the area of intersection of this box and another.

◆ intersection() [2/3]

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

Calculate the area of intersection of this box and another.

◆ intersection() [3/3]

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

Calculate the area of intersection of this box and another.

◆ intersects() [1/3]

ArrayMaskR Ogre::ArrayAabb::intersects ( const ArrayAabb b2) const
inline

Returns whether or not this box intersects another.

◆ intersects() [2/3]

ArrayMaskR Ogre::ArrayAabb::intersects ( const ArrayAabb b2) const
inline

Returns whether or not this box intersects another.

◆ intersects() [3/3]

ArrayMaskR Ogre::ArrayAabb::intersects ( const ArrayAabb b2) const
inline

Returns whether or not this box intersects another.

◆ merge() [1/6]

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

Merges the passed in box into the current box.

The result is the box which encompasses both.

◆ merge() [2/6]

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

Merges the passed in box into the current box.

The result is the box which encompasses both.

◆ merge() [3/6]

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

Merges the passed in box into the current box.

The result is the box which encompasses both.

◆ merge() [4/6]

void Ogre::ArrayAabb::merge ( const ArrayVector3 points)
inline

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

◆ merge() [5/6]

void Ogre::ArrayAabb::merge ( const ArrayVector3 points)
inline

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

◆ merge() [6/6]

void Ogre::ArrayAabb::merge ( const ArrayVector3 points)
inline

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

◆ setAll() [1/3]

void Ogre::ArrayAabb::setAll ( const Aabb aabb)
inline

◆ setAll() [2/3]

void Ogre::ArrayAabb::setAll ( const Aabb aabb)
inline

◆ setAll() [3/3]

void Ogre::ArrayAabb::setAll ( const Aabb aabb)
inline

◆ setFromAabb() [1/3]

void Ogre::ArrayAabb::setFromAabb ( const Aabb aabb,
size_t  index 
)
inline

◆ setFromAabb() [2/3]

void Ogre::ArrayAabb::setFromAabb ( const Aabb aabb,
size_t  index 
)
inline

◆ setFromAabb() [3/3]

void Ogre::ArrayAabb::setFromAabb ( const Aabb aabb,
size_t  index 
)
inline

◆ squaredDistance() [1/3]

ArrayReal Ogre::ArrayAabb::squaredDistance ( const ArrayVector3 v) const
inline

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

◆ squaredDistance() [2/3]

ArrayReal Ogre::ArrayAabb::squaredDistance ( const ArrayVector3 v) const
inline

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

◆ squaredDistance() [3/3]

ArrayReal Ogre::ArrayAabb::squaredDistance ( const ArrayVector3 v) const
inline

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

◆ transformAffine() [1/3]

void Ogre::ArrayAabb::transformAffine ( const ArrayMatrix4 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.

◆ transformAffine() [2/3]

void Ogre::ArrayAabb::transformAffine ( const ArrayMatrix4 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.

◆ transformAffine() [3/3]

void Ogre::ArrayAabb::transformAffine ( const ArrayMatrix4 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.

◆ volume() [1/3]

ArrayReal Ogre::ArrayAabb::volume ( ) const
inline

Calculate the volume of this box.

◆ volume() [2/3]

ArrayReal Ogre::ArrayAabb::volume ( ) const
inline

Calculate the volume of this box.

◆ volume() [3/3]

ArrayReal Ogre::ArrayAabb::volume ( ) const
inline

Calculate the volume of this box.

Member Data Documentation

◆ BOX_INFINITE

static const ArrayAabb Ogre::ArrayAabb::BOX_INFINITE
static

◆ BOX_ZERO

static const ArrayAabb Ogre::ArrayAabb::BOX_ZERO
static

◆ mCenter

ArrayVector3 Ogre::ArrayAabb::mCenter

◆ mHalfSize

ArrayVector3 Ogre::ArrayAabb::mHalfSize

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