class mrpt::math::CSplineInterpolator1D
Overview
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> class CSplineInterpolator1D: public mrpt::serialization::CSerializable { public: // typedefs typedef std::shared_ptr<mrpt::math ::CSplineInterpolator1D> Ptr; typedef std::shared_ptr<const mrpt::math ::CSplineInterpolator1D> ConstPtr; typedef std::unique_ptr<mrpt::math ::CSplineInterpolator1D> UniquePtr; typedef std::unique_ptr<const mrpt::math ::CSplineInterpolator1D> ConstUniquePtr; // fields static constexpr const char* className = "mrpt::math" "::" "CSplineInterpolator1D"; // construction template <class VECTOR> CSplineInterpolator1D( const VECTOR& initial_x, const VECTOR& initial_y, bool wrap2pi = false ); CSplineInterpolator1D(bool wrap2pi = false); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; void setWrap2pi(bool wrap); bool getWrap2pi(); template <class VECTOR> void setXY( const VECTOR& x, const VECTOR& y, bool clearPreviousContent = true ); void appendXY(double x, double y); void clear(); double& query(double x, double& y, bool& out_valid) const; template <class VECTOR1, class VECTOR2> bool queryVector(const VECTOR1& x, VECTOR2& out_y) const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
Typedefs
typedef std::shared_ptr<mrpt::math ::CSplineInterpolator1D> Ptr
A type for the associated smart pointer.
Construction
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.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
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 .
The vectors must have the same length.
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”.
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:
template <class VECTOR1, class VECTOR2> bool queryVector( const VECTOR1& x, VECTOR2& out_y ) const
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: