diff options
author | Maxim Pimenov <m@maps.me> | 2018-07-26 17:35:11 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <bykoianko@gmail.com> | 2018-08-01 13:45:25 +0300 |
commit | 159e70c4f76754f884b97f11d869ee0bd4bd338b (patch) | |
tree | 6d3c1c049a47f84a98a4aedf21752b83bf650cc1 /coding | |
parent | 4e04f92c65fb54f6905190748669607eb76d944d (diff) |
[geometry] Refactoring of code that works with parametrized segments.
Specialized classes DistanceToLineSquare and ProjectionToSection
are replaced with a unified ParametrizedSegment class.
Diffstat (limited to 'coding')
-rw-r--r-- | coding/coding_tests/geometry_coding_test.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/coding/coding_tests/geometry_coding_test.cpp b/coding/coding_tests/geometry_coding_test.cpp index ffb8291589..08fc66083c 100644 --- a/coding/coding_tests/geometry_coding_test.cpp +++ b/coding/coding_tests/geometry_coding_test.cpp @@ -8,9 +8,9 @@ #include "coding/varint.hpp" #include "coding/writer.hpp" -#include "geometry/distance.hpp" #include "geometry/geometry_tests/large_polygon.hpp" #include "geometry/mercator.hpp" +#include "geometry/parametrized_segment.hpp" #include "geometry/simplification.hpp" #include "base/logging.hpp" @@ -67,10 +67,14 @@ void TestPolylineEncode(string testName, vector<m2::PointU> const & points, vector<m2::PointU> SimplifyPoints(vector<m2::PointU> const & points, double eps) { vector<m2::PointU> simpPoints; - typedef m2::DistanceToLineSquare<m2::PointD> DistanceF; - DistanceF dist; - SimplifyNearOptimal(20, points.begin(), points.end(), eps, dist, - AccumulateSkipSmallTrg<DistanceF, m2::PointU>(dist, simpPoints, eps)); + + auto distFact = [](m2::PointD const & p0, m2::PointD const & p1) { + return m2::ParametrizedSegment<m2::PointD>(p0, p1); + }; + + SimplifyNearOptimal( + 20, points.begin(), points.end(), eps, distFact, + AccumulateSkipSmallTrg<decltype(distFact), m2::PointU>(distFact, simpPoints, eps)); return simpPoints; } |