| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /** | ||
| 2 | * \file bezier_curve.h | ||
| 3 | * \brief class allowing to create a Bezier curve of dimension 1 <= n <= 3. | ||
| 4 | * \author Steve T. | ||
| 5 | * \version 0.1 | ||
| 6 | * \date 06/17/2013 | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _CLASS_QUADRATIC_COST | ||
| 10 | #define _CLASS_QUADRATIC_COST | ||
| 11 | |||
| 12 | #include <Eigen/Core> | ||
| 13 | |||
| 14 | #include "ndcurves/optimization/definitions.h" | ||
| 15 | #include "ndcurves/optimization/details.h" | ||
| 16 | |||
| 17 | namespace ndcurves { | ||
| 18 | namespace optimization { | ||
| 19 | |||
| 20 | enum integral_cost_flag { | ||
| 21 | DISTANCE = 0x000, | ||
| 22 | VELOCITY = 0x001, | ||
| 23 | ACCELERATION = 0x002, | ||
| 24 | JERK = 0x003, | ||
| 25 | FOURTH = 0x004, | ||
| 26 | FIFTH = 0x005 | ||
| 27 | }; | ||
| 28 | |||
| 29 | template <typename Point, typename Numeric> | ||
| 30 | 2 | quadratic_variable<Numeric> compute_integral_cost_internal( | |
| 31 | const problem_data<Point, Numeric>& pData, const std::size_t num_derivate) { | ||
| 32 | typedef bezier_curve<Numeric, Numeric, true, linear_variable<Numeric> > | ||
| 33 | bezier_t; | ||
| 34 | typedef typename bezier_t::t_point_t t_point_t; | ||
| 35 | typedef typename t_point_t::const_iterator cit_point_t; | ||
| 36 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | bezier_t acc = pData.bezier->compute_derivate(num_derivate); |
| 37 | 2 | const t_point_t& wps = acc.waypoints(); | |
| 38 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | quadratic_variable<Numeric> res(bezier_product<Point, Numeric, cit_point_t>( |
| 39 | 2 | wps.begin(), wps.end(), wps.begin(), wps.end(), pData.dim_)); | |
| 40 | 4 | return res; | |
| 41 | 2 | } | |
| 42 | |||
| 43 | template <typename Point, typename Numeric> | ||
| 44 | 2 | quadratic_variable<Numeric> compute_integral_cost( | |
| 45 | const problem_data<Point, Numeric>& pData, const integral_cost_flag flag) { | ||
| 46 | 2 | std::size_t size = (std::size_t)(flag); | |
| 47 | 2 | return compute_integral_cost_internal<Point, Numeric>(pData, size); | |
| 48 | } | ||
| 49 | |||
| 50 | } // namespace optimization | ||
| 51 | } // namespace ndcurves | ||
| 52 | #endif //_CLASS_QUADRATIC_COST | ||
| 53 |