示例#1
0
        /**
         * Returns the order in which a specified subcell is visited by the Hilbert
         * curve. This is the inverse of {@link #posToIJ}.
         *
         * @param orientation the subcell orientation, in the range [0,3].
         * @param ijIndex the subcell index where
         *     {@code 0->(0,0), 1->(0,1), 2->(1,0), 3->(1,1)}.
         * @return the position of the subcell in the Hilbert traversal, in the range
         *     [0,3].
         * @throws IllegalArgumentException if either parameter is out of bounds.
         */

        public static int IjToPos(int orientation, int ijIndex)
        {
            Preconditions.CheckArgument(0 <= orientation && orientation < 4);
            Preconditions.CheckArgument(0 <= ijIndex && ijIndex < 4);
            return(_IjToPos[orientation][ijIndex]);
        }
示例#2
0
        public static int PosToOrientation(int position)
        {
            Preconditions.CheckArgument(0 <= position && position < 4);

            return(_PosToOrientation[position]);
        }