diff options
author | Yury Melnichek <melnichek@gmail.com> | 2011-01-03 20:51:24 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:09:11 +0300 |
commit | 22c2ab6839d5bbec9f3a2639483ddfe5732b1fcb (patch) | |
tree | c6633a87a210b05913d0522323b6defa0f30b228 /geometry/rect2d.hpp | |
parent | f2871f3fd2b16fcce0525e0fb4e9af013f60916f (diff) |
Refactor index to use FilesContainer and pass occlusionRect (unused for now) with query.
Diffstat (limited to 'geometry/rect2d.hpp')
-rw-r--r-- | geometry/rect2d.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/geometry/rect2d.hpp b/geometry/rect2d.hpp index 40109415bf..a4cd5a6b79 100644 --- a/geometry/rect2d.hpp +++ b/geometry/rect2d.hpp @@ -17,6 +17,7 @@ namespace m2 template <typename T> struct min_max_value<T, true> { T get_min() { return numeric_limits<T>::max(); } + // TODO: There is an overflow here: -(-128) != 127. T get_max() { return -get_min(); } }; template <typename T> struct min_max_value<T, false> @@ -52,6 +53,16 @@ namespace m2 { } + static Rect GetEmptyRect() { return Rect(); } + + static Rect GetInfiniteRect() + { + T const tMax = numeric_limits<T>::max(); + // This works for both ints and floats. + T const tMin = min(-tMax, numeric_limits<T>::min()); + return Rect(tMin, tMin, tMax, tMax); + } + void MakeEmpty() { m_minX = m_minY = impl::min_max_value<T, numeric_limits<T>::is_signed>().get_min(); |