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

Method RemoveEmptySpaceBetweenBorders

tools/poly_borders/borders_data.cpp:276–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void BordersData::RemoveEmptySpaceBetweenBorders()
277{
278 LOG(LINFO, ("Start removing empty space between borders."));
279
280 for (size_t curBorderId = 0; curBorderId < m_bordersPolygons.size(); ++curBorderId)
281 {
282 LOG(LDEBUG, ("Get:", m_indexToPolyFileName[curBorderId]));
283
284 if (ShouldLog(curBorderId, m_bordersPolygons.size()))
285 LOG(LINFO, ("Removing empty spaces:", curBorderId + 1, "/", m_bordersPolygons.size()));
286
287 auto & curPolygon = m_bordersPolygons[curBorderId];
288 for (size_t curPointId = 0; curPointId < curPolygon.m_points.size(); ++curPointId)
289 {
290 if (curPolygon.IsFrozen(curPointId, curPointId) || !HasLinkAt(curBorderId, curPointId))
291 continue;
292
293 size_t constexpr kMaxLookAhead = 5;
294 for (size_t shift = 1; shift <= kMaxLookAhead; ++shift)
295 {
296 if (TryToReplace(curBorderId, curPointId /* curLeftPointId */, curPointId + shift /* curRightPointId */) ==
297 base::ControlFlow::Break)
298 {
299 break;
300 }
301 }
302 }
303 }
304
305 DoReplace();
306}
307
308base::ControlFlow BordersData::TryToReplace(size_t curBorderId, size_t & curLeftPointId, size_t curRightPointId)
309{

Callers 2

mainFunction · 0.80
ProcessFunction · 0.80

Calls 3

ShouldLogFunction · 0.85
IsFrozenMethod · 0.80
sizeMethod · 0.45

Tested by 1

ProcessFunction · 0.64