SA_Maths
Sapphire Suite's C++ Maths Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SA::AABB3D< T > Struct Template Reference

AABB 3D Sapphire's class. More...

#include <AABB3D.hpp>

Public Member Functions

 AABB3D ()=default
 Default constructor.
 
 AABB3D (const Vec3< T > &_min, const Vec3< T > &_max)
 Value constructor from min and max.
 
 AABB3D (const AABB3D &_first, const AABB3D &_second)
 Merge 2 AABB box.
 
 AABB3D (const AABB2D< T > &_aabb2D) noexcept
 Constructor from AABB2D.
 
bool IsValid () const noexcept
 Wether this AABB has valid values (ie min < max);.
 
constexpr bool Equals (const AABB3D &_other, T _epsilon=std::numeric_limits< T >::epsilon()) const noexcept
 Compare 2 AABB3D.
 
constexpr bool operator== (const AABB3D &_rhs) const noexcept
 Compare 2 AABB equality.
 
constexpr bool operator!= (const AABB3D &_rhs) const noexcept
 Compare 2 AABB inequality.
 
bool IsCollidingX (const AABB3D &_other) const
 Perform collision test on X axis only.
 
bool IsCollidingY (const AABB3D &_other) const
 Perform collision test on Y axis only.
 
bool IsCollidingZ (const AABB3D &_other) const
 Perform collision test on Z axis only.
 
bool IsColliding (const AABB3D &_other) const
 Perform collision test on every axis.
 
float Width () const
 Compute width (X axis) from min and max.
 
float Height () const
 Compute height (Y axis) from min and max.
 
float Depth () const
 Compute depth (Z axis) from min and max.
 
Vec3< T > Center () const
 Compute center from min and max.
 
float Area () const
 Compute area from min and max.
 

Static Public Member Functions

static AABB3D Merge (const AABB3D &_first, const AABB3D &_second)
 Merge 2 AABB3D box to create a big AABB3D which wrap both boxes.
 

Public Attributes

Vec3< T > min
 Min box component.
 
Vec3< T > max
 Max box component.
 

Detailed Description

template<typename T>
struct SA::AABB3D< T >

AABB 3D Sapphire's class.

Template Parameters
TType of the AABB.

Constructor & Destructor Documentation

◆ AABB3D() [1/3]

template<typename T >
SA::AABB3D< T >::AABB3D ( const Vec3< T > & _min,
const Vec3< T > & _max )

Value constructor from min and max.

Parameters
_minMin value
_maxMax value.

◆ AABB3D() [2/3]

template<typename T >
SA::AABB3D< T >::AABB3D ( const AABB3D< T > & _first,
const AABB3D< T > & _second )

Merge 2 AABB box.

Parameters
_firstFirst AABB to merge.
_secondSecond AABB to merge.

◆ AABB3D() [3/3]

template<typename T >
SA::AABB3D< T >::AABB3D ( const AABB2D< T > & _aabb2D)
noexcept

Constructor from AABB2D.

Parameters
_aabb2D2D AABB object.

Member Function Documentation

◆ Area()

template<typename T >
float SA::AABB3D< T >::Area ( ) const

Compute area from min and max.

Returns
AABB area

◆ Center()

template<typename T >
Vec3< T > SA::AABB3D< T >::Center ( ) const

Compute center from min and max.

Returns
AABB center.

◆ Depth()

template<typename T >
float SA::AABB3D< T >::Depth ( ) const

Compute depth (Z axis) from min and max.

Returns
AABB height.

◆ Equals()

template<typename T >
constexpr bool SA::AABB3D< T >::Equals ( const AABB3D< T > & _other,
T _epsilon = std::numeric_limits< T >::epsilon() ) const
constexprnoexcept

Compare 2 AABB3D.

Parameters
[in]_otherOther AABB to compare to.
[in]_epsilonEpsilon value for threshold comparison.
Returns
Whether this and _other are equal.

◆ Height()

template<typename T >
float SA::AABB3D< T >::Height ( ) const

Compute height (Y axis) from min and max.

Returns
AABB height.

◆ IsColliding()

template<typename T >
bool SA::AABB3D< T >::IsColliding ( const AABB3D< T > & _other) const

Perform collision test on every axis.

Parameters
_otherOther AABB box.
Returns
true if this and other collide on any axis.

◆ IsCollidingX()

template<typename T >
bool SA::AABB3D< T >::IsCollidingX ( const AABB3D< T > & _other) const

Perform collision test on X axis only.

Parameters
_otherOther AABB box.
Returns
true if this and other collide on X axis.

◆ IsCollidingY()

template<typename T >
bool SA::AABB3D< T >::IsCollidingY ( const AABB3D< T > & _other) const

Perform collision test on Y axis only.

Parameters
_otherOther AABB box.
Returns
true if this and other collide on Y axis.

◆ IsCollidingZ()

template<typename T >
bool SA::AABB3D< T >::IsCollidingZ ( const AABB3D< T > & _other) const

Perform collision test on Z axis only.

Parameters
_otherOther AABB box.
Returns
true if this and other collide on Z axis.

◆ IsValid()

template<typename T >
bool SA::AABB3D< T >::IsValid ( ) const
noexcept

Wether this AABB has valid values (ie min < max);.

Returns
true if components are valid.

◆ Merge()

template<typename T >
static AABB3D SA::AABB3D< T >::Merge ( const AABB3D< T > & _first,
const AABB3D< T > & _second )
static

Merge 2 AABB3D box to create a big AABB3D which wrap both boxes.

Parameters
_firstFirst AABB object to merge.
_secondSecond AABB object to merge.
Returns
AABB3D Big AABB box from merge.

◆ operator!=()

template<typename T >
constexpr bool SA::AABB3D< T >::operator!= ( const AABB3D< T > & _rhs) const
constexprnoexcept

Compare 2 AABB inequality.

Parameters
[in]_rhsOther AABB to compare to.
Returns
Whether this and _rhs are non-equal.

◆ operator==()

template<typename T >
constexpr bool SA::AABB3D< T >::operator== ( const AABB3D< T > & _rhs) const
constexprnoexcept

Compare 2 AABB equality.

Parameters
[in]_rhsOther AABB to compare to.
Returns
Whether this and _rhs are equal.

◆ Width()

template<typename T >
float SA::AABB3D< T >::Width ( ) const

Compute width (X axis) from min and max.

Returns
AABB width.

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