box_box_collision.cpp
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE COAL_BOX_BOX_COLLISION
2 #include <boost/test/included/unit_test.hpp>
3 
4 #include <Eigen/Geometry>
7 #include "coal/internal/tools.h"
8 
9 #include "utility.h"
10 
11 using coal::Box;
12 using coal::CoalScalar;
13 using coal::collide;
17 using coal::Transform3s;
18 using coal::Vec3s;
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  Transform3s T1 = Transform3s::Identity();
27  Transform3s T2 = Transform3s::Identity();
28 
29  // Compute collision
30  CollisionRequest req;
31  req.enable_cached_gjk_guess = true;
32  req.distance_upper_bound = 1e-6;
34  ComputeCollision collide_functor(&shape1, &shape2);
35 
36  T1.setTranslation(Vec3s(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(Vec3s(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 }
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
narrowphase.h
utility.h
coal::Box
Center at zero point, axis aligned box.
Definition: coal/shape/geometric_shapes.h:166
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(box_box_collision)
Definition: box_box_collision.cpp:20
coal::Transform3s
Simple transform class used locally by InterpMotion.
Definition: coal/math/transform.h:55
res
res
coal::Transform3s::setTranslation
void setTranslation(const Eigen::MatrixBase< Derived > &T_)
set transform from translation
Definition: coal/math/transform.h:143
coal::CollisionResult
collision result
Definition: coal/collision_data.h:390
coal::CollisionRequest
request to the collision algorithm
Definition: coal/collision_data.h:311
tools.h
geometric_shapes.h
coal::QueryRequest::enable_cached_gjk_guess
bool enable_cached_gjk_guess
whether enable gjk initial guess @Deprecated Use gjk_initial_guess instead
Definition: coal/collision_data.h:177
coal::collide
COAL_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:61
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
coal::CollisionRequest::distance_upper_bound
CoalScalar distance_upper_bound
Distance above which GJK solver makes an early stopping. GJK stops searching for the closest points w...
Definition: coal/collision_data.h:340
coal::ComputeCollision
This class reduces the cost of identifying the geometry pair. This is mostly useful for repeated shap...
Definition: coal/collision.h:78


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:57