Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
coal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Coal
coal
Commits
059fafa6
Commit
059fafa6
authored
10 years ago
by
Florent Lamiraux
Browse files
Options
Downloads
Patches
Plain Diff
Fix test_fcl_box_box_distance.
parent
8cb56bd6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/test_fcl_box_box_distance.cpp
+40
-1
40 additions, 1 deletion
test/test_fcl_box_box_distance.cpp
test/test_fcl_capsule_box_1.cpp
+17
-17
17 additions, 17 deletions
test/test_fcl_capsule_box_1.cpp
test/test_fcl_capsule_box_2.cpp
+8
-10
8 additions, 10 deletions
test/test_fcl_capsule_box_2.cpp
with
65 additions
and
28 deletions
test/test_fcl_box_box_distance.cpp
+
40
−
1
View file @
059fafa6
...
...
@@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(distance_box_box_1)
CollisionObject
o2
(
s2
,
tf2
);
// Enable computation of nearest points
DistanceRequest
distanceRequest
(
true
);
DistanceRequest
distanceRequest
(
true
,
0
,
0
,
GST_INDEP
);
DistanceResult
distanceResult
;
distance
(
&
o1
,
&
o2
,
distanceRequest
,
distanceResult
);
...
...
@@ -127,3 +127,42 @@ BOOST_AUTO_TEST_CASE(distance_box_box_2)
BOOST_CHECK_CLOSE
(
p2
[
1
],
0.01175873
,
1e-4
);
BOOST_CHECK_CLOSE
(
p2
[
2
],
-
1.62123444
+
10
,
1e-4
);
}
BOOST_AUTO_TEST_CASE
(
distance_box_box_3
)
{
CollisionGeometryPtr_t
s1
(
new
Box
(
1
,
1
,
1
));
CollisionGeometryPtr_t
s2
(
new
Box
(
1
,
1
,
1
));
static
double
pi
=
M_PI
;
Transform3f
tf1
(
Quaternion3f
(
cos
(
pi
/
8
),
0
,
0
,
sin
(
pi
/
8
)),
Vec3f
(
-
2
,
1
,
.5
));
Transform3f
tf2
(
Quaternion3f
(
cos
(
pi
/
8
),
0
,
sin
(
pi
/
8
),
0
),
Vec3f
(
2
,
.5
,
.5
));
CollisionObject
o1
(
s1
,
tf1
);
CollisionObject
o2
(
s2
,
tf2
);
// Enable computation of nearest points
DistanceRequest
distanceRequest
(
true
,
0
,
0
,
GST_INDEP
);
DistanceResult
distanceResult
;
distance
(
&
o1
,
&
o2
,
distanceRequest
,
distanceResult
);
std
::
cerr
<<
"Applied translation on two boxes"
;
std
::
cerr
<<
" T1 = "
<<
tf1
.
getTranslation
()
<<
", T2 = "
<<
tf2
.
getTranslation
()
<<
std
::
endl
;
std
::
cerr
<<
"Closest points: p1 = "
<<
distanceResult
.
nearest_points
[
0
]
<<
", p2 = "
<<
distanceResult
.
nearest_points
[
1
]
<<
", distance = "
<<
distanceResult
.
min_distance
<<
std
::
endl
;
const
Vec3f
&
p1
=
distanceResult
.
nearest_points
[
0
];
const
Vec3f
&
p2
=
distanceResult
.
nearest_points
[
1
];
double
distance
=
4
-
sqrt
(
2
);
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
distance
,
1e-4
);
BOOST_CHECK_CLOSE
(
p1
[
0
],
sqrt
(
2
)
/
2
-
2
,
1e-4
);
BOOST_CHECK_CLOSE
(
p1
[
1
],
1
,
1e-4
);
BOOST_CHECK_CLOSE
(
p1
[
2
],
.5
,
1e-6
);
BOOST_CHECK_CLOSE
(
p2
[
0
],
2
-
sqrt
(
2
)
/
2
,
1e-4
);
BOOST_CHECK_CLOSE
(
p2
[
1
],
1
,
1e-4
);
BOOST_CHECK_CLOSE
(
p2
[
2
],
.5
,
1e-4
);
}
This diff is collapsed.
Click to expand it.
test/test_fcl_capsule_box_1.cpp
+
17
−
17
View file @
059fafa6
...
...
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
CollisionGeometryPtr_t
boxGeometry
(
new
fcl
::
Box
(
1.
,
2.
,
4.
));
// Enable computation of nearest points
fcl
::
DistanceRequest
distanceRequest
(
true
);
fcl
::
DistanceRequest
distanceRequest
(
true
,
0
,
0
,
fcl
::
GST_INDEP
);
fcl
::
DistanceResult
distanceResult
;
fcl
::
Transform3f
tf1
(
fcl
::
Vec3f
(
3.
,
0
,
0
));
...
...
@@ -69,11 +69,11 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
fcl
::
Vec3f
o1
(
distanceResult
.
nearest_points
[
0
]);
// Nearest point on box
fcl
::
Vec3f
o2
(
distanceResult
.
nearest_points
[
1
]);
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
0.5
,
1e-
4
);
BOOST_CHECK_CLOSE
(
o1
[
0
],
-
2
.0
,
1e-
4
);
CHECK_CLOSE_TO_0
(
o1
[
1
],
1e-
4
);
BOOST_CHECK_CLOSE
(
o2
[
0
],
0.5
,
1e-
4
);
BOOST_
CHECK_CLOSE
(
o1
[
1
],
0.0
,
1e-
4
);
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
0.5
,
1e-
1
);
BOOST_CHECK_CLOSE
(
o1
[
0
],
1
.0
,
1e-
1
);
CHECK_CLOSE_TO_0
(
o1
[
1
],
1e-
1
);
BOOST_CHECK_CLOSE
(
o2
[
0
],
0.5
,
1e-
1
);
CHECK_CLOSE
_TO_0
(
o1
[
1
],
1e-
1
);
// Move capsule above box
tf1
=
fcl
::
Transform3f
(
fcl
::
Vec3f
(
0.
,
0.
,
8.
));
...
...
@@ -85,10 +85,10 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
o1
=
distanceResult
.
nearest_points
[
0
];
o2
=
distanceResult
.
nearest_points
[
1
];
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
2.0
,
1e-
4
);
CHECK_CLOSE_TO_0
(
o1
[
0
],
1e-
4
);
CHECK_CLOSE_TO_0
(
o1
[
1
],
1e-
4
);
BOOST_CHECK_CLOSE
(
o1
[
2
],
-
4.0
,
1e-
4
);
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
2.0
,
1e-
1
);
CHECK_CLOSE_TO_0
(
o1
[
0
],
1e-
1
);
CHECK_CLOSE_TO_0
(
o1
[
1
],
1e-
1
);
BOOST_CHECK_CLOSE
(
o1
[
2
],
4.0
,
1e-
1
);
// Disabled broken test lines. Please see #25.
// CHECK_CLOSE_TO_0 (o2 [0], 1e-4);
...
...
@@ -106,11 +106,11 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
o1
=
distanceResult
.
nearest_points
[
0
];
o2
=
distanceResult
.
nearest_points
[
1
];
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
5.5
,
1e-
4
);
CHECK_CLOSE
_TO_0
(
o1
[
0
],
1e-
4
);
CHECK_CLOSE_TO_0
(
o1
[
1
],
1e-
4
);
BOOST_
CHECK_CLOSE
(
o1
[
2
],
4.0
,
1e-
4
);
BOOST_CHECK_CLOSE
(
o2
[
0
],
-
0.5
,
1e-
4
);
CHECK_CLOSE_TO_0
(
o2
[
1
],
1e-
4
);
CHECK_CLOSE_TO_0
(
o2
[
2
],
1e-
4
);
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
5.5
,
1e-
1
);
BOOST_
CHECK_CLOSE
(
o1
[
0
],
-
6
,
1e-
2
);
CHECK_CLOSE_TO_0
(
o1
[
1
],
1e-
1
);
CHECK_CLOSE
_TO_0
(
o1
[
2
],
1e-
1
);
BOOST_CHECK_CLOSE
(
o2
[
0
],
-
0.5
,
1e-
2
);
CHECK_CLOSE_TO_0
(
o2
[
1
],
1e-
1
);
CHECK_CLOSE_TO_0
(
o2
[
2
],
1e-
1
);
}
This diff is collapsed.
Click to expand it.
test/test_fcl_capsule_box_2.cpp
+
8
−
10
View file @
059fafa6
...
...
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
CollisionGeometryPtr_t
boxGeometry
(
new
fcl
::
Box
(
1.
,
2.
,
4.
));
// Enable computation of nearest points
fcl
::
DistanceRequest
distanceRequest
(
true
);
fcl
::
DistanceRequest
distanceRequest
(
true
,
0
,
0
,
fcl
::
GST_INDEP
);
fcl
::
DistanceResult
distanceResult
;
// Rotate capsule around y axis by pi/2 and move it behind box
...
...
@@ -71,13 +71,11 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
fcl
::
Vec3f
o1
=
distanceResult
.
nearest_points
[
0
];
fcl
::
Vec3f
o2
=
distanceResult
.
nearest_points
[
1
];
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
5.5
,
1e-4
);
// Disabled broken test lines. Please see #25.
// CHECK_CLOSE_TO_0 (o1 [0], 1e-4);
// CHECK_CLOSE_TO_0 (o1 [1], 1e-4);
BOOST_CHECK_CLOSE
(
o1
[
2
],
4.0
,
1e-4
);
BOOST_CHECK_CLOSE
(
o2
[
0
],
-
0.5
,
1e-4
);
// Disabled broken test lines. Please see #25.
// BOOST_CHECK_CLOSE (o2 [1], 0.8, 1e-4);
// BOOST_CHECK_CLOSE (o2 [2], 1.5, 1e-4);
BOOST_CHECK_CLOSE
(
distanceResult
.
min_distance
,
5.5
,
1e-2
);
BOOST_CHECK_CLOSE
(
o1
[
0
],
-
6
,
1e-2
);
BOOST_CHECK_CLOSE
(
o1
[
1
],
0.8
,
1e-1
);
BOOST_CHECK_CLOSE
(
o1
[
2
],
1.5
,
1e-2
);
BOOST_CHECK_CLOSE
(
o2
[
0
],
-
0.5
,
1e-2
);
BOOST_CHECK_CLOSE
(
o2
[
1
],
0.8
,
1e-1
);
BOOST_CHECK_CLOSE
(
o2
[
2
],
1.5
,
1e-2
);
}
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