登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
public static float[][] lineGridFix(float[][] input, int gap) { float[][] values = new float[(input.length - 1) * gap + 2][(input[0].length - 1) * gap + 2];
for (int m = 0; m < input.length - 1; m++) { for (int n = 0; n < input[0].length - 1; n++) {
float upLeft = input[m][n]; float upRight = input[m][n + 1]; float downLeft = input[m + 1][n]; float downRight = input[m + 1][n + 1];
for (int i = 0; i < gap + 2; i++) { // start x, y float yLeft = upLeft + (downLeft - upLeft) * i / (gap + 1); float yRight = upRight + (downRight - upRight) * i / (gap + 1); for (int j = 0; j < gap + 2; j++) { float value = yLeft + (yRight - yLeft) * j / (gap + 1); values[m * gap + i][n * gap + j] = value; } }
} } return values; }
|