From 79f982d157fd8f7dfce0fe6d165b1049daa63c18 Mon Sep 17 00:00:00 2001 From: Ross Nordby Date: Thu, 14 Dec 2023 17:23:17 -0600 Subject: [PATCH] Tinytweak; shouldn't reject things that were incorrectly rejected before. --- BepuPhysics/Collidables/ConvexHullHelper.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BepuPhysics/Collidables/ConvexHullHelper.cs b/BepuPhysics/Collidables/ConvexHullHelper.cs index 805373b7..587c339c 100644 --- a/BepuPhysics/Collidables/ConvexHullHelper.cs +++ b/BepuPhysics/Collidables/ConvexHullHelper.cs @@ -202,7 +202,7 @@ static void FindExtremeFace( // } // } //} - var coplanar = Vector.LessThanOrEqual(Vector.Abs(dot), planeEpsilon); + var coplanar = Vector.GreaterThan(dot, -planeEpsilon); if (Vector.LessThanAny(coplanar, Vector.Zero)) { var bundleBaseIndex = i << BundleIndexing.VectorShift; @@ -318,8 +318,7 @@ static int FindNextIndexForFaceHull2(Vector2 start, Vector2 previousEdgeDirectio if (alongNormal > planeEpsilon && !ignoreSlot) Console.WriteLine("It looks like we've found a point significantly beyond the bounding plane we just identified; how's that possible?"); - //TODO: Here and in the 3d variant: should you really be using the abs? That rejects anything that is numerically too far outside the face, which... should be rare, but we shouldn't let that point just corrupt things later. - if (float.Abs(alongNormal) <= planeEpsilon) + if (alongNormal > -planeEpsilon) { var alongEdge = Vector2.Dot(toCandidate, edgeDirection); var rawDistance = float.Sqrt(alongEdge * alongEdge + alongNormal * alongNormal);