From 233c7e3419a98eaa7e91a7c91f3fad23ec5b6cdc Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Thu, 20 Feb 2020 15:55:09 +0100
Subject: [PATCH] [EPA] Fix test for degenerate faces.

---
 src/narrowphase/gjk.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/narrowphase/gjk.cpp b/src/narrowphase/gjk.cpp
index 5537653f..fb4b1794 100644
--- a/src/narrowphase/gjk.cpp
+++ b/src/narrowphase/gjk.cpp
@@ -1261,7 +1261,7 @@ bool EPA::expand(size_t pass, SimplexV* w, SimplexF* f, size_t e, SimplexHorizon
   const size_t e1 = nexti[e];
     
   // case 1: the new face is not degenerated, i.e., the new face is not coplanar with the old face f.
-  if(f->n.dot(w->w) - f->d < -tolerance)
+  if(f->n.dot(w->w - f->vertex[e]->w) < -tolerance)
   {
     SimplexF* nf = newFace(f->vertex[e1], f->vertex[e], w, false);
     if(nf)
-- 
GitLab