NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
BoundaryLinearInterpolation.hpp
1 // Created on: June 30, 2015
2 // Author: Hafez Farazi <farazi@ais.uni-bonn.de>
3 #pragma once
4 #include <vision_module/Tools/LineSegment.hpp>
5 #include <math.h>
12 {
13 private:
14  LineSegment line;
15 public:
17  line(_line)
18  {
19 
20  }
21 
22  inline BoundaryLineInterpolation(double nearDistance,double nearValue,double farDistance,double farValue)
23  {
24  line.P1=Point2d(nearDistance,nearValue);
25  line.P2=Point2d(farDistance,farValue);
26  }
27 
28  inline bool GetValue(double distance, double &value)
29  {
30  double max_y = std::max(line.P1.y, line.P2.y);
31  LineSegment verLine(cv::Point(distance, 0), cv::Point2d(distance, max_y));
32  cv::Point2d resBand;
33  if (line.Intersect(verLine, resBand))
34  {
35  value = resBand.y;
36  return true;
37  }
38  return false;
39  }
40 
41  inline virtual ~BoundaryLineInterpolation()
42  {
43 
44  }
45 };
A class representing line segments.
Definition: LineSegment.hpp:17
A class for interpolating between boundaries.
Definition: BoundaryLinearInterpolation.hpp:11