Skip to content
GitLab
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
72d949c6
Commit
72d949c6
authored
Dec 18, 2019
by
Pierre Fernbach
Browse files
add operator == in piecewise
parent
c3aa1f34
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/curves/piecewise_curve.h
View file @
72d949c6
...
...
@@ -80,6 +80,35 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Safe, Point,Point_deriv
return
(
*
curves_
.
at
(
find_interval
(
t
)))(
t
);
}
/**
* @brief isApprox check if other and *this are equals, given a precision treshold.
* This test is done by discretizing, it should be re-implemented in the child class to check exactly
* all the members.
* @param other the other curve to check
* @param order the order up to which the derivatives of the curves are checked for equality
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
virtual
bool
isApprox
(
const
piecewise_curve_t
&
other
,
const
Numeric
prec
=
Eigen
::
NumTraits
<
Numeric
>::
dummy_precision
(),
const
size_t
order
=
5
)
const
{
std
::
cout
<<
"is approx in piecewise called."
<<
std
::
endl
;
if
(
num_curves
()
!=
other
.
num_curves
())
return
false
;
for
(
size_t
i
=
0
;
i
<
num_curves
()
;
++
i
)
{
if
(
!
curve_at_index
(
i
)
->
isApprox
(
*
other
.
curve_at_index
(
i
),
prec
,
order
))
return
false
;
}
return
true
;
}
virtual
bool
operator
==
(
const
piecewise_curve_t
&
other
)
const
{
return
isApprox
(
other
);
}
virtual
bool
operator
!=
(
const
piecewise_curve_t
&
other
)
const
{
return
!
(
*
this
==
other
);
}
/// \brief Evaluate the derivative of order N of curve at time t.
/// \param t : time when to evaluate the spline.
/// \param order : order of derivative.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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