hpp-fcl  1.7.4
HPP fork of FCL -- The Flexible Collision Library
shape_shape_func.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2014, CNRS-LAAS
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
37 #ifndef HPP_FCL_INTERNAL_SHAPE_SHAPE_FUNC_H
38 #define HPP_FCL_INTERNAL_SHAPE_SHAPE_FUNC_H
39 
41 
42 #include <hpp/fcl/collision_data.h>
44 
45 namespace hpp
46 {
47 namespace fcl
48 {
49  template<typename T_SH1, typename T_SH2>
50  HPP_FCL_DLLAPI FCL_REAL ShapeShapeDistance
51  (const CollisionGeometry* o1, const Transform3f& tf1,
52  const CollisionGeometry* o2, const Transform3f& tf2,
53  const GJKSolver* nsolver, const DistanceRequest& request,
54  DistanceResult& result);
55 
56  template<typename T_SH1, typename T_SH2>
57  HPP_FCL_DLLAPI std::size_t ShapeShapeCollide
58  (const CollisionGeometry* o1, const Transform3f& tf1,
59  const CollisionGeometry* o2, const Transform3f& tf2,
60  const GJKSolver* nsolver, const CollisionRequest& request,
61  CollisionResult& result);
62 
63 #define SHAPE_SHAPE_DISTANCE_SPECIALIZATION(T1,T2) \
64 template<> \
65 HPP_FCL_DLLAPI FCL_REAL ShapeShapeDistance<T1,T2> \
66  (const CollisionGeometry* o1, const Transform3f& tf1, \
67  const CollisionGeometry* o2, const Transform3f& tf2, \
68  const GJKSolver* nsolver, const DistanceRequest& request, \
69  DistanceResult& result); \
70 template<> \
71 HPP_FCL_DLLAPI FCL_REAL ShapeShapeDistance<T2,T1> \
72 (const CollisionGeometry* o1, const Transform3f& tf1, \
73  const CollisionGeometry* o2, const Transform3f& tf2, \
74  const GJKSolver* nsolver, const DistanceRequest& request, \
75  DistanceResult& result)
76 
77  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box,Halfspace);
78  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box,Plane);
79  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box,Sphere);
80  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule,Capsule);
81  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule,Halfspace);
82  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule,Plane);
83  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cone,Halfspace);
84  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cone,Plane);
85  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cylinder,Halfspace);
86  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cylinder,Plane);
87  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere,Halfspace);
88  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere,Plane);
89  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere,Sphere);
90  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere,Cylinder);
91 
92  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(ConvexBase, Halfspace);
93  SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Halfspace);
94 
95 #undef SHAPE_SHAPE_DISTANCE_SPECIALIZATION
96 
97 #define SHAPE_SHAPE_COLLIDE_SPECIALIZATION(T1,T2) \
98 template<> \
99 HPP_FCL_DLLAPI std::size_t ShapeShapeCollide<T1,T2> \
100  (const CollisionGeometry* o1, const Transform3f& tf1, \
101  const CollisionGeometry* o2, const Transform3f& tf2, \
102  const GJKSolver* nsolver, const CollisionRequest& request, \
103  CollisionResult& result)
104 
105  SHAPE_SHAPE_COLLIDE_SPECIALIZATION(Sphere,Sphere);
106 
107 #undef SHAPE_SHAPE_COLLIDE_SPECIALIZATION
108 }
109 
110 } // namespace hpp
111 
113 
114 #endif
Main namespace.
Definition: AABB.h:43
double FCL_REAL
Definition: data_types.h:66
#define HPP_FCL_DLLAPI
Definition: config.hh:64