mixed up zero tolerance

This commit is contained in:
Irlan Robson 2017-02-18 00:47:52 -02:00 committed by GitHub
parent a1fb4b903b
commit ed90be74b8

View File

@ -192,23 +192,23 @@ void b3ClosestPointsOnSegments(b3Vec3* C1, b3Vec3* C2,
b3Vec3 E2 = Q2 - P2; b3Vec3 E2 = Q2 - P2;
float32 L2 = b3Length(E2); float32 L2 = b3Length(E2);
if (L1 < 0.0f && L2 < 0.0f) if (L1 < B3_LINEAR_SLOP && L2 < B3_LINEAR_SLOP)
{ {
*C1 = P1; *C1 = P1;
*C2 = P2; *C2 = P2;
return; return;
} }
if (L1 < 0.0f) if (L1 < B3_LINEAR_SLOP)
{ {
*C1 = P1; *C1 = P1;
*C2 = b3ClosestPointOnSegment(P1, P2, Q2); *C2 = L2 < B3_LINEAR_SLOP ? P2 : b3ClosestPointOnSegment(P1, P2, Q2);
return; return;
} }
if (L2 < 0.0f) if (L2 < B3_LINEAR_SLOP)
{ {
*C1 = b3ClosestPointOnSegment(P2, P1, Q1); *C1 = L1 < B3_LINEAR_SLOP ? P1 : b3ClosestPointOnSegment(P2, P1, Q1);
*C2 = P2; *C2 = P2;
return; return;
} }
@ -222,8 +222,8 @@ void b3ClosestPointsOnSegments(b3Vec3* C1, b3Vec3* C2,
// or // or
// sin^2 = 1 - cos^2 // sin^2 = 1 - cos^2
// Use small parallelism tolerance used because the coincidence tolerance above is also small/zero. // Use small parallelism tolerance because the coincidence tolerance above is also smal.
const float32 kTol = 0.001f; const float32 kTol = 0.005f;
float32 b = b3Dot(N1, N2); float32 b = b3Dot(N1, N2);
float32 den = 1.0f - b * b; float32 den = 1.0f - b * b;