trajectory_collection
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TrajColl::CubicHermiteSpline< T > Class Template Reference

Cubic Hermite spline. More...

#include <CubicHermiteSpline.h>

Inheritance diagram for TrajColl::CubicHermiteSpline< T >:
Inheritance graph
[legend]
Collaboration diagram for TrajColl::CubicHermiteSpline< T >:
Collaboration graph
[legend]

Public Member Functions

 CubicHermiteSpline (int dim, const std::map< double, std::pair< T, T >> &points={})
 Constructor. More...
 
const std::map< double, std::pair< T, T > > & points () const noexcept
 Access points. More...
 
void clearPoints ()
 Clear points. More...
 
void appendPoint (const std::pair< double, std::pair< T, T >> &point)
 Add point. More...
 
void calcCoeff ()
 Calculate coefficients. More...
 
virtual T operator() (double t) const override
 Evaluate function value. More...
 
virtual T derivative (double t, int order=1) const override
 Evaluate function derivative value. More...
 
void calcMonotoneVelocity (bool keepStartVel=false, bool keepEndVel=false)
 Overwrite the velocity with keeping the time and position for making cubic Hermite spline monotone. More...
 
- Public Member Functions inherited from TrajColl::PiecewiseFunc< T >
 PiecewiseFunc ()
 Constructor. More...
 
virtual size_t index (double t) const
 Get the index of piecewise functions. More...
 
virtual double domainLowerLimit () const override
 Get lower limit of domain. More...
 
virtual double domainUpperLimit () const override
 Get upper limit of domain. More...
 
void clearFuncs ()
 Clear function. More...
 
void appendFunc (double t, std::shared_ptr< Func< T >> func)
 Add function. More...
 
void setDomainLowerLimit (double t)
 Set lower limit of domain. More...
 
- Public Member Functions inherited from TrajColl::Func< T >
 Func ()
 Constructor. More...
 

Protected Member Functions

std::pair< double, double > argSegment (double t) const
 Get the piecewise segment. More...
 
- Protected Member Functions inherited from TrajColl::PiecewiseFunc< T >
void checkArg (double t) const
 Check argument of function. More...
 

Protected Attributes

int dim_
 Dimension of value. More...
 
std::map< double, std::pair< T, T > > points_
 Times, positions, and velocities in way points. More...
 
- Protected Attributes inherited from TrajColl::PiecewiseFunc< T >
std::map< double, std::shared_ptr< Func< T > > > funcs_
 Map of upper bound of domain and function. More...
 
double tLowerLimit_ = std::numeric_limits<double>::lowest()
 Lower limit of domain of this function. More...
 

Detailed Description

template<class T>
class TrajColl::CubicHermiteSpline< T >

Cubic Hermite spline.

Template Parameters
Tfunction value type

Definition at line 13 of file CubicHermiteSpline.h.

Constructor & Destructor Documentation

◆ CubicHermiteSpline()

template<class T >
TrajColl::CubicHermiteSpline< T >::CubicHermiteSpline ( int  dim,
const std::map< double, std::pair< T, T >> &  points = {} 
)
inline

Constructor.

Parameters
dimdimension of value
pointstimes, positions, and velocities in way points

Definition at line 20 of file CubicHermiteSpline.h.

Member Function Documentation

◆ appendPoint()

template<class T >
void TrajColl::CubicHermiteSpline< T >::appendPoint ( const std::pair< double, std::pair< T, T >> &  point)
inline

Add point.

Parameters
pointtime, position, and velocity of way point

Definition at line 37 of file CubicHermiteSpline.h.

◆ argSegment()

template<class T >
std::pair<double, double> TrajColl::CubicHermiteSpline< T >::argSegment ( double  t) const
inlineprotected

Get the piecewise segment.

Parameters
tarugment of function

Definition at line 230 of file CubicHermiteSpline.h.

◆ calcCoeff()

template<class T >
void TrajColl::CubicHermiteSpline< T >::calcCoeff ( )
inline

Calculate coefficients.

See https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Interpolation_on_an_arbitrary_interval for the algorithm

Definition at line 46 of file CubicHermiteSpline.h.

◆ calcMonotoneVelocity()

template<class T >
void TrajColl::CubicHermiteSpline< T >::calcMonotoneVelocity ( bool  keepStartVel = false,
bool  keepEndVel = false 
)
inline

Overwrite the velocity with keeping the time and position for making cubic Hermite spline monotone.

Parameters
keepStartVelWhether to try to keep the start velocity which is stored in points_ (just an attempt, so actually changed)
keepEndVelWhether to try to keep the end velocity which is stored in points_ (just an attempt, so actually changed)

See https://en.wikipedia.org/wiki/Monotone_cubic_interpolation#Interpolant_selection for the algorithm

Definition at line 117 of file CubicHermiteSpline.h.

◆ clearPoints()

template<class T >
void TrajColl::CubicHermiteSpline< T >::clearPoints ( )
inline

Clear points.

Definition at line 29 of file CubicHermiteSpline.h.

◆ derivative()

template<class T >
virtual T TrajColl::CubicHermiteSpline< T >::derivative ( double  t,
int  order = 1 
) const
inlineoverridevirtual

Evaluate function derivative value.

Parameters
tarugment of function
orderderivative order

Reimplemented from TrajColl::PiecewiseFunc< T >.

Definition at line 100 of file CubicHermiteSpline.h.

◆ operator()()

template<class T >
virtual T TrajColl::CubicHermiteSpline< T >::operator() ( double  t) const
inlineoverridevirtual

Evaluate function value.

Parameters
tarugment of function

Reimplemented from TrajColl::PiecewiseFunc< T >.

Definition at line 86 of file CubicHermiteSpline.h.

◆ points()

template<class T >
const std::map<double, std::pair<T, T> >& TrajColl::CubicHermiteSpline< T >::points ( ) const
inlinenoexcept

Access points.

Definition at line 23 of file CubicHermiteSpline.h.

Member Data Documentation

◆ dim_

template<class T >
int TrajColl::CubicHermiteSpline< T >::dim_
protected

Dimension of value.

Definition at line 242 of file CubicHermiteSpline.h.

◆ points_

template<class T >
std::map<double, std::pair<T, T> > TrajColl::CubicHermiteSpline< T >::points_
protected

Times, positions, and velocities in way points.

Definition at line 245 of file CubicHermiteSpline.h.


The documentation for this class was generated from the following file: