Skip to content
Snippets Groups Projects
Unverified Commit b357d665 authored by stonneau's avatar stonneau Committed by GitHub
Browse files

Merge pull request #7 from stonneau/bug_fix_extract

tentative bug fix for extract
parents 55466e8d 4cdcfb59
No related branches found
Tags rbprm_1
No related merge requests found
......@@ -304,6 +304,8 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
* @return
*/
std::pair<bezier_curve_t,bezier_curve_t> split(const Numeric T){
if (T == T_)
throw std::runtime_error("can't split curve, interval range is equal to original curve");
t_point_t wps_first(size_),wps_second(size_);
const double t = T/T_;
wps_first[0] = pts_.front();
......@@ -325,6 +327,8 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
bezier_curve_t extract(const Numeric t1, const Numeric t2){
if(t1 < 0. || t1 > T_ || t2 < 0. || t2 > T_)
throw std::out_of_range("In Extract curve : times out of bounds");
if(t1 == 0. && t2 == T_)
return bezier_curve_t(waypoints().begin(), waypoints().end(), T_,mult_T_);
if(t1 == 0.)
return split(t2).first;
if(t2 == T_)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment