Commit e34f7250 authored by Lucile Remigy's avatar Lucile Remigy
Browse files

Delete GJKSolver template

parent 87b17c31
......@@ -42,6 +42,7 @@
#include <hpp/fcl/data_types.h>
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -54,13 +55,22 @@ namespace fcl
/// Return value is the number of contacts generated between the two objects.
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const GJKSolver* nsolver,
const CollisionRequest& request,
CollisionResult& result);
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
const CollisionRequest& request,
CollisionResult& result);
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const CollisionRequest& request, CollisionResult& result);
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const CollisionRequest& request, CollisionResult& result);
}
} // namespace hpp
......
......@@ -42,6 +42,7 @@
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -49,7 +50,7 @@ namespace fcl
{
/// @brief collision matrix stores the functions for collision between different types of objects and provides a uniform call interface
template<typename GJKSolver>
struct CollisionFunctionMatrix
{
/// @brief the uniform call interface for collision: for collision, we need know
......
......@@ -40,6 +40,7 @@
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -50,12 +51,19 @@ namespace fcl
/// Return value is the minimum distance generated between the two objects.
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2,
const GJKSolver* nsolver,
const DistanceRequest& request, DistanceResult& result);
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
const DistanceRequest& request, DistanceResult& result);
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const DistanceRequest& request, DistanceResult& result);
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const DistanceRequest& request, DistanceResult& result);
}
} // namespace hpp
......
......@@ -40,6 +40,7 @@
#include <hpp/fcl/collision_object.h>
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
......@@ -47,7 +48,6 @@ namespace fcl
{
/// @brief distance matrix stores the functions for distance between different types of objects and provides a uniform call interface
template<typename GJKSolver>
struct DistanceFunctionMatrix
{
/// @brief the uniform call interface for distance: for distance, we need know
......
......@@ -47,21 +47,18 @@ namespace hpp
namespace fcl
{
template<typename GJKSolver>
CollisionFunctionMatrix<GJKSolver>& getCollisionFunctionLookTable()
CollisionFunctionMatrix& getCollisionFunctionLookTable()
{
static CollisionFunctionMatrix<GJKSolver> table;
static CollisionFunctionMatrix table;
return table;
}
template<typename GJKSolver>
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const GJKSolver* nsolver,
const CollisionRequest& request,
CollisionResult& result)
{
return collide(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(),
nsolver, request, result);
return collide(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(), nsolver, request, result);
}
// reorder collision results in the order the call has been made.
......@@ -81,7 +78,6 @@ void invertResults(CollisionResult& result)
}
}
template<typename GJKSolver>
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
......@@ -92,7 +88,7 @@ std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
if(!nsolver_)
nsolver = new GJKSolver();
const CollisionFunctionMatrix<GJKSolver>& looktable = getCollisionFunctionLookTable<GJKSolver>();
const CollisionFunctionMatrix& looktable = getCollisionFunctionLookTable();
result.distance_lower_bound = -1;
std::size_t res;
if(request.num_max_contacts == 0)
......@@ -146,7 +142,7 @@ std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
case GST_INDEP:
{
GJKSolver solver;
return collide<GJKSolver>(o1, o2, &solver, request, result);
return collide(o1, o2, &solver, request, result);
}
default:
return -1; // error
......@@ -162,7 +158,7 @@ std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
case GST_INDEP:
{
GJKSolver solver;
return collide<GJKSolver>(o1, tf1, o2, tf2, &solver, request, result);
return collide(o1, tf1, o2, tf2, &solver, request, result);
}
default:
std::cerr << "Warning! Invalid GJK solver" << std::endl;
......
This diff is collapsed.
......@@ -46,22 +46,19 @@ namespace hpp
namespace fcl
{
template<typename GJKSolver>
DistanceFunctionMatrix<GJKSolver>& getDistanceFunctionLookTable()
DistanceFunctionMatrix& getDistanceFunctionLookTable()
{
static DistanceFunctionMatrix<GJKSolver> table;
static DistanceFunctionMatrix table;
return table;
}
template<typename GJKSolver>
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const GJKSolver* nsolver,
const DistanceRequest& request, DistanceResult& result)
{
return distance<GJKSolver>(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(), nsolver,
return distance(o1->collisionGeometry().get(), o1->getTransform(), o2->collisionGeometry().get(), o2->getTransform(), nsolver,
request, result);
}
template<typename GJKSolver>
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver_,
......@@ -71,7 +68,7 @@ FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
if(!nsolver_)
nsolver = new GJKSolver();
const DistanceFunctionMatrix<GJKSolver>& looktable = getDistanceFunctionLookTable<GJKSolver>();
const DistanceFunctionMatrix& looktable = getDistanceFunctionLookTable();
OBJECT_TYPE object_type1 = o1->getObjectType();
NODE_TYPE node_type1 = o1->getNodeType();
......@@ -126,7 +123,7 @@ FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const Di
case GST_INDEP:
{
GJKSolver solver;
return distance<GJKSolver>(o1, o2, &solver, request, result);
return distance(o1, o2, &solver, request, result);
}
default:
return -1; // error
......@@ -142,7 +139,7 @@ FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
case GST_INDEP:
{
GJKSolver solver;
return distance<GJKSolver>(o1, tf1, o2, tf2, &solver, request, result);
return distance(o1, tf1, o2, tf2, &solver, request, result);
}
default:
return -1;
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Box, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Box, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Box, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Box>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Box, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Box, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Box, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Box>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Box, Sphere, GJKSolver>
FCL_REAL ShapeShapeDistance <Box, Sphere>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Sphere, Box, GJKSolver>
FCL_REAL ShapeShapeDistance <Sphere, Box>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -26,7 +26,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Capsule, Capsule, GJKSolver>
FCL_REAL ShapeShapeDistance <Capsule, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest& request,
......@@ -321,7 +321,7 @@ namespace fcl {
}
template <>
std::size_t ShapeShapeCollide <Capsule, Capsule, GJKSolver>
std::size_t ShapeShapeCollide <Capsule, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const CollisionRequest& request,
......@@ -331,7 +331,7 @@ namespace fcl {
DistanceResult distanceResult;
DistanceRequest distanceRequest (request.enable_contact);
FCL_REAL distance = ShapeShapeDistance <Capsule, Capsule, GJKSolver>
FCL_REAL distance = ShapeShapeDistance <Capsule, Capsule>
(o1, tf1, o2, tf2, unused, distanceRequest, distanceResult);
if (distance <= 0) {
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Capsule, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Capsule, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Capsule, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Capsule, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Capsule, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Capsule, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Capsule>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cone, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Cone, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Cone, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Cone>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cone, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Cone, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Cone, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Cone>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cylinder, Halfspace, GJKSolver>
FCL_REAL ShapeShapeDistance <Cylinder, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Halfspace, Cylinder, GJKSolver>
FCL_REAL ShapeShapeDistance <Halfspace, Cylinder>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Cylinder, Plane, GJKSolver>
FCL_REAL ShapeShapeDistance <Cylinder, Plane>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Plane, Cylinder, GJKSolver>
FCL_REAL ShapeShapeDistance <Plane, Cylinder>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
This diff is collapsed.
......@@ -35,18 +35,19 @@
/** \author Florent Lamiraux */
#include <hpp/fcl/collision_data.h>
#include <hpp/fcl/narrowphase/narrowphase.h>
namespace hpp
{
namespace fcl {
template<typename T_SH1, typename T_SH2, typename GJKSolver>
template<typename T_SH1, typename T_SH2>
FCL_REAL ShapeShapeDistance
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver* nsolver, const DistanceRequest& request,
DistanceResult& result);
template<typename T_SH1, typename T_SH2, typename GJKSolver>
template<typename T_SH1, typename T_SH2>
std::size_t ShapeShapeCollide
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
......
......@@ -49,7 +49,7 @@ namespace fcl {
class GJKSolver;
template <>
FCL_REAL ShapeShapeDistance <Sphere, Cylinder, GJKSolver>
FCL_REAL ShapeShapeDistance <Sphere, Cylinder>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......@@ -65,7 +65,7 @@ namespace fcl {
}
template <>
FCL_REAL ShapeShapeDistance <Cylinder, Sphere, GJKSolver>
FCL_REAL ShapeShapeDistance <Cylinder, Sphere>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const GJKSolver*, const DistanceRequest&,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment