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

Method RemoveDuplicatingPointImpl

tools/poly_borders/borders_data.hpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33 template <class PointsT>
34 static size_t RemoveDuplicatingPointImpl(PointsT & points)
35 {
36 auto const equalFn = [](auto const & p1, auto const & p2) { return p1.EqualDxDy(p2, kEqualityEpsilon); };
37
38 auto const last = std::unique(points.begin(), points.end(), equalFn);
39 size_t count = std::distance(last, points.end());
40 points.erase(last, points.end());
41
42 while (points.size() > 1 && equalFn(points.front(), points.back()))
43 {
44 ++count;
45 points.pop_back();
46 }
47
48 return count;
49 }
50
51 /// \brief Checks whether we can replace points from segment: [curLeftPointId, curRightPointId]
52 /// of |curBorderId| to points from another border in order to get rid of empty space

Callers

nothing calls this directly

Calls 10

uniqueFunction · 0.85
distanceFunction · 0.85
frontMethod · 0.80
backMethod · 0.80
EqualDxDyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected