private Vector3 EPA(Simplex s, Prism A, Prism B) { while (true) { var e = s.ClosestEdge(); var point = GetSupport(A, B, e.direction); var d = Vector3.Dot(point, e.direction); if (d - e.distance < Mathf.Pow(10, 6)) { Debug.Log(s.numPoints); var normal = e.direction; var depth = d; print("in epa"); return(normal * depth); } else { // Insert point between points in closestEdge. Debug.Log("in epa adding point" + point + " " + e.index); s.Add(point, e.index); } } }
private Vector3 EPA(Simplex s, Prism A, Prism B) { while (true) { Edge e = s.ClosestEdge(); var point = GetSupport(A, B, e.normal); float d = Vector3.Dot(point, e.normal); if (d - e.distance < Mathf.Pow(10, 5)) { var normal = e.normal; var depth = d; return(normal * depth); } else { // we haven't reached the edge of the Minkowski Difference // so continue expanding by adding the new point to the simplex // in between the points that made the closest edge s.Add(point, e.index); } } }