Utilities
Utilities header only library
geom::TAabb< dimensions, Type > Struct Template Reference

Template axis aligned bounding box in an arbitrary dimension. More...

Public Types

using Vec = glm::vec< dimensions, Type, glm::highp >
 

Public Member Functions

 TAabb (const Vec &corner1, const Vec &corner2)
 
Vec GetSize () const
 Returns sizing vector.
 
Vec GetCenter () const
 Returns center point of bounding box.
 
float GetDiagonalSqr () const
 Returns square size of diagonal.
 
float GetDiagonal () const
 Returns size of diagonal.
 
bool IsIncluded (const Vec &point) const
 Checks if point is included in range of bounding box.
 
bool IsInside (const TAabb &aabb) const
 Checks if this bounding box is inside other Aabb.
 
void Include (const Vec &point)
 Enlarges aabb so that it covers also defined point.
 
void Include (const TAabb< dimensions, Type > &aabb)
 Enlarges aabb so that it covers also area of specified aabb.
 
bool IsValid () const
 Checks if structure is valid. Invalid structure may have max < min.
 
TAabb< dimensions, Type > GetIntersection (const TAabb< dimensions, Type > &aabb) const
 Returns smaller bounding box computed as an intersection.
 
bool AreIntersected (const TAabb< dimensions, Type > &aabb) const
 Checks if aabb has an intersection with defined bounding box.
 
Type Volume ()
 Returns volume of bounding box.
 
void Clear ()
 Resets min and max to init values.
 
void Inflate (float d)
 Inflate in all directions.
 
TAabb< dimensions, Type > & operator+= (const TAabb< dimensions, Type > &other)
 
TAabb< dimensions, Type > & operator+= (const Type &other)
 
TAabb< dimensions, Type > & operator+= (const Vec &vector)
 
TAabb< dimensions, Type > & operator-= (const TAabb< dimensions, Type > &other)
 
TAabb< dimensions, Type > & operator-= (const Type &other)
 
TAabb< dimensions, Type > & operator-= (const Vec &vector)
 
TAabb< dimensions, Type > & operator*= (const Type &factor)
 
TAabb< dimensions, Type > & operator* (const Type &factor)
 
TAabb< dimensions, Type > & operator*= (const Vec &vector)
 
TAabb< dimensions, Type > & operator/= (const Type &divisor)
 
TAabb< dimensions, Type > & operator/ (const Type &divisor)
 
TAabb< dimensions, Type > & operator/= (const Vec &vector)
 

Data Fields

Vec min = Vec(std::numeric_limits<Type>::max())
 
Vec max = Vec(std::numeric_limits<Type>::lowest())
 

Detailed Description

template<int dimensions, typename Type>
struct geom::TAabb< dimensions, Type >

Template axis aligned bounding box in an arbitrary dimension.