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 /track_analyzing | |
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 'track_analyzing')
-rw-r--r-- | track_analyzing/track_matcher.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/track_analyzing/track_matcher.cpp b/track_analyzing/track_matcher.cpp index d8c7420679..e87d6fe899 100644 --- a/track_analyzing/track_matcher.cpp +++ b/track_analyzing/track_matcher.cpp @@ -8,7 +8,7 @@ #include <indexer/scales.hpp> -#include <geometry/distance.hpp> +#include <geometry/parametrized_segment.hpp> #include <base/stl_helpers.hpp> @@ -25,9 +25,8 @@ double constexpr kMatchingRange = 20.0; double DistanceToSegment(m2::PointD const & segmentBegin, m2::PointD const & segmentEnd, m2::PointD const & point) { - m2::ProjectionToSection<m2::PointD> projection; - projection.SetBounds(segmentBegin, segmentEnd); - m2::PointD const projectionPoint = projection(point); + m2::ParametrizedSegment<m2::PointD> const segment(segmentBegin, segmentEnd); + m2::PointD const projectionPoint = segment.ClosestPointTo(point); return MercatorBounds::DistanceOnEarth(point, projectionPoint); } |