private static void computeLaplacian1( FilterBuffer2.Extrapolation ex, float[][] x, float[][] y) { int n1 = x[0].length; int n2 = x.length; FilterBuffer2 fbx = new FilterBuffer2(1,1,1,1,x); fbx.setExtrapolation(ex); for (int i2=0; i2<n2; ++i2) { float[] xm = fbx.get(i2-1); float[] x0 = fbx.get(i2 ); float[] xp = fbx.get(i2+1); float[] y0 = y[i2]; for (int i1=0,j1=1; i1<n1; ++i1,++j1) y0[i1] = xm[j1]+xp[j1]+x0[j1-1]+x0[j1+1]-4.0f*x0[j1]; } }
private static void computeLaplacian2( FilterBuffer2.Extrapolation ex, float[][] x, float[][] y) { int n1 = x[0].length; int n2 = x.length; FilterBuffer2 fbx = new FilterBuffer2(1,1,1,1,x); FilterBuffer2 fby = new FilterBuffer2(1,1,1,1,y); fbx.setExtrapolation(ex); fby.setExtrapolation(ex); fbx.setMode(FilterBuffer2.Mode.INPUT); fby.setMode(FilterBuffer2.Mode.OUTPUT); for (int i2=0; i2<=n2; ++i2) { float[] xm = fbx.get(i2-1); float[] x0 = fbx.get(i2 ); float[] ym = fby.get(i2-1); float[] y0 = fby.get(i2 ); for (int i1=0,j1=1; i1<=n1; ++i1,++j1) { float d1 = x0[j1]-x0[j1-1]; float d2 = x0[j1]-xm[j1 ]; y0[j1 ] -= d1+d2; y0[j1-1] += d1; ym[j1 ] += d2; } } fby.flush(); }
FilterBuffer2 fbx = new FilterBuffer2(1,1,1,1,x); FilterBuffer2 fby = new FilterBuffer2(1,1,1,1,y); fbx.setExtrapolation(FilterBuffer2.Extrapolation.ZERO_SLOPE);