Skip to content

Commit f992f1f

Browse files
author
C. Andy Martin
committed
narrowphase distance: fix signed distance when touching
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.
1 parent 7fcdc7f commit f992f1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/fcl/narrowphase/distance-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ typename NarrowPhaseSolver::S distance(
163163
assert(collision_result.isCollision());
164164

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

0 commit comments

Comments
 (0)