hpp-spline  4.10.0
template based classes for creating and manipulating spline and bezier curves. Comes with extra options specific to end-effector trajectories in robotics.
bezier_polynom_conversion.h
Go to the documentation of this file.
1 
9 #ifndef _BEZIER_POLY_CONVERSION
10 #define _BEZIER_POLY_CONVERSION
11 
12 #include "curve_abc.h"
13 #include "bernstein.h"
14 #include "curve_constraint.h"
15 
16 #include "MathDefs.h"
17 
18 #include <vector>
19 #include <stdexcept>
20 
21 #include <iostream>
22 
23 namespace spline {
29 
33 template <typename Bezier, typename Polynom>
34 Polynom from_bezier(const Bezier& curve) {
35  typedef typename Polynom::t_point_t t_point_t;
36  typedef typename Polynom::num_t num_t;
37  assert(curve.min() == 0.);
38  assert(curve.max() == 1.);
39  t_point_t coefficients;
40  Bezier current(curve);
41  coefficients.push_back(curve(0.));
42  num_t fact = 1;
43  for (std::size_t i = 1; i <= curve.degree_; ++i) {
44  current = current.compute_derivate(1);
45  fact *= (num_t)i;
46  coefficients.push_back(current(0.) / fact);
47  }
48  return Polynom(coefficients, curve.min(), curve.max());
49 }
50 
54 /*template<typename Bezier, typename Polynom>
55 Bezier from_polynom(const Polynom& polynom)
56 {
57  typedef Bezier::point_t point_t;
58  typedef Bezier::time_t time_t;
59  typedef Bezier::num_t num_t;
60  typedef Bezier::curve_constraints_t curve_constraints_t;
61  typedef Bezier::t_point_t t_point_t;
62  typedef Bezier::cit_point_t cit_point_t;
63  typedef Bezier::bezier_curve_t bezier_curve_t;
64 }*/
65 } // namespace spline
66 #endif //_BEZIER_POLY_CONVERSION
curve_abc.h
interface for a Curve of arbitrary dimension.
bernstein.h
MathDefs.h
curve_constraint.h
struct to define constraints on start / end velocities and acceleration on a curve
spline::fact
unsigned int fact(const unsigned int n)
Computes factorial of a number.
Definition: bernstein.h:24
spline
Definition: bernstein.h:20
spline::from_bezier
Polynom from_bezier(const Bezier &curve)
Provides methods for converting a curve from a bernstein representation to a polynom representation.
Definition: bezier_polynom_conversion.h:34