예제 #1
0
        //returns true if inverse has NOT been checked (i.e. u,v is a valid pair).
        private static bool CheckInverse(Point2 u, Point2 v)
        {
            var vCoords        = v.Coordinates;
            var inverseVCoords = new int[Globals.d];

            //checks to see if any element of v is less than half of k/2
            for (int i = 0; i < Globals.d; i++)
            {
                if (vCoords[i] < Math.Ceiling((double)Globals.k / 2))
                {
                    return(false);
                }
            }

            //checks to see if v inverse ordered lexicographically is smaller than u
            for (int i = 0; i < Globals.d; i++)
            {
                inverseVCoords[i] = Globals.k - vCoords[i];
            }

            Array.Sort(inverseVCoords);

            if (u.CompareLexicographically(new Point2(inverseVCoords)))
            {
                return(false);
            }

            return(true);
        }