Commit 3eb383ad authored by JasonChmn's avatar JasonChmn
Browse files

[piecewise_curve] Set margin as defined constant (value to modify)

parent 1a4440ce
Pipeline #4773 passed with stage
in 2 minutes and 11 seconds
......@@ -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;
}
......
......@@ -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)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment