Program: 11486
Project: 11486
Buggy source:
private static void interpolate(final double xyRatio,final org.jlinda.core.Window tileWindow,final double xScale,final double yScale,final double offset,final double invalidIndex,FastDelaunayTriangulator FDT,final double[][] z1_in,final double[][] z2_in,final double[][] z1_out,final double[][] z2_out){
  final double x_min=tileWindow.linelo;
  final double y_min=tileWindow.pixlo;
  int i, j;
  long i_min, i_max, j_min, j_max;
  double xp, yp;
  double xkj, ykj, xlj, ylj;
  double f;
  double a, b, c;
  double zj, zk, zl, zkj, zlj;
  double[] vx=new double[4];
  double[] vy=new double[4];
  double[] vz=new double[3];
  double[] abc1=new double[3];
  double[] abc2=new double[3];
  final int nx=(int)tileWindow.lines();
  final int ny=(int)tileWindow.pixels();
  for (  Triangle triangle : FDT.triangles) {
    vx[0]=vx[3]=triangle.getA().x;
    vy[0]=vy[3]=triangle.getA().y / xyRatio;
    vx[1]=triangle.getB().x;
    vy[1]=triangle.getB().y / xyRatio;
    vx[2]=triangle.getC().x;
    vy[2]=triangle.getC().y / xyRatio;
    if (vx[0] == invalidIndex || vx[1] == invalidIndex || vx[2] == invalidIndex || vy[0] == invalidIndex || vy[1] == invalidIndex || vy[2] == invalidIndex) {
      continue;
    }
    xp=Math.min(Math.min(vx[0],vx[1]),vx[2]);
    i_min=coordToIndex(xp,x_min,xScale,offset);
    xp=Math.max(Math.max(vx[0],vx[1]),vx[2]);
    i_max=coordToIndex(xp,x_min,xScale,offset);
    yp=Math.min(Math.min(vy[0],vy[1]),vy[2]);
    j_min=coordToIndex(yp,y_min,yScale,offset);
    yp=Math.max(Math.max(vy[0],vy[1]),vy[2]);
    j_max=coordToIndex(yp,y_min,yScale,offset);
    if ((i_max < 0) || (i_min >= nx)) {
      continue;
    }
    if ((j_max < 0) || (j_min >= ny)) {
      continue;
    }
    if (i_min < 0) {
      i_min=0;
    }
    if (i_max >= nx) {
      i_max=nx - 1;
    }
    if (j_min < 0) {
      j_min=0;
    }
    if (j_max >= ny) {
      j_max=ny - 1;
    }
    xkj=vx[1] - vx[0];
    ykj=vy[1] - vy[0];
    xlj=vx[2] - vx[0];
    ylj=vy[2] - vy[0];
    f=1.0 / (xkj * ylj - ykj * xlj);
    vz[0]=triangle.getA().z;
    vz[1]=triangle.getB().z;
    vz[2]=triangle.getC().z;
    abc1=getABC(vx,vy,vz,z1_in,f,xkj,ykj,xlj,ylj);
    abc2=getABC(vx,vy,vz,z2_in,f,xkj,ykj,xlj,ylj);
    for (i=(int)i_min; i <= i_max; i++) {
      xp=indexToCoord(i,x_min,xScale,offset);
      for (j=(int)j_min; j <= j_max; j++) {
        yp=indexToCoord(j,y_min,yScale,offset);
        if (!pointInTriangle(vx,vy,xp,yp)) {
          continue;
        }
        z1_out[i][j]=abc1[0] * xp + abc1[1] * yp + abc1[2];
        z2_out[i][j]=abc2[0] * xp + abc2[1] * yp + abc2[2];
      }
    }
  }
}

Fixed version (ground truth):
private static void interpolate(final double xyRatio,final org.jlinda.core.Window tileWindow,final double xScale,final double yScale,final double offset,final double invalidIndex,FastDelaunayTriangulator FDT,final double[][] z1_in,final double[][] z2_in,final double[][] z3_in,final double[][] z4_in,final double[][] z1_out,final double[][] z2_out,final double[][] z3_out,final double[][] z4_out){
  final double x_min=tileWindow.linelo;
  final double y_min=tileWindow.pixlo;
  int i, j;
  long i_min, i_max, j_min, j_max;
  double xp, yp;
  double xkj, ykj, xlj, ylj;
  double f;
  double a, b, c;
  double zj, zk, zl, zkj, zlj;
  double[] vx=new double[4];
  double[] vy=new double[4];
  double[] vz=new double[3];
  double[] abc1=new double[3];
  double[] abc2=new double[3];
  double[] abc3=new double[3];
  double[] abc4=new double[3];
  final int nx=(int)tileWindow.lines();
  final int ny=(int)tileWindow.pixels();
  for (  Triangle triangle : FDT.triangles) {
    vx[0]=vx[3]=triangle.getA().x;
    vy[0]=vy[3]=triangle.getA().y / xyRatio;
    vx[1]=triangle.getB().x;
    vy[1]=triangle.getB().y / xyRatio;
    vx[2]=triangle.getC().x;
    vy[2]=triangle.getC().y / xyRatio;
    if (vx[0] == invalidIndex || vx[1] == invalidIndex || vx[2] == invalidIndex || vy[0] == invalidIndex || vy[1] == invalidIndex || vy[2] == invalidIndex) {
      continue;
    }
    xp=Math.min(Math.min(vx[0],vx[1]),vx[2]);
    i_min=coordToIndex(xp,x_min,xScale,offset);
    xp=Math.max(Math.max(vx[0],vx[1]),vx[2]);
    i_max=coordToIndex(xp,x_min,xScale,offset);
    yp=Math.min(Math.min(vy[0],vy[1]),vy[2]);
    j_min=coordToIndex(yp,y_min,yScale,offset);
    yp=Math.max(Math.max(vy[0],vy[1]),vy[2]);
    j_max=coordToIndex(yp,y_min,yScale,offset);
    if ((i_max < 0) || (i_min >= nx)) {
      continue;
    }
    if ((j_max < 0) || (j_min >= ny)) {
      continue;
    }
    if (i_min < 0) {
      i_min=0;
    }
    if (i_max >= nx) {
      i_max=nx - 1;
    }
    if (j_min < 0) {
      j_min=0;
    }
    if (j_max >= ny) {
      j_max=ny - 1;
    }
    xkj=vx[1] - vx[0];
    ykj=vy[1] - vy[0];
    xlj=vx[2] - vx[0];
    ylj=vy[2] - vy[0];
    f=1.0 / (xkj * ylj - ykj * xlj);
    vz[0]=triangle.getA().z;
    vz[1]=triangle.getB().z;
    vz[2]=triangle.getC().z;
    abc1=getABC(vx,vy,vz,z1_in,f,xkj,ykj,xlj,ylj);
    abc2=getABC(vx,vy,vz,z2_in,f,xkj,ykj,xlj,ylj);
    abc3=getABC(vx,vy,vz,z3_in,f,xkj,ykj,xlj,ylj);
    abc4=getABC(vx,vy,vz,z4_in,f,xkj,ykj,xlj,ylj);
    for (i=(int)i_min; i <= i_max; i++) {
      xp=indexToCoord(i,x_min,xScale,offset);
      for (j=(int)j_min; j <= j_max; j++) {
        yp=indexToCoord(j,y_min,yScale,offset);
        if (!pointInTriangle(vx,vy,xp,yp)) {
          continue;
        }
        z1_out[i][j]=abc1[0] * xp + abc1[1] * yp + abc1[2];
        z2_out[i][j]=abc2[0] * xp + abc2[1] * yp + abc2[2];
        z3_out[i][j]=abc3[0] * xp + abc3[1] * yp + abc3[2];
        z4_out[i][j]=abc4[0] * xp + abc4[1] * yp + abc4[2];
      }
    }
  }
}