From b8dbd66db9eef679f8046c3ad84c465b275326e2 Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Thu, 17 Sep 2015 13:00:25 +0300 Subject: [PATCH] Fix problem with incorrect results of contains --- geometry/region2d.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/geometry/region2d.hpp b/geometry/region2d.hpp index cee91cc26e..b3437dd735 100644 --- a/geometry/region2d.hpp +++ b/geometry/region2d.hpp @@ -17,16 +17,18 @@ namespace m2 { struct DefEqualFloat { + // 10e-9 is two orders of magnitude more accurate than our OSM source data. + static double constexpr kPrecision = 10e-9; template bool EqualPoints(TPoint const & p1, TPoint const & p2) const { - return my::AlmostEqualAbs(p1.x, p2.x, static_cast(1e-7)) && - my::AlmostEqualAbs(p1.y, p2.y, static_cast(1e-7)); + return my::AlmostEqualAbs(p1.x, p2.x, static_cast(kPrecision)) && + my::AlmostEqualAbs(p1.y, p2.y, static_cast(kPrecision)); } template - bool EqualZero(TCoord val, TCoord exp) const + bool EqualZero(TCoord val, TCoord) const { - return my::AlmostEqualAbs(val, 0.0, exp); + return my::AlmostEqualAbs(val, 0.0, static_cast(kPrecision)); } };