MRPT logo

mrpt::math::CSplineInterpolator1D Class Reference

A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline interpolation, where possible. More...

#include <mrpt/math/CSplineInterpolator1D.h>

Inheritance diagram for mrpt::math::CSplineInterpolator1D:

mrpt::utils::CSerializable

List of all members.

Public Member Functions

 CSplineInterpolator1D (const std::vector< double > &initial_x, const std::vector< double > &initial_y, bool wrap2pi=false)
 Constructor with optional initial values.
 CSplineInterpolator1D (bool wrap2pi=false)
 Constructor.
void setWrap2pi (bool wrap)
 If set to true, the interpolated data will be wrapped to ]-pi,pi].
bool getWrap2pi ()
 Return the wrap property.
void setXY (const std::vector< double > &x, const std::vector< double > &y, bool clearPreviousContent=true)
 Set all the data at once .
void appendXY (double x, double y)
 Append a new point:.
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".
bool queryVector (const vector_double &x, vector_double &out_y) const
 As query, but for a whole vector at once.

Private Attributes

std::map< double, double > m_x2y
 The placeholders for the data.
bool m_wrap2pi
 Whether to wrap "y".


Detailed Description

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

Definition at line 47 of file CSplineInterpolator1D.h.


Constructor & Destructor Documentation

mrpt::math::CSplineInterpolator1D::CSplineInterpolator1D ( const std::vector< double > &  initial_x,
const std::vector< double > &  initial_y,
bool  wrap2pi = false 
)

Constructor with optional initial values.

mrpt::math::CSplineInterpolator1D::CSplineInterpolator1D ( bool  wrap2pi = false  ) 

Constructor.


Member Function Documentation

void mrpt::math::CSplineInterpolator1D::appendXY ( double  x,
double  y 
)

Append a new point:.

void mrpt::math::CSplineInterpolator1D::clear ( void   )  [inline]

Clears all stored points.

Definition at line 84 of file CSplineInterpolator1D.h.

bool mrpt::math::CSplineInterpolator1D::getWrap2pi (  )  [inline]

Return the wrap property.

Definition at line 73 of file CSplineInterpolator1D.h.

double& mrpt::math::CSplineInterpolator1D::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.

Returns:
A reference to "y"
See also:
queryVector

bool mrpt::math::CSplineInterpolator1D::queryVector ( const vector_double x,
vector_double out_y 
) const

As query, but for a whole vector at once.

Returns:
false if there is at least one value that couldn't be interpolated (in this case the output is indeterminate).
See also:
query

void mrpt::math::CSplineInterpolator1D::setWrap2pi ( bool  wrap  )  [inline]

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

Definition at line 70 of file CSplineInterpolator1D.h.

void mrpt::math::CSplineInterpolator1D::setXY ( const std::vector< double > &  x,
const std::vector< double > &  y,
bool  clearPreviousContent = true 
)

Set all the data at once .

The vectors must have the same length.


Member Data Documentation

Whether to wrap "y".

Definition at line 56 of file CSplineInterpolator1D.h.

std::map<double,double> mrpt::math::CSplineInterpolator1D::m_x2y [private]

The placeholders for the data.

Definition at line 54 of file CSplineInterpolator1D.h.




Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:20:53 EDT 2009