Main MRPT website > C++ reference for MRPT 1.5.6
interp_fit.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
8  +---------------------------------------------------------------------------+ */
9 #pragma once
10
11 #include <mrpt/utils/utils_defs.h>
13 #include <mrpt/math/wrap2pi.h>
14
15 namespace mrpt
16 {
17  namespace math
18  {
19  /** @addtogroup interpolation_grp Interpolation, least-squares fit, splines
20  * \ingroup mrpt_base_grp
21  * @{ */
22
23  /** Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximation of the sequence at the point "x".
24  * If the point "x" is out of the range [x0,x1], the closest extreme "ys" value is returned.
25  * \note Implementation in `#include <mrpt/math/interp_fit.hpp>`
26  * \sa spline, interpolate2points
27  */
28  template <class T,class VECTOR>
29  T interpolate(const T &x, const VECTOR &ys, const T &x0, const T &x1);
30
31  /** Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1).
32  * If wrap2pi is true, output is wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range).
33  * \sa spline, interpolate, leastSquareLinearFit
34  */
35  double BASE_IMPEXP interpolate2points(const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi = false);
36
37  /** Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the two middle points
38  * If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range).
39  * \sa leastSquareLinearFit
40  * \note Implementation in `#include <mrpt/math/interp_fit.hpp>`
41  */
42  template <typename NUMTYPE, class VECTORLIKE>
43  NUMTYPE spline(const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi = false);
44
45  /** Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a single point "t".
46  * The vectors x and y must have size >=2, and all values of "x" must be different.
47  * If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range).
48  * \sa spline
49  * \sa getRegressionLine, getRegressionPlane
50  * \note Implementation in `#include <mrpt/math/interp_fit.hpp>`
51  */
52  template <typename NUMTYPE,class VECTORLIKE, int NUM_POINTS = Eigen::Dynamic>
53  NUMTYPE leastSquareLinearFit(const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi = false);
54
55  /** Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a sequence of points "ts" and returned at "outs".
56  * If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range).
57  * \sa spline, getRegressionLine, getRegressionPlane
58  * \note Implementation in `#include <mrpt/math/interp_fit.hpp>`
59  */
60  template <class VECTORLIKE1,class VECTORLIKE2,class VECTORLIKE3, int NUM_POINTS = Eigen::Dynamic>
61  void leastSquareLinearFit(const VECTORLIKE1 &ts,VECTORLIKE2 &outs,const VECTORLIKE3 &x,const VECTORLIKE3 &y,bool wrap2pi = false);
62
63  /** @} */ // end grouping interpolation_grp
64
65 } // End of MATH namespace
66 } // End of namespace
NUMTYPE leastSquareLinearFit(const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)
Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y"...
Definition: interp_fit.hpp:114
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1166
T interpolate(const T &x, const VECTOR &ys, const T &x0, const T &x1)
Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximat...
Definition: interp_fit.hpp:17
GLdouble GLdouble t
Definition: glew.h:1303
GLint GLint GLint GLint GLint x
Definition: glew.h:1166
NUMTYPE spline(const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)
Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the tw...
Definition: interp_fit.hpp:37
double BASE_IMPEXP interpolate2points(const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi=false)
Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1).
Definition: math.cpp:2043

 Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018