Main MRPT website > C++ reference for MRPT 1.5.7
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | 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

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
voidoperator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
template<class VECTOR >
 CSplineInterpolator1D (const VECTOR &initial_x, const VECTOR &initial_y, bool wrap2pi=false)
 Constructor with optional initial values. More...
 
 CSplineInterpolator1D (bool wrap2pi=false)
 Constructor. More...
 
void setWrap2pi (bool wrap)
 If set to true, the interpolated data will be wrapped to ]-pi,pi]. More...
 
bool getWrap2pi ()
 Return the wrap property. More...
 
template<class VECTOR >
void setXY (const VECTOR &x, const VECTOR &y, bool clearPreviousContent=true)
 Set all the data at once . More...
 
void appendXY (double x, double y)
 Append a new point: More...
 
void clear ()
 Clears all stored points. More...
 
double & query (double x, double &y, bool &out_valid) const
 Query an interpolation of the curve at some "x". More...
 
template<class VECTOR1 , class VECTOR2 >
bool queryVector (const VECTOR1 &x, VECTOR2 &out_y) const
 As query, but for a whole vector at once. More...
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
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). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Static Public Attributes

static const mrpt::utils::TRuntimeClassId classCObject
 
RTTI stuff
static const mrpt::utils::TRuntimeClassId classCSerializable
 

Protected Member Functions

CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version)
 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. More...
 

Private Attributes

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

RTTI stuff

typedef CSplineInterpolator1DPtr Ptr
 
typedef CSplineInterpolator1DPtr ConstPtr
 
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
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CSplineInterpolator1DPtr Create ()
 

Member Typedef Documentation

typedef CSplineInterpolator1DPtr mrpt::math::CSplineInterpolator1D::ConstPtr

Definition at line 32 of file CSplineInterpolator1D.h.

typedef CSplineInterpolator1DPtr mrpt::math::CSplineInterpolator1D::Ptr

A typedef for the associated smart pointer

Definition at line 32 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 43 of file CSplineInterpolator1D.h.

CSplineInterpolator1D::CSplineInterpolator1D ( bool  wrap2pi = false)

Constructor.

Definition at line 34 of file CSplineInterpolator1D.cpp.

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::math::CSplineInterpolator1D::_GetBaseClass ( )
staticprotected
void CSplineInterpolator1D::appendXY ( double  x,
double  y 
)

Append a new point:

Definition at line 41 of file CSplineInterpolator1D.cpp.

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

Clears all stored points.

Definition at line 79 of file CSplineInterpolator1D.h.

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 143 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
inlineinherited

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 140 of file CObject.h.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

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

void mrpt::math::CSplineInterpolator1D::operator delete ( void ptr)
throw (
)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

void mrpt::math::CSplineInterpolator1D::operator delete ( void ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

void mrpt::math::CSplineInterpolator1D::operator delete ( void memory,
void ptr 
)
throw (
)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

void mrpt::math::CSplineInterpolator1D::operator delete[] ( void ptr)
throw (
)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

static void* mrpt::math::CSplineInterpolator1D::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 32 of file CSplineInterpolator1D.h.

void* mrpt::math::CSplineInterpolator1D::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

void* mrpt::math::CSplineInterpolator1D::operator new ( size_t  size)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

void* mrpt::math::CSplineInterpolator1D::operator new[] ( size_t  size)
inline

Definition at line 32 of file CSplineInterpolator1D.h.

double & 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

Definition at line 49 of file CSplineInterpolator1D.cpp.

References mrpt::math::spline().

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.

References DEFINE_SERIALIZABLE_POST_CUSTOM_BASE.

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

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

Implements mrpt::utils::CSerializable.

Definition at line 130 of file CSplineInterpolator1D.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

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.

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.

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB.

Definition at line 79 of file CSerializable.h.

References BASE_IMPEXP, DEFINE_MRPT_OBJECT_POST, mrpt::utils::ObjectToOctetVector(), mrpt::utils::ObjectToRawString(), mrpt::utils::ObjectToString(), mrpt::utils::OctetVectorToObject(), mrpt::utils::RawStringToObject(), and mrpt::utils::StringToObject().

Referenced by mrpt::poses::operator<<(), mrpt::utils::TCamera::readFromStream(), mrpt::obs::CObservationImage::readFromStream(), mrpt::obs::CObservationStereoImages::readFromStream(), mrpt::obs::CObservation2DRangeScan::readFromStream(), and mrpt::utils::CImage::readFromStream().

void CSplineInterpolator1D::writeToStream ( mrpt::utils::CStream out,
int getVersion 
) const
protectedvirtual

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

Implements mrpt::utils::CSerializable.

Definition at line 115 of file CSplineInterpolator1D.cpp.

Member Data Documentation

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

Definition at line 32 of file CSplineInterpolator1D.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 128 of file CObject.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 42 of file CSerializable.h.

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

Definition at line 32 of file CSplineInterpolator1D.h.

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

Definition at line 32 of file CSplineInterpolator1D.h.

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

Whether to wrap "y".

Definition at line 38 of file CSplineInterpolator1D.h.

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.8.11 for MRPT 1.5.7 Git: 2190203 Tue May 15 02:01:15 2018 +0200 at miƩ may 16 12:40:16 CEST 2018