Commit 798c0ade authored by jpan's avatar jpan
Browse files

remove exhaustive in request


git-svn-id: https://kforge.ros.org/fcl/fcl_ros@145 253336fb-580f-4252-a368-f3cef5a2a82b
parent f0220fea
......@@ -87,18 +87,15 @@ struct CostSource
struct CollisionRequest
{
bool exhaustive;
size_t num_max_contacts;
bool enable_contact;
size_t num_max_cost_sources;
bool enable_cost;
CollisionRequest(bool exhaustive_ = false,
size_t num_max_contacts_ = 1,
CollisionRequest(size_t num_max_contacts_ = 1,
bool enable_contact_ = false,
size_t num_max_cost_sources_ = 1,
bool enable_cost_ = false) : exhaustive(exhaustive_),
num_max_contacts(num_max_contacts_),
bool enable_cost_ = false) : num_max_contacts(num_max_contacts_),
enable_contact(enable_contact_),
num_max_cost_sources(num_max_cost_sources_),
enable_cost(enable_cost_)
......
......@@ -219,7 +219,7 @@ public:
bool canStop() const
{
return (!this->request.exhaustive) && (!this->request.enable_cost) && (this->result->isCollision()) && (this->request.num_max_contacts <= this->result->numContacts());
return (!this->request.enable_cost) && (this->result->isCollision()) && (this->request.num_max_contacts <= this->result->numContacts());
}
Vec3f* vertices;
......@@ -469,7 +469,7 @@ public:
bool canStop() const
{
return (!this->request.exhaustive) && (!this->request.enable_cost) && (this->result->isCollision()) && (this->request.num_max_contacts <= this->result->numContacts());
return (!this->request.enable_cost) && (this->result->isCollision()) && (this->request.num_max_contacts <= this->result->numContacts());
}
Vec3f* vertices;
......
......@@ -201,11 +201,9 @@ public:
&normal))
{
is_intersect = true;
if(!this->request.exhaustive)
{
if(this->request.num_max_contacts < n_contacts + this->result->numContacts())
n_contacts = (this->request.num_max_contacts >= this->result->numContacts()) ? (this->request.num_max_contacts - this->result->numContacts()) : 0;
}
if(this->request.num_max_contacts < n_contacts + this->result->numContacts())
n_contacts = (this->request.num_max_contacts >= this->result->numContacts()) ? (this->request.num_max_contacts - this->result->numContacts()) : 0;
for(unsigned int i = 0; i < n_contacts; ++i)
{
......@@ -235,7 +233,7 @@ public:
/** \brief Whether the traversal process can stop early */
bool canStop() const
{
return (!this->request.exhaustive) && (!this->request.enable_cost) && (this->result->isCollision()) && (this->request.num_max_contacts <= this->result->numContacts());
return (!this->request.enable_cost) && (this->result->isCollision()) && (this->request.num_max_contacts <= this->result->numContacts());
}
Vec3f* vertices1;
......@@ -388,7 +386,7 @@ public:
bool canStop() const
{
return (pairs.size() > 0) && (!this->request.exhaustive) && (this->request.num_max_contacts <= pairs.size());
return (pairs.size() > 0) && (this->request.num_max_contacts <= pairs.size());
}
Vec3f* vertices1;
......@@ -486,7 +484,7 @@ public:
bool canStop() const
{
return (pairs.size() > 0) && (!this->request.exhaustive) && (this->request.num_max_contacts <= pairs.size());
return (pairs.size() > 0) && (this->request.num_max_contacts <= pairs.size());
}
Vec3f* vertices1;
......@@ -651,7 +649,7 @@ public:
bool canStop() const
{
return (pairs.size() > 0) && (!this->request.exhaustive) && (this->request.num_max_contacts <= pairs.size());
return (pairs.size() > 0) && (this->request.num_max_contacts <= pairs.size());
}
Vec3f* vertices1;
......@@ -736,7 +734,7 @@ public:
bool canStop() const
{
return (pairs.size() > 0) && (!this->request.exhaustive) && (this->request.num_max_contacts <= pairs.size());
return (pairs.size() > 0) && (this->request.num_max_contacts <= pairs.size());
}
Vec3f* vertices1;
......@@ -819,7 +817,7 @@ public:
bool canStop() const
{
return (pairs.size() > 0) && (!this->request.exhaustive) && (this->request.num_max_contacts <= pairs.size());
return (pairs.size() > 0) && (this->request.num_max_contacts <= pairs.size());
}
Vec3f* vertices1;
......
......@@ -325,7 +325,7 @@ private:
cresult->addCostSource(CostSource(overlap_part, root1->getOccupancy() * s.cost_density));
}
return (!crequest->exhaustive) && (!crequest->enable_cost) && (cresult->isCollision()) && (crequest->num_max_contacts <= cresult->numContacts());
return (!crequest->enable_cost) && (cresult->isCollision()) && (crequest->num_max_contacts <= cresult->numContacts());
}
else return false;
}
......@@ -528,7 +528,7 @@ private:
cresult->addCostSource(CostSource(overlap_part, root1->getOccupancy() * tree2->cost_density));
}
return (!crequest->exhaustive) && (!crequest->enable_cost) && (cresult->isCollision()) && (crequest->num_max_contacts <= cresult->numContacts());
return (!crequest->enable_cost) && (cresult->isCollision()) && (crequest->num_max_contacts <= cresult->numContacts());
}
else
return false;
......@@ -743,7 +743,7 @@ private:
cresult->addCostSource(CostSource(overlap_part, root1->getOccupancy() * root2->getOccupancy()));
}
return (!crequest->exhaustive) && (!crequest->enable_cost) && (cresult->isCollision()) && (crequest->num_max_contacts <= cresult->numContacts());
return (!crequest->enable_cost) && (cresult->isCollision()) && (crequest->num_max_contacts <= cresult->numContacts());
}
else if(!tree1->isNodeFree(root1) && !tree2->isNodeFree(root2) && crequest->enable_cost) // uncertain area (here means both are uncertain or one uncertain and one occupied)
{
......
......@@ -59,7 +59,7 @@ bool defaultCollisionFunction(CollisionObject* o1, CollisionObject* o2, void* cd
collide(o1, o2, request, result);
if( (!request.exhaustive) && (result.isCollision()) && (result.numContacts() >= request.num_max_contacts))
if( (result.isCollision()) && (result.numContacts() >= request.num_max_contacts))
cdata->done = true;
return cdata->done;
......
......@@ -75,7 +75,7 @@ int collide(const CollisionGeometry* o1, const SimpleTransform& tf1,
const CollisionFunctionMatrix<NarrowPhaseSolver>& looktable = getCollisionFunctionLookTable<NarrowPhaseSolver>();
int res;
if(request.num_max_contacts == 0 && !request.exhaustive)
if(request.num_max_contacts == 0)
{
std::cerr << "Warning: should stop early as num_max_contact is " << request.num_max_contacts << " !" << std::endl;
res = 0;
......
......@@ -55,7 +55,7 @@ int conservativeAdvancement(const CollisionGeometry* o1,
CollisionResult& result,
FCL_REAL& toc)
{
if((request.num_max_contacts == 0) && !request.exhaustive)
if(request.num_max_contacts == 0)
{
std::cerr << "Warning: should stop early as num_max_contact is " << request.num_max_contacts << " !" << std::endl;
return 0;
......
......@@ -100,12 +100,10 @@ static inline void meshCollisionOrientedNodeLeafTesting(int b1, int b2,
&normal))
{
is_intersect = true;
if(!request.exhaustive)
{
if(request.num_max_contacts < result.numContacts() + n_contacts)
n_contacts = (request.num_max_contacts > result.numContacts()) ? (request.num_max_contacts - result.numContacts()) : 0;
}
if(request.num_max_contacts < result.numContacts() + n_contacts)
n_contacts = (request.num_max_contacts > result.numContacts()) ? (request.num_max_contacts - result.numContacts()) : 0;
for(unsigned int i = 0; i < n_contacts; ++i)
{
result.addContact(Contact(model1, model2, primitive_id1, primitive_id2, tf1.transform(contacts[i]), tf1.getQuatRotation().transform(normal), penetration));
......
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