CubbyFlow::BoundingBox< T, N > Class Template Reference

Generic N-D axis-aligned bounding box class. More...

#include <Core/BoundingBox/BoundingBox.h>

Public Types

using VectorType = Vector< T, N >
 

Public Member Functions

 BoundingBox ()
 Default constructor. More...
 
 BoundingBox (const VectorType &point1, const VectorType &point2)
 Constructs a box that tightly covers two points. More...
 
 BoundingBox (const BoundingBox &other)
 Constructs a box with other box instance. More...
 
bool Overlaps (const BoundingBox &other) const
 Returns true of this box and other box overlaps. More...
 
bool Contains (const VectorType &point) const
 Returns true if the input point is inside of this box. More...
 
VectorType MidPoint () const
 Returns the mid-point of this box. More...
 
DiagonalLength () const
 Returns diagonal length of this box. More...
 
DiagonalLengthSquared () const
 Returns squared diagonal length of this box. More...
 
void Reset ()
 Resets this box to initial state (min=infinite, max=-infinite). More...
 
void Merge (const VectorType &point)
 Merges this and other point. More...
 
void Merge (const BoundingBox &other)
 Merges this and other boxes. More...
 
void Expand (T delta)
 

Public Attributes

VectorType lowerCorner
 Lower corner of the bounding box. More...
 
VectorType upperCorner
 Upper corner of the bounding box. More...
 

Detailed Description

template<typename T, size_t N>
class CubbyFlow::BoundingBox< T, N >

Generic N-D axis-aligned bounding box class.

Template Parameters
T- Real number type.
N- Dimension.

Member Typedef Documentation

◆ VectorType

template<typename T , size_t N>
using CubbyFlow::BoundingBox< T, N >::VectorType = Vector<T, N>

Constructor & Destructor Documentation

◆ BoundingBox() [1/3]

template<typename T , size_t N>
CubbyFlow::BoundingBox< T, N >::BoundingBox ( )

Default constructor.

◆ BoundingBox() [2/3]

template<typename T , size_t N>
CubbyFlow::BoundingBox< T, N >::BoundingBox ( const VectorType point1,
const VectorType point2 
)

Constructs a box that tightly covers two points.

◆ BoundingBox() [3/3]

template<typename T , size_t N>
CubbyFlow::BoundingBox< T, N >::BoundingBox ( const BoundingBox< T, N > &  other)

Constructs a box with other box instance.

Member Function Documentation

◆ Contains()

template<typename T , size_t N>
bool CubbyFlow::BoundingBox< T, N >::Contains ( const VectorType point) const

Returns true if the input point is inside of this box.

◆ DiagonalLength()

template<typename T , size_t N>
T CubbyFlow::BoundingBox< T, N >::DiagonalLength ( ) const

Returns diagonal length of this box.

◆ DiagonalLengthSquared()

template<typename T , size_t N>
T CubbyFlow::BoundingBox< T, N >::DiagonalLengthSquared ( ) const

Returns squared diagonal length of this box.

◆ Expand()

template<typename T , size_t N>
void CubbyFlow::BoundingBox< T, N >::Expand ( delta)

Expands this box by given delta to all direction. If the width of the box was x, expand(y) will result a box with x+y+y width.

◆ Merge() [1/2]

template<typename T , size_t N>
void CubbyFlow::BoundingBox< T, N >::Merge ( const VectorType point)

Merges this and other point.

◆ Merge() [2/2]

template<typename T , size_t N>
void CubbyFlow::BoundingBox< T, N >::Merge ( const BoundingBox< T, N > &  other)

Merges this and other boxes.

◆ MidPoint()

template<typename T , size_t N>
Vector< T, N > CubbyFlow::BoundingBox< T, N >::MidPoint ( ) const

Returns the mid-point of this box.

◆ Overlaps()

template<typename T , size_t N>
bool CubbyFlow::BoundingBox< T, N >::Overlaps ( const BoundingBox< T, N > &  other) const

Returns true of this box and other box overlaps.

◆ Reset()

template<typename T , size_t N>
void CubbyFlow::BoundingBox< T, N >::Reset ( )

Resets this box to initial state (min=infinite, max=-infinite).

Member Data Documentation

◆ lowerCorner

template<typename T , size_t N>
VectorType CubbyFlow::BoundingBox< T, N >::lowerCorner

Lower corner of the bounding box.

◆ upperCorner

template<typename T , size_t N>
VectorType CubbyFlow::BoundingBox< T, N >::upperCorner

Upper corner of the bounding box.


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