collision_func_matrix.cpp
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00038 #include "fcl/collision_func_matrix.h"
00039 
00040 #include "fcl/traversal/traversal_node_setup.h"
00041 #include "fcl/collision_node.h"
00042 #include "fcl/narrowphase/narrowphase.h"
00043 
00044 
00045 namespace fcl
00046 {
00047 
00048 #if FCL_HAVE_OCTOMAP
00049 template<typename T_SH, typename NarrowPhaseSolver>
00050 std::size_t ShapeOcTreeCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2,
00051                                const NarrowPhaseSolver* nsolver,
00052                                const CollisionRequest& request, CollisionResult& result)
00053 {
00054   if(request.isSatisfied(result)) return result.numContacts();
00055 
00056   ShapeOcTreeCollisionTraversalNode<T_SH, NarrowPhaseSolver> node;
00057   const T_SH* obj1 = static_cast<const T_SH*>(o1);
00058   const OcTree* obj2 = static_cast<const OcTree*>(o2);
00059   OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00060 
00061   initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, request, result);
00062   collide(&node);
00063 
00064   return result.numContacts();
00065 }
00066 
00067 template<typename T_SH, typename NarrowPhaseSolver>
00068 std::size_t OcTreeShapeCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2,
00069                                const NarrowPhaseSolver* nsolver,
00070                                const CollisionRequest& request, CollisionResult& result)
00071 {
00072   if(request.isSatisfied(result)) return result.numContacts();
00073 
00074   OcTreeShapeCollisionTraversalNode<T_SH, NarrowPhaseSolver> node;
00075   const OcTree* obj1 = static_cast<const OcTree*>(o1);
00076   const T_SH* obj2 = static_cast<const T_SH*>(o2);
00077   OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00078 
00079   initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, request, result);
00080   collide(&node);
00081 
00082   return result.numContacts();
00083 }
00084 
00085 template<typename NarrowPhaseSolver>
00086 std::size_t OcTreeCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2,
00087                           const NarrowPhaseSolver* nsolver,
00088                           const CollisionRequest& request, CollisionResult& result)
00089 {
00090   if(request.isSatisfied(result)) return result.numContacts();
00091 
00092   OcTreeCollisionTraversalNode<NarrowPhaseSolver> node;
00093   const OcTree* obj1 = static_cast<const OcTree*>(o1);
00094   const OcTree* obj2 = static_cast<const OcTree*>(o2);
00095   OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00096 
00097   initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, request, result);
00098   collide(&node);
00099 
00100   return result.numContacts();
00101 }
00102 
00103 template<typename T_BVH, typename NarrowPhaseSolver>
00104 std::size_t OcTreeBVHCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2,
00105                              const NarrowPhaseSolver* nsolver,
00106                              const CollisionRequest& request, CollisionResult& result)
00107 {
00108   if(request.isSatisfied(result)) return result.numContacts();
00109 
00110   if(request.enable_cost && request.use_approximate_cost)
00111   {
00112     CollisionRequest no_cost_request(request); // request remove cost to avoid the exact but expensive cost computation between mesh and octree
00113     no_cost_request.enable_cost = false; // disable cost computation
00114 
00115     OcTreeMeshCollisionTraversalNode<T_BVH, NarrowPhaseSolver> node;
00116     const OcTree* obj1 = static_cast<const OcTree*>(o1);
00117     const BVHModel<T_BVH>* obj2 = static_cast<const BVHModel<T_BVH>*>(o2);
00118     OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00119 
00120     initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, no_cost_request, result);
00121     collide(&node);
00122 
00123     Box box;
00124     Transform3f box_tf;
00125     constructBox(obj2->getBV(0).bv, tf2, box, box_tf); // compute the box for BVH's root node
00126 
00127     box.cost_density = obj2->cost_density;
00128     box.threshold_occupied = obj2->threshold_occupied;
00129     box.threshold_free = obj2->threshold_free;
00130 
00131     CollisionRequest only_cost_request(result.numContacts(), false, request.num_max_cost_sources, true, false); // additional cost request, no contacts
00132     OcTreeShapeCollide<Box, NarrowPhaseSolver>(o1, tf1, &box, box_tf, nsolver, only_cost_request, result);
00133   }
00134   else
00135   {
00136     OcTreeMeshCollisionTraversalNode<T_BVH, NarrowPhaseSolver> node;
00137     const OcTree* obj1 = static_cast<const OcTree*>(o1);
00138     const BVHModel<T_BVH>* obj2 = static_cast<const BVHModel<T_BVH>*>(o2);
00139     OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00140 
00141     initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, request, result);
00142     collide(&node);
00143   }
00144   
00145   return result.numContacts();
00146 }
00147 
00148 template<typename T_BVH, typename NarrowPhaseSolver>
00149 std::size_t BVHOcTreeCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2,
00150                              const NarrowPhaseSolver* nsolver,
00151                              const CollisionRequest& request, CollisionResult& result)
00152 {
00153   if(request.isSatisfied(result)) return result.numContacts();
00154  
00155   if(request.enable_cost && request.use_approximate_cost)
00156   {
00157     CollisionRequest no_cost_request(request); // request remove cost to avoid the exact but expensive cost computation between mesh and octree
00158     no_cost_request.enable_cost = false; // disable cost computation
00159 
00160     MeshOcTreeCollisionTraversalNode<T_BVH, NarrowPhaseSolver> node;
00161     const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>*>(o1);
00162     const OcTree* obj2 = static_cast<const OcTree*>(o2);
00163     OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00164 
00165     initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, no_cost_request, result);
00166     collide(&node);
00167 
00168     Box box;
00169     Transform3f box_tf;
00170     constructBox(obj1->getBV(0).bv, tf1, box, box_tf);
00171 
00172     box.cost_density = obj1->cost_density;
00173     box.threshold_occupied = obj1->threshold_occupied;
00174     box.threshold_free = obj1->threshold_free;
00175 
00176     CollisionRequest only_cost_request(result.numContacts(), false, request.num_max_cost_sources, true, false);
00177     ShapeOcTreeCollide<Box, NarrowPhaseSolver>(&box, box_tf, o2, tf2, nsolver, only_cost_request, result);
00178   }
00179   else
00180   {
00181     MeshOcTreeCollisionTraversalNode<T_BVH, NarrowPhaseSolver> node;
00182     const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>*>(o1);
00183     const OcTree* obj2 = static_cast<const OcTree*>(o2);
00184     OcTreeSolver<NarrowPhaseSolver> otsolver(nsolver);
00185 
00186     initialize(node, *obj1, tf1, *obj2, tf2, &otsolver, request, result);
00187     collide(&node);
00188   }
00189   
00190   return result.numContacts();
00191 }
00192 
00193 #endif
00194 
00195 template<typename T_SH1, typename T_SH2, typename NarrowPhaseSolver>
00196 std::size_t ShapeShapeCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00197                               const NarrowPhaseSolver* nsolver,
00198                               const CollisionRequest& request, CollisionResult& result)
00199 {
00200   if(request.isSatisfied(result)) return result.numContacts();
00201 
00202   ShapeCollisionTraversalNode<T_SH1, T_SH2, NarrowPhaseSolver> node;
00203   const T_SH1* obj1 = static_cast<const T_SH1*>(o1);
00204   const T_SH2* obj2 = static_cast<const T_SH2*>(o2);
00205 
00206   initialize(node, *obj1, tf1, *obj2, tf2, nsolver, request, result);
00207   collide(&node);
00208 
00209   return result.numContacts();
00210 }
00211 
00212 template<typename T_BVH, typename T_SH, typename NarrowPhaseSolver>
00213 struct BVHShapeCollider
00214 {
00215   static std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00216                              const NarrowPhaseSolver* nsolver,
00217                              const CollisionRequest& request, CollisionResult& result)
00218   {
00219     if(request.isSatisfied(result)) return result.numContacts();
00220 
00221     if(request.enable_cost && request.use_approximate_cost)
00222     {
00223       CollisionRequest no_cost_request(request);
00224       no_cost_request.enable_cost = false;
00225       
00226       MeshShapeCollisionTraversalNode<T_BVH, T_SH, NarrowPhaseSolver> node;
00227       const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>* >(o1);
00228       BVHModel<T_BVH>* obj1_tmp = new BVHModel<T_BVH>(*obj1);
00229       Transform3f tf1_tmp = tf1;
00230       const T_SH* obj2 = static_cast<const T_SH*>(o2);
00231 
00232       initialize(node, *obj1_tmp, tf1_tmp, *obj2, tf2, nsolver, no_cost_request, result);
00233       fcl::collide(&node);
00234 
00235       delete obj1_tmp;
00236 
00237       Box box;
00238       Transform3f box_tf;
00239       constructBox(obj1->getBV(0).bv, tf1, box, box_tf);
00240 
00241       box.cost_density = obj1->cost_density;
00242       box.threshold_occupied = obj1->threshold_occupied;
00243       box.threshold_free = obj1->threshold_free;
00244       
00245       CollisionRequest only_cost_request(result.numContacts(), false, request.num_max_cost_sources, true, false);
00246       ShapeShapeCollide<Box, T_SH>(&box, box_tf, o2, tf2, nsolver, only_cost_request, result);
00247     }
00248     else
00249     {
00250       MeshShapeCollisionTraversalNode<T_BVH, T_SH, NarrowPhaseSolver> node;
00251       const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>* >(o1);
00252       BVHModel<T_BVH>* obj1_tmp = new BVHModel<T_BVH>(*obj1);
00253       Transform3f tf1_tmp = tf1;
00254       const T_SH* obj2 = static_cast<const T_SH*>(o2);
00255 
00256       initialize(node, *obj1_tmp, tf1_tmp, *obj2, tf2, nsolver, request, result);
00257       fcl::collide(&node);
00258 
00259       delete obj1_tmp;
00260     }
00261 
00262     return result.numContacts();
00263   }
00264 };
00265 
00266 namespace details
00267 {
00268 
00269 template<typename OrientMeshShapeCollisionTraveralNode, typename T_BVH, typename T_SH, typename NarrowPhaseSolver>
00270 std::size_t orientedBVHShapeCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00271                                     const NarrowPhaseSolver* nsolver,
00272                                     const CollisionRequest& request, CollisionResult& result)
00273 {
00274   if(request.isSatisfied(result)) return result.numContacts();
00275 
00276   if(request.enable_cost && request.use_approximate_cost)
00277   {
00278     CollisionRequest no_cost_request(request);
00279     no_cost_request.enable_cost = false;
00280 
00281     OrientMeshShapeCollisionTraveralNode node;
00282     const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>* >(o1);
00283     const T_SH* obj2 = static_cast<const T_SH*>(o2);
00284 
00285     initialize(node, *obj1, tf1, *obj2, tf2, nsolver, no_cost_request, result);
00286     fcl::collide(&node);
00287    
00288     Box box;
00289     Transform3f box_tf;
00290     constructBox(obj1->getBV(0).bv, tf1, box, box_tf);
00291 
00292     box.cost_density = obj1->cost_density;
00293     box.threshold_occupied = obj1->threshold_occupied;
00294     box.threshold_free = obj1->threshold_free;
00295       
00296     CollisionRequest only_cost_request(result.numContacts(), false, request.num_max_cost_sources, true, false);
00297     ShapeShapeCollide<Box, T_SH>(&box, box_tf, o2, tf2, nsolver, only_cost_request, result);     
00298   }
00299   else
00300   {
00301     OrientMeshShapeCollisionTraveralNode node;
00302     const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>* >(o1);
00303     const T_SH* obj2 = static_cast<const T_SH*>(o2);
00304 
00305     initialize(node, *obj1, tf1, *obj2, tf2, nsolver, request, result);
00306     fcl::collide(&node);
00307   }
00308 
00309   return result.numContacts();
00310 }
00311 
00312 }
00313 
00314 
00315 template<typename T_SH, typename NarrowPhaseSolver>
00316 struct BVHShapeCollider<OBB, T_SH, NarrowPhaseSolver>
00317 {
00318   static std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00319                              const NarrowPhaseSolver* nsolver,
00320                              const CollisionRequest& request, CollisionResult& result)
00321   {
00322     return details::orientedBVHShapeCollide<MeshShapeCollisionTraversalNodeOBB<T_SH, NarrowPhaseSolver>, OBB, T_SH, NarrowPhaseSolver>(o1, tf1, o2, tf2, nsolver, request, result);
00323   } 
00324 };
00325 
00326 
00327 template<typename T_SH, typename NarrowPhaseSolver>
00328 struct BVHShapeCollider<RSS, T_SH, NarrowPhaseSolver>
00329 {
00330   static std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00331                              const NarrowPhaseSolver* nsolver,
00332                              const CollisionRequest& request, CollisionResult& result)
00333   {
00334     return details::orientedBVHShapeCollide<MeshShapeCollisionTraversalNodeRSS<T_SH, NarrowPhaseSolver>, RSS, T_SH, NarrowPhaseSolver>(o1, tf1, o2, tf2, nsolver, request, result);
00335   } 
00336 };
00337 
00338 
00339 template<typename T_SH, typename NarrowPhaseSolver>
00340 struct BVHShapeCollider<kIOS, T_SH, NarrowPhaseSolver>
00341 {
00342   static std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00343                              const NarrowPhaseSolver* nsolver,
00344                              const CollisionRequest& request, CollisionResult& result)
00345   {
00346     return details::orientedBVHShapeCollide<MeshShapeCollisionTraversalNodekIOS<T_SH, NarrowPhaseSolver>, kIOS, T_SH, NarrowPhaseSolver>(o1, tf1, o2, tf2, nsolver, request, result);
00347   } 
00348 };
00349 
00350 
00351 template<typename T_SH, typename NarrowPhaseSolver>
00352 struct BVHShapeCollider<OBBRSS, T_SH, NarrowPhaseSolver>
00353 {
00354   static std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00355                              const NarrowPhaseSolver* nsolver,
00356                              const CollisionRequest& request, CollisionResult& result)
00357   {
00358     return details::orientedBVHShapeCollide<MeshShapeCollisionTraversalNodeOBBRSS<T_SH, NarrowPhaseSolver>, OBBRSS, T_SH, NarrowPhaseSolver>(o1, tf1, o2, tf2, nsolver, request, result);
00359   } 
00360 };
00361 
00362 
00363 template<typename T_BVH>
00364 std::size_t BVHCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, const CollisionRequest& request, CollisionResult& result)
00365 {
00366   if(request.isSatisfied(result)) return result.numContacts();
00367   
00368   MeshCollisionTraversalNode<T_BVH> node;
00369   const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>* >(o1);
00370   const BVHModel<T_BVH>* obj2 = static_cast<const BVHModel<T_BVH>* >(o2);
00371   BVHModel<T_BVH>* obj1_tmp = new BVHModel<T_BVH>(*obj1);
00372   Transform3f tf1_tmp = tf1;
00373   BVHModel<T_BVH>* obj2_tmp = new BVHModel<T_BVH>(*obj2);
00374   Transform3f tf2_tmp = tf2;
00375   
00376   initialize(node, *obj1_tmp, tf1_tmp, *obj2_tmp, tf2_tmp, request, result);
00377   collide(&node);
00378 
00379   delete obj1_tmp;
00380   delete obj2_tmp;
00381 
00382   return result.numContacts();
00383 }
00384 
00385 namespace details
00386 {
00387 template<typename OrientedMeshCollisionTraversalNode, typename T_BVH>
00388 std::size_t orientedMeshCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, const CollisionRequest& request, CollisionResult& result)
00389 {
00390   if(request.isSatisfied(result)) return result.numContacts();
00391 
00392   OrientedMeshCollisionTraversalNode node;
00393   const BVHModel<T_BVH>* obj1 = static_cast<const BVHModel<T_BVH>* >(o1);
00394   const BVHModel<T_BVH>* obj2 = static_cast<const BVHModel<T_BVH>* >(o2);
00395 
00396   initialize(node, *obj1, tf1, *obj2, tf2, request, result);
00397   collide(&node);
00398 
00399   return result.numContacts();
00400 }
00401 
00402 }
00403 
00404 template<>
00405 std::size_t BVHCollide<OBB>(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, const CollisionRequest& request, CollisionResult& result)
00406 {
00407   return details::orientedMeshCollide<MeshCollisionTraversalNodeOBB, OBB>(o1, tf1, o2, tf2, request, result);
00408 }
00409 
00410 template<>
00411 std::size_t BVHCollide<OBBRSS>(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, const CollisionRequest& request, CollisionResult& result)
00412 {
00413   return details::orientedMeshCollide<MeshCollisionTraversalNodeOBBRSS, OBBRSS>(o1, tf1, o2, tf2, request, result);
00414 }
00415 
00416 
00417 template<>
00418 std::size_t BVHCollide<kIOS>(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, const CollisionRequest& request, CollisionResult& result)
00419 {
00420   return details::orientedMeshCollide<MeshCollisionTraversalNodekIOS, kIOS>(o1, tf1, o2, tf2, request, result);
00421 }
00422 
00423 
00424 template<typename T_BVH, typename NarrowPhaseSolver>
00425 std::size_t BVHCollide(const CollisionGeometry* o1, const Transform3f& tf1, const CollisionGeometry* o2, const Transform3f& tf2, 
00426                        const NarrowPhaseSolver* nsolver,
00427                        const CollisionRequest& request, CollisionResult& result)
00428 {
00429   return BVHCollide<T_BVH>(o1, tf1, o2, tf2, request, result);
00430 }
00431 
00432 
00433 template<typename NarrowPhaseSolver>
00434 CollisionFunctionMatrix<NarrowPhaseSolver>::CollisionFunctionMatrix()
00435 {
00436   for(int i = 0; i < NODE_COUNT; ++i)
00437   {
00438     for(int j = 0; j < NODE_COUNT; ++j)
00439       collision_matrix[i][j] = NULL;
00440   }
00441 
00442   collision_matrix[GEOM_BOX][GEOM_BOX] = &ShapeShapeCollide<Box, Box, NarrowPhaseSolver>;
00443   collision_matrix[GEOM_BOX][GEOM_SPHERE] = &ShapeShapeCollide<Box, Sphere, NarrowPhaseSolver>;
00444   collision_matrix[GEOM_BOX][GEOM_CAPSULE] = &ShapeShapeCollide<Box, Capsule, NarrowPhaseSolver>;
00445   collision_matrix[GEOM_BOX][GEOM_CONE] = &ShapeShapeCollide<Box, Cone, NarrowPhaseSolver>;
00446   collision_matrix[GEOM_BOX][GEOM_CYLINDER] = &ShapeShapeCollide<Box, Cylinder, NarrowPhaseSolver>;
00447   collision_matrix[GEOM_BOX][GEOM_CONVEX] = &ShapeShapeCollide<Box, Convex, NarrowPhaseSolver>;
00448   collision_matrix[GEOM_BOX][GEOM_PLANE] = &ShapeShapeCollide<Box, Plane, NarrowPhaseSolver>;
00449 
00450   collision_matrix[GEOM_SPHERE][GEOM_BOX] = &ShapeShapeCollide<Sphere, Box, NarrowPhaseSolver>;
00451   collision_matrix[GEOM_SPHERE][GEOM_SPHERE] = &ShapeShapeCollide<Sphere, Sphere, NarrowPhaseSolver>;
00452   collision_matrix[GEOM_SPHERE][GEOM_CAPSULE] = &ShapeShapeCollide<Sphere, Capsule, NarrowPhaseSolver>;
00453   collision_matrix[GEOM_SPHERE][GEOM_CONE] = &ShapeShapeCollide<Sphere, Cone, NarrowPhaseSolver>;
00454   collision_matrix[GEOM_SPHERE][GEOM_CYLINDER] = &ShapeShapeCollide<Sphere, Cylinder, NarrowPhaseSolver>;
00455   collision_matrix[GEOM_SPHERE][GEOM_CONVEX] = &ShapeShapeCollide<Sphere, Convex, NarrowPhaseSolver>;
00456   collision_matrix[GEOM_SPHERE][GEOM_PLANE] = &ShapeShapeCollide<Sphere, Plane, NarrowPhaseSolver>;
00457 
00458   collision_matrix[GEOM_CAPSULE][GEOM_BOX] = &ShapeShapeCollide<Capsule, Box, NarrowPhaseSolver>;
00459   collision_matrix[GEOM_CAPSULE][GEOM_SPHERE] = &ShapeShapeCollide<Capsule, Sphere, NarrowPhaseSolver>;
00460   collision_matrix[GEOM_CAPSULE][GEOM_CAPSULE] = &ShapeShapeCollide<Capsule, Capsule, NarrowPhaseSolver>;
00461   collision_matrix[GEOM_CAPSULE][GEOM_CONE] = &ShapeShapeCollide<Capsule, Cone, NarrowPhaseSolver>;
00462   collision_matrix[GEOM_CAPSULE][GEOM_CYLINDER] = &ShapeShapeCollide<Capsule, Cylinder, NarrowPhaseSolver>;
00463   collision_matrix[GEOM_CAPSULE][GEOM_CONVEX] = &ShapeShapeCollide<Capsule, Convex, NarrowPhaseSolver>;
00464   collision_matrix[GEOM_CAPSULE][GEOM_PLANE] = &ShapeShapeCollide<Capsule, Plane, NarrowPhaseSolver>;
00465 
00466   collision_matrix[GEOM_CONE][GEOM_BOX] = &ShapeShapeCollide<Cone, Box, NarrowPhaseSolver>;
00467   collision_matrix[GEOM_CONE][GEOM_SPHERE] = &ShapeShapeCollide<Cone, Sphere, NarrowPhaseSolver>;
00468   collision_matrix[GEOM_CONE][GEOM_CAPSULE] = &ShapeShapeCollide<Cone, Capsule, NarrowPhaseSolver>;
00469   collision_matrix[GEOM_CONE][GEOM_CONE] = &ShapeShapeCollide<Cone, Cone, NarrowPhaseSolver>;
00470   collision_matrix[GEOM_CONE][GEOM_CYLINDER] = &ShapeShapeCollide<Cone, Cylinder, NarrowPhaseSolver>;
00471   collision_matrix[GEOM_CONE][GEOM_CONVEX] = &ShapeShapeCollide<Cone, Convex, NarrowPhaseSolver>;
00472   collision_matrix[GEOM_CONE][GEOM_PLANE] = &ShapeShapeCollide<Cone, Plane, NarrowPhaseSolver>;
00473 
00474   collision_matrix[GEOM_CYLINDER][GEOM_BOX] = &ShapeShapeCollide<Cylinder, Box, NarrowPhaseSolver>;
00475   collision_matrix[GEOM_CYLINDER][GEOM_SPHERE] = &ShapeShapeCollide<Cylinder, Sphere, NarrowPhaseSolver>;
00476   collision_matrix[GEOM_CYLINDER][GEOM_CAPSULE] = &ShapeShapeCollide<Cylinder, Capsule, NarrowPhaseSolver>;
00477   collision_matrix[GEOM_CYLINDER][GEOM_CONE] = &ShapeShapeCollide<Cylinder, Cone, NarrowPhaseSolver>;
00478   collision_matrix[GEOM_CYLINDER][GEOM_CYLINDER] = &ShapeShapeCollide<Cylinder, Cylinder, NarrowPhaseSolver>;
00479   collision_matrix[GEOM_CYLINDER][GEOM_CONVEX] = &ShapeShapeCollide<Cylinder, Convex, NarrowPhaseSolver>;
00480   collision_matrix[GEOM_CYLINDER][GEOM_PLANE] = &ShapeShapeCollide<Cylinder, Plane, NarrowPhaseSolver>;
00481 
00482   collision_matrix[GEOM_CONVEX][GEOM_BOX] = &ShapeShapeCollide<Convex, Box, NarrowPhaseSolver>;
00483   collision_matrix[GEOM_CONVEX][GEOM_SPHERE] = &ShapeShapeCollide<Convex, Sphere, NarrowPhaseSolver>;
00484   collision_matrix[GEOM_CONVEX][GEOM_CAPSULE] = &ShapeShapeCollide<Convex, Capsule, NarrowPhaseSolver>;
00485   collision_matrix[GEOM_CONVEX][GEOM_CONE] = &ShapeShapeCollide<Convex, Cone, NarrowPhaseSolver>;
00486   collision_matrix[GEOM_CONVEX][GEOM_CYLINDER] = &ShapeShapeCollide<Convex, Cylinder, NarrowPhaseSolver>;
00487   collision_matrix[GEOM_CONVEX][GEOM_CONVEX] = &ShapeShapeCollide<Convex, Convex, NarrowPhaseSolver>;
00488   collision_matrix[GEOM_CONVEX][GEOM_PLANE] = &ShapeShapeCollide<Convex, Plane, NarrowPhaseSolver>;
00489 
00490   collision_matrix[GEOM_PLANE][GEOM_BOX] = &ShapeShapeCollide<Plane, Box, NarrowPhaseSolver>;
00491   collision_matrix[GEOM_PLANE][GEOM_SPHERE] = &ShapeShapeCollide<Plane, Sphere, NarrowPhaseSolver>;
00492   collision_matrix[GEOM_PLANE][GEOM_CAPSULE] = &ShapeShapeCollide<Plane, Capsule, NarrowPhaseSolver>;
00493   collision_matrix[GEOM_PLANE][GEOM_CONE] = &ShapeShapeCollide<Plane, Cone, NarrowPhaseSolver>;
00494   collision_matrix[GEOM_PLANE][GEOM_CYLINDER] = &ShapeShapeCollide<Plane, Cylinder, NarrowPhaseSolver>;
00495   collision_matrix[GEOM_PLANE][GEOM_CONVEX] = &ShapeShapeCollide<Plane, Convex, NarrowPhaseSolver>;
00496   collision_matrix[GEOM_PLANE][GEOM_PLANE] = &ShapeShapeCollide<Plane, Plane, NarrowPhaseSolver>;
00497 
00498   collision_matrix[BV_AABB][GEOM_BOX] = &BVHShapeCollider<AABB, Box, NarrowPhaseSolver>::collide;
00499   collision_matrix[BV_AABB][GEOM_SPHERE] = &BVHShapeCollider<AABB, Sphere, NarrowPhaseSolver>::collide;
00500   collision_matrix[BV_AABB][GEOM_CAPSULE] = &BVHShapeCollider<AABB, Capsule, NarrowPhaseSolver>::collide;
00501   collision_matrix[BV_AABB][GEOM_CONE] = &BVHShapeCollider<AABB, Cone, NarrowPhaseSolver>::collide;
00502   collision_matrix[BV_AABB][GEOM_CYLINDER] = &BVHShapeCollider<AABB, Cylinder, NarrowPhaseSolver>::collide;
00503   collision_matrix[BV_AABB][GEOM_CONVEX] = &BVHShapeCollider<AABB, Convex, NarrowPhaseSolver>::collide;
00504   collision_matrix[BV_AABB][GEOM_PLANE] = &BVHShapeCollider<AABB, Plane, NarrowPhaseSolver>::collide;
00505 
00506   collision_matrix[BV_OBB][GEOM_BOX] = &BVHShapeCollider<OBB, Box, NarrowPhaseSolver>::collide;
00507   collision_matrix[BV_OBB][GEOM_SPHERE] = &BVHShapeCollider<OBB, Sphere, NarrowPhaseSolver>::collide;
00508   collision_matrix[BV_OBB][GEOM_CAPSULE] = &BVHShapeCollider<OBB, Capsule, NarrowPhaseSolver>::collide;
00509   collision_matrix[BV_OBB][GEOM_CONE] = &BVHShapeCollider<OBB, Cone, NarrowPhaseSolver>::collide;
00510   collision_matrix[BV_OBB][GEOM_CYLINDER] = &BVHShapeCollider<OBB, Cylinder, NarrowPhaseSolver>::collide;
00511   collision_matrix[BV_OBB][GEOM_CONVEX] = &BVHShapeCollider<OBB, Convex, NarrowPhaseSolver>::collide;
00512   collision_matrix[BV_OBB][GEOM_PLANE] = &BVHShapeCollider<OBB, Plane, NarrowPhaseSolver>::collide;
00513 
00514   collision_matrix[BV_RSS][GEOM_BOX] = &BVHShapeCollider<RSS, Box, NarrowPhaseSolver>::collide;
00515   collision_matrix[BV_RSS][GEOM_SPHERE] = &BVHShapeCollider<RSS, Sphere, NarrowPhaseSolver>::collide;
00516   collision_matrix[BV_RSS][GEOM_CAPSULE] = &BVHShapeCollider<RSS, Capsule, NarrowPhaseSolver>::collide;
00517   collision_matrix[BV_RSS][GEOM_CONE] = &BVHShapeCollider<RSS, Cone, NarrowPhaseSolver>::collide;
00518   collision_matrix[BV_RSS][GEOM_CYLINDER] = &BVHShapeCollider<RSS, Cylinder, NarrowPhaseSolver>::collide;
00519   collision_matrix[BV_RSS][GEOM_CONVEX] = &BVHShapeCollider<RSS, Convex, NarrowPhaseSolver>::collide;
00520   collision_matrix[BV_RSS][GEOM_PLANE] = &BVHShapeCollider<RSS, Plane, NarrowPhaseSolver>::collide;
00521 
00522   collision_matrix[BV_KDOP16][GEOM_BOX] = &BVHShapeCollider<KDOP<16>, Box, NarrowPhaseSolver>::collide;
00523   collision_matrix[BV_KDOP16][GEOM_SPHERE] = &BVHShapeCollider<KDOP<16>, Sphere, NarrowPhaseSolver>::collide;
00524   collision_matrix[BV_KDOP16][GEOM_CAPSULE] = &BVHShapeCollider<KDOP<16>, Capsule, NarrowPhaseSolver>::collide;
00525   collision_matrix[BV_KDOP16][GEOM_CONE] = &BVHShapeCollider<KDOP<16>, Cone, NarrowPhaseSolver>::collide;
00526   collision_matrix[BV_KDOP16][GEOM_CYLINDER] = &BVHShapeCollider<KDOP<16>, Cylinder, NarrowPhaseSolver>::collide;
00527   collision_matrix[BV_KDOP16][GEOM_CONVEX] = &BVHShapeCollider<KDOP<16>, Convex, NarrowPhaseSolver>::collide;
00528   collision_matrix[BV_KDOP16][GEOM_PLANE] = &BVHShapeCollider<KDOP<16>, Plane, NarrowPhaseSolver>::collide;
00529 
00530   collision_matrix[BV_KDOP18][GEOM_BOX] = &BVHShapeCollider<KDOP<18>, Box, NarrowPhaseSolver>::collide;
00531   collision_matrix[BV_KDOP18][GEOM_SPHERE] = &BVHShapeCollider<KDOP<18>, Sphere, NarrowPhaseSolver>::collide;
00532   collision_matrix[BV_KDOP18][GEOM_CAPSULE] = &BVHShapeCollider<KDOP<18>, Capsule, NarrowPhaseSolver>::collide;
00533   collision_matrix[BV_KDOP18][GEOM_CONE] = &BVHShapeCollider<KDOP<18>, Cone, NarrowPhaseSolver>::collide;
00534   collision_matrix[BV_KDOP18][GEOM_CYLINDER] = &BVHShapeCollider<KDOP<18>, Cylinder, NarrowPhaseSolver>::collide;
00535   collision_matrix[BV_KDOP18][GEOM_CONVEX] = &BVHShapeCollider<KDOP<18>, Convex, NarrowPhaseSolver>::collide;
00536   collision_matrix[BV_KDOP18][GEOM_PLANE] = &BVHShapeCollider<KDOP<18>, Plane, NarrowPhaseSolver>::collide;
00537 
00538   collision_matrix[BV_KDOP24][GEOM_BOX] = &BVHShapeCollider<KDOP<24>, Box, NarrowPhaseSolver>::collide;
00539   collision_matrix[BV_KDOP24][GEOM_SPHERE] = &BVHShapeCollider<KDOP<24>, Sphere, NarrowPhaseSolver>::collide;
00540   collision_matrix[BV_KDOP24][GEOM_CAPSULE] = &BVHShapeCollider<KDOP<24>, Capsule, NarrowPhaseSolver>::collide;
00541   collision_matrix[BV_KDOP24][GEOM_CONE] = &BVHShapeCollider<KDOP<24>, Cone, NarrowPhaseSolver>::collide;
00542   collision_matrix[BV_KDOP24][GEOM_CYLINDER] = &BVHShapeCollider<KDOP<24>, Cylinder, NarrowPhaseSolver>::collide;
00543   collision_matrix[BV_KDOP24][GEOM_CONVEX] = &BVHShapeCollider<KDOP<24>, Convex, NarrowPhaseSolver>::collide;
00544   collision_matrix[BV_KDOP24][GEOM_PLANE] = &BVHShapeCollider<KDOP<24>, Plane, NarrowPhaseSolver>::collide;
00545 
00546   collision_matrix[BV_kIOS][GEOM_BOX] = &BVHShapeCollider<kIOS, Box, NarrowPhaseSolver>::collide;
00547   collision_matrix[BV_kIOS][GEOM_SPHERE] = &BVHShapeCollider<kIOS, Sphere, NarrowPhaseSolver>::collide;
00548   collision_matrix[BV_kIOS][GEOM_CAPSULE] = &BVHShapeCollider<kIOS, Capsule, NarrowPhaseSolver>::collide;
00549   collision_matrix[BV_kIOS][GEOM_CONE] = &BVHShapeCollider<kIOS, Cone, NarrowPhaseSolver>::collide;
00550   collision_matrix[BV_kIOS][GEOM_CYLINDER] = &BVHShapeCollider<kIOS, Cylinder, NarrowPhaseSolver>::collide;
00551   collision_matrix[BV_kIOS][GEOM_CONVEX] = &BVHShapeCollider<kIOS, Convex, NarrowPhaseSolver>::collide;
00552   collision_matrix[BV_kIOS][GEOM_PLANE] = &BVHShapeCollider<kIOS, Plane, NarrowPhaseSolver>::collide;
00553 
00554   collision_matrix[BV_OBBRSS][GEOM_BOX] = &BVHShapeCollider<OBBRSS, Box, NarrowPhaseSolver>::collide;
00555   collision_matrix[BV_OBBRSS][GEOM_SPHERE] = &BVHShapeCollider<OBBRSS, Sphere, NarrowPhaseSolver>::collide;
00556   collision_matrix[BV_OBBRSS][GEOM_CAPSULE] = &BVHShapeCollider<OBBRSS, Capsule, NarrowPhaseSolver>::collide;
00557   collision_matrix[BV_OBBRSS][GEOM_CONE] = &BVHShapeCollider<OBBRSS, Cone, NarrowPhaseSolver>::collide;
00558   collision_matrix[BV_OBBRSS][GEOM_CYLINDER] = &BVHShapeCollider<OBBRSS, Cylinder, NarrowPhaseSolver>::collide;
00559   collision_matrix[BV_OBBRSS][GEOM_CONVEX] = &BVHShapeCollider<OBBRSS, Convex, NarrowPhaseSolver>::collide;
00560   collision_matrix[BV_OBBRSS][GEOM_PLANE] = &BVHShapeCollider<OBBRSS, Plane, NarrowPhaseSolver>::collide;
00561 
00562   collision_matrix[BV_AABB][BV_AABB] = &BVHCollide<AABB, NarrowPhaseSolver>;
00563   collision_matrix[BV_OBB][BV_OBB] = &BVHCollide<OBB, NarrowPhaseSolver>;
00564   collision_matrix[BV_RSS][BV_RSS] = &BVHCollide<RSS, NarrowPhaseSolver>;
00565   collision_matrix[BV_KDOP16][BV_KDOP16] = &BVHCollide<KDOP<16>, NarrowPhaseSolver>;
00566   collision_matrix[BV_KDOP18][BV_KDOP18] = &BVHCollide<KDOP<18>, NarrowPhaseSolver>;
00567   collision_matrix[BV_KDOP24][BV_KDOP24] = &BVHCollide<KDOP<24>, NarrowPhaseSolver>;
00568   collision_matrix[BV_kIOS][BV_kIOS] = &BVHCollide<kIOS, NarrowPhaseSolver>;
00569   collision_matrix[BV_OBBRSS][BV_OBBRSS] = &BVHCollide<OBBRSS, NarrowPhaseSolver>;
00570 
00571 #if FCL_HAVE_OCTOMAP
00572   collision_matrix[GEOM_OCTREE][GEOM_BOX] = &OcTreeShapeCollide<Box, NarrowPhaseSolver>;
00573   collision_matrix[GEOM_OCTREE][GEOM_SPHERE] = &OcTreeShapeCollide<Sphere, NarrowPhaseSolver>;
00574   collision_matrix[GEOM_OCTREE][GEOM_CAPSULE] = &OcTreeShapeCollide<Capsule, NarrowPhaseSolver>;
00575   collision_matrix[GEOM_OCTREE][GEOM_CONE] = &OcTreeShapeCollide<Cone, NarrowPhaseSolver>;
00576   collision_matrix[GEOM_OCTREE][GEOM_CYLINDER] = &OcTreeShapeCollide<Cylinder, NarrowPhaseSolver>;
00577   collision_matrix[GEOM_OCTREE][GEOM_CONVEX] = &OcTreeShapeCollide<Convex, NarrowPhaseSolver>;
00578   collision_matrix[GEOM_OCTREE][GEOM_PLANE] = &OcTreeShapeCollide<Plane, NarrowPhaseSolver>;
00579 
00580   collision_matrix[GEOM_BOX][GEOM_OCTREE] = &ShapeOcTreeCollide<Box, NarrowPhaseSolver>;
00581   collision_matrix[GEOM_SPHERE][GEOM_OCTREE] = &ShapeOcTreeCollide<Sphere, NarrowPhaseSolver>;
00582   collision_matrix[GEOM_CAPSULE][GEOM_OCTREE] = &ShapeOcTreeCollide<Capsule, NarrowPhaseSolver>;
00583   collision_matrix[GEOM_CONE][GEOM_OCTREE] = &ShapeOcTreeCollide<Cone, NarrowPhaseSolver>;
00584   collision_matrix[GEOM_CYLINDER][GEOM_OCTREE] = &ShapeOcTreeCollide<Cylinder, NarrowPhaseSolver>;
00585   collision_matrix[GEOM_CONVEX][GEOM_OCTREE] = &ShapeOcTreeCollide<Convex, NarrowPhaseSolver>;
00586   collision_matrix[GEOM_PLANE][GEOM_OCTREE] = &ShapeOcTreeCollide<Plane, NarrowPhaseSolver>;
00587 
00588   collision_matrix[GEOM_OCTREE][GEOM_OCTREE] = &OcTreeCollide<NarrowPhaseSolver>;
00589 
00590   collision_matrix[GEOM_OCTREE][BV_AABB] = &OcTreeBVHCollide<AABB, NarrowPhaseSolver>;
00591   collision_matrix[GEOM_OCTREE][BV_OBB] = &OcTreeBVHCollide<OBB, NarrowPhaseSolver>;
00592   collision_matrix[GEOM_OCTREE][BV_RSS] = &OcTreeBVHCollide<RSS, NarrowPhaseSolver>;
00593   collision_matrix[GEOM_OCTREE][BV_OBBRSS] = &OcTreeBVHCollide<OBBRSS, NarrowPhaseSolver>;
00594   collision_matrix[GEOM_OCTREE][BV_kIOS] = &OcTreeBVHCollide<kIOS, NarrowPhaseSolver>;
00595   collision_matrix[GEOM_OCTREE][BV_KDOP16] = &OcTreeBVHCollide<KDOP<16>, NarrowPhaseSolver>;
00596   collision_matrix[GEOM_OCTREE][BV_KDOP18] = &OcTreeBVHCollide<KDOP<18>, NarrowPhaseSolver>;
00597   collision_matrix[GEOM_OCTREE][BV_KDOP24] = &OcTreeBVHCollide<KDOP<24>, NarrowPhaseSolver>;
00598 
00599   collision_matrix[BV_AABB][GEOM_OCTREE] = &BVHOcTreeCollide<AABB, NarrowPhaseSolver>;
00600   collision_matrix[BV_OBB][GEOM_OCTREE] = &BVHOcTreeCollide<OBB, NarrowPhaseSolver>;
00601   collision_matrix[BV_RSS][GEOM_OCTREE] = &BVHOcTreeCollide<RSS, NarrowPhaseSolver>;
00602   collision_matrix[BV_OBBRSS][GEOM_OCTREE] = &BVHOcTreeCollide<OBBRSS, NarrowPhaseSolver>;
00603   collision_matrix[BV_kIOS][GEOM_OCTREE] = &BVHOcTreeCollide<kIOS, NarrowPhaseSolver>;
00604   collision_matrix[BV_KDOP16][GEOM_OCTREE] = &BVHOcTreeCollide<KDOP<16>, NarrowPhaseSolver>;
00605   collision_matrix[BV_KDOP18][GEOM_OCTREE] = &BVHOcTreeCollide<KDOP<18>, NarrowPhaseSolver>;
00606   collision_matrix[BV_KDOP24][GEOM_OCTREE] = &BVHOcTreeCollide<KDOP<24>, NarrowPhaseSolver>;
00607 #endif
00608 }
00609 
00610 
00611 template struct CollisionFunctionMatrix<GJKSolver_libccd>;
00612 template struct CollisionFunctionMatrix<GJKSolver_indep>;
00613 
00614 
00615 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


fcl
Author(s): Jia Pan
autogenerated on Tue Jan 15 2013 16:05:30