Skip to content

Commit

Permalink
narrowphase distance: fix signed distance when touching
Browse files Browse the repository at this point in the history
In the case of mesh or octree distance checks, we do a collision
after distance checking when doing signed distance to find
penetration depth. However, the maximum penetration depth was
initialized to numeric limits min, which is slightly greater than
zero. If the only contact is exactly 0.0 depth, the code fails.
Fix this to the negative max.
  • Loading branch information
C. Andy Martin committed Jul 22, 2021
1 parent 7fcdc7f commit f992f1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fcl/narrowphase/distance-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typename NarrowPhaseSolver::S distance(
assert(collision_result.isCollision());

std::size_t index = static_cast<std::size_t>(-1);
S max_pen_depth = std::numeric_limits<S>::min();
S max_pen_depth = -std::numeric_limits<S>::max();
for (auto i = 0u; i < collision_result.numContacts(); ++i)
{
const auto& contact = collision_result.getContact(i);
Expand Down

0 comments on commit f992f1f

Please sign in to comment.