Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public 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

Definition at line 29 of file CSplineInterpolator1D.h.

#include <mrpt/math/CSplineInterpolator1D.h>

Inheritance diagram for mrpt::math::CSplineInterpolator1D:
Inheritance graph

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.
 

Protected Member Functions

CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const MRPT_OVERRIDE
 
void readFromStream (mrpt::utils::CStream &in, int version) MRPT_OVERRIDE
 

Private Attributes

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

RTTI stuff <br>

typedef CSplineInterpolator1DPtr SmartPtr
 
static mrpt::utils::CLASSINIT _init_CSplineInterpolator1D
 
static mrpt::utils::TRuntimeClassId classCSplineInterpolator1D
 
static const mrpt::utils::TRuntimeClassIdclassinfo
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const MRPT_OVERRIDE
 
virtual mrpt::utils::CObjectduplicate () const MRPT_OVERRIDE
 
static mrpt::utils::CObjectCreateObject ()
 
static CSplineInterpolator1DPtr Create ()
 

Member Typedef Documentation

◆ SmartPtr

A typedef for the associated smart pointer

Definition at line 32 of file CSplineInterpolator1D.h.

Constructor & Destructor Documentation

◆ CSplineInterpolator1D() [1/2]

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 43 of file CSplineInterpolator1D.h.

◆ CSplineInterpolator1D() [2/2]

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

Constructor.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::utils::TRuntimeClassId * mrpt::math::CSplineInterpolator1D::_GetBaseClass ( )
staticprotected

◆ appendXY()

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

Append a new point:

◆ clear()

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

Clears all stored points.

Definition at line 79 of file CSplineInterpolator1D.h.

◆ Create()

static CSplineInterpolator1DPtr mrpt::math::CSplineInterpolator1D::Create ( )
static

◆ CreateObject()

static mrpt::utils::CObject * mrpt::math::CSplineInterpolator1D::CreateObject ( )
static

◆ duplicate()

virtual mrpt::utils::CObject * mrpt::math::CSplineInterpolator1D::duplicate ( ) const
virtual

◆ GetRuntimeClass()

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

◆ getWrap2pi()

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

Return the wrap property.

Definition at line 58 of file CSplineInterpolator1D.h.

◆ query()

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

◆ 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 93 of file CSplineInterpolator1D.h.

◆ readFromStream()

void mrpt::math::CSplineInterpolator1D::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protected

◆ setWrap2pi()

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

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

Definition at line 55 of file CSplineInterpolator1D.h.

◆ setXY()

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 64 of file CSplineInterpolator1D.h.

References ASSERT_EQUAL_, MRPT_END, and MRPT_START.

◆ writeToStream()

void mrpt::math::CSplineInterpolator1D::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
protected

Member Data Documentation

◆ _init_CSplineInterpolator1D

mrpt::utils::CLASSINIT mrpt::math::CSplineInterpolator1D::_init_CSplineInterpolator1D
staticprotected

Definition at line 32 of file CSplineInterpolator1D.h.

◆ classCSplineInterpolator1D

mrpt::utils::TRuntimeClassId mrpt::math::CSplineInterpolator1D::classCSplineInterpolator1D
static

Definition at line 32 of file CSplineInterpolator1D.h.

◆ classinfo

const mrpt::utils::TRuntimeClassId* mrpt::math::CSplineInterpolator1D::classinfo
static

Definition at line 32 of file CSplineInterpolator1D.h.

◆ m_wrap2pi

bool mrpt::math::CSplineInterpolator1D::m_wrap2pi
private

Whether to wrap "y".

Definition at line 38 of file CSplineInterpolator1D.h.

◆ m_x2y

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

The placeholders for the data.

Definition at line 36 of file CSplineInterpolator1D.h.




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Thu Mar 23 03:22:58 UTC 2023