Skip to content

Commit

Permalink
core: restore missing lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Jun 7, 2022
1 parent 74a052a commit 8bc84d2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 51 deletions.
40 changes: 18 additions & 22 deletions include/hpp/fcl/internal/traversal_node_bvh_shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,15 @@ class MeshShapeCollisionTraversalNode
}

FCL_REAL distToCollision = distance - this->request.security_margin;
// if (collision) {
// sqrDistLowerBound = 0;
// if (this->request.num_max_contacts > this->result->numContacts()) {
// this->result->addContact(Contact(this->model1, this->model2,
// primitive_id, Contact::NONE, c1,
// -normal, -distance));
// assert(this->result->isCollision());
// }
// }
// else
if (distToCollision <= this->request.collision_distance_threshold) {
if (collision) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(Contact(this->model1, this->model2,
primitive_id, Contact::NONE, c1,
-normal, -distance));
assert(this->result->isCollision());
}
} else if (distToCollision <= this->request.collision_distance_threshold) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(
Expand Down Expand Up @@ -331,17 +329,15 @@ class ShapeMeshCollisionTraversalNode
}

FCL_REAL distToCollision = distance - this->request.security_margin;
// if (collision) {
// sqrDistLowerBound = 0;
// if (this->request.num_max_contacts > this->result->numContacts()) {
// this->result->addContact(Contact(this->model1, this->model2,
// Contact::NONE, primitive_id, c1,
// normal, -distance));
// assert(this->result->isCollision());
// }
// }
// else
if (distToCollision <= this->request.collision_distance_threshold) {
if (collision) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(Contact(this->model1, this->model2,
Contact::NONE, primitive_id, c1,
normal, -distance));
assert(this->result->isCollision());
}
} else if (distToCollision <= this->request.collision_distance_threshold) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(
Expand Down
54 changes: 25 additions & 29 deletions include/hpp/fcl/internal/traversal_node_hfield_shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,23 +325,20 @@ class HeightFieldShapeCollisionTraversalNode
FCL_REAL distance;
Vec3f c1, c2, normal;

// bool collision =
this->shapeDistance(convex1, convex2, this->tf1, *(this->model2), this->tf2,
distance, c1, c2, normal);
bool collision =
this->shapeDistance(convex1, convex2, this->tf1, *(this->model2),
this->tf2, distance, c1, c2, normal);

FCL_REAL distToCollision = distance - this->request.security_margin;
// if (collision) {
// sqrDistLowerBound = 0;
// if (this->request.num_max_contacts > this->result->numContacts()) {
// this->result->addContact(Contact(this->model1, this->model2,
// (int)b1,
// (int)Contact::NONE, c1, normal,
// -distance));
// assert(this->result->isCollision());
// }
// }
// else
if (distToCollision <= this->request.collision_distance_threshold) {
if (collision) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(Contact(this->model1, this->model2, (int)b1,
(int)Contact::NONE, c1, normal,
-distance));
assert(this->result->isCollision());
}
} else if (distToCollision <= this->request.collision_distance_threshold) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(Contact(this->model1, this->model2, (int)b1,
Expand Down Expand Up @@ -509,22 +506,21 @@ class ShapeHeightFieldCollisionTraversalNode
Vec3f normal;
Vec3f c1, c2; // closest points

// bool collision =
this->shapeDistance(*(this->model1), this->tf1, convex1, convex2, this->tf2,
distance, c1, c2, normal);
bool collision =
this->shapeDistance(*(this->model1), this->tf1, convex1, convex2,
this->tf2, distance, c1, c2, normal);

FCL_REAL distToCollision = distance - this->request.security_margin;
// if (collision) {
// sqrDistLowerBound = 0;
// if (this->request.num_max_contacts > this->result->numContacts()) {
// this->result->addContact(Contact(this->model1, this->model2,
// Contact::NONE, b2, c1, normal,
// distance));
// assert(this->result->isCollision());
// return;
// }
// } else
if (distToCollision < 0) {
if (collision) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(Contact(this->model1, this->model2,
Contact::NONE, b2, c1, normal,
distance));
assert(this->result->isCollision());
return;
}
} else if (distToCollision < 0) {
sqrDistLowerBound = 0;
if (this->request.num_max_contacts > this->result->numContacts()) {
this->result->addContact(Contact(this->model1, this->model2,
Expand Down

0 comments on commit 8bc84d2

Please sign in to comment.