Jet  v1.3.3
Public Types | Public Member Functions | Public Attributes | List of all members
jet::BoundingBox< T, N > Class Template Reference

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

#include <jet/bounding_box.h>

Public Types

typedef Vector< T, N > VectorType
 

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 jet::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>
typedef Vector<T, N> jet::BoundingBox< T, N >::VectorType

Constructor & Destructor Documentation

◆ BoundingBox() [1/3]

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

Default constructor.

◆ BoundingBox() [2/3]

template<typename T , size_t N>
jet::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>
jet::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 jet::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 jet::BoundingBox< T, N >::diagonalLength ( ) const

Returns diagonal length of this box.

◆ diagonalLengthSquared()

template<typename T , size_t N>
T jet::BoundingBox< T, N >::diagonalLengthSquared ( ) const

Returns squared diagonal length of this box.

◆ expand()

template<typename T , size_t N>
void jet::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 jet::BoundingBox< T, N >::merge ( const BoundingBox< T, N > &  other)

Merges this and other boxes.

◆ merge() [2/2]

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

Merges this and other point.

◆ midPoint()

template<typename T , size_t N>
VectorType jet::BoundingBox< T, N >::midPoint ( ) const

Returns the mid-point of this box.

◆ overlaps()

template<typename T , size_t N>
bool jet::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 jet::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 jet::BoundingBox< T, N >::lowerCorner

Lower corner of the bounding box.

◆ upperCorner

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

Upper corner of the bounding box.


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