Changed the way of handling BOX2 traits (used std::numeric_limits).
This commit is contained in:
parent
1e04f3b948
commit
c7fa57faf6
|
@ -28,24 +28,9 @@
|
|||
#define __BOX2_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <limits>
|
||||
|
||||
|
||||
template <class Vec>
|
||||
class BOX2_TRAITS
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
class BOX2_TRAITS<VECTOR2I>
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
c_max_size = INT_MAX - 1,
|
||||
c_min_coord_value = INT_MIN / 2 + 1
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Class BOX2
|
||||
* handles a 2-D bounding box, built on top of an origin point
|
||||
|
@ -59,8 +44,9 @@ private:
|
|||
Vec m_Size; // Rectangle Size
|
||||
|
||||
public:
|
||||
typedef typename Vec::coord_type coord_type;
|
||||
typedef typename Vec::extended_type ecoord_type;
|
||||
typedef typename Vec::coord_type coord_type;
|
||||
typedef typename Vec::extended_type ecoord_type;
|
||||
typedef typename std::numeric_limits<coord_type> coord_limits;
|
||||
|
||||
BOX2() {};
|
||||
|
||||
|
@ -73,8 +59,8 @@ public:
|
|||
|
||||
void SetMaximum()
|
||||
{
|
||||
m_Pos.x = m_Pos.y = BOX2_TRAITS<Vec>().c_min_coord_value;
|
||||
m_Size.x = m_Size.y = BOX2_TRAITS<Vec>().c_max_size;
|
||||
m_Pos.x = m_Pos.y = coord_limits::min() / 2 + coord_limits::epsilon();
|
||||
m_Size.x = m_Size.y = coord_limits::max() - coord_limits::epsilon();
|
||||
}
|
||||
|
||||
Vec Centre() const
|
||||
|
|
Loading…
Reference in New Issue