diff --git a/include/curves/piecewise_curve.h b/include/curves/piecewise_curve.h index 73eb0daca5b3f375d4814dd5a9122c19fc274434..0278c433d09c56af702410fa1429a7c5202dbd5a 100644 --- a/include/curves/piecewise_curve.h +++ b/include/curves/piecewise_curve.h @@ -8,6 +8,8 @@ #ifndef _CLASS_PIECEWISE_CURVE #define _CLASS_PIECEWISE_CURVE +#define MARGIN 1e-3 + #include "curve_abc.h" #include "curve_conversion.h" @@ -85,9 +87,8 @@ 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 && !(fabs(cf.min()-T_max_)<margin)) + if (size_!=0 && !(fabs(cf.min()-T_max_)<MARGIN)) { throw std::invalid_argument("Can not add new Polynom to PiecewiseCurve : time discontinuity between T_max_ and pol.min()"); } @@ -103,7 +104,6 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> /// bool is_continuous(const std::size_t order) { - const double margin = 1e-9; bool isContinuous = true; std::size_t i=0; point_t value_end, value_start; @@ -123,7 +123,7 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Dim, Safe, Point> value_start = next.derivate(next.min(),order); } - if ((value_end-value_start).norm() > margin) + if ((value_end-value_start).norm() > MARGIN) { isContinuous = false; } diff --git a/tests/Main.cpp b/tests/Main.cpp index 252405f5ab359e1cedb1d655adf476688be2de2f..ef0adfd9011f47090926f77557525728893fdafd 100644 --- a/tests/Main.cpp +++ b/tests/Main.cpp @@ -41,7 +41,7 @@ typedef piecewise_curve <double, double, 3, true, point_t, t_point_t, polynomial typedef piecewise_curve <double, double, 3, true, point_t, t_point_t, bezier_curve_t> piecewise_bezier_curve_t; typedef piecewise_curve <double, double, 3, true, point_t, t_point_t, cubic_hermite_spline_t> piecewise_cubic_hermite_curve_t; -const double margin = 1e-9; +const double margin = 1e-3; bool QuasiEqual(const double a, const double b) {