Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
ndcurves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loco-3d
ndcurves
Commits
c80dd0c7
Commit
c80dd0c7
authored
5 years ago
by
Pierre Fernbach
Browse files
Options
Downloads
Patches
Plain Diff
curve_abc now implemente isApprox() method and operator == and !=
parent
10c28e90
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/curves/curve_abc.h
+44
-0
44 additions, 0 deletions
include/curves/curve_abc.h
with
44 additions
and
0 deletions
include/curves/curve_abc.h
+
44
−
0
View file @
c80dd0c7
...
...
@@ -59,6 +59,50 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria
/// \return \f$\frac{d^Nx(t)}{dt^N}\f$, point corresponding on derivative curve of order N at time t.
virtual
point_derivate_t
derivate
(
const
time_t
t
,
const
std
::
size_t
order
)
const
=
0
;
/**
* @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
curve_t
&
other
,
const
Numeric
prec
=
Eigen
::
NumTraits
<
Numeric
>::
dummy_precision
(),
const
size_t
order
=
5
)
const
{
bool
equal
=
(
min
()
==
other
.
min
())
&&
(
max
()
==
other
.
max
())
&&
(
dim
()
==
other
.
dim
());
if
(
!
equal
){
return
false
;
}
// check the value along the two curves
Numeric
t
=
min
();
while
(
t
<=
max
()){
if
(
!
(
*
this
)(
t
).
isApprox
(
other
(
t
),
prec
)){
return
false
;
}
t
+=
0.01
;
// FIXME : define this step somewhere ??
}
// check if the derivatives are equals
for
(
size_t
n
=
1
;
n
<=
order
;
++
n
){
t
=
min
();
while
(
t
<=
max
()){
if
(
!
derivate
(
t
,
n
).
isApprox
(
other
.
derivate
(
t
,
n
),
prec
)){
return
false
;
}
t
+=
0.01
;
// FIXME : define this step somewhere ??
}
}
return
true
;
}
virtual
bool
operator
==
(
const
curve_t
&
other
)
const
{
return
isApprox
(
other
);
}
virtual
bool
operator
!=
(
const
curve_t
&
other
)
const
{
return
!
(
*
this
==
other
);
}
/*Operations*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment