curves::polynomial Class Reference

Represents a polynomial of an arbitrary order defined on the interval $[t_{min}, t_{max}]$. It follows the equation :
$ x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N $
where N is the order and $ t \in [t_{min}, t_{max}] $. More...

#include <curves/polynomial.h>

Public Types

typedef Point point_t
 
typedef T_Point t_point_t
 
typedef Time time_t
 
typedef Numeric num_t
 
typedef curve_abc< Time, Numeric, Safe, Point > curve_abc_t
 
typedef Eigen::MatrixXd coeff_t
 
typedef Eigen::Ref< coeff_tcoeff_t_ref
 
typedef polynomial< Time, Numeric, Safe, Point, T_Point > polynomial_t
 
typedef curve_abc_t::curve_ptr_t curve_ptr_t
 

Public Member Functions

 polynomial ()
 Empty constructor. More...
 
 polynomial (const coeff_t &coefficients, const time_t min, const time_t max)
 Constructor. More...
 
 polynomial (const T_Point &coefficients, const time_t min, const time_t max)
 Constructor. More...
 
template<typename In >
 polynomial (In zeroOrderCoefficient, In out, const time_t min, const time_t max)
 Constructor. More...
 
 polynomial (const Point &init, const Point &end, const time_t min, const time_t max)
 Constructor from boundary condition with C0 : create a polynomial that connect exactly init and end (order 1) More...
 
 polynomial (const Point &init, const Point &d_init, const Point &end, const Point &d_end, const time_t min, const time_t max)
 Constructor from boundary condition with C1 : create a polynomial that connect exactly init and end and thier first order derivatives(order 3) More...
 
 polynomial (const Point &init, const Point &d_init, const Point &dd_init, const Point &end, const Point &d_end, const Point &dd_end, const time_t min, const time_t max)
 Constructor from boundary condition with C2 : create a polynomial that connect exactly init and end and thier first and second order derivatives(order 5) More...
 
 ~polynomial ()
 Destructor. More...
 
 polynomial (const polynomial &other)
 
virtual point_t operator() (const time_t t) const
 Evaluation of the cubic spline at time t using horner's scheme. More...
 
bool isApprox (const polynomial_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 polynomial_t &other) const
 
virtual bool operator!= (const polynomial_t &other) const
 
virtual point_t derivate (const time_t t, const std::size_t order) const
 Evaluation of the derivative of order N of spline at time t. More...
 
polynomial_t compute_derivate (const std::size_t order) const
 
polynomial_tcompute_derivate_ptr (const std::size_t order) const
 Compute the derived curve at order N. More...
 
Eigen::MatrixXd coeff () const
 
point_t coeffAtDegree (const std::size_t degree) const
 
virtual std::size_t dim () const
 Get dimension of curve. More...
 
virtual num_t min () const
 Get the minimum time for which the curve is defined. More...
 
virtual num_t 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 Attributes

std::size_t dim_
 
coeff_t coefficients_
 
std::size_t degree_
 
time_t T_min_
 
time_t T_max_
 

Friends

class boost::serialization::access
 

Detailed Description

Represents a polynomial of an arbitrary order defined on the interval $[t_{min}, t_{max}]$. It follows the equation :
$ x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N $
where N is the order and $ t \in [t_{min}, t_{max}] $.

Member Typedef Documentation

◆ coeff_t

typedef Eigen::MatrixXd curves::polynomial::coeff_t

◆ coeff_t_ref

◆ curve_abc_t

typedef curve_abc<Time, Numeric, Safe, Point> curves::polynomial::curve_abc_t

◆ curve_ptr_t

◆ num_t

typedef Numeric curves::polynomial::num_t

◆ point_t

◆ polynomial_t

typedef polynomial<Time, Numeric, Safe, Point, T_Point> curves::polynomial::polynomial_t

◆ t_point_t

◆ time_t

Constructor & Destructor Documentation

◆ polynomial() [1/8]

curves::polynomial::polynomial ( )
inline

Empty constructor.

Curve obtained this way can not perform other class functions.

◆ polynomial() [2/8]

curves::polynomial::polynomial ( const coeff_t coefficients,
const time_t  min,
const time_t  max 
)
inline

Constructor.

Parameters
coefficients: a reference to an Eigen matrix where each column is a coefficient, from the zero order coefficient, up to the highest order. Spline order is given by the number of the columns -1.
min: LOWER bound on interval definition of the curve.
max: UPPER bound on interval definition of the curve.

◆ polynomial() [3/8]

curves::polynomial::polynomial ( const T_Point &  coefficients,
const time_t  min,
const time_t  max 
)
inline

Constructor.

Parameters
coefficients: a container containing all coefficients of the spline, starting with the zero order coefficient, up to the highest order. Spline order is given by the size of the coefficients.
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ polynomial() [4/8]

template<typename In >
curves::polynomial::polynomial ( In  zeroOrderCoefficient,
In  out,
const time_t  min,
const time_t  max 
)
inline

Constructor.

Parameters
zeroOrderCoefficient: an iterator pointing to the first element of a structure containing the coefficients it corresponds to the zero degree coefficient.
out: an iterator pointing to the last element of a structure ofcoefficients.
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ polynomial() [5/8]

curves::polynomial::polynomial ( const Point &  init,
const Point &  end,
const time_t  min,
const time_t  max 
)
inline

Constructor from boundary condition with C0 : create a polynomial that connect exactly init and end (order 1)

Parameters
initthe initial point of the curve
endthe final point of the curve
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

References coefficients_, max(), min(), T_max_, and T_min_.

◆ polynomial() [6/8]

curves::polynomial::polynomial ( const Point &  init,
const Point &  d_init,
const Point &  end,
const Point &  d_end,
const time_t  min,
const time_t  max 
)
inline

Constructor from boundary condition with C1 : create a polynomial that connect exactly init and end and thier first order derivatives(order 3)

Parameters
initthe initial point of the curve
d_initthe initial value of the derivative of the curve
endthe final point of the curve
d_endthe final value of the derivative of the curve
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

References coefficients_, degree_, dim_, max(), min(), T_max_, and T_min_.

◆ polynomial() [7/8]

curves::polynomial::polynomial ( const Point &  init,
const Point &  d_init,
const Point &  dd_init,
const Point &  end,
const Point &  d_end,
const Point &  dd_end,
const time_t  min,
const time_t  max 
)
inline

Constructor from boundary condition with C2 : create a polynomial that connect exactly init and end and thier first and second order derivatives(order 5)

Parameters
initthe initial point of the curve
d_initthe initial value of the derivative of the curve
d_initthe initial value of the second derivative of the curve
endthe final point of the curve
d_endthe final value of the derivative of the curve
d_endthe final value of the second derivative of the curve
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

References coefficients_, degree_, dim_, max(), min(), T_max_, and T_min_.

◆ ~polynomial()

curves::polynomial::~polynomial ( )
inline

Destructor.

◆ polynomial() [8/8]

curves::polynomial::polynomial ( const polynomial other)
inline

Member Function Documentation

◆ coeff()

Eigen::MatrixXd curves::polynomial::coeff ( ) const
inline

References coefficients_.

◆ coeffAtDegree()

point_t curves::polynomial::coeffAtDegree ( const std::size_t  degree) const
inline

References coefficients_, degree(), and degree_.

◆ compute_derivate()

polynomial_t curves::polynomial::compute_derivate ( const std::size_t  order) const
inline

◆ compute_derivate_ptr()

polynomial_t* curves::polynomial::compute_derivate_ptr ( const std::size_t  order) const
inline

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.

References compute_derivate().

◆ degree()

virtual std::size_t curves::polynomial::degree ( ) const
inlinevirtual

Get the degree of the curve.

Returns
$degree$, the degree of the curve.

References degree_.

Referenced by coeffAtDegree(), and isApprox().

◆ derivate()

virtual point_t curves::polynomial::derivate ( const time_t  t,
const std::size_t  order 
) const
inlinevirtual

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

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

References coefficients_, degree_, dim_, T_max_, and T_min_.

◆ dim()

virtual std::size_t curves::polynomial::dim ( ) const
inlinevirtual

Get dimension of curve.

Returns
dimension of curve.

References dim_.

Referenced by isApprox().

◆ isApprox() [1/2]

virtual bool curves::polynomial::isApprox ( const curve_abc_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inlinevirtual

References isApprox().

◆ isApprox() [2/2]

bool curves::polynomial::isApprox ( const polynomial_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inline

isApprox check if other and *this are approximately equals.

Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent

Parameters
otherthe other curve to check
precthe precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
Returns
true is the two curves are approximately equals

References coefficients_, degree(), degree_, dim(), dim_, max(), min(), T_max_, and T_min_.

Referenced by isApprox(), and operator==().

◆ max()

virtual num_t curves::polynomial::max ( ) const
inlinevirtual

Get the maximum time for which the curve is defined.

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

References T_max_.

Referenced by isApprox(), and polynomial().

◆ min()

virtual num_t curves::polynomial::min ( ) const
inlinevirtual

Get the minimum time for which the curve is defined.

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

References T_min_.

Referenced by isApprox(), and polynomial().

◆ operator!=()

virtual bool curves::polynomial::operator!= ( const polynomial_t other) const
inlinevirtual

◆ operator()()

virtual point_t curves::polynomial::operator() ( const time_t  t) const
inlinevirtual

Evaluation of the cubic spline at time t using horner's scheme.

Parameters
t: time when to evaluate the spline.
Returns
$x(t)$ point corresponding on spline at time t.

References coefficients_, degree_, T_max_, and T_min_.

◆ operator==()

virtual bool curves::polynomial::operator== ( const polynomial_t other) const
inlinevirtual

References isApprox().

◆ serialize()

template<class Archive >
void curves::polynomial::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

References coefficients_, degree_, dim_, T_max_, and T_min_.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ coefficients_

coeff_t curves::polynomial::coefficients_

◆ degree_

std::size_t curves::polynomial::degree_

◆ dim_

std::size_t curves::polynomial::dim_

◆ T_max_

time_t curves::polynomial::T_max_

◆ T_min_

time_t curves::polynomial::T_min_