#include <ndcurves/piecewise_curve.h>
Public Types | |
typedef Point | point_t |
typedef Point_derivate | point_derivate_t |
typedef std::vector< point_t, Eigen::aligned_allocator< point_t > > | t_point_t |
typedef std::vector< point_derivate_t, Eigen::aligned_allocator< point_derivate_t > > | t_point_derivate_t |
typedef Time | time_t |
typedef Numeric | num_t |
typedef curve_abc< Time, Numeric, Safe, point_t, point_derivate_t > | base_curve_t |
typedef CurveType | curve_t |
typedef boost::shared_ptr< curve_t > | curve_ptr_t |
typedef std::vector< curve_ptr_t > | t_curve_ptr_t |
typedef std::vector< Time > | t_time_t |
typedef piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType > | piecewise_curve_t |
typedef piecewise_curve< Time, Numeric, Safe, Point_derivate, Point_derivate, typename CurveType::curve_derivate_t > | piecewise_curve_derivate_t |
typedef boost::shared_ptr< typename piecewise_curve_derivate_t::curve_t > | curve_derivate_ptr_t |
![]() | |
typedef Point | point_t |
typedef Point_derivate | point_derivate_t |
typedef Time | time_t |
typedef Numeric | num_t |
typedef curve_abc< Time, Numeric, Safe, point_t, point_derivate_t > | curve_t |
typedef curve_abc< Time, Numeric, Safe, point_derivate_t > | curve_derivate_t |
typedef boost::shared_ptr< curve_t > | curve_ptr_t |
Public Member Functions | |
piecewise_curve () | |
Empty constructor. Add at least one curve to call other class functions. More... | |
piecewise_curve (const curve_ptr_t &cf) | |
Constructor. Initialize a piecewise curve by giving the first curve. More... | |
piecewise_curve (const t_curve_ptr_t &curves_list) | |
piecewise_curve (const piecewise_curve &other) | |
virtual | ~piecewise_curve () |
virtual point_t | operator() (const Time t) const |
Evaluation of the cubic spline at time t. More... | |
bool | isApprox (const piecewise_curve_t &other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const |
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 More... | |
virtual bool | isApprox (const base_curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const |
isApprox check if other and *this are approximately equal given a precision treshold Only two curves of the same class can be approximately equal, for comparison between different type of curves see isEquivalent. More... | |
virtual bool | operator== (const piecewise_curve_t &other) const |
virtual bool | operator!= (const piecewise_curve_t &other) const |
virtual point_derivate_t | derivate (const Time t, const std::size_t order) const |
Evaluate the derivative of order N of curve at time t. More... | |
piecewise_curve_derivate_t * | compute_derivate_ptr (const std::size_t order) const |
compute_derivate return a piecewise_curve which is the derivative of this at given order More... | |
template<typename Curve > | |
void | add_curve (const Curve &curve) |
void | add_curve_ptr (const curve_ptr_t &cf) |
Add a new curve to piecewise curve, which should be defined in ![]() ![]() ![]() | |
bool | is_continuous (const std::size_t order) |
Check if the curve is continuous of order given. More... | |
std::size_t | num_curves () const |
Get number of curves in piecewise curve. More... | |
curve_ptr_t | curve_at_time (const time_t t) const |
Get curve corresponding to time t in piecewise curve. Example : A piecewise curve PC made of two curves : c1 for t in [0,1] and c2 for t in ]1,2]. PC.curve_at_time(0.5) will return c1. More... | |
curve_ptr_t | curve_at_index (const std::size_t idx) const |
Get curve at specified index in piecewise curve. More... | |
template<typename Bezier > | |
piecewise_curve_t | convert_piecewise_curve_to_bezier () |
Convert all curves in piecewise curve into bezier curves. More... | |
template<typename Hermite > | |
piecewise_curve_t | convert_piecewise_curve_to_cubic_hermite () |
Convert all curves in piecewise curve into cubic hermite curves. Curves need to be of degree inferior or equal to three. More... | |
template<typename Polynomial > | |
piecewise_curve_t | convert_piecewise_curve_to_polynomial () |
Convert all curves in piecewise curve into polynomial curves. 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... | |
std::size_t | getNumberCurves () |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
![]() | |
curve_abc () | |
Constructor. More... | |
virtual | ~curve_abc () |
Destructor. More... | |
virtual point_t | operator() (const time_t t) const =0 |
Evaluation of the cubic spline at time t. More... | |
virtual curve_derivate_t * | compute_derivate_ptr (const std::size_t order) const =0 |
Compute the derived curve at order N. More... | |
virtual point_derivate_t | derivate (const time_t t, const std::size_t order) const =0 |
Evaluate the derivative of order N of curve at time t. 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. This test is done by discretizing both curves and evaluating them and their derivatives. 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 equal given a precision treshold Only two curves of the same class can be approximately equal, for comparison between different type of curves see isEquivalent. More... | |
virtual std::size_t | dim () const =0 |
Get dimension of curve. More... | |
virtual time_t | min () const =0 |
Get the minimum time for which the curve is defined. More... | |
virtual time_t | max () const =0 |
Get the maximum time for which the curve is defined. More... | |
virtual std::size_t | degree () const =0 |
Get the degree of the curve. More... | |
std::pair< time_t, time_t > | timeRange () |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
![]() | |
template<class Derived > | |
void | loadFromText (const std::string &filename) |
Loads a Derived object from a text file. More... | |
template<class Derived > | |
void | saveAsText (const std::string &filename) const |
Saved a Derived object as a text file. More... | |
template<class Derived > | |
void | loadFromXML (const std::string &filename, const std::string &tag_name) |
Loads a Derived object from an XML file. More... | |
template<class Derived > | |
void | saveAsXML (const std::string &filename, const std::string &tag_name) const |
Saved a Derived object as an XML file. More... | |
template<class Derived > | |
void | loadFromBinary (const std::string &filename) |
Loads a Derived object from an binary file. More... | |
template<class Derived > | |
void | saveAsBinary (const std::string &filename) const |
Saved a Derived object as an binary file. More... | |
Static Public Member Functions | |
template<typename Polynomial > | |
static piecewise_curve_t | convert_discrete_points_to_polynomial (t_point_t points, t_time_t time_points) |
Convert discrete points into piecewise polynomial curve with C0 continuity. More... | |
template<typename Polynomial > | |
static piecewise_curve_t | convert_discrete_points_to_polynomial (t_point_t points, t_point_derivate_t points_derivative, t_time_t time_points) |
Convert discrete points into piecewise polynomial curve with C1 continuity. More... | |
template<typename Polynomial > | |
static piecewise_curve_t | convert_discrete_points_to_polynomial (t_point_t points, t_point_derivate_t points_derivative, t_point_derivate_t points_second_derivative, t_time_t time_points) |
Convert discrete points into piecewise polynomial curve with C2 continuity. More... | |
template<typename Polynomial > | |
static piecewise_curve_t | load_piecewise_from_text_file (const std::string &filename, const time_t dt, const size_t dim) |
load_piecewise_from_text_file build a piecewise polynomial from a list of discrete points read from a file. The file should contains one points per line, optionally with it's derivative and second derivatives. Each lines should then contains dim, 2*dim or 3*dim values More... | |
Public Attributes | |
std::size_t | dim_ |
t_curve_ptr_t | curves_ |
t_time_t | time_curves_ |
std::size_t | size_ |
Time | T_min_ |
Time | T_max_ |
Friends | |
class | boost::serialization::access |
typedef curve_abc<Time, Numeric, Safe, point_t, point_derivate_t> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::base_curve_t |
typedef boost::shared_ptr<typename piecewise_curve_derivate_t::curve_t> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::curve_derivate_ptr_t |
typedef boost::shared_ptr<curve_t> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::curve_ptr_t |
typedef CurveType ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::curve_t |
typedef Numeric ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::num_t |
typedef piecewise_curve<Time, Numeric, Safe, Point_derivate, Point_derivate, typename CurveType::curve_derivate_t> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::piecewise_curve_derivate_t |
typedef piecewise_curve<Time, Numeric, Safe, Point, Point_derivate, CurveType> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::piecewise_curve_t |
typedef Point_derivate ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::point_derivate_t |
typedef Point ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::point_t |
typedef std::vector<curve_ptr_t> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::t_curve_ptr_t |
typedef std::vector<point_derivate_t, Eigen::aligned_allocator<point_derivate_t> > ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::t_point_derivate_t |
typedef std::vector<point_t, Eigen::aligned_allocator<point_t> > ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::t_point_t |
typedef std::vector<Time> ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::t_time_t |
typedef Time ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::time_t |
|
inline |
Empty constructor. Add at least one curve to call other class functions.
|
inline |
Constructor. Initialize a piecewise curve by giving the first curve.
cf | : a curve. |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
Add a new curve to piecewise curve, which should be defined in
cf | : curve to add. |
|
inlinevirtual |
compute_derivate return a piecewise_curve which is the derivative of this at given order
order | order of derivative |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinestatic |
Convert discrete points into piecewise polynomial curve with C2 continuity.
points | : discrete points to convert. |
points_derivative | : derivative of order 1 corresponding to each point in piecewise curve. |
points_second_derivative | : derivative of order 2 corresponding to each point in piecewise curve. |
time_points | : time corresponding to each point in piecewise curve. |
|
inlinestatic |
Convert discrete points into piecewise polynomial curve with C1 continuity.
points | : discrete points to convert. |
points_derivative | : derivative of order 1 corresponding to each point in piecewise curve. |
time_points | : time corresponding to each point in piecewise curve. |
|
inlinestatic |
Convert discrete points into piecewise polynomial curve with C0 continuity.
points | : discrete points to convert. |
time_points | : time corresponding to each point in piecewise curve. |
|
inline |
Convert all curves in piecewise curve into bezier curves.
|
inline |
Convert all curves in piecewise curve into cubic hermite curves. Curves need to be of degree inferior or equal to three.
|
inline |
Convert all curves in piecewise curve into polynomial curves.
|
inline |
Get curve at specified index in piecewise curve.
idx | : Index of curve to return, from 0 to num_curves-1. |
|
inline |
Get curve corresponding to time t in piecewise curve. Example : A piecewise curve PC made of two curves : c1 for t in [0,1] and c2 for t in ]1,2]. PC.curve_at_time(0.5) will return c1.
t | : time to select curve. |
|
inlinevirtual |
Get the degree of the curve.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
Evaluate the derivative of order N of curve at time t.
t | : time when to evaluate the spline. |
order | : order of derivative. |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
Get dimension of curve.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inline |
|
inline |
Check if the curve is continuous of order given.
order | : order of continuity we want to check. |
|
inlinevirtual |
isApprox check if other and *this are approximately equal given a precision treshold Only two curves of the same class can be approximately equal, for comparison between different type of curves see isEquivalent.
other | the other curve to check |
prec | the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision() |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
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
other | the other curve to check |
prec | the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision() |
|
inlinestatic |
load_piecewise_from_text_file build a piecewise polynomial from a list of discrete points read from a file. The file should contains one points per line, optionally with it's derivative and second derivatives. Each lines should then contains dim, 2*dim or 3*dim values
filename | the (absolute) name of the file to load |
dt | the time step between each points in the file |
dim | the dimension of the curve |
|
inlinevirtual |
Get the maximum time for which the curve is defined.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
Get the minimum time for which the curve is defined.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inline |
Get number of curves in piecewise curve.
|
inlinevirtual |
|
inlinevirtual |
Evaluation of the cubic spline at time t.
t | : time when to evaluate the spine |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
|
inline |
|
friend |
t_curve_ptr_t ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::curves_ |
std::size_t ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::dim_ |
std::size_t ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::size_ |
Time ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::T_max_ |
Time ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::T_min_ |
t_time_t ndcurves::piecewise_curve< Time, Numeric, Safe, Point, Point_derivate, CurveType >::time_curves_ |