private void gaussianHeightScaling() {

        int kernel_size = (int)(Math.sqrt(gaussian_kernel.length));
        int kernel_size2 = kernel_size / 2;

        int startx = FROMx == 0 ? kernel_size2 : FROMx;
        int starty = FROMy == 0 ? kernel_size2 : FROMy;
        int endx = TOx == detail ? detail - kernel_size2 : TOx;
        int endy = TOy == detail ? detail - kernel_size2 : TOy;

        for(int x = startx; x < endx; x++) {
            for(int y = starty; y < endy; y++) {
                double sum = 0;

                for(int k = x - kernel_size2, p = 0; p < kernel_size; k++, p++) {
                    for(int l = y - kernel_size2, t = 0; t < kernel_size; l++, t++) {
                        sum += temp_array[k][l] * gaussian_kernel[p * kernel_size + t];
                    }
                }

                vert[x][y][1] = (float)sum;
            }
        }
    }