00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00038 #ifndef FCL_GEOMETRIC_SHAPES_UTILITY_H
00039 #define FCL_GEOMETRIC_SHAPES_UTILITY_H
00040
00041 #include <vector>
00042 #include "fcl/shape/geometric_shapes.h"
00043 #include "fcl/BV/BV.h"
00044
00045 namespace fcl
00046 {
00047
00049 namespace details
00050 {
00052 std::vector<Vec3f> getBoundVertices(const Box& box, const Transform3f& tf);
00053 std::vector<Vec3f> getBoundVertices(const Sphere& sphere, const Transform3f& tf);
00054 std::vector<Vec3f> getBoundVertices(const Capsule& capsule, const Transform3f& tf);
00055 std::vector<Vec3f> getBoundVertices(const Cone& cone, const Transform3f& tf);
00056 std::vector<Vec3f> getBoundVertices(const Cylinder& cylinder, const Transform3f& tf);
00057 std::vector<Vec3f> getBoundVertices(const Convex& convex, const Transform3f& tf);
00058 std::vector<Vec3f> getBoundVertices(const Triangle2& triangle, const Transform3f& tf);
00059 }
00061
00062
00064 template<typename BV, typename S>
00065 void computeBV(const S& s, const Transform3f& tf, BV& bv)
00066 {
00067 std::vector<Vec3f> convex_bound_vertices = details::getBoundVertices(s, tf);
00068 fit(&convex_bound_vertices[0], (int)convex_bound_vertices.size(), bv);
00069 }
00070
00071 template<>
00072 void computeBV<AABB, Box>(const Box& s, const Transform3f& tf, AABB& bv);
00073
00074 template<>
00075 void computeBV<AABB, Sphere>(const Sphere& s, const Transform3f& tf, AABB& bv);
00076
00077 template<>
00078 void computeBV<AABB, Capsule>(const Capsule& s, const Transform3f& tf, AABB& bv);
00079
00080 template<>
00081 void computeBV<AABB, Cone>(const Cone& s, const Transform3f& tf, AABB& bv);
00082
00083 template<>
00084 void computeBV<AABB, Cylinder>(const Cylinder& s, const Transform3f& tf, AABB& bv);
00085
00086 template<>
00087 void computeBV<AABB, Convex>(const Convex& s, const Transform3f& tf, AABB& bv);
00088
00089 template<>
00090 void computeBV<AABB, Triangle2>(const Triangle2& s, const Transform3f& tf, AABB& bv);
00091
00092
00094 template<>
00095 void computeBV<AABB, Plane>(const Plane& s, const Transform3f& tf, AABB& bv);
00096
00097
00098
00099 template<>
00100 void computeBV<OBB, Box>(const Box& s, const Transform3f& tf, OBB& bv);
00101
00102 template<>
00103 void computeBV<OBB, Sphere>(const Sphere& s, const Transform3f& tf, OBB& bv);
00104
00105 template<>
00106 void computeBV<OBB, Capsule>(const Capsule& s, const Transform3f& tf, OBB& bv);
00107
00108 template<>
00109 void computeBV<OBB, Cone>(const Cone& s, const Transform3f& tf, OBB& bv);
00110
00111 template<>
00112 void computeBV<OBB, Cylinder>(const Cylinder& s, const Transform3f& tf, OBB& bv);
00113
00114 template<>
00115 void computeBV<OBB, Convex>(const Convex& s, const Transform3f& tf, OBB& bv);
00116
00117 template<>
00118 void computeBV<OBB, Plane>(const Plane& s, const Transform3f& tf, OBB& bv);
00119
00120 template<>
00121 void computeBV<RSS, Plane>(const Plane& s, const Transform3f& tf, RSS& bv);
00122
00123 template<>
00124 void computeBV<OBBRSS, Plane>(const Plane& s, const Transform3f& tf, OBBRSS& bv);
00125
00126 template<>
00127 void computeBV<kIOS, Plane>(const Plane& s, const Transform3f& tf, kIOS& bv);
00128
00129 template<>
00130 void computeBV<KDOP<16>, Plane>(const Plane& s, const Transform3f& tf, KDOP<16>& bv);
00131
00132 template<>
00133 void computeBV<KDOP<18>, Plane>(const Plane& s, const Transform3f& tf, KDOP<18>& bv);
00134
00135 template<>
00136 void computeBV<KDOP<24>, Plane>(const Plane& s, const Transform3f& tf, KDOP<24>& bv);
00137
00138
00140 void constructBox(const AABB& bv, Box& box, Transform3f& tf);
00141
00142 void constructBox(const OBB& bv, Box& box, Transform3f& tf);
00143
00144 void constructBox(const OBBRSS& bv, Box& box, Transform3f& tf);
00145
00146 void constructBox(const kIOS& bv, Box& box, Transform3f& tf);
00147
00148 void constructBox(const RSS& bv, Box& box, Transform3f& tf);
00149
00150 void constructBox(const KDOP<16>& bv, Box& box, Transform3f& tf);
00151
00152 void constructBox(const KDOP<18>& bv, Box& box, Transform3f& tf);
00153
00154 void constructBox(const KDOP<24>& bv, Box& box, Transform3f& tf);
00155
00156 void constructBox(const AABB& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00157
00158 void constructBox(const OBB& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00159
00160 void constructBox(const OBBRSS& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00161
00162 void constructBox(const kIOS& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00163
00164 void constructBox(const RSS& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00165
00166 void constructBox(const KDOP<16>& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00167
00168 void constructBox(const KDOP<18>& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00169
00170 void constructBox(const KDOP<24>& bv, const Transform3f& tf_bv, Box& box, Transform3f& tf);
00171
00172
00173 }
00174
00175 #endif