Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
mrpt::math::CSplineInterpolator1D Class Reference

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

#include <mrpt/math/CSplineInterpolator1D.h>

Inheritance diagram for mrpt::math::CSplineInterpolator1D:
Inheritance graph
[legend]

List of all members.

Public Member Functions

template<class VECTOR >
 CSplineInterpolator1D (const VECTOR &initial_x, const VECTOR &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.
template<class VECTOR >
void setXY (const VECTOR &x, const VECTOR &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".
template<class VECTOR1 , class VECTOR2 >
bool queryVector (const VECTOR1 &x, VECTOR2 &out_y) const
 As query, but for a whole vector at once.
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).
CObjectclone () const
 Cloning interface for smart pointers.

Static Public Attributes

static const
mrpt::utils::TRuntimeClassId 
classCObject

Protected Member Functions

virtual void writeToStream (mrpt::utils::CStream &out, int *getVersion) const =0
 Introduces a pure virtual method responsible for writing to a CStream.
virtual void readFromStream (mrpt::utils::CStream &in, int version)=0
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Private Attributes

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

RTTI stuff

typedef CSplineInterpolator1DPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CSplineInterpolator1D
static mrpt::utils::TRuntimeClassId classCSplineInterpolator1D
static const
mrpt::utils::TRuntimeClassId
classinfo
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CSplineInterpolator1DPtr Create ()

RTTI stuff

static const
mrpt::utils::TRuntimeClassId 
classCSerializable
class mrpt::utils::CStream

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 51 of file CSplineInterpolator1D.h.


Constructor & Destructor Documentation

template<class VECTOR >
mrpt::math::CSplineInterpolator1D::CSplineInterpolator1D ( const VECTOR &  initial_x,
const VECTOR &  initial_y,
bool  wrap2pi = false 
) [inline]

Constructor with optional initial values.

Definition at line 62 of file CSplineInterpolator1D.h.

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

Constructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::math::CSplineInterpolator1D::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::utils::CSerializable.

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

Append a new point:

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

Clears all stored points.

Definition at line 98 of file CSplineInterpolator1D.h.

CObject* mrpt::utils::CObject::clone ( ) const [inline, inherited]

Cloning interface for smart pointers.

Reimplemented in mrpt::opengl::CRenderizable, and mrpt::opengl::CRenderizableDisplayList.

Definition at line 154 of file CObject.h.

static CSplineInterpolator1DPtr mrpt::math::CSplineInterpolator1D::Create ( ) [static]
static mrpt::utils::CObject* mrpt::math::CSplineInterpolator1D::CreateObject ( ) [static]
virtual mrpt::utils::CObject* mrpt::math::CSplineInterpolator1D::duplicate ( ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const [inline, inherited]

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 151 of file CObject.h.

virtual const mrpt::utils::TRuntimeClassId* mrpt::math::CSplineInterpolator1D::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

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

Return the wrap property.

Definition at line 77 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
template<class VECTOR1 , class VECTOR2 >
bool mrpt::math::CSplineInterpolator1D::queryVector ( const VECTOR1 &  x,
VECTOR2 &  out_y 
) const [inline]

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

Definition at line 112 of file CSplineInterpolator1D.h.

virtual void mrpt::utils::CSerializable::readFromStream ( mrpt::utils::CStream in,
int  version 
) [protected, pure virtual, inherited]

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters:
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions:
std::exceptionOn any error, see CStream::ReadBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.

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

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

Definition at line 74 of file CSplineInterpolator1D.h.

template<class VECTOR >
void mrpt::math::CSplineInterpolator1D::setXY ( const VECTOR &  x,
const VECTOR &  y,
bool  clearPreviousContent = true 
) [inline]

Set all the data at once .

The vectors must have the same length.

Definition at line 83 of file CSplineInterpolator1D.h.

References MRPT_START, ASSERT_EQUAL_, and MRPT_END.

virtual void mrpt::utils::CSerializable::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const [protected, pure virtual, inherited]

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters:
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions:
std::exceptionOn any error, see CStream::WriteBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.


Friends And Related Function Documentation

friend class mrpt::utils::CStream [friend, inherited]

Member Data Documentation

Definition at line 51 of file CSplineInterpolator1D.h.

Definition at line 139 of file CObject.h.

Definition at line 56 of file CSerializable.h.

Definition at line 51 of file CSplineInterpolator1D.h.

Definition at line 51 of file CSplineInterpolator1D.h.

Whether to wrap "y".

Definition at line 57 of file CSplineInterpolator1D.h.

The placeholders for the data.

Definition at line 55 of file CSplineInterpolator1D.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011