| 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 |