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

@ -1 +1 @@
Subproject commit eae77cfdfb7eb64f87ddd48204ea9b90d6d5cfd8
Subproject commit 727ddfecc952e7bd8e4b11ef34436454a50e7532

View file

@ -190,7 +190,7 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
deleteOrphEdgs(g);
LOG(VDEBUG) << "Collapsing edges...";
// collapseEdges(g);
collapseEdges(g);
LOG(VDEBUG) << "Deleting orphan nodes...";
deleteOrphNds(g);

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;

View file

@ -990,6 +990,12 @@ CASE("geometry") {
geo::Line<double> llll{geo::Point<double>(1.2, 0), geo::Point<double>(1, 2)};
EXPECT(geo::intersects(llll, bbox));
Line<double> l5new;
l5new.push_back(Point<double>(-10, -5));
l5new.push_back(Point<double>(-8, -4));
EXPECT(geo::getBoundingBox(l5new).getUpperRight().getX() == approx(-8));
EXPECT(geo::getBoundingBox(l5new).getUpperRight().getY() == approx(-4));
Line<double> l5;
l5.push_back(Point<double>(0, 0));
l5.push_back(Point<double>(1.5, 2));