From f868dc371c0583c0acd2f3b1751c9ad6c201a63f Mon Sep 17 00:00:00 2001
From: Steve T <stonneau@hotmail.fr>
Date: Fri, 8 Feb 2019 00:38:04 +0100
Subject: [PATCH] removed switch in operator()

---
 include/hpp/spline/bezier_curve.h | 33 +++----------------------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/include/hpp/spline/bezier_curve.h b/include/hpp/spline/bezier_curve.h
index 40e149f..17f5483 100644
--- a/include/hpp/spline/bezier_curve.h
+++ b/include/hpp/spline/bezier_curve.h
@@ -139,37 +139,10 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
 	///  \param t : the time when to evaluate the spine
 	///  \param return : the value x(t)
     virtual point_t operator()(const time_t t) const
-	{
-        num_t nT = t /  T_;
-                if(Safe &! (0 <= t && t <= T_))
-		{
-            throw std::out_of_range("can't evaluate bezier curve, out of range"); // TODO
-        }
-		else
         {
-            num_t dt = (1 - nT);
-			switch(size_)
-            {
-                case 1 :
-                    return mult_T_ * pts_[0];
-				case 2 :
-                    return mult_T_ * (pts_[0] * dt +  nT * pts_[1]);
-				break;
-				case 3 :
-                    return 	mult_T_ * (pts_[0] * dt * dt
-                       				+ 2 * pts_[1] * nT * dt
-                        + pts_[2] * nT * nT);
-				break;
-                case 4 :
-                    return 	mult_T_ * (pts_[0] * dt * dt * dt
-						+ 3 * pts_[1] * nT * dt * dt 
-						+ 3 * pts_[2] * nT * nT * dt 
-                        + pts_[3] * nT * nT *nT);
-                default :
-                    return evalHorner(t);
-				break;
-			}
-		}
+            if(Safe &! (0 <= t && t <= T_))
+                throw std::out_of_range("can't evaluate bezier curve, out of range"); // TODO
+            return evalHorner(t);
 	}
 
     ///  \brief Computes the derivative curve at order N.
-- 
GitLab