Class CSplineInterpolator1D

Inheritance Relationships

Base Type

  • public mrpt::serialization::CSerializable

Class Documentation

class CSplineInterpolator1D : public mrpt::serialization::CSerializable

A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline interpolation, where possible. This class internally relies on mrpt::math::spline. Optionally the y coordinate can be set as wrapped in ]-pi,pi]. For querying interpolated points, see \ sa mrpt::math::spline, mrpt::poses::CPose3DInterpolator

Public Functions

template<class VECTOR>
inline CSplineInterpolator1D(const VECTOR &initial_x, const VECTOR &initial_y, bool wrap2pi = false)

Constructor with optional initial values.

CSplineInterpolator1D(bool wrap2pi = false)

Constructor

inline void setWrap2pi(bool wrap)

If set to true, the interpolated data will be wrapped to ]-pi,pi]

inline bool getWrap2pi()

Return the wrap property

template<class VECTOR>
inline void setXY(const VECTOR &x, const VECTOR &y, bool clearPreviousContent = true)

Set all the data at once . The vectors must have the same length.

void appendXY(double x, double y)

Append a new point:

inline void clear()

Clears all stored points

double &query(double x, double &y, bool &out_valid) const

Query an interpolation of the curve at some “x”. The result is stored in “y”. If the “x” point is out of range, “valid_out” is set to false.

See also

queryVector

Returns:

A reference to “y”

template<class VECTOR1, class VECTOR2>
inline bool queryVector(const VECTOR1 &x, VECTOR2 &out_y) const

As query, but for a whole vector at once.

See also

query

Returns:

false if there is at least one value that couldn’t be interpolated (in this case the output is indeterminate).