From 1a4440cee2598534601f5877ca9de4ad412da8cc Mon Sep 17 00:00:00 2001
From: JasonChmn <jason.chemin@hotmail.fr>
Date: Wed, 3 Jul 2019 15:55:14 +0200
Subject: [PATCH] [piecewise_curve] remove comparison using epsilon / merge if
 conditions

---
 include/curves/piecewise_curve.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/curves/piecewise_curve.h b/include/curves/piecewise_curve.h
index fe99f43..73eb0da 100644
--- a/include/curves/piecewise_curve.h
+++ b/include/curves/piecewise_curve.h
@@ -85,13 +85,11 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
     ///
     void add_curve(const curve_t& cf)
     {
+        const double margin = 1e-9;
         // Check time continuity : Beginning time of pol must be equal to T_max_ of actual piecewise curve.
-        if (size_!=0)
+        if (size_!=0 && !(fabs(cf.min()-T_max_)<margin))
         {
-            if (!(fabs(cf.min()-T_max_)<std::numeric_limits<Time>::epsilon()))
-            {
-                throw std::invalid_argument("Can not add new Polynom to PiecewiseCurve : time discontinuity between T_max_ and pol.min()");
-            }
+            throw std::invalid_argument("Can not add new Polynom to PiecewiseCurve : time discontinuity between T_max_ and pol.min()");
         }
         curves_.push_back(cf);
         size_ = curves_.size();
@@ -105,7 +103,7 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
     ///
     bool is_continuous(const std::size_t order)
     {
-        double margin = 0.001;
+        const double margin = 1e-9;
         bool isContinuous = true;
         std::size_t i=0;
         point_t value_end, value_start;
-- 
GitLab