message: Add functions to obtain a line in an s interval
diff: #include <vector>
  #include <cmath>
  #include <limits>
  +#include <algorithm>
  #include <boost/tuple/tuple.hpp>
  #include <boost/geometry.hpp>
  @@ -46,6 +47,16 @@ class Line_t : public Shape<bg::model::linestring<T>, T> {
  recompute_s();
  }
  + std::vector<T> get_points_in_s_interval(float begin, float end) const {
  + std::vector<T> points;
  + uint begin_idx = std::lower_bound(s_.begin(), s_.end(), begin) - s_.begin();
  + uint end_idx = std::lower_bound(s_.begin(), s_.end(), end) - s_.begin();
  + std::copy(Shape<bg::model::linestring<T>, T>::obj_.begin() + begin_idx,
  + Shape<bg::model::linestring<T>, T>::obj_.begin() + end_idx,
  + std::back_inserter(points));
  + return points;
  + }
  +
  void reverse() {
  boost::geometry::reverse(Shape<bg::model::linestring<T>, T>::obj_);
  }
  @@ -68,7 +79,6 @@ class Line_t : public Shape<bg::model::linestring<T>, T> {
  boost::geometry::reverse(new_line.obj_);
  append_linestring(new_line);
  }
  -
  }
  typedef typename std::vector<T>::iterator point_iterator;
  @@ -212,6 +222,18 @@ inline Point2d get_normal_at_s(Line l, float s) {
  }
  +inline Line line_from_s_interval(Line line, float begin, float end) {
  + Line new_line;
  + new_line.add_point(get_point_at_s(line, begin));
  + std::vector<Point2d> points = line.get_points_in_s_interval(begin, end);
  + for (auto const &point : points) {
  + new_line.add_point(point);
  + }
  + new_line.add_point(get_point_at_s(line, end));
  + return new_line;
  +}
  +
  +
  inline std::tuple<Point2d, double, uint> get_nearest_point_and_s(Line l, const Point2d &p) { // get_nearest_point
  // edge cases: empty or one-point line
  if (l.obj_.empty()) {
  