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 28 of file CSplineInterpolator1D.h.
#include <mrpt/math/CSplineInterpolator1D.h>
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) noexcept |
void | operator delete[] (void *ptr) noexcept |
void | operator delete (void *memory, void *ptr) noexcept |
void * | operator 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 mxArray * | writeToMatlab () 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 | |
mrpt::utils::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 void * | operator new (size_t size, void *ptr) |
Protected Member Functions | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const override |
Introduces a pure virtual method responsible for writing to a CStream. More... | |
void | readFromStream (mrpt::utils::CStream &in, int version) override |
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 | |
using | Ptr = std::shared_ptr< CSplineInterpolator1D > |
using | ConstPtr = std::shared_ptr< const CSplineInterpolator1D > |
static mrpt::utils::CLASSINIT | _init_CSplineInterpolator1D |
static const mrpt::utils::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "CSplineInterpolator1D" |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
static const mrpt::utils::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static mrpt::utils::CObject * | CreateObject () |
template<typename... Args> | |
static Ptr | Create (Args &&... args) |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::utils::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
using mrpt::math::CSplineInterpolator1D::ConstPtr = std::shared_ptr<const CSplineInterpolator1D > |
Definition at line 30 of file CSplineInterpolator1D.h.
using mrpt::math::CSplineInterpolator1D::Ptr = std::shared_ptr< CSplineInterpolator1D > |
A typedef for the associated smart pointer
Definition at line 30 of file CSplineInterpolator1D.h.
|
inline |
Constructor with optional initial values.
Definition at line 42 of file CSplineInterpolator1D.h.
References setXY().
CSplineInterpolator1D::CSplineInterpolator1D | ( | bool | wrap2pi = false | ) |
Constructor.
Definition at line 34 of file CSplineInterpolator1D.cpp.
|
staticprotected |
void CSplineInterpolator1D::appendXY | ( | double | x, |
double | y | ||
) |
Append a new point:
Definition at line 41 of file CSplineInterpolator1D.cpp.
|
inline |
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
inlinestatic |
Definition at line 30 of file CSplineInterpolator1D.h.
|
static |
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
|
static |
|
inline |
Return the wrap property.
Definition at line 55 of file CSplineInterpolator1D.h.
References m_wrap2pi.
Definition at line 30 of file CSplineInterpolator1D.h.
|
inlinenoexcept |
Definition at line 30 of file CSplineInterpolator1D.h.
|
inlinenoexcept |
Definition at line 30 of file CSplineInterpolator1D.h.
Definition at line 30 of file CSplineInterpolator1D.h.
|
inlinestatic |
Definition at line 30 of file CSplineInterpolator1D.h.
|
inlinenoexcept |
Definition at line 30 of file CSplineInterpolator1D.h.
|
inline |
Definition at line 30 of file CSplineInterpolator1D.h.
|
inline |
Definition at line 30 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.
Definition at line 45 of file CSplineInterpolator1D.cpp.
References mrpt::math::spline().
Referenced by queryVector().
|
inline |
As query, but for a whole vector at once.
Definition at line 90 of file CSplineInterpolator1D.h.
References query().
|
overrideprotectedvirtual |
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.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any error, see CStream::ReadBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 125 of file CSplineInterpolator1D.cpp.
References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.
|
inline |
If set to true, the interpolated data will be wrapped to ]-pi,pi].
Definition at line 53 of file CSplineInterpolator1D.h.
References m_wrap2pi.
|
inline |
Set all the data at once .
The vectors must have the same length.
Definition at line 60 of file CSplineInterpolator1D.h.
References ASSERT_EQUAL_, m_x2y, MRPT_END, and MRPT_START.
Referenced by CSplineInterpolator1D().
|
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.
mxArray
(caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB. Definition at line 89 of file CSerializable.h.
|
overrideprotectedvirtual |
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.
out | The output binary stream where object must be dumped. |
getVersion | If nullptr, 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. |
std::exception | On any error, see CStream::WriteBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 110 of file CSplineInterpolator1D.cpp.
|
staticprotected |
Definition at line 30 of file CSplineInterpolator1D.h.
|
static |
Definition at line 30 of file CSplineInterpolator1D.h.
|
private |
Whether to wrap "y".
Definition at line 37 of file CSplineInterpolator1D.h.
Referenced by getWrap2pi(), and setWrap2pi().
|
private |
The placeholders for the data.
Definition at line 34 of file CSplineInterpolator1D.h.
|
staticprotected |
Definition at line 30 of file CSplineInterpolator1D.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |