NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LinearInterpolator.hpp
1 // Created on: May 23, 2015
2 // Author: Hafez Farazi <farazi@ais.uni-bonn.de>
3 
4 #pragma once
5 #include <math.h>
6 #include <vision_module/Tools/LineSegment.hpp>
13 {
14 private:
15  LineSegment line;
16 public:
17  inline LinearInterpolator(LineSegment _line):line(_line)
18  {
19 
20  }
21 
22  inline LinearInterpolator(cv::Point2d p1, cv::Point2d p2)
23  {
24  line.P1=p1;
25  line.P2=p2;
26  }
27 
28  inline double Interpolate(double x)
29  {
30  return (line.P1.y + (line.P2.y - line.P1.y) * (x - line.P1.x) / (line.P2.x - line.P1.x));
31  }
32 
33  inline virtual ~LinearInterpolator()
34  {
35 
36  }
37 };
A class representing line segments.
Definition: LineSegment.hpp:17
A class for linearInterpolation.
Definition: LinearInterpolator.hpp:12