mixed up if statement

This commit is contained in:
Irlan 2017-02-18 10:09:40 -02:00
parent a1fb4b903b
commit c110347669

View File

@ -192,21 +192,21 @@ 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 = b3ClosestPointOnSegment(P1, P2, Q2);
return; return;
} }
if (L2 < 0.0f) if (L2 < B3_LINEAR_SLOP)
{ {
*C1 = b3ClosestPointOnSegment(P2, P1, Q1); *C1 = b3ClosestPointOnSegment(P2, P1, Q1);
*C2 = P2; *C2 = P2;
@ -221,9 +221,7 @@ void b3ClosestPointsOnSegments(b3Vec3* C1, b3Vec3* C2,
// sin = norm( cross(n1, n2) ) // sin = norm( cross(n1, n2) )
// or // or
// sin^2 = 1 - cos^2 // sin^2 = 1 - cos^2
const float32 kTol = 0.005f;
// Use small parallelism tolerance used because the coincidence tolerance above is also small/zero.
const float32 kTol = 0.001f;
float32 b = b3Dot(N1, N2); float32 b = b3Dot(N1, N2);
float32 den = 1.0f - b * b; float32 den = 1.0f - b * b;