diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2015-09-17 13:00:25 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:06:11 +0300 |
commit | b8dbd66db9eef679f8046c3ad84c465b275326e2 (patch) | |
tree | b0746fc31638e8383341227973d584e3ce1281a1 /geometry | |
parent | 7970cc3aefcd555de9bb921470b745f0b38655f8 (diff) |
Fix problem with incorrect results of contains
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/region2d.hpp | 10 |
1 files 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 <class TPoint> bool EqualPoints(TPoint const & p1, TPoint const & p2) const { - return my::AlmostEqualAbs(p1.x, p2.x, static_cast<typename TPoint::value_type>(1e-7)) && - my::AlmostEqualAbs(p1.y, p2.y, static_cast<typename TPoint::value_type>(1e-7)); + return my::AlmostEqualAbs(p1.x, p2.x, static_cast<typename TPoint::value_type>(kPrecision)) && + my::AlmostEqualAbs(p1.y, p2.y, static_cast<typename TPoint::value_type>(kPrecision)); } template <class TCoord> - 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<TCoord>(kPrecision)); } }; |