38 #ifndef FCL_COLLISION_INL_H 39 #define FCL_COLLISION_INL_H 41 #include "fcl/narrowphase/collision.h" 43 #include "fcl/narrowphase/detail/collision_func_matrix.h" 44 #include "fcl/narrowphase/detail/gjk_solver_indep.h" 45 #include "fcl/narrowphase/detail/gjk_solver_libccd.h" 53 const CollisionObject<double>* o1,
54 const CollisionObject<double>* o2,
55 const CollisionRequest<double>& request,
56 CollisionResult<double>& result);
61 const CollisionGeometry<double>* o1,
62 const Transform3<double>& tf1,
63 const CollisionGeometry<double>* o2,
64 const Transform3<double>& tf2,
65 const CollisionRequest<double>& request,
66 CollisionResult<double>& result);
69 template<
typename GJKSolver>
70 detail::CollisionFunctionMatrix<GJKSolver>& getCollisionFunctionLookTable()
72 static detail::CollisionFunctionMatrix<GJKSolver> table;
77 template <
typename S,
typename NarrowPhaseSolver>
79 const CollisionObject<S>* o1,
80 const CollisionObject<S>* o2,
81 const NarrowPhaseSolver* nsolver,
82 const CollisionRequest<S>& request,
83 CollisionResult<S>& result)
85 return collide(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(),
86 nsolver, request, result);
90 template <
typename S,
typename NarrowPhaseSolver>
92 const CollisionGeometry<S>* o1,
93 const Transform3<S>& tf1,
94 const CollisionGeometry<S>* o2,
95 const Transform3<S>& tf2,
96 const NarrowPhaseSolver* nsolver_,
97 const CollisionRequest<S>& request,
98 CollisionResult<S>& result)
100 const NarrowPhaseSolver* nsolver = nsolver_;
102 nsolver =
new NarrowPhaseSolver();
104 const auto& looktable = getCollisionFunctionLookTable<NarrowPhaseSolver>();
107 if(request.num_max_contacts == 0)
109 std::cerr <<
"Warning: should stop early as num_max_contact is " << request.num_max_contacts <<
" !" << std::endl;
116 NODE_TYPE node_type1 = o1->getNodeType();
117 NODE_TYPE node_type2 = o2->getNodeType();
119 if(object_type1 == OT_GEOM && object_type2 == OT_BVH)
121 if(!looktable.collision_matrix[node_type2][node_type1])
123 std::cerr <<
"Warning: collision function between node type " << node_type1 <<
" and node type " << node_type2 <<
" is not supported"<< std::endl;
127 res = looktable.collision_matrix[node_type2][node_type1](o2, tf2, o1, tf1, nsolver, request, result);
131 if(!looktable.collision_matrix[node_type1][node_type2])
133 std::cerr <<
"Warning: collision function between node type " << node_type1 <<
" and node type " << node_type2 <<
" is not supported"<< std::endl;
137 res = looktable.collision_matrix[node_type1][node_type2](o1, tf1, o2, tf2, nsolver, request, result);
148 template <
typename S>
157 return collide(o1, o2, &solver, request, result);
162 return collide(o1, o2, &solver, request, result);
170 template <
typename S>
173 const Transform3<S>& tf1,
175 const Transform3<S>& tf2,
184 return collide(o1, tf1, o2, tf2, &solver, request, result);
189 return collide(o1, tf1, o2, tf2, &solver, request, result);
192 std::cerr <<
"Warning! Invalid GJK solver" << std::endl;
NODE_TYPE
traversal node type: bounding volume (AABB, OBB, RSS, kIOS, OBBRSS, KDOP16, KDOP18, kDOP24), basic shape (box, sphere, ellipsoid, capsule, cone, cylinder, convex, plane, halfspace, triangle), and octree
Definition: collision_geometry.h:54
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
collision result
Definition: collision_request.h:48
The geometry for the object for collision or distance computation.
Definition: collision_geometry.h:59
GJKSolverType gjk_solver_type
narrow phase solver
Definition: collision_request.h:70
collision and distance solver based on libccd library.
Definition: gjk_solver_libccd.h:53
request to the collision algorithm
Definition: collision_request.h:52
OBJECT_TYPE
object type: BVH (mesh, points), basic geometry, octree
Definition: collision_geometry.h:51
the object for collision or distance computation, contains the geometry and the transform information...
Definition: collision_object.h:51
collision and distance solver based on GJK algorithm implemented in fcl (rewritten the code from the ...
Definition: gjk_solver_indep.h:53