Loading include/math/box2.h +6 −20 Original line number Original line Diff line number Diff line Loading @@ -28,24 +28,9 @@ #define __BOX2_H #define __BOX2_H #include <math/vector2d.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 * Class BOX2 * handles a 2-D bounding box, built on top of an origin point * handles a 2-D bounding box, built on top of an origin point Loading @@ -61,6 +46,7 @@ private: public: public: typedef typename Vec::coord_type coord_type; typedef typename Vec::coord_type coord_type; typedef typename Vec::extended_type ecoord_type; typedef typename Vec::extended_type ecoord_type; typedef typename std::numeric_limits<coord_type> coord_limits; BOX2() {}; BOX2() {}; Loading @@ -73,8 +59,8 @@ public: void SetMaximum() void SetMaximum() { { m_Pos.x = m_Pos.y = BOX2_TRAITS<Vec>().c_min_coord_value; m_Pos.x = m_Pos.y = coord_limits::min() / 2 + coord_limits::epsilon(); m_Size.x = m_Size.y = BOX2_TRAITS<Vec>().c_max_size; m_Size.x = m_Size.y = coord_limits::max() - coord_limits::epsilon(); } } Vec Centre() const Vec Centre() const Loading Loading
include/math/box2.h +6 −20 Original line number Original line Diff line number Diff line Loading @@ -28,24 +28,9 @@ #define __BOX2_H #define __BOX2_H #include <math/vector2d.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 * Class BOX2 * handles a 2-D bounding box, built on top of an origin point * handles a 2-D bounding box, built on top of an origin point Loading @@ -61,6 +46,7 @@ private: public: public: typedef typename Vec::coord_type coord_type; typedef typename Vec::coord_type coord_type; typedef typename Vec::extended_type ecoord_type; typedef typename Vec::extended_type ecoord_type; typedef typename std::numeric_limits<coord_type> coord_limits; BOX2() {}; BOX2() {}; Loading @@ -73,8 +59,8 @@ public: void SetMaximum() void SetMaximum() { { m_Pos.x = m_Pos.y = BOX2_TRAITS<Vec>().c_min_coord_value; m_Pos.x = m_Pos.y = coord_limits::min() / 2 + coord_limits::epsilon(); m_Size.x = m_Size.y = BOX2_TRAITS<Vec>().c_max_size; m_Size.x = m_Size.y = coord_limits::max() - coord_limits::epsilon(); } } Vec Centre() const Vec Centre() const Loading