AGXDynamics  2.31.1.0
agxCollide::BoundingAABB Class Reference

Axis aligned bounding box implementation. More...

#include <BoundingAABB.h>

+ Inheritance diagram for agxCollide::BoundingAABB:

Public Types

typedef Vec3 Type
 

Public Member Functions

 BoundingAABB ()
 Creates an empty bounding volume. isCleared() will return 'true'. More...
 
 BoundingAABB (const agx::Vec3 &min, const agx::Vec3 &max)
 Creates a bounding volume given a component-wise minimum and maximum point. More...
 
 BoundingAABB (const agx::Bound3 &other, const agx::AffineMatrix4x4 &transform)
 Creates a bounding volume given a bounding volume given in another coordinate-system. More...
 
BoundT calculateOverlap (const BoundT &other) const
 
bool contains (const Vec3 &value) const
 
void expand (const agx::Bound3 &other)
 Expands a bounding volume to contain both itself and another bound. More...
 
void expand (const agx::Vec3 &point)
 Expands a bounding volume to contain both itself and another point. More...
 
void expand (const agx::Vec3 &otherMin, const agx::Vec3 &otherMax)
 Expands a bounding volume to contain both itself and another bound. More...
 
void expand (const agx::Bound3 &other, const agx::AffineMatrix4x4 &transform)
 Expands a bounding volume given a bounding volume given in another coordinate-system. More...
 
void expand (const agx::Vec3 &otherMin, const agx::Vec3 &otherMax, const agx::AffineMatrix4x4 &transform)
 Expands a bounding volume given a bounding volume given in another coordinate-system. More...
 
bool hasOverlap (const BoundT &other) const
 
bool hasOverlap (const BoundingAABB *other) const
 Tests if the bound intersects with another bounding volume. More...
 
bool isCleared () const
 Is the bounding volume cleared? Will be true e.g. More...
 
bool isValid () const
 
const Vec3 & max () const
 
Vec3 & max ()
 
Vec3 mid () const
 
const Vec3 & min () const
 
Vec3 & min ()
 
 operator BoundT< T2 > () const
 Convert the bound to a bound with a different underlying type. More...
 
bool operator!= (const BoundT &other) const
 
BoundT operator* (T2 scale)
 Create a new bound that has the same midpoint as the current bound, but with a size that is scaled according to the given scale. More...
 
BoundT< Vec3 > operator* (T2 scale)
 
BoundT & operator*= (T2 scale)
 Scale the bound so that is size is changed according to the given scale, but the midpoint remains unchanged. More...
 
BoundT< Vec3 > & operator*= (T2 scale)
 
bool operator== (const BoundT &other) const
 
void reset ()
 Removes any extent of the bound. More...
 
void set (const agx::Bound3 &other, const agx::AffineMatrix4x4 &transform)
 Sets a bounding volume given a bounding volume given in another coordinate-system. More...
 
void set (const Vec3 &min, const Vec3 &max)
 Relocate the bound to the new location. More...
 
Vec3 size () const
 
bool testSphereOverlap (const agx::Vec3 &pos, agx::Real radius) const
 Test if a sphere overlaps the bound. More...
 
BoundT translate (const Vec3 &offset) const
 Move the bound's midpoint without altering its size. More...
 

Protected Attributes

Vec3 m_max
 
Vec3 m_min
 

Detailed Description

Axis aligned bounding box implementation.

Definition at line 37 of file BoundingAABB.h.

Member Typedef Documentation

◆ Type

typedef Vec3 agx::BoundT< Vec3 >::Type
inherited

Definition at line 39 of file Bound.h.

Constructor & Destructor Documentation

◆ BoundingAABB() [1/3]

agxCollide::BoundingAABB::BoundingAABB ( )

Creates an empty bounding volume. isCleared() will return 'true'.

Definition at line 146 of file BoundingAABB.h.

◆ BoundingAABB() [2/3]

agxCollide::BoundingAABB::BoundingAABB ( const agx::Vec3 &  min,
const agx::Vec3 &  max 
)

Creates a bounding volume given a component-wise minimum and maximum point.

Parameters
minThe component-wise minimum.
maxThe component-wise maximum. If min is not the component-wise minimum and max is not the component-wise maximum, unexpected results might occur.

Definition at line 152 of file BoundingAABB.h.

◆ BoundingAABB() [3/3]

agxCollide::BoundingAABB::BoundingAABB ( const agx::Bound3 &  other,
const agx::AffineMatrix4x4 &  transform 
)

Creates a bounding volume given a bounding volume given in another coordinate-system.

Parameters
otherThe bounding volume, given in another coordinate system.
transformThe transformation matrix from the coordinate system where 'other' is defined to the desired one.

Definition at line 157 of file BoundingAABB.h.

References expand(), and reset().

Member Function Documentation

◆ calculateOverlap()

BoundT< Vec3 > agx::BoundT< Vec3 >::calculateOverlap ( const BoundT< Vec3 > &  other) const
inherited
Returns
A new bound that is the intersection of the current and the given bound.

Definition at line 298 of file Bound.h.

◆ contains()

bool agx::BoundT< Vec3 >::contains ( const Vec3 &  value) const
inherited
Returns
True if the given value lies within the bound. False otherwise.

Definition at line 295 of file Bound.h.

◆ expand() [1/5]

void agxCollide::BoundingAABB::expand ( const agx::Bound3 &  other)

Expands a bounding volume to contain both itself and another bound.

If isCleared() was true before, the bound will be set to the other one.

Definition at line 184 of file BoundingAABB.h.

References agx::BoundT< T >::max(), and agx::BoundT< T >::min().

Referenced by BoundingAABB(), expand(), and set().

◆ expand() [2/5]

void agxCollide::BoundingAABB::expand ( const agx::Vec3 &  point)

Expands a bounding volume to contain both itself and another point.

If isCleared() was true before, the bound will be set to the point.

Definition at line 190 of file BoundingAABB.h.

References expand().

◆ expand() [3/5]

void agxCollide::BoundingAABB::expand ( const agx::Vec3 &  otherMin,
const agx::Vec3 &  otherMax 
)

Expands a bounding volume to contain both itself and another bound.

If isCleared() was true before, the bound will be set the other one.

Parameters
otherMinThe component-wise minimum.
otherMaxThe component-wise maximum. If min is not the component-wise minimum and max is not the component-wise maximum, unexpected results might occur.

Definition at line 196 of file BoundingAABB.h.

References agx::Vec3T< Real >::componentMax(), agx::Vec3T< Real >::componentMin(), agx::BoundT< Vec3 >::max(), and agx::BoundT< Vec3 >::min().

◆ expand() [4/5]

void agxCollide::BoundingAABB::expand ( const agx::Bound3 &  other,
const agx::AffineMatrix4x4 &  transform 
)

Expands a bounding volume given a bounding volume given in another coordinate-system.

If isCleared() was true before, the bound will be set to the point.

Parameters
otherThe bounding volume, given in another coordinate system.
transformThe transformation matrix from the coordinate system where 'other' is defined to the desired one.

Definition at line 203 of file BoundingAABB.h.

References expand(), agx::BoundT< T >::max(), agx::BoundT< T >::min(), and agxData::transform().

◆ expand() [5/5]

void agxCollide::BoundingAABB::expand ( const agx::Vec3 &  otherMin,
const agx::Vec3 &  otherMax,
const agx::AffineMatrix4x4 &  transform 
)

Expands a bounding volume given a bounding volume given in another coordinate-system.

If isCleared() was true before, the bound will be set to the point.

Parameters
otherMinThe component-wise minimum, given in another coordinate system.
otherMaxThe component-wise maximum, given in another coordinate system.
transformThe transformation matrix from the coordinate system where 'otherMin' and 'otherMax' are defined to the desired one.

◆ hasOverlap() [1/2]

bool agx::BoundT< Vec3 >::hasOverlap ( const BoundT< Vec3 > &  other) const
inherited
Returns
True if the given bound overlaps with the current bound.

Definition at line 304 of file Bound.h.

Referenced by hasOverlap().

◆ hasOverlap() [2/2]

bool agxCollide::BoundingAABB::hasOverlap ( const BoundingAABB *  other) const

Tests if the bound intersects with another bounding volume.

Parameters
otherThe other bounding volume, to be given in same coordinate system.
Return values
Dothe bounding volumes overlap?

Definition at line 209 of file BoundingAABB.h.

References agx::BoundT< Vec3 >::hasOverlap().

◆ isCleared()

bool agxCollide::BoundingAABB::isCleared ( ) const

Is the bounding volume cleared? Will be true e.g.

after call to reset().

Definition at line 178 of file BoundingAABB.h.

References agx::BoundT< Vec3 >::max(), and agx::BoundT< Vec3 >::min().

◆ isValid()

bool agx::BoundT< Vec3 >::isValid ( ) const
inherited
Returns
True if the lower bound is less than or equal to the upper bound.

Definition at line 273 of file Bound.h.

◆ max() [1/2]

const Vec3 & agx::BoundT< Vec3 >::max ( ) const
inherited
Returns
A reference to the upper end of the bound.

Definition at line 255 of file Bound.h.

Referenced by expand(), isCleared(), reset(), and testSphereOverlap().

◆ max() [2/2]

Vec3 & agx::BoundT< Vec3 >::max ( )
inherited
Returns
A reference to the upper end of the bound.

Definition at line 261 of file Bound.h.

◆ mid()

Vec3 agx::BoundT< Vec3 >::mid ( ) const
inherited
Returns
The midpoint between the lower bound and the upper bound.

Definition at line 270 of file Bound.h.

◆ min() [1/2]

const Vec3 & agx::BoundT< Vec3 >::min ( ) const
inherited
Returns
A reference to the lower end of the bound.

Definition at line 252 of file Bound.h.

Referenced by expand(), isCleared(), reset(), and testSphereOverlap().

◆ min() [2/2]

Vec3 & agx::BoundT< Vec3 >::min ( )
inherited
Returns
A reference to the lower end of the bound.

Definition at line 258 of file Bound.h.

◆ operator BoundT< T2 >()

agx::BoundT< Vec3 >::operator BoundT< T2 > ( ) const
inherited

Convert the bound to a bound with a different underlying type.

Definition at line 240 of file Bound.h.

◆ operator!=()

bool agx::BoundT< Vec3 >::operator!= ( const BoundT< Vec3 > &  other) const
inherited

Definition at line 333 of file Bound.h.

◆ operator*() [1/2]

BoundT agx::BoundT< Vec3 >::operator* ( T2  scale)
inherited

Create a new bound that has the same midpoint as the current bound, but with a size that is scaled according to the given scale.

◆ operator*() [2/2]

BoundT<Vec3 > agx::BoundT< Vec3 >::operator* ( T2  scale)
inherited

Definition at line 287 of file Bound.h.

◆ operator*=() [1/2]

BoundT& agx::BoundT< Vec3 >::operator*= ( T2  scale)
inherited

Scale the bound so that is size is changed according to the given scale, but the midpoint remains unchanged.

◆ operator*=() [2/2]

BoundT<Vec3 >& agx::BoundT< Vec3 >::operator*= ( T2  scale)
inherited

Definition at line 277 of file Bound.h.

◆ operator==()

bool agx::BoundT< Vec3 >::operator== ( const BoundT< Vec3 > &  other) const
inherited

Definition at line 317 of file Bound.h.

◆ reset()

void agxCollide::BoundingAABB::reset ( )

Removes any extent of the bound.

isCleared() will return 'true'.

Definition at line 171 of file BoundingAABB.h.

References agx::BoundT< Vec3 >::max(), agx::BoundT< Vec3 >::min(), agx::RealMax, and agx::Vec3T< T >::set().

Referenced by BoundingAABB(), and set().

◆ set() [1/2]

void agxCollide::BoundingAABB::set ( const agx::Bound3 &  other,
const agx::AffineMatrix4x4 &  transform 
)

Sets a bounding volume given a bounding volume given in another coordinate-system.

Parameters
otherThe bounding volume, given in another coordinate system.
transformThe transformation matrix from the coordinate system where 'other' is defined to the desired one.

Definition at line 164 of file BoundingAABB.h.

References expand(), and reset().

◆ set() [2/2]

void agx::BoundT< Vec3 >::set ( const Vec3 &  min,
const Vec3 &  max 
)
inherited

Relocate the bound to the new location.

Definition at line 264 of file Bound.h.

◆ size()

Vec3 agx::BoundT< Vec3 >::size ( ) const
inherited
Returns
The distance from the lower bound to the upper bound.

Definition at line 267 of file Bound.h.

◆ testSphereOverlap()

bool agxCollide::BoundingAABB::testSphereOverlap ( const agx::Vec3 &  pos,
agx::Real  radius 
) const

Test if a sphere overlaps the bound.

May give false positives outside the bound's edges or corners.

Parameters
posThe position of the sphere.
radiusThe radius of the sphere
Return values
Dothe sphere and the bound overlap? May give false positives outside the bound's edges or corners.

Definition at line 215 of file BoundingAABB.h.

References agx::BoundT< Vec3 >::max(), and agx::BoundT< Vec3 >::min().

◆ translate()

BoundT< Vec3 > agx::BoundT< Vec3 >::translate ( const Vec3 &  offset) const
inherited

Move the bound's midpoint without altering its size.

Definition at line 311 of file Bound.h.

Member Data Documentation

◆ m_max

Vec3 agx::BoundT< Vec3 >::m_max
protectedinherited

Definition at line 120 of file Bound.h.

◆ m_min

Vec3 agx::BoundT< Vec3 >::m_min
protectedinherited

Definition at line 119 of file Bound.h.


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