Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pierre Fernbach
curves
Commits
3eb383ad
Commit
3eb383ad
authored
Jul 03, 2019
by
JasonChmn
Browse files
[piecewise_curve] Set margin as defined constant (value to modify)
parent
1a4440ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/curves/piecewise_curve.h
View file @
3eb383ad
...
...
@@ -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
;
}
...
...
tests/Main.cpp
View file @
3eb383ad
...
...
@@ -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
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment