curves::cubic_hermite_spline< Time, Numeric, Safe, Point > Struct Template Reference

#include <curves/fwd.h>

Inheritance diagram for curves::cubic_hermite_spline< Time, Numeric, Safe, Point >:
[legend]
Collaboration diagram for curves::cubic_hermite_spline< Time, Numeric, Safe, Point >:
[legend]

Public Types

typedef Point point_t
 
typedef std::pair< Point, Point > pair_point_tangent_t
 
typedef std::vector< pair_point_tangent_t, Eigen::aligned_allocator< Point > > t_pair_point_tangent_t
 
typedef std::vector< Time > vector_time_t
 
typedef Numeric num_t
 
typedef curve_abc< Time, Numeric, Safe, point_tcurve_abc_t
 
typedef cubic_hermite_spline< Time, Numeric, Safe, point_tcubic_hermite_spline_t
 
- Public Types inherited from curves::curve_abc< Time, Numeric, Safe, Point >
typedef Point point_t
 
typedef Point point_derivate_t
 
typedef Time time_t
 
typedef Numeric num_t
 
typedef curve_abc< Time, Numeric, Safe, point_t, point_derivate_tcurve_t
 
typedef boost::shared_ptr< curve_tcurve_ptr_t
 

Public Member Functions

 cubic_hermite_spline ()
 Empty constructor. More...
 
template<typename In >
 cubic_hermite_spline (In PairsBegin, In PairsEnd, const vector_time_t &time_control_points)
 Constructor. More...
 
 cubic_hermite_spline (const cubic_hermite_spline &other)
 
virtual ~cubic_hermite_spline ()
 Destructor. More...
 
virtual Point operator() (const Time t) const
 Evaluation of the cubic hermite spline at time t. More...
 
bool isApprox (const cubic_hermite_spline_t &other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 isApprox check if other and *this are approximately equals. More...
 
virtual bool isApprox (const curve_abc_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 
virtual bool operator== (const cubic_hermite_spline_t &other) const
 
virtual bool operator!= (const cubic_hermite_spline_t &other) const
 
virtual Point derivate (const Time t, const std::size_t order) const
 Evaluate the derivative of order N of spline at time t. More...
 
cubic_hermite_spline_t compute_derivate (const std::size_t) const
 
cubic_hermite_spline_tcompute_derivate_ptr (const std::size_t order) const
 Compute the derived curve at order N. More...
 
void setTime (const vector_time_t &time_control_points)
 Set time of each control point of cubic hermite spline. More...
 
t_pair_point_tangent_t getControlPoints ()
 Get vector of pair (positition, derivative) corresponding to control points. More...
 
vector_time_t getTime ()
 Get vector of Time corresponding to Time for each control point. More...
 
std::size_t size () const
 Get number of control points contained in the trajectory. More...
 
std::size_t numIntervals () const
 Get number of intervals (subsplines) contained in the trajectory. More...
 
Point evalCubicHermiteSpline (const Numeric t, std::size_t degree_derivative) const
 Evaluate value of cubic hermite spline or its derivate at specified order at time $t$. More...
 
virtual std::size_t dim () const
 Get dimension of curve. More...
 
virtual Time min () const
 Get the minimum time for which the curve is defined. More...
 
virtual Time max () const
 Get the maximum time for which the curve is defined. More...
 
virtual std::size_t degree () const
 Get the degree of the curve. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
- Public Member Functions inherited from curves::curve_abc< Time, Numeric, Safe, Point >
 curve_abc ()
 Constructor. More...
 
virtual ~curve_abc ()
 Destructor. More...
 
bool isEquivalent (const curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision(), const size_t order=5) const
 isEquivalent check if other and *this are approximately equal by values, given a precision treshold. More...
 
virtual bool isApprox (const curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const=0
 isApprox check if other and *this are approximately equals given a precision treshold Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent. More...
 
std::pair< time_t, time_ttimeRange ()
 
void serialize (Archive &, const unsigned int version)
 

Static Public Member Functions

static void evalCoeffs (const Numeric t, Numeric &h00, Numeric &h10, Numeric &h01, Numeric &h11, std::size_t degree_derivative)
 Evaluate coefficient for polynom of cubic hermite spline. More...
 

Public Attributes

std::size_t dim_
 Dim of curve. More...
 
t_pair_point_tangent_t control_points_
 Vector of pair < Point, Tangent >. More...
 
vector_time_t time_control_points_
 Vector of Time corresponding to time of each N control points : time at $P_0, P_1, P_2, ..., P_N$. More...
 
vector_time_t duration_splines_
 Vector of Time corresponding to time duration of each subspline. More...
 
Time T_min_
 Starting time of cubic hermite spline : T_min_ is equal to first time of control points. More...
 
Time T_max_
 Ending time of cubic hermite spline : T_max_ is equal to last time of control points. More...
 
std::size_t size_
 Number of control points (pairs). More...
 
std::size_t degree_
 Degree (Cubic so degree 3) More...
 

Friends

class boost::serialization::access
 

Member Typedef Documentation

◆ cubic_hermite_spline_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef cubic_hermite_spline<Time, Numeric, Safe, point_t> curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::cubic_hermite_spline_t

◆ curve_abc_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef curve_abc<Time, Numeric, Safe, point_t> curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::curve_abc_t

◆ num_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Numeric curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::num_t

◆ pair_point_tangent_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef std::pair<Point, Point> curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::pair_point_tangent_t

◆ point_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Point curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::point_t

◆ t_pair_point_tangent_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef std::vector<pair_point_tangent_t, Eigen::aligned_allocator<Point> > curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::t_pair_point_tangent_t

◆ vector_time_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef std::vector<Time> curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::vector_time_t

Constructor & Destructor Documentation

◆ cubic_hermite_spline() [1/3]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::cubic_hermite_spline ( )
inline

Empty constructor.

Curve obtained this way can not perform other class functions.

◆ cubic_hermite_spline() [2/3]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
template<typename In >
curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::cubic_hermite_spline ( In  PairsBegin,
In  PairsEnd,
const vector_time_t time_control_points 
)
inline

Constructor.

Parameters
wayPointsBegin: an iterator pointing to the first element of a pair(position, derivative) container.
wayPointsEns: an iterator pointing to the last element of a pair(position, derivative) container.
time_control_points: vector containing time for each waypoint.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::control_points_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::dim_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::setTime(), and curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size_.

◆ cubic_hermite_spline() [3/3]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::cubic_hermite_spline ( const cubic_hermite_spline< Time, Numeric, Safe, Point > &  other)
inline

◆ ~cubic_hermite_spline()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::~cubic_hermite_spline ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ compute_derivate()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
cubic_hermite_spline_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::compute_derivate ( const std::size_t  ) const
inline

◆ compute_derivate_ptr()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
cubic_hermite_spline_t* curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::compute_derivate_ptr ( const std::size_t  order) const
inlinevirtual

Compute the derived curve at order N.

Parameters
order: order of derivative.
Returns
A pointer to $\frac{d^Nx(t)}{dt^N}$ derivative order N of the curve.

Implements curves::curve_abc< Time, Numeric, Safe, Point >.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::compute_derivate().

◆ degree()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual std::size_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::degree ( ) const
inlinevirtual

◆ derivate()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual Point curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::derivate ( const Time  t,
const std::size_t  order 
) const
inlinevirtual

Evaluate the derivative of order N of spline at time t.

Parameters
t: time when to evaluate the spline.
order: order of derivative.
Returns
$\frac{d^Np(t)}{dt^N}$ point corresponding on derivative spline of order N at time t.

Implements curves::curve_abc< Time, Numeric, Safe, Point >.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::evalCubicHermiteSpline().

◆ dim()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual std::size_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::dim ( ) const
inlinevirtual

◆ evalCoeffs()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
static void curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::evalCoeffs ( const Numeric  t,
Numeric &  h00,
Numeric &  h10,
Numeric &  h01,
Numeric &  h11,
std::size_t  degree_derivative 
)
inlinestatic

Evaluate coefficient for polynom of cubic hermite spline.

Coefficients of polynom :

  • $h00(t)=2t^3-3t^2+1$;
  • $h10(t)=t^3-2t^2+t$;
  • $h01(t)=-2t^3+3t^2$;
  • $h11(t)=t^3-t^2$.
    From it, we can calculate their derivate order N : $\frac{d^Nh00(t)}{dt^N}$, $\frac{d^Nh10(t)}{dt^N}$, $\frac{d^Nh01(t)}{dt^N}$, $\frac{d^Nh11(t)}{dt^N}$.
    Parameters
    t: time to calculate coefficients.
    h00: variable to store value of coefficient.
    h10: variable to store value of coefficient.
    h01: variable to store value of coefficient.
    h11: variable to store value of coefficient.
    degree_derivative: order of derivative.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::control_points_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::dim_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::duration_splines_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size(), curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size_, and curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_.

Referenced by curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::evalCubicHermiteSpline().

◆ evalCubicHermiteSpline()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
Point curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::evalCubicHermiteSpline ( const Numeric  t,
std::size_t  degree_derivative 
) const
inline

Evaluate value of cubic hermite spline or its derivate at specified order at time $t$.

A cubic hermite spline on unit interval $[0,1]$ and given two control points defined by their position and derivative $\{p_0,m_0\}$ and $\{p_1,m_1\}$, is defined by the polynom :
$p(t)=h_{00}(t)P_0 + h_{10}(t)m_0 + h_{01}(t)p_1 + h_{11}(t)m_1$
To extend this formula to a cubic hermite spline on any arbitrary interval, we define $\alpha=(t-t_0)/(t_1-t_0) \in [0, 1]$ where $t \in [t_0, t_1]$.
Polynom $p(t) \in [t_0, t_1]$ becomes $p(\alpha) \in [0, 1]$ and $p(\alpha) = p((t-t_0)/(t_1-t_0))$.

Parameters
t: time when to evaluate the curve.
degree_derivative: Order of derivate of cubic hermite spline (set value to 0 if you do not want derivate)
Returns
point corresponding $p(t)$ on spline at time t or its derivate order N $\frac{d^Np(t)}{dt^N}$.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::control_points_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::evalCoeffs(), curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size_, and curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_.

Referenced by curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::derivate(), and curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::operator()().

◆ getControlPoints()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
t_pair_point_tangent_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::getControlPoints ( )
inline

Get vector of pair (positition, derivative) corresponding to control points.

Returns
vector containing control points.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::control_points_.

◆ getTime()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
vector_time_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::getTime ( )
inline

Get vector of Time corresponding to Time for each control point.

Returns
vector containing time of each control point.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_.

◆ isApprox() [1/2]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
bool curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::isApprox ( const cubic_hermite_spline_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inline

◆ isApprox() [2/2]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::isApprox ( const curve_abc_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inlinevirtual

◆ max()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual Time curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::max ( ) const
inlinevirtual

Get the maximum time for which the curve is defined.

Returns
$t_{max}$, upper bound of time range.

Implements curves::curve_abc< Time, Numeric, Safe, Point >.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_.

Referenced by curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::isApprox().

◆ min()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual Time curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::min ( ) const
inlinevirtual

Get the minimum time for which the curve is defined.

Returns
$t_{min}$, lower bound of time range.

Implements curves::curve_abc< Time, Numeric, Safe, Point >.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_.

Referenced by curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::isApprox().

◆ numIntervals()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
std::size_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::numIntervals ( ) const
inline

Get number of intervals (subsplines) contained in the trajectory.

Returns
number of intervals (subsplines).

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size().

◆ operator!=()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::operator!= ( const cubic_hermite_spline_t other) const
inlinevirtual

◆ operator()()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual Point curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::operator() ( const Time  t) const
inlinevirtual

◆ operator==()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::operator== ( const cubic_hermite_spline_t other) const
inlinevirtual

◆ serialize()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
template<class Archive >
void curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

◆ setTime()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
void curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::setTime ( const vector_time_t time_control_points)
inline

Set time of each control point of cubic hermite spline.

Set duration of each spline, Exemple : $( 0., 0.5, 0.9, ..., 4.5 )$ with values corresponding to times for $P_0, P_1, P_2, ..., P_N$ respectively.

Parameters
time_control_points: Vector containing time for each control point.

References curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size(), curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::T_max_, curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::T_min_, and curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_.

Referenced by curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::cubic_hermite_spline().

◆ size()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
std::size_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::size ( ) const
inline

Friends And Related Function Documentation

◆ boost::serialization::access

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
friend class boost::serialization::access
friend

Member Data Documentation

◆ control_points_

◆ degree_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
std::size_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::degree_

◆ dim_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
std::size_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::dim_

◆ duration_splines_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
vector_time_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::duration_splines_

Vector of Time corresponding to time duration of each subspline.


For N control points with time $T_{P_0}, T_{P_1}, T_{P_2}, ..., T_{P_N}$ respectively, duration of each subspline is : ( T_{P_1}-T_{P_0}, T_{P_2}-T_{P_1}, ..., T_{P_N}-T_{P_{N-1} )
It contains $N-1$ durations.

Referenced by curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::evalCoeffs(), and curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::isApprox().

◆ size_

◆ T_max_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
Time curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::T_max_

◆ T_min_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
Time curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::T_min_

◆ time_control_points_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
vector_time_t curves::cubic_hermite_spline< Time, Numeric, Safe, Point >::time_control_points_