From 73fee04ec667c913e3da62ec2caa918b5b5f61bc Mon Sep 17 00:00:00 2001 From: JasonChmn <jason.chemin@hotmail.fr> Date: Tue, 30 Apr 2019 11:05:34 +0200 Subject: [PATCH] Edit doc deCastelJau algorithm in bezier curve --- include/curves/bezier_curve.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/curves/bezier_curve.h b/include/curves/bezier_curve.h index 38ce0aa..8682c75 100644 --- a/include/curves/bezier_curve.h +++ b/include/curves/bezier_curve.h @@ -218,7 +218,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> /// Warning: the horner scheme is about 100 times faster than this method.<br> /// This method will probably be removed in the future as the computation of bernstein polynomial is very costly. /// \param t : time when to evaluate the curve. - /// \return \f$x(t)\f$, point corresponding on curve at time t. + /// \return \f$x(t)\f$ point corresponding on curve at time t. /// point_t evalBernstein(const Numeric t) const { @@ -241,7 +241,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> /// Using Horner's method, the polynom is transformed into : <br> /// \f$x(t) = a_0 + t(a_1 + t(a_2+t(...))\f$ with N additions and multiplications. /// \param t : time when to evaluate the curve. - /// \return \f$x(t)\f$, point corresponding on curve at time t. + /// \return \f$x(t)\f$ point corresponding on curve at time t. /// point_t evalHorner(const Numeric t) const { @@ -264,8 +264,11 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> const t_point_t& waypoints() const {return pts_;} /// \brief Evaluate the curve value at time t using deCasteljau algorithm. + /// The algorithm will compute the \f$N-1\f$ centroids of parameters \f${t,1-t}\f$ of consecutive \f$N\f$ control points + /// of bezier curve, and perform it iteratively until getting one point in the list which will be the evaluation of bezier + /// curve at time \f$t\f$. /// \param t : time when to evaluate the curve. - /// \return \f$x(t)\f$, point corresponding on curve at time t. + /// \return \f$x(t)\f$ point corresponding on curve at time t. /// point_t evalDeCasteljau(const Numeric t) const { // normalize time : @@ -277,11 +280,16 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> return pts[0]*mult_T_; } + t_point_t deCasteljauReduction(const Numeric t) const{ return deCasteljauReduction(waypoints(),t/T_); } /// \brief Compute de Casteljau's reduction of the given list of points at time t. + /// For the list \f$pts\f$ of N points, compute a new list of points of size N-1 :<br> + /// \f$<br>( pts[0]*(1-t)+pts[1], pts[1]*(1-t)+pts[2], ..., pts[0]*(N-2)+pts[N-1] )\f$<br> + /// with t the time when to evaluate bezier curve.<br>\ + /// The new list contains centroid of parameters \f${t,1-t}\f$ of consecutive points in the list. /// \param pts : list of points. /// \param u : NORMALIZED time when to evaluate the curve. /// \return Reduced list of point (size of pts - 1). -- GitLab