예제 #1
0
    private FaceSet faceSetAt(AlignedCoord alco, Direction dir)
    {
        int index = indexOfFaceSetAtCoord(alco, dir);

//		bug ("got the index: " + index);

        if (index < 0)
        {
            return(null);
        }

        try {
            return(faceSets[index]);
        } catch (ArgumentOutOfRangeException e) {
            throw new Exception("index was out of range: index was: " + index + " aligned coord: " + alco.toString() + "direction: " + dir);
        }
        return(null);
    }
예제 #2
0
    private int indexOfFaceSetAtCoord(AlignedCoord coord, Direction dir)
    {
        int nudge_lookup = ((int)dir % 2 == 0) ? 0 : 1;          // pos dirs are 0, 2 and 4

        int ret;

        try {
            ret = faceSetTable[coord.across * 2 + nudge_lookup, coord.up] - FaceAggregator.FACETABLE_LOOKUP_SHIFT;
        }
        catch (IndexOutOfRangeException e)
        {
            throw new Exception("this index was: across " + (coord.across * 2 + nudge_lookup) + " up: " + coord.up + ". face table length was: dim 0: " + faceSetTable.GetLength(0) + " 1 " + faceSetTable.GetLength(1) + " coord was " + coord.toString() + "Direction was: " + dir + " my face axis is: " + faceNormal);
        }
        return(ret);
    }