test
box_box_collision.cpp
Go to the documentation of this file.
1
#define BOOST_TEST_MODULE BOX_BOX_COLLISION
2
#include <boost/test/included/unit_test.hpp>
3
4
#include <Eigen/Geometry>
5
#include <
hpp/fcl/narrowphase/narrowphase.h
>
6
#include <
hpp/fcl/shape/geometric_shapes.h
>
7
#include <
hpp/fcl/internal/tools.h
>
8
9
#include "
utility.h
"
10
11
using
hpp::fcl::Box
;
12
using
hpp::fcl::collide
;
13
using
hpp::fcl::CollisionRequest
;
14
using
hpp::fcl::CollisionResult
;
15
using
hpp::fcl::ComputeCollision
;
16
using
hpp::fcl::FCL_REAL
;
17
using
hpp::fcl::Transform3f
;
18
using
hpp::fcl::Vec3f
;
19
20
BOOST_AUTO_TEST_CASE
(box_box_collision) {
21
// Define boxes
22
Box
shape1(1, 1, 1);
23
Box
shape2(1, 1, 1);
24
25
// Define transforms
26
Transform3f
T1 = Transform3f::Identity();
27
Transform3f
T2 = Transform3f::Identity();
28
29
// Compute collision
30
CollisionRequest
req;
31
req.
enable_cached_gjk_guess
=
true
;
32
req.
distance_upper_bound
= 1e-6;
33
CollisionResult
res
;
34
ComputeCollision
collide_functor(&shape1, &shape2);
35
36
T1.
setTranslation
(
Vec3f
(0, 0, 0));
37
res
.clear();
38
BOOST_CHECK(
collide
(&shape1, T1, &shape2, T2, req,
res
) ==
true
);
39
res
.clear();
40
BOOST_CHECK(collide_functor(T1, T2, req,
res
) ==
true
);
41
42
T1.
setTranslation
(
Vec3f
(2, 0, 0));
43
res
.clear();
44
BOOST_CHECK(
collide
(&shape1, T1, &shape2, T2, req,
res
) ==
false
);
45
res
.clear();
46
BOOST_CHECK(collide_functor(T1, T2, req,
res
) ==
false
);
47
}
hpp::fcl::ComputeCollision
This class reduces the cost of identifying the geometry pair. This is mostly useful for repeated shap...
Definition:
collision.h:103
hpp::fcl::Vec3f
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition:
data_types.h:66
utility.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(box_box_collision)
Definition:
box_box_collision.cpp:20
narrowphase.h
hpp::fcl::collide
HPP_FCL_DLLAPI std::size_t collide(const CollisionObject *o1, const CollisionObject *o2, const CollisionRequest &request, CollisionResult &result)
Main collision interface: given two collision objects, and the requirements for contacts,...
Definition:
src/collision.cpp:63
res
res
hpp::fcl::FCL_REAL
double FCL_REAL
Definition:
data_types.h:65
hpp::fcl::CollisionRequest
request to the collision algorithm
Definition:
collision_data.h:235
hpp::fcl::CollisionResult
collision result
Definition:
collision_data.h:302
hpp::fcl::QueryRequest::enable_cached_gjk_guess
bool enable_cached_gjk_guess
whether enable gjk initial guess @Deprecated Use gjk_initial_guess instead
Definition:
collision_data.h:126
hpp::fcl::Transform3f
Simple transform class used locally by InterpMotion.
Definition:
transform.h:54
hpp::fcl::CollisionRequest::distance_upper_bound
FCL_REAL distance_upper_bound
Distance above which GJK solver makes an early stopping. GJK stops searching for the closest points w...
Definition:
collision_data.h:263
geometric_shapes.h
hpp::fcl::Transform3f::setTranslation
void setTranslation(const Eigen::MatrixBase< Derived > &T_)
set transform from translation
Definition:
transform.h:142
tools.h
hpp::fcl::Box
Center at zero point, axis aligned box.
Definition:
shape/geometric_shapes.h:125
hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:12