Blobalizer
Loading...
Searching...
No Matches
BoundingBox< size, T > Struct Template Reference

A generic 3D axis-aligned bounding box defined by its minimum and maximum points. More...

#include <BoundingBox.h>

Public Types

typedef Magnum::Math::Vector< size, float > PointType
 The type of points that make up this box.
 

Public Member Functions

 BoundingBox ()
 Constructs a new empty bounding box.
 
 BoundingBox (const PointType &p)
 Creates a new bounding box contained the given point with zero size.
 
 BoundingBox (const PointType &min, const PointType &max)
 Creates a new minimal bounding box containing the two points. The given minimum point has to be smaller than the maximum.
 
bool operator== (const BoundingBox &other) const
 Compares this bounding box to another and checks if they are equal.
 
bool operator!= (const BoundingBox &other) const
 Compares this bounding box to another and checks if they are not equal.
 
PointType center () const
 Returns the center of this bounding box. The result of this method on an undefined bounding box will be NaN.
 
void reset ()
 Resets this bounding box to an undefined state.
 
PointType size () const
 Returns the size of this bounding box. The result of this method on an undefined bounding box will be -Inf.
 
PointType extends () const
 Returns the extends of this bounding box, this equal to half the size or the distance from the center to a corner. The result of this method on an undefined bounding box will be -Inf.
 
void expandBy (const PointType &p)
 Minimally expand this box to encompass the given point.
 
void expandBy (const BoundingBox &other)
 Minimally expand this box to encompass the given bounding box.
 
bool contains (const PointType &p) const
 Checks if the given point is contained within this bounding box.
 

Public Attributes

PointType min
 Component-wise minimum.
 
PointType max
 Component-wise maximum.
 

Detailed Description

template<size_t size, class T>
struct BoundingBox< size, T >

A generic 3D axis-aligned bounding box defined by its minimum and maximum points.

Template Parameters
Tthe type of component
sizethe dimension of this box

Member Typedef Documentation

◆ PointType

template<size_t size, class T >
typedef Magnum::Math::Vector<size, float> BoundingBox< size, T >::PointType

The type of points that make up this box.

Constructor & Destructor Documentation

◆ BoundingBox() [1/3]

template<size_t size, class T >
BoundingBox< size, T >::BoundingBox ( )
inline

Constructs a new empty bounding box.

◆ BoundingBox() [2/3]

template<size_t size, class T >
BoundingBox< size, T >::BoundingBox ( const PointType p)
inline

Creates a new bounding box contained the given point with zero size.

Parameters
pThe point defining the location of the bounding box.

◆ BoundingBox() [3/3]

template<size_t size, class T >
BoundingBox< size, T >::BoundingBox ( const PointType min,
const PointType max 
)
inline

Creates a new minimal bounding box containing the two points. The given minimum point has to be smaller than the maximum.

Parameters
minthe minimum bound of the box.
maxthe maximum bound of the box.

Member Function Documentation

◆ center()

template<size_t size, class T >
PointType BoundingBox< size, T >::center ( ) const
inline

Returns the center of this bounding box. The result of this method on an undefined bounding box will be NaN.

Returns
the center of this bounding box

◆ contains()

template<size_t size, class T >
bool BoundingBox< size, T >::contains ( const PointType p) const
inline

Checks if the given point is contained within this bounding box.

Parameters
pthe point to check
Returns
true if the point is contained within this bounding box, false otherwise

◆ expandBy() [1/2]

template<size_t size, class T >
void BoundingBox< size, T >::expandBy ( const BoundingBox< size, T > &  other)
inline

Minimally expand this box to encompass the given bounding box.

Parameters
pthe bounding box to add to this box.

◆ expandBy() [2/2]

template<size_t size, class T >
void BoundingBox< size, T >::expandBy ( const PointType p)
inline

Minimally expand this box to encompass the given point.

Parameters
pthe point to add to this box.

◆ extends()

template<size_t size, class T >
PointType BoundingBox< size, T >::extends ( ) const
inline

Returns the extends of this bounding box, this equal to half the size or the distance from the center to a corner. The result of this method on an undefined bounding box will be -Inf.

Returns
the extends of this bounding box

◆ operator!=()

template<size_t size, class T >
bool BoundingBox< size, T >::operator!= ( const BoundingBox< size, T > &  other) const
inline

Compares this bounding box to another and checks if they are not equal.

◆ operator==()

template<size_t size, class T >
bool BoundingBox< size, T >::operator== ( const BoundingBox< size, T > &  other) const
inline

Compares this bounding box to another and checks if they are equal.

◆ reset()

template<size_t size, class T >
void BoundingBox< size, T >::reset ( )
inline

Resets this bounding box to an undefined state.

◆ size()

template<size_t size, class T >
PointType BoundingBox< size, T >::size ( ) const
inline

Returns the size of this bounding box. The result of this method on an undefined bounding box will be -Inf.

Returns
the size of this bounding box

Member Data Documentation

◆ max

template<size_t size, class T >
PointType BoundingBox< size, T >::max

Component-wise maximum.

◆ min

template<size_t size, class T >
PointType BoundingBox< size, T >::min

Component-wise minimum.


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