BEPUphysics.CollisionTests.CollisionAlgorithms.GJK.RaySimplex.GetPointClosestToOrigin C# (CSharp) Method

GetPointClosestToOrigin() public method

Gets the point on the simplex that is closest to the origin.
public GetPointClosestToOrigin ( RaySimplex &simplex, Microsoft.Xna.Framework.Vector3 &point ) : bool
simplex RaySimplex Simplex to test.
point Microsoft.Xna.Framework.Vector3 Closest point on the simplex.
return bool
        public bool GetPointClosestToOrigin(ref RaySimplex simplex, out Vector3 point)
        {
            //This method finds the closest point on the simplex to the origin.
            //Barycentric coordinates are assigned to the MinimumNormCoordinates as necessary to perform the inclusion calculation.
            //If the simplex is a tetrahedron and found to be overlapping the origin, the function returns true to tell the caller to terminate.
            //Elements of the simplex that are not used to determine the point of minimum norm are removed from the simplex.

            switch (State)
            {

                case SimplexState.Point:
                    point = A;
                    break;
                case SimplexState.Segment:
                    GetPointOnSegmentClosestToOrigin(ref simplex, out point);
                    break;
                case SimplexState.Triangle:
                    GetPointOnTriangleClosestToOrigin(ref simplex, out point);
                    break;
                case SimplexState.Tetrahedron:
                    return GetPointOnTetrahedronClosestToOrigin(ref simplex, out point);
                default:
                    point = Toolbox.ZeroVector;
                    break;


            }
            return false;
        }