BEPUphysics.CollisionTests.CollisionAlgorithms.GJK.GJKToolbox.GetClosestPoints C# (CSharp) Method

GetClosestPoints() private static method

private static GetClosestPoints ( ConvexShape shapeA, ConvexShape shapeB, RigidTransform &localTransformB, CachedSimplex &cachedSimplex, Vector3 &localClosestPointA, Vector3 &localClosestPointB ) : bool
shapeA BEPUphysics.CollisionShapes.ConvexShapes.ConvexShape
shapeB BEPUphysics.CollisionShapes.ConvexShapes.ConvexShape
localTransformB BEPUutilities.RigidTransform
cachedSimplex CachedSimplex
localClosestPointA Vector3
localClosestPointB Vector3
return bool
        private static bool GetClosestPoints(ConvexShape shapeA, ConvexShape shapeB, ref RigidTransform localTransformB,
                                             ref CachedSimplex cachedSimplex, out Vector3 localClosestPointA, out Vector3 localClosestPointB)
        {

            var simplex = new PairSimplex(ref cachedSimplex, ref localTransformB);

            Vector3 closestPoint;
            int count = 0;
            while (true)
            {
                if (simplex.GetPointClosestToOrigin(out closestPoint) || //Also reduces the simplex and computes barycentric coordinates if necessary. 
                    closestPoint.LengthSquared() <= Toolbox.Epsilon * simplex.errorTolerance)
                {
                    //Intersecting.
                    localClosestPointA = Toolbox.ZeroVector;
                    localClosestPointB = Toolbox.ZeroVector;

                    simplex.UpdateCachedSimplex(ref cachedSimplex);
                    return true;
                }

                if (++count > MaximumGJKIterations)
                    break; //Must break BEFORE a new vertex is added if we're over the iteration limit.  This guarantees final simplex is not a tetrahedron.

                if (simplex.GetNewSimplexPoint(shapeA, shapeB, count, ref closestPoint))
                {
                    //No progress towards origin, not intersecting.
                    break;
                }

            }
            //Compute closest points from the contributing simplexes and barycentric coordinates
            simplex.GetClosestPoints(out localClosestPointA, out localClosestPointB);
            //simplex.VerifyContributions();
            //if (Vector3.Distance(localClosestPointA - localClosestPointB, closestPoint) > .00001f)
            //    Debug.WriteLine("break.");
            simplex.UpdateCachedSimplex(ref cachedSimplex);
            return false;
        }

Same methods

GJKToolbox::GetClosestPoints ( ConvexShape shapeA, ConvexShape shapeB, RigidTransform &transformA, RigidTransform &transformB, CachedSimplex &cachedSimplex, Vector3 &closestPointA, Vector3 &closestPointB ) : bool
GJKToolbox::GetClosestPoints ( ConvexShape shapeA, ConvexShape shapeB, RigidTransform &transformA, RigidTransform &transformB, Vector3 &closestPointA, Vector3 &closestPointB ) : bool