From c110347669d2bc41a407c7192769dc73aa2b379d Mon Sep 17 00:00:00 2001 From: Irlan Date: Sat, 18 Feb 2017 10:09:40 -0200 Subject: [PATCH] mixed up if statement --- src/bounce/collision/distance.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/bounce/collision/distance.cpp b/src/bounce/collision/distance.cpp index 69b6bb4..4fc2766 100644 --- a/src/bounce/collision/distance.cpp +++ b/src/bounce/collision/distance.cpp @@ -192,21 +192,21 @@ void b3ClosestPointsOnSegments(b3Vec3* C1, b3Vec3* C2, b3Vec3 E2 = Q2 - P2; float32 L2 = b3Length(E2); - if (L1 < 0.0f && L2 < 0.0f) + if (L1 < B3_LINEAR_SLOP && L2 < B3_LINEAR_SLOP) { *C1 = P1; *C2 = P2; return; } - if (L1 < 0.0f) + if (L1 < B3_LINEAR_SLOP) { *C1 = P1; *C2 = b3ClosestPointOnSegment(P1, P2, Q2); return; } - if (L2 < 0.0f) + if (L2 < B3_LINEAR_SLOP) { *C1 = b3ClosestPointOnSegment(P2, P1, Q1); *C2 = P2; @@ -221,9 +221,7 @@ void b3ClosestPointsOnSegments(b3Vec3* C1, b3Vec3* C2, // sin = norm( cross(n1, n2) ) // or // sin^2 = 1 - cos^2 - - // Use small parallelism tolerance used because the coincidence tolerance above is also small/zero. - const float32 kTol = 0.001f; + const float32 kTol = 0.005f; float32 b = b3Dot(N1, N2); float32 den = 1.0f - b * b;