Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/coding
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2018-07-26 17:35:11 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2018-08-01 13:45:25 +0300
commit159e70c4f76754f884b97f11d869ee0bd4bd338b (patch)
tree6d3c1c049a47f84a98a4aedf21752b83bf650cc1 /coding
parent4e04f92c65fb54f6905190748669607eb76d944d (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.cpp14
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;
}