diff --git a/src/bounce/collision/shapes/qhull.cpp b/src/bounce/collision/shapes/qhull.cpp index d67dc7c..621cdc6 100644 --- a/src/bounce/collision/shapes/qhull.cpp +++ b/src/bounce/collision/shapes/qhull.cpp @@ -149,8 +149,7 @@ void b3QHull::Set(const b3Vec3* points, u32 count) for (u32 j = 0; j < psCount; ++j) { - const float32 kTol = 0.5f * B3_LINEAR_SLOP; - if (b3DistanceSquared(p, ps[j]) < kTol * kTol) + if (b3DistanceSquared(p, ps[j]) <= B3_LINEAR_SLOP * B3_LINEAR_SLOP) { unique = false; break; diff --git a/src/bounce/quickhull/qh_hull.cpp b/src/bounce/quickhull/qh_hull.cpp index 03e66e6..e8647ee 100644 --- a/src/bounce/quickhull/qh_hull.cpp +++ b/src/bounce/quickhull/qh_hull.cpp @@ -162,8 +162,8 @@ bool qhHull::BuildInitialHull(const b3Vec3* vertices, u32 vertexCount) } } - // Coincident check. - if (d0 < B3_LINEAR_SLOP * B3_LINEAR_SLOP) + // Coincidence check + if (d0 <= B3_EPSILON * B3_EPSILON) { B3_ASSERT(false); return false; @@ -200,7 +200,7 @@ bool qhHull::BuildInitialHull(const b3Vec3* vertices, u32 vertexCount) } // Colinear check. - if (a0 < (2.0f * B3_LINEAR_SLOP) * (2.0f * B3_LINEAR_SLOP)) + if (a0 <= (2.0f * B3_EPSILON) * (2.0f * B3_EPSILON)) { B3_ASSERT(false); return false; @@ -241,7 +241,7 @@ bool qhHull::BuildInitialHull(const b3Vec3* vertices, u32 vertexCount) } // Coplanar check. - if (d0 < m_tolerance) + if (d0 <= m_tolerance) { B3_ASSERT(false); return false; @@ -749,7 +749,7 @@ void qhHull::Validate(const qhHalfEdge* edge) const b3Vec3 A = edge->tail->position; b3Vec3 B = twin->tail->position; - B3_ASSERT(b3DistanceSquared(A, B) >= B3_LINEAR_SLOP * B3_LINEAR_SLOP); + B3_ASSERT(b3DistanceSquared(A, B) > B3_EPSILON * B3_EPSILON); u32 count = 0; const qhHalfEdge* begin = edge;