static public Vector3f findTriangleSimplex(List<Vector3f> simplex){
        Vector3f newDirection;
        //A is the point added last to the simplex 
        Vector3f a = simplex.get(2); 
        Vector3f b = simplex.get(1); 
        Vector3f c = simplex.get(0); 
        Vector3f ao = Vector3f.ORIGIN.minus(a); 

        // The AB edge
        Vector3f ab = b.minus(a); 
        // the AC edge
        Vector3f ac = c.minus(a); 
        // The normal to the triangle
        Vector3f abc = ab.cross(ac); 

        if (abc.cross(ac).sameDirection(ao)) {
            // The origin is above
            if (ac.sameDirection(ao)) { 
                simplex.clear(); 
                simplex.add(a); 
                simplex.add(c); 
                newDirection = ac.cross(ao).cross(ac); 
            } 
            else 
                if (ab.sameDirection(ao)) { 
                    simplex.clear(); 
                    simplex.add(a); 
                    simplex.add(b); 
                    newDirection = ab.cross(ao).cross(ab); 
                } 
                else { 
                    simplex.clear(); 
                    simplex.add(a); 
                    newDirection = ao; 
                } 
        } 
        else {
            // The origin is below
            if (ab.cross(abc).sameDirection(ao)) { 
                if (ab.sameDirection(ao)) { 
                    simplex.clear(); 
                    simplex.add(a); 
                    simplex.add(b); 
                    newDirection = ab.cross(ao).cross(ab); 
                } 
                else { 
                    simplex.clear(); 
                    simplex.add(a); 
                    newDirection = ao; 
                } 
            } 
            else { 
                if (abc.sameDirection(ao)) { 
                    //the simplex stays A, B, C 
                    newDirection = abc; 
                } 
                else { 
                    simplex.clear(); 
                    simplex.add(a);
                    simplex.add(c); 
                    simplex.add(b); 
                    
                    newDirection = abc.negate(); 
                } 
            } 
        } 
        return newDirection;
    }