Go to the documentation of this file.
39 template <
class VECTOR>
41 const VECTOR& initial_x,
const VECTOR& initial_y,
bool wrap2pi =
false)
44 setXY(initial_x, initial_y);
57 template <
class VECTOR>
59 const VECTOR&
x,
const VECTOR&
y,
bool clearPreviousContent =
true)
62 if (clearPreviousContent)
m_x2y.clear();
64 const size_t n = size_t(
x.size());
65 for (
size_t i = 0; i <
n; i++)
m_x2y[
x[i]] =
y[i];
80 double&
query(
double x,
double&
y,
bool& out_valid)
const;
87 template <
class VECTOR1,
class VECTOR2>
90 const size_t n = size_t(
x.size());
92 bool valid, anyValid =
false;
93 for (
size_t i = 0; i <
n; i++)
95 query(
x[i], out_y[i], valid);
96 if (valid) anyValid =
true;
bool queryVector(const VECTOR1 &x, VECTOR2 &out_y) const
As query, but for a whole vector at once.
A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline ...
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
void setXY(const VECTOR &x, const VECTOR &y, bool clearPreviousContent=true)
Set all the data at once .
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double & query(double x, double &y, bool &out_valid) const
Query an interpolation of the curve at some "x".
CSplineInterpolator1D(const VECTOR &initial_x, const VECTOR &initial_y, bool wrap2pi=false)
Constructor with optional initial values.
bool getWrap2pi()
Return the wrap property.
void clear()
Clears all stored points.
bool m_wrap2pi
Whether to wrap "y".
The virtual base class which provides a unified interface for all persistent objects in MRPT.
std::map< double, double > m_x2y
The placeholders for the data.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void appendXY(double x, double y)
Append a new point:
void setWrap2pi(bool wrap)
If set to true, the interpolated data will be wrapped to ]-pi,pi].
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |