35 #define BOOST_TEST_MODULE FCL_SECURITY_MARGIN 36 #include <boost/test/included/unit_test.hpp> 60 #define MATH_SQUARED(x) (x * x) 70 const double tol = 1e-8;
80 computeBV(s2, tf2_collision, bv2_transformed);
83 bv1.
overlap(bv2_transformed, collisionRequest, sqrDistLowerBound);
85 BOOST_CHECK_CLOSE(sqrDistLowerBound, 0, tol);
95 computeBV(s2, tf2_no_collision, bv2_transformed);
98 bv1.
overlap(bv2_transformed, collisionRequest, sqrDistLowerBound);
100 BOOST_CHECK_CLOSE(sqrDistLowerBound,
MATH_SQUARED(distance), tol);
110 AABB bv2_transformed;
111 computeBV(s2, tf2_no_collision, bv2_transformed);
114 bv1.
overlap(bv2_transformed, collisionRequest, sqrDistLowerBound);
116 BOOST_CHECK_SMALL(sqrDistLowerBound, tol);
126 AABB bv2_transformed;
130 bv1.
overlap(bv2_transformed, collisionRequest, sqrDistLowerBound);
132 BOOST_CHECK_SMALL(sqrDistLowerBound, tol);
140 AABB bv2_transformed;
141 computeBV(s2, tf2_collision, bv2_transformed);
144 bv1.
overlap(bv2_transformed, collisionRequest, sqrDistLowerBound);
170 AABB bv2_transformed;
171 computeBV(s2, tf2_collision, bv2_transformed);
174 bv1.
overlap(bv2_transformed, collisionRequest, sqrDistLowerBound);
179 BOOST_CHECK(!bv1.
overlap(bv3));
193 collide(s1.get(),
tf1, s2.get(), tf2_collision, collisionRequest,
207 collide(s1.get(),
tf1, s2.get(), tf2_no_collision, collisionRequest,
221 collide(s1.get(),
tf1, s2.get(), tf2_no_collision, collisionRequest,
237 collide(s1.get(),
tf1, s2.get(),
tf2, collisionRequest, collisionResult);
249 collide(s1.get(),
tf1, s2.get(), tf2_collision, collisionRequest,
253 -collisionRequest.security_margin, 1e-8);
268 collide(c1.get(),
tf1, c2.get(), tf2_collision, collisionRequest,
282 collide(c1.get(),
tf1, c2.get(), tf2_no_collision, collisionRequest,
296 collide(c1.get(),
tf1, c2.get(), tf2_no_collision, collisionRequest,
312 collide(c1.get(),
tf1, c2.get(),
tf2, collisionRequest, collisionResult);
324 collide(c1.get(),
tf1, c2.get(), tf2_collision, collisionRequest,
338 const double tol = 1e-3;
344 collide(b1.get(),
tf1, b2.get(), tf2_collision, collisionRequest,
359 collide(b1.get(),
tf1, b2.get(), tf2_no_collision, collisionRequest,
361 BOOST_CHECK(!collisionResult.isCollision());
362 BOOST_CHECK_CLOSE(collisionResult.distance_lower_bound, distance, tol);
371 collide(b1.get(),
tf1, b2.get(), tf2_collision, collisionRequest,
375 -collisionRequest.security_margin, tol);
384 collide(b1.get(),
tf1, b2.get(), tf2_collision, collisionRequest,
388 -collisionRequest.security_margin, tol);
402 collide(b1.get(),
tf1, b2.get(),
tf2, collisionRequest, collisionResult);
410 template <
typename ShapeType1,
typename ShapeType2>
412 const ShapeType2& shape2,
418 collide(&shape1, tf1, &shape2, tf2_collision, collisionRequest,
433 collide(&shape1, tf1, &shape2, tf2_no_collision, collisionRequest,
435 BOOST_CHECK(!collisionResult.isCollision());
436 BOOST_CHECK_CLOSE(collisionResult.distance_lower_bound, distance, tol);
445 collide(&shape1, tf1, &shape2, tf2_collision, collisionRequest,
458 collide(&shape1, tf1, &shape2, tf2_collision, collisionRequest,
479 collide(&shape1, tf1, &shape2,
tf2, collisionRequest, collisionResult);
499 const double tol = 1e-6;
shared_ptr< ConvexBase > convex
Convex<Triangle> representation of this object.
request to the distance computation
void computeBV(const S &s, const Transform3f &tf, BV &bv)
calculate a bounding volume for a shape in a specific configuration
bool overlap(const AABB &other) const
Check whether two AABB are overlap.
BOOST_AUTO_TEST_CASE(aabb_aabb)
FCL_REAL distance_lower_bound
void test_shape_shape(const ShapeType1 &shape1, const Transform3f &tf1, const ShapeType2 &shape2, const Transform3f &tf2_collision, const FCL_REAL tol)
request to the collision algorithm
HPP_FCL_DLLAPI FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL)
Approximate distance between two kIOS bounding volumes.
void buildConvexRepresentation(bool share_memory)
Build this Convex<Triangle> representation of this model. The result is stored in attribute convex...
Center at zero point, axis aligned box.
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
A class describing the AABB collision structure, which is a box in 3D space determined by two diagona...
Center at zero point sphere.
Capsule It is where is the distance between the point x and the capsule segment AB...
Base for convex polytope.
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, including num of max contacts, whether perform exhaustive collision (i.e., returning returning all the contact points), whether return detailed contact information (i.e., normal, contact point, depth; otherwise only contact primitive id is returned), this function performs the collision between them. Return value is the number of contacts generated between the two objects.
shared_ptr< CollisionGeometry > CollisionGeometryPtr_t
const Contact & getContact(size_t i) const
get the i-th contact calculated
bool isCollision() const
return binary collision result
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
the object for collision or distance computation, contains the geometry and the transform information...
void generateBVHModel(BVHModel< BV > &model, const Box &shape, const Transform3f &pose)
Generate BVH model from box.
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision.