correct use of numeric_limits

This commit is contained in:
Patrick Brosi 2018-08-02 19:41:39 +02:00
parent 64b83f569c
commit f56294b597
5 changed files with 10 additions and 4 deletions

View file

@ -16,7 +16,7 @@ class Box {
// maximum inverse box as default value of box
Box()
: _ll(std::numeric_limits<T>::max(), std::numeric_limits<T>::max()),
_ur(std::numeric_limits<T>::min(), std::numeric_limits<T>::min()) {}
_ur(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::lowest()) {}
Box(const Point<T>& ll, const Point<T>& ur) : _ll(ll), _ur(ur) {}
const Point<T>& getLowerLeft() const { return _ll; }
const Point<T>& getUpperRight() const { return _ur; }

View file

@ -1167,7 +1167,7 @@ inline Polygon<T> convexHull(const MultiPoint<T>& l) {
if (l.size() == 1) return convexHull(l[0]);
Point<T> left(std::numeric_limits<T>::max(), 0);
Point<T> right(std::numeric_limits<T>::min(), 0);
Point<T> right(std::numeric_limits<T>::lowest(), 0);
for (const auto& p : l) {
if (p.getX() <= left.getX()) left = p;
if (p.getX() >= right.getX()) right = p;