From a2e355a683d7aeb64ada41c50e604342ffe69209 Mon Sep 17 00:00:00 2001 From: Vissarion Fysikopoulos Date: Tue, 12 Feb 2019 12:37:46 +0200 Subject: [PATCH] [algorithm] Simplify termination condition for single points in line_interpolate --- .../geometry/algorithms/line_interpolate_point.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/algorithms/line_interpolate_point.hpp b/include/boost/geometry/algorithms/line_interpolate_point.hpp index 28d896877..77e9ab844 100644 --- a/include/boost/geometry/algorithms/line_interpolate_point.hpp +++ b/include/boost/geometry/algorithms/line_interpolate_point.hpp @@ -104,14 +104,13 @@ struct range Distance prev_distance = 0; Distance current_distance = 0; point_t start_p = *prev; - bool single_point = false; - for ( ; it != end && !single_point; ++it) + for ( ; it != end ; ++it) { result_type res = strategy.compute(*prev, *it); current_distance = prev_distance + res.distance; - while (current_distance >= repeated_distance && !single_point) + while (current_distance >= repeated_distance ) { point_t p; strategy.apply(start_p, *it, @@ -120,17 +119,18 @@ struct range p, current_distance - prev_distance, res); - single_point = boost::is_same::value; policy.apply(p, pointlike); + if (boost::is_same::value) + { + return; + } start_p = p; prev_distance = repeated_distance; repeated_distance += max_distance; } - prev_distance = current_distance; prev = it; start_p = *prev; - } // case when max_distance is larger than linestring's length