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
Guilhem Saurel
ndcurves
Commits
136063f0
Commit
136063f0
authored
Sep 28, 2020
by
Steve T
Browse files
Only one static vartiable MARGIN
parent
73a80cb7
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/curves/MathDefs.h
View file @
136063f0
...
...
@@ -48,5 +48,7 @@ Matrix3 skew(const Point& x) {
return
res
;
}
static
const
double
MARGIN
(
0.001
);
}
// namespace curves
#endif //_SPLINEMATH
include/curves/bezier_curve.h
View file @
136063f0
...
...
@@ -566,7 +566,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
void
assert_operator_compatible
(
const
bezier_curve_t
&
other
)
const
{
if
((
fabs
(
min
()
-
other
.
min
())
>
bezier_curve_t
::
MARGIN
)
||
(
fabs
(
max
()
-
other
.
max
())
>
bezier_curve_t
::
MARGIN
)){
if
((
fabs
(
min
()
-
other
.
min
())
>
MARGIN
)
||
(
fabs
(
max
()
-
other
.
max
())
>
MARGIN
)){
throw
std
::
invalid_argument
(
"Can't perform base operation (+ - ) on two Bezier curves with different time ranges"
);
}
}
...
...
@@ -601,7 +601,6 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
/*const*/
std
::
size_t
degree_
;
/*const*/
std
::
vector
<
Bern
<
Numeric
>
>
bernstein_
;
/*const*/
t_point_t
control_points_
;
static
const
double
MARGIN
;
/* Attributes */
static
bezier_curve_t
zero
(
const
std
::
size_t
dim
,
const
time_t
T
=
1.
)
{
...
...
@@ -630,9 +629,6 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
}
};
// End struct bezier_curve
template
<
typename
Time
,
typename
Numeric
,
bool
Safe
,
typename
Point
>
const
double
bezier_curve
<
Time
,
Numeric
,
Safe
,
Point
>::
MARGIN
(
0.001
);
template
<
typename
T
,
typename
N
,
bool
S
,
typename
P
>
bezier_curve
<
T
,
N
,
S
,
P
>
operator
+
(
const
bezier_curve
<
T
,
N
,
S
,
P
>&
p1
,
const
bezier_curve
<
T
,
N
,
S
,
P
>&
p2
)
{
bezier_curve
<
T
,
N
,
S
,
P
>
res
(
p1
);
...
...
include/curves/cross_implementation.h
View file @
136063f0
/**
* \file c
ubic_hermite_spline
.h
* \file c
ross_implementation
.h
* \brief class allowing to create a cubic hermite spline of any dimension.
* \author
Justin Carpentier <jcarpent@laas.fr> modified by Jason Chemin <jchemin@laas.fr>
* \date 0
5
/20
19
* \author
Steve Tonneau
* \date 0
9
/20
20
*/
#ifndef _CLASS_CROSSIMP
...
...
include/curves/linear_variable.h
View file @
136063f0
...
...
@@ -111,7 +111,7 @@ struct linear_variable : public serialization::Serializable {
throw
std
::
invalid_argument
(
"Can't perform cross product on linear variables more than one unknown "
);
if
(
isZero
()
||
other
.
isZero
())
return
linear_variable_t
::
Zero
(
3
);
if
((
B
().
squaredNorm
()
-
B
().
diagonal
().
squaredNorm
()
>
linear_variable_t
::
MARGIN
)
||
(
other
.
B
().
squaredNorm
()
-
other
.
B
().
diagonal
().
squaredNorm
()
>
linear_variable_t
::
MARGIN
)
)
if
((
B
().
squaredNorm
()
-
B
().
diagonal
().
squaredNorm
()
>
MARGIN
)
||
(
other
.
B
().
squaredNorm
()
-
other
.
B
().
diagonal
().
squaredNorm
()
>
MARGIN
)
)
throw
std
::
invalid_argument
(
"Can't perform cross product on linear variables if B is not diagonal "
);
// (B1 x + c1) X (B2 x + c2) = (-c2X B1) x + (bX B2) x + b1Xb2
typename
linear_variable_t
::
matrix_3_t
newB
=
skew
<
typename
linear_variable_t
::
matrix_3_t
,
typename
linear_variable_t
::
vector_3_t
>
(
-
other
.
c
())
*
B
()
+
...
...
@@ -167,7 +167,6 @@ struct linear_variable : public serialization::Serializable {
matrix_x_t
B_
;
vector_x_t
c_
;
bool
zero
;
static
const
double
MARGIN
;
};
template
<
typename
N
,
bool
S
>
...
...
@@ -218,9 +217,6 @@ std::ostream &operator<<(std::ostream &os, const linear_variable<N, S>& l) {
return
os
<<
"linear_variable:
\n
\t
B:
\n
"
<<
l
.
B
()
<<
"
\t
c:
\n
"
<<
l
.
c
().
transpose
();
}
template
<
typename
N
,
bool
S
>
const
double
linear_variable
<
N
,
S
>::
MARGIN
(
0.001
);
}
// namespace curves
DEFINE_CLASS_TEMPLATE_VERSION
(
SINGLE_ARG
(
typename
Numeric
,
bool
Safe
),
...
...
include/curves/piecewise_curve.h
View file @
136063f0
...
...
@@ -582,7 +582,6 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Safe, Point, Point_deri
t_time_t
time_curves_
;
// for curves 0/1/2 : [ Tmin0, Tmax0,Tmax1,Tmax2 ]
std
::
size_t
size_
;
// Number of segments in piecewise curve = size of curves_
Time
T_min_
,
T_max_
;
static
const
double
MARGIN
;
/* Attributes */
// Serialization of the class
...
...
@@ -602,10 +601,6 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Safe, Point, Point_deri
ar
&
boost
::
serialization
::
make_nvp
(
"T_max"
,
T_max_
);
}
};
// End struct piecewise curve
template
<
typename
Time
,
typename
Numeric
,
bool
Safe
,
typename
Point
,
typename
Point_derivate
,
typename
CurveType
>
const
double
piecewise_curve
<
Time
,
Numeric
,
Safe
,
Point
,
Point_derivate
,
CurveType
>::
MARGIN
(
0.001
);
}
// namespace curves
DEFINE_CLASS_TEMPLATE_VERSION
(
SINGLE_ARG
(
typename
Time
,
typename
Numeric
,
bool
Safe
,
typename
Point
,
...
...
include/curves/polynomial.h
View file @
136063f0
...
...
@@ -42,7 +42,6 @@ struct polynomial : public curve_abc<Time, Numeric, Safe, Point> {
typedef
Eigen
::
Ref
<
coeff_t
>
coeff_t_ref
;
typedef
polynomial
<
Time
,
Numeric
,
Safe
,
Point
,
T_Point
>
polynomial_t
;
typedef
typename
curve_abc_t
::
curve_ptr_t
curve_ptr_t
;
static
const
double
MARGIN
;
/* Constructors - destructors */
public:
...
...
@@ -462,7 +461,7 @@ struct polynomial : public curve_abc<Time, Numeric, Safe, Point> {
}
// remove last degrees is they are equal to 0
long
final_degree
=
new_degree
;
while
(
nCoeffs
.
col
(
final_degree
).
norm
()
<=
polynomial_t
::
MARGIN
){
while
(
nCoeffs
.
col
(
final_degree
).
norm
()
<=
curves
::
MARGIN
){
--
final_degree
;
}
return
polynomial_t
(
nCoeffs
.
leftCols
(
final_degree
+
1
),
min
(),
max
());
...
...
@@ -478,7 +477,7 @@ struct polynomial : public curve_abc<Time, Numeric, Safe, Point> {
private:
void
assert_operator_compatible
(
const
polynomial_t
&
other
)
const
{
if
((
fabs
(
min
()
-
other
.
min
())
>
polynomial_t
::
MARGIN
)
||
(
fabs
(
max
()
-
other
.
max
())
>
polynomial_t
::
MARGIN
)
||
dim
()
!=
other
.
dim
()){
if
((
fabs
(
min
()
-
other
.
min
())
>
curves
::
MARGIN
)
||
(
fabs
(
max
()
-
other
.
max
())
>
curves
::
MARGIN
)
||
dim
()
!=
other
.
dim
()){
throw
std
::
invalid_argument
(
"Can't perform base operation (+ - ) on two polynomials with different time ranges or different dimensions"
);
}
}
...
...
@@ -514,9 +513,6 @@ struct polynomial : public curve_abc<Time, Numeric, Safe, Point> {
};
// class polynomial
template
<
typename
T
,
typename
N
,
bool
S
,
typename
P
,
typename
TP
>
const
double
polynomial
<
T
,
N
,
S
,
P
,
TP
>::
MARGIN
(
0.001
);
template
<
typename
T
,
typename
N
,
bool
S
,
typename
P
,
typename
TP
>
polynomial
<
T
,
N
,
S
,
P
,
TP
>
operator
+
(
const
polynomial
<
T
,
N
,
S
,
P
,
TP
>&
p1
,
const
polynomial
<
T
,
N
,
S
,
P
,
TP
>&
p2
)
{
polynomial
<
T
,
N
,
S
,
P
,
TP
>
res
(
p1
);
...
...
Write
Preview
Markdown
is supported
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