Exemple #1
0
    private float[,] GetSubHeightsMatrix(float[,] heightsMatrix,
                                         SubmatrixPosition submatrixPosition)
    {
        int N = heightsMatrix.GetLength(0);

        switch (submatrixPosition)
        {
        case SubmatrixPosition.TOP_LEFT:
            return(GetSubMatrix(heightsMatrix, 0, 0, N / 2 + 1, N / 2 + 1));

        case SubmatrixPosition.TOP_RIGHT:
            return(GetSubMatrix(heightsMatrix, 0, N / 2, N / 2 + 1, N));

        case SubmatrixPosition.BOTTOM_LEFT:
            return(GetSubMatrix(heightsMatrix, N / 2, 0, N, N / 2 + 1));

        case SubmatrixPosition.BOTTOM_RIGHT:
            return(GetSubMatrix(heightsMatrix, N / 2, N / 2, N, N));

        default:
            return(GetSubMatrix(heightsMatrix, 0, 0, N, N));
        }
    }
    private float[,] GetSubHeightsMatrix( float[,] heightsMatrix, 
	                                       SubmatrixPosition submatrixPosition )
    {
        int N = heightsMatrix.GetLength (0);

        switch (submatrixPosition) {
            case SubmatrixPosition.TOP_LEFT:
                return GetSubMatrix( heightsMatrix, 0, 0, N/2+1, N/2+1 );
            case SubmatrixPosition.TOP_RIGHT:
                return GetSubMatrix( heightsMatrix, 0, N/2, N/2+1, N );
            case SubmatrixPosition.BOTTOM_LEFT:
                return GetSubMatrix( heightsMatrix, N/2, 0, N, N/2+1 );
            case SubmatrixPosition.BOTTOM_RIGHT:
                return GetSubMatrix( heightsMatrix, N/2, N/2, N, N );
            default:
                return GetSubMatrix( heightsMatrix, 0, 0, N, N );
        }
    }