DNA Calib 1.1
Project brief
Public Member Functions | Static Public Attributes | Private Types | Private Attributes | List of all members
dnac::BoundingBox Class Reference

#include <BoundingBox.h>

Collaboration diagram for dnac::BoundingBox:
Collaboration graph

Public Member Functions

template<typename TIter , typename std::enable_if< std::is_same< unqualified_iter_value_type< TIter >, fvec2 >::value, void >::type * = nullptr>
 BoundingBox (TIter begin, TIter end, float alpha)
 
template<typename TContainer >
 BoundingBox (TContainer container, float alpha=defaultAlpha)
 
bool contains (const fvec2 &point) const
 
fvec2 getMin () const
 
fvec2 getMax () const
 

Static Public Attributes

static constexpr float defaultAlpha = 0.0003f
 

Private Types

template<typename TIter >
using unqualified_iter_value_type = typename std::remove_cv< typename std::iterator_traits< TIter >::value_type >::type
 

Private Attributes

fvec2 min
 
fvec2 max
 

Member Typedef Documentation

◆ unqualified_iter_value_type

template<typename TIter >
using dnac::BoundingBox::unqualified_iter_value_type = typename std::remove_cv<typename std::iterator_traits<TIter>::value_type>::type
private

Constructor & Destructor Documentation

◆ BoundingBox() [1/2]

template<typename TIter , typename std::enable_if< std::is_same< unqualified_iter_value_type< TIter >, fvec2 >::value, void >::type * = nullptr>
dnac::BoundingBox::BoundingBox ( TIter  begin,
TIter  end,
float  alpha 
)
inline
25 :
26 min{std::numeric_limits<float>::max(), std::numeric_limits<float>::max()},
27 max{std::numeric_limits<float>::min(), std::numeric_limits<float>::min()} {
28
29 for (auto it = begin; it < end; it++) {
30 const auto& vertex = *it;
31 min[0] = std::min(vertex[0], min[0]);
32 min[1] = std::min(vertex[1], min[1]);
33 max[0] = std::max(vertex[0], max[0]);
34 max[1] = std::max(vertex[1], max[1]);
35 }
36 min -= alpha;
37 max += alpha;
38 }
fvec2 min
Definition: BoundingBox.h:59
fvec2 max
Definition: BoundingBox.h:60

References max, and min.

◆ BoundingBox() [2/2]

template<typename TContainer >
dnac::BoundingBox::BoundingBox ( TContainer  container,
float  alpha = defaultAlpha 
)
inlineexplicit
41 :
42 BoundingBox(std::begin(container), std::end(container), alpha) {
43 }
BoundingBox(TIter begin, TIter end, float alpha)
Definition: BoundingBox.h:25

Member Function Documentation

◆ contains()

bool dnac::BoundingBox::contains ( const fvec2 point) const
inline
45 {
46 return point[0] >= min[0] && point[0] <= max[0] &&
47 point[1] >= min[1] && point[1] <= max[1];
48 }

References max, and min.

◆ getMax()

fvec2 dnac::BoundingBox::getMax ( ) const
inline
54 {
55 return max;
56 }

References max.

◆ getMin()

fvec2 dnac::BoundingBox::getMin ( ) const
inline
50 {
51 return min;
52 }

References min.

Member Data Documentation

◆ defaultAlpha

constexpr float dnac::BoundingBox::defaultAlpha = 0.0003f
staticconstexpr

◆ max

fvec2 dnac::BoundingBox::max
private

Referenced by BoundingBox(), contains(), and getMax().

◆ min

fvec2 dnac::BoundingBox::min
private

Referenced by BoundingBox(), contains(), and getMin().


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