diff --git a/src/distance_sphere_sphere.cpp b/src/distance_sphere_sphere.cpp index b01af68a450b1297e2b8ab905e21e1b048568a45..f14dd708336d6f646ebdfedc4b169d59ebe1c9ad 100644 --- a/src/distance_sphere_sphere.cpp +++ b/src/distance_sphere_sphere.cpp @@ -72,7 +72,9 @@ namespace fcl { result.b1 = result.b2 = -1; Vec3f c1c2 = center2 - center1; FCL_REAL dist = c1c2.norm (); - Vec3f unit (dist > epsilon ? c1c2/dist : Vec3f (0,0,0)); + Vec3f unit (0,0,0); + if(dist > epsilon) + unit = c1c2/dist; FCL_REAL penetrationDepth; penetrationDepth = r1 + r2 - dist; bool collision = (penetrationDepth >= 0); @@ -112,7 +114,9 @@ namespace fcl { Vec3f c1c2 = center2 - center1; FCL_REAL dist = c1c2.norm (); - Vec3f unit (dist > epsilon ? c1c2/dist : Vec3f (0,0,0)); + Vec3f unit (0,0,0); + if(dist > epsilon) + unit = c1c2/dist; FCL_REAL penetrationDepth; // Unlike in distance computation, we consider the security margin. penetrationDepth = r1 + r2 + margin - dist;