MRPT  1.9.9
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 24 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) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *memory, void *ptr) noexcept
 
voidoperator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
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...
 
RTTI classes and functions for polymorphic hierarchies
mrpt::rtti::CObject::Ptr 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...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Protected Member Functions

CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. 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

using Ptr = std::shared_ptr< CSplineInterpolator1D >
 
using ConstPtr = std::shared_ptr< const CSplineInterpolator1D >
 
using UniquePtr = std::unique_ptr< CSplineInterpolator1D >
 
using ConstUniquePtr = std::unique_ptr< const CSplineInterpolator1D >
 
static mrpt::rtti::CLASSINIT _init_CSplineInterpolator1D
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "CSplineInterpolator1D"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static mrpt::rtti::CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ ConstPtr

◆ ConstUniquePtr

Definition at line 26 of file CSplineInterpolator1D.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 26 of file CSplineInterpolator1D.h.

◆ UniquePtr

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

References setXY().

◆ CSplineInterpolator1D() [2/2]

CSplineInterpolator1D::CSplineInterpolator1D ( bool  wrap2pi = false)

Constructor.

Definition at line 29 of file CSplineInterpolator1D.cpp.

Member Function Documentation

◆ _GetBaseClass()

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

◆ appendXY()

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

Append a new point:

Definition at line 36 of file CSplineInterpolator1D.cpp.

◆ clear()

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

Clears all stored points.

Definition at line 71 of file CSplineInterpolator1D.h.

References m_x2y.

◆ clone()

virtual mrpt::rtti::CObject* mrpt::math::CSplineInterpolator1D::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ Create()

template<typename... Args>
static Ptr mrpt::math::CSplineInterpolator1D::Create ( Args &&...  args)
inlinestatic

Definition at line 26 of file CSplineInterpolator1D.h.

◆ CreateObject()

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

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::math::CSplineInterpolator1D::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 26 of file CSplineInterpolator1D.h.

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr 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 168 of file CObject.h.

References mrpt::rtti::CObject::clone().

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

◆ getClassName()

static constexpr auto mrpt::math::CSplineInterpolator1D::getClassName ( )
inlinestatic

Definition at line 26 of file CSplineInterpolator1D.h.

◆ GetRuntimeClass()

virtual const mrpt::rtti::TRuntimeClassId* mrpt::math::CSplineInterpolator1D::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::math::CSplineInterpolator1D::GetRuntimeClassIdStatic ( )
static

◆ getWrap2pi()

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

Return the wrap property.

Definition at line 51 of file CSplineInterpolator1D.h.

References m_wrap2pi.

◆ operator delete() [1/3]

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator delete() [2/3]

void mrpt::math::CSplineInterpolator1D::operator delete ( void ptr)
inlinenoexcept

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator delete() [3/3]

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator delete[]()

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator new() [1/3]

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator new() [2/3]

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator new() [3/3]

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ operator new[]()

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

Definition at line 26 of file CSplineInterpolator1D.h.

◆ query()

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 40 of file CSplineInterpolator1D.cpp.

References mrpt::math::spline().

Referenced by 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 86 of file CSplineInterpolator1D.h.

References query().

◆ serializeFrom()

void CSplineInterpolator1D::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

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 I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 108 of file CSplineInterpolator1D.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

◆ serializeGetVersion()

uint8_t CSplineInterpolator1D::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 101 of file CSplineInterpolator1D.cpp.

◆ serializeTo()

void CSplineInterpolator1D::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Pure virtual method for writing (serializing) to an abstract archive.

Users don't call this method directly. Instead, use stream << object;.

Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 102 of file CSplineInterpolator1D.cpp.

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

References m_wrap2pi.

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

References ASSERT_EQUAL_, m_x2y, MRPT_END, and MRPT_START.

Referenced by CSplineInterpolator1D().

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::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 nullptr is class does not support conversion to MATLAB.

Definition at line 68 of file CSerializable.h.

Member Data Documentation

◆ _init_CSplineInterpolator1D

mrpt::rtti::CLASSINIT mrpt::math::CSplineInterpolator1D::_init_CSplineInterpolator1D
staticprotected

Definition at line 26 of file CSplineInterpolator1D.h.

◆ className

constexpr const char* mrpt::math::CSplineInterpolator1D::className = "CSplineInterpolator1D"
static

Definition at line 26 of file CSplineInterpolator1D.h.

◆ m_wrap2pi

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

Whether to wrap "y".

Definition at line 33 of file CSplineInterpolator1D.h.

Referenced by getWrap2pi(), and setWrap2pi().

◆ m_x2y

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

The placeholders for the data.

Definition at line 30 of file CSplineInterpolator1D.h.

Referenced by clear(), and setXY().

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::math::CSplineInterpolator1D::runtimeClassId
staticprotected

Definition at line 26 of file CSplineInterpolator1D.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020