Commit de23a832 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Remove enum GJKSolverType and related class attributes.

parent 7b458fa3
......@@ -52,9 +52,6 @@ namespace hpp
namespace fcl
{
/// @brief Type of narrow phase GJK solver
enum GJKSolverType {GST_INDEP};
/// @brief Contact information returned by collision
struct Contact
{
......@@ -158,9 +155,6 @@ struct CollisionRequest
/// Whether a lower bound on distance is returned when objects are disjoint
bool enable_distance_lower_bound;
/// @brief narrow phase solver
GJKSolverType gjk_solver_type;
/// @brief whether enable gjk intial guess
bool enable_cached_gjk_guess;
......@@ -178,15 +172,13 @@ struct CollisionRequest
bool enable_distance_lower_bound_ = false,
size_t num_max_cost_sources_ = 1,
bool enable_cost_ = false,
bool use_approximate_cost_ = true,
GJKSolverType gjk_solver_type_ = GST_INDEP)
bool use_approximate_cost_ = true)
HPP_FCL_DEPRECATED;
explicit CollisionRequest(const CollisionRequestFlag flag, size_t num_max_contacts_) :
num_max_contacts(num_max_contacts_),
enable_contact(flag & CONTACT),
enable_distance_lower_bound (flag & DISTANCE_LOWER_BOUND),
gjk_solver_type(GST_INDEP),
security_margin (0),
break_distance (1e-3)
{
......@@ -198,7 +190,6 @@ struct CollisionRequest
num_max_contacts(1),
enable_contact(false),
enable_distance_lower_bound (false),
gjk_solver_type(GST_INDEP),
security_margin (0),
break_distance (1e-3)
{
......@@ -294,18 +285,12 @@ struct DistanceRequest
FCL_REAL rel_err; // relative error, between 0 and 1
FCL_REAL abs_err; // absoluate error
/// @brief narrow phase solver type
GJKSolverType gjk_solver_type;
DistanceRequest(bool enable_nearest_points_ = false,
FCL_REAL rel_err_ = 0.0,
FCL_REAL abs_err_ = 0.0,
GJKSolverType gjk_solver_type_ = GST_INDEP) : enable_nearest_points(enable_nearest_points_),
rel_err(rel_err_),
abs_err(abs_err_),
gjk_solver_type(gjk_solver_type_)
FCL_REAL abs_err_ = 0.0) :
enable_nearest_points(enable_nearest_points_),
rel_err(rel_err_),
abs_err(abs_err_)
{
}
......
......@@ -137,33 +137,24 @@ std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
const CollisionRequest& request, CollisionResult& result)
{
switch(request.gjk_solver_type)
{
case GST_INDEP:
{
GJKSolver solver;
return collide(o1, o2, &solver, request, result);
}
default:
return -1; // error
}
GJKSolver solver;
solver.enable_cached_guess = request.enable_cached_gjk_guess;
if (solver.enable_cached_guess)
solver.cached_guess = request.cached_gjk_guess;
return collide(o1, o2, &solver, request, result);
}
std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const CollisionRequest& request, CollisionResult& result)
{
switch(request.gjk_solver_type)
{
case GST_INDEP:
{
GJKSolver solver;
return collide(o1, tf1, o2, tf2, &solver, request, result);
}
default:
std::cerr << "Warning! Invalid GJK solver" << std::endl;
return -1; // error
}
GJKSolver solver;
solver.enable_cached_guess = request.enable_cached_gjk_guess;
if (solver.enable_cached_guess)
solver.cached_guess = request.cached_gjk_guess;
return collide(o1, tf1, o2, tf2, &solver, request, result);
if (solver.enable_cached_guess)
result.cached_gjk_guess = solver.cached_guess;
}
}
......
......@@ -55,12 +55,10 @@ bool DistanceRequest::isSatisfied(const DistanceResult& result) const
CollisionRequest::CollisionRequest
(size_t num_max_contacts_, bool enable_contact_,
bool enable_distance_lower_bound_, size_t /*num_max_cost_sources_*/,
bool /*enable_cost_*/, bool /*use_approximate_cost_*/,
GJKSolverType gjk_solver_type_) :
bool /*enable_cost_*/, bool /*use_approximate_cost_*/) :
num_max_contacts(num_max_contacts_),
enable_contact(enable_contact_),
enable_distance_lower_bound (enable_distance_lower_bound_),
gjk_solver_type(gjk_solver_type_),
security_margin (0),
break_distance (1e-3)
{
......
......@@ -117,32 +117,16 @@ FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const GJ
FCL_REAL distance(const CollisionObject* o1, const CollisionObject* o2, const DistanceRequest& request, DistanceResult& result)
{
switch(request.gjk_solver_type)
{
case GST_INDEP:
{
GJKSolver solver;
return distance(o1, o2, &solver, request, result);
}
default:
return -1; // error
}
GJKSolver solver;
return distance(o1, o2, &solver, request, result);
}
FCL_REAL distance(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeometry* o2, const Transform3f& tf2,
const DistanceRequest& request, DistanceResult& result)
{
switch(request.gjk_solver_type)
{
case GST_INDEP:
{
GJKSolver solver;
return distance(o1, tf1, o2, tf2, &solver, request, result);
}
default:
return -1;
}
GJKSolver solver;
return distance(o1, tf1, o2, tf2, &solver, request, result);
}
......
......@@ -58,7 +58,6 @@ using hpp::fcl::Vec3f;
using hpp::fcl::CollisionObject;
using hpp::fcl::DistanceResult;
using hpp::fcl::DistanceRequest;
using hpp::fcl::GST_INDEP;
BOOST_AUTO_TEST_CASE(distance_box_box_1)
{
......@@ -72,7 +71,7 @@ BOOST_AUTO_TEST_CASE(distance_box_box_1)
CollisionObject o2 (s2, tf2);
// Enable computation of nearest points
DistanceRequest distanceRequest (true, 0, 0, GST_INDEP);
DistanceRequest distanceRequest (true, 0, 0);
DistanceResult distanceResult;
hpp::fcl::distance (&o1, &o2, distanceRequest, distanceResult);
......@@ -116,7 +115,7 @@ BOOST_AUTO_TEST_CASE(distance_box_box_2)
CollisionObject o2 (s2, tf2);
// Enable computation of nearest points
DistanceRequest distanceRequest (true, 0, 0, GST_INDEP);
DistanceRequest distanceRequest (true, 0, 0);
DistanceResult distanceResult;
hpp::fcl::distance (&o1, &o2, distanceRequest, distanceResult);
......@@ -157,7 +156,7 @@ BOOST_AUTO_TEST_CASE(distance_box_box_3)
CollisionObject o2 (s2, tf2);
// Enable computation of nearest points
DistanceRequest distanceRequest (true, 0, 0, GST_INDEP);
DistanceRequest distanceRequest (true, 0, 0);
DistanceResult distanceResult;
hpp::fcl::distance (&o1, &o2, distanceRequest, distanceResult);
......
......@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
CollisionGeometryPtr_t boxGeometry (new hpp::fcl::Box (1., 2., 4.));
// Enable computation of nearest points
hpp::fcl::DistanceRequest distanceRequest (true, 0, 0, hpp::fcl::GST_INDEP);
hpp::fcl::DistanceRequest distanceRequest (true, 0, 0);
hpp::fcl::DistanceResult distanceResult;
hpp::fcl::Transform3f tf1 (hpp::fcl::Vec3f (3., 0, 0));
......
......@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(distance_capsule_box)
CollisionGeometryPtr_t boxGeometry (new hpp::fcl::Box (1., 2., 4.));
// Enable computation of nearest points
hpp::fcl::DistanceRequest distanceRequest (true, 0, 0, hpp::fcl::GST_INDEP);
hpp::fcl::DistanceRequest distanceRequest (true, 0, 0);
hpp::fcl::DistanceResult distanceResult;
// Rotate capsule around y axis by pi/2 and move it behind box
......
This diff is collapsed.
......@@ -428,7 +428,6 @@ BOOST_AUTO_TEST_CASE(consistency_distance_spheresphere_GJK)
generateBVHModel(s2_rss, s2, Transform3f(), 16, 16);
DistanceRequest request;
request.gjk_solver_type = GST_INDEP;
DistanceResult res, res1;
Transform3f pose;
......@@ -1507,7 +1506,6 @@ BOOST_AUTO_TEST_CASE(consistency_collision_spheresphere_GJK)
generateBVHModel(s2_obb, s2, Transform3f(), 16, 16);
CollisionRequest request (false, 1, false);
request.gjk_solver_type = GST_INDEP;
CollisionResult result;
......@@ -1727,7 +1725,6 @@ BOOST_AUTO_TEST_CASE(consistency_collision_boxbox_GJK)
generateBVHModel(s2_obb, s2, Transform3f());
CollisionRequest request (false, 1, false);
request.gjk_solver_type = GST_INDEP;
CollisionResult result;
......@@ -1849,7 +1846,6 @@ BOOST_AUTO_TEST_CASE(consistency_collision_spherebox_GJK)
generateBVHModel(s2_obb, s2, Transform3f());
CollisionRequest request (false, 1, false);
request.gjk_solver_type = GST_INDEP;
CollisionResult result;
......@@ -1971,7 +1967,6 @@ BOOST_AUTO_TEST_CASE(consistency_collision_cylindercylinder_GJK)
generateBVHModel(s2_obb, s2, Transform3f(), 16, 16);
CollisionRequest request (false, 1, false);
request.gjk_solver_type = GST_INDEP;
CollisionResult result;
......@@ -2060,7 +2055,6 @@ BOOST_AUTO_TEST_CASE(consistency_collision_conecone_GJK)
generateBVHModel(s2_obb, s2, Transform3f(), 16, 16);
CollisionRequest request (false, 1, false);
request.gjk_solver_type = GST_INDEP;
CollisionResult result;
......
......@@ -417,14 +417,6 @@ std::string getNodeTypeName(NODE_TYPE node_type)
return std::string("invalid");
}
std::string getGJKSolverName(GJKSolverType solver_type)
{
if (solver_type == GST_INDEP)
return std::string("built-in");
else
return std::string("invalid");
}
Quaternion3f makeQuat(FCL_REAL w, FCL_REAL x, FCL_REAL y, FCL_REAL z)
{
Quaternion3f q;
......
......@@ -172,8 +172,6 @@ bool defaultDistanceFunction(CollisionObject* o1, CollisionObject* o2, void* cda
std::string getNodeTypeName(NODE_TYPE node_type);
std::string getGJKSolverName(GJKSolverType solver_type);
Quaternion3f makeQuat(FCL_REAL w, FCL_REAL x, FCL_REAL y, FCL_REAL z);
std::ostream& operator<< (std::ostream& os, const Transform3f& tf);
......
Supports Markdown
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