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
Humanoid Path Planner
hpp-fcl
Commits
8c0fc9a3
Verified
Commit
8c0fc9a3
authored
Jun 09, 2021
by
Justin Carpentier
Browse files
test: add test of for distanceLowerBounds with basic primitives
parent
37f46961
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/distance_lower_bound.cpp
View file @
8c0fc9a3
...
...
@@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(mesh_mesh)
col1
=
testDistanceLowerBound
(
transforms
[
i
],
m1
,
m2
,
distanceLowerBound
);
col2
=
testDistance
(
transforms
[
i
],
m1
,
m2
,
distance
);
col3
=
testCollide
(
transforms
[
i
],
m1
,
m2
);
std
::
cout
<<
"col1 = "
<<
col1
<<
", col2 = "
<<
col2
std
::
cout
<<
"col1 = "
<<
col1
<<
", col2 = "
<<
col2
<<
", col3 = "
<<
col3
<<
std
::
endl
;
std
::
cout
<<
"distance lower bound = "
<<
distanceLowerBound
<<
std
::
endl
;
std
::
cout
<<
"distance = "
<<
distance
<<
std
::
endl
;
...
...
@@ -164,6 +164,42 @@ BOOST_AUTO_TEST_CASE(mesh_mesh)
}
}
BOOST_AUTO_TEST_CASE
(
box_sphere
)
{
shared_ptr
<
hpp
::
fcl
::
Sphere
>
sphere
(
new
hpp
::
fcl
::
Sphere
(
0.5
));
shared_ptr
<
hpp
::
fcl
::
Box
>
box
(
new
hpp
::
fcl
::
Box
(
1.
,
1.
,
1.
));
Transform3f
M1
;
M1
.
setIdentity
();
Transform3f
M2
;
M2
.
setIdentity
();
std
::
vector
<
Transform3f
>
transforms
;
FCL_REAL
extents
[]
=
{
-
2.
,
-
2.
,
-
2.
,
2.
,
2.
,
2.
};
const
std
::
size_t
n
=
1000
;
generateRandomTransforms
(
extents
,
transforms
,
n
);
FCL_REAL
distanceLowerBound
,
distance
;
bool
col1
,
col2
;
col1
=
testDistanceLowerBound
(
M1
,
sphere
,
box
,
distanceLowerBound
);
col2
=
testDistance
(
M1
,
sphere
,
box
,
distance
);
BOOST_CHECK
(
col1
==
col2
);
BOOST_CHECK
(
distanceLowerBound
<=
distance
);
for
(
std
::
size_t
i
=
0
;
i
<
transforms
.
size
();
++
i
)
{
FCL_REAL
distanceLowerBound
,
distance
;
bool
col1
,
col2
;
col1
=
testDistanceLowerBound
(
transforms
[
i
],
sphere
,
box
,
distanceLowerBound
);
col2
=
testDistance
(
transforms
[
i
],
sphere
,
box
,
distance
);
BOOST_CHECK
(
col1
==
col2
);
if
(
!
col1
)
{
BOOST_CHECK_MESSAGE
(
distanceLowerBound
<=
distance
,
"distance = "
<<
distance
<<
", lower bound = "
<<
distanceLowerBound
);
}
}
}
BOOST_AUTO_TEST_CASE
(
box_mesh
)
{
std
::
vector
<
Vec3f
>
p1
;
...
...
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