Commit 703b04f4 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

Use point_t::Zero(Dim) instead of point_t::Zero() because it is required to...

Use point_t::Zero(Dim) instead of point_t::Zero()  because it is required to use a waypoint_t as templated type
parent e201b5f2
...@@ -182,7 +182,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> ...@@ -182,7 +182,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
for(typename t_point_t::const_iterator pit = pts_.begin(); pit != pts_.end()-1; ++pit) for(typename t_point_t::const_iterator pit = pts_.begin(); pit != pts_.end()-1; ++pit)
derived_wp.push_back((num_t)degree_ * (*(pit+1) - (*pit))); derived_wp.push_back((num_t)degree_ * (*(pit+1) - (*pit)));
if(derived_wp.empty()) if(derived_wp.empty())
derived_wp.push_back(point_t::Zero()); derived_wp.push_back(point_t::Zero(Dim));
bezier_curve_t deriv(derived_wp.begin(), derived_wp.end(),T_, mult_T_ * (1./T_) ); bezier_curve_t deriv(derived_wp.begin(), derived_wp.end(),T_, mult_T_ * (1./T_) );
return deriv.compute_derivate(order-1); return deriv.compute_derivate(order-1);
} }
...@@ -195,7 +195,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> ...@@ -195,7 +195,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
if(order == 0) return *this; if(order == 0) return *this;
num_t new_degree = (num_t)(degree_+1); num_t new_degree = (num_t)(degree_+1);
t_point_t n_wp; t_point_t n_wp;
point_t current_sum = point_t::Zero(); point_t current_sum = point_t::Zero(Dim);
// recomputing waypoints q_i from derivative waypoints p_i. q_0 is the given constant. // recomputing waypoints q_i from derivative waypoints p_i. q_0 is the given constant.
// then q_i = (sum( j = 0 -> j = i-1) p_j) /n+1 // then q_i = (sum( j = 0 -> j = i-1) p_j) /n+1
n_wp.push_back(current_sum); n_wp.push_back(current_sum);
...@@ -227,7 +227,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> ...@@ -227,7 +227,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// ///
point_t evalBernstein(const Numeric u) const point_t evalBernstein(const Numeric u) const
{ {
point_t res = point_t::Zero(); point_t res = point_t::Zero(Dim);
typename t_point_t::const_iterator pts_it = pts_.begin(); typename t_point_t::const_iterator pts_it = pts_.begin();
for(typename std::vector<Bern<Numeric> >::const_iterator cit = bernstein_.begin(); for(typename std::vector<Bern<Numeric> >::const_iterator cit = bernstein_.begin();
cit !=bernstein_.end(); ++cit, ++pts_it) cit !=bernstein_.end(); ++cit, ++pts_it)
...@@ -381,7 +381,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> ...@@ -381,7 +381,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
static bezier_curve_t zero(const time_t T=1.) static bezier_curve_t zero(const time_t T=1.)
{ {
std::vector<point_t> ts; std::vector<point_t> ts;
ts.push_back(point_t::Zero()); ts.push_back(point_t::Zero(Dim));
return bezier_curve_t(ts.begin(), ts.end(),T); return bezier_curve_t(ts.begin(), ts.end(),T);
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment