| 70 | } |
| 71 | |
| 72 | bool NeedReplace(std::vector<m2::PointD> const & curSubpolygon, std::vector<m2::PointD> const & anotherSubpolygon) |
| 73 | { |
| 74 | auto const areaDiff = AbsAreaDiff(curSubpolygon, anotherSubpolygon); |
| 75 | double constexpr kMaxAreaDiffMetersSquared = 20000.0; |
| 76 | if (areaDiff > kMaxAreaDiffMetersSquared) |
| 77 | return false; |
| 78 | |
| 79 | if (AlmostEqualAbs(areaDiff, 0.0, BordersData::kEqualityEpsilon)) |
| 80 | return false; |
| 81 | |
| 82 | // We know that |curSize| is always greater than 1, because we construct it such way, but we know |
| 83 | // nothing about |anotherSize|, and we do not want to replace current subpolygon of several points |
| 84 | // with a subpolygon consisting of one point or consisting of too many points. |
| 85 | CHECK_GREATER(curSubpolygon.size(), 1, ()); |
| 86 | return 1 < anotherSubpolygon.size() && anotherSubpolygon.size() < 10; |
| 87 | } |
| 88 | |
| 89 | bool ShouldLog(size_t i, size_t n) |
| 90 | { |
no test coverage detected