MCPcopy Create free account
hub / github.com/comaps/comaps / NeedReplace

Function NeedReplace

tools/poly_borders/borders_data.cpp:72–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72bool 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
89bool ShouldLog(size_t i, size_t n)
90{

Callers 1

TryToReplaceMethod · 0.85

Calls 3

AbsAreaDiffFunction · 0.85
AlmostEqualAbsFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected