Program: 11490
Project: 11490
Buggy source:
/** 
 * Compute local illuminated area for given point.
 * @param xMin           Start of the simulated area in range direction.
 * @param yMin           Start of the simulated area in azimuth direction.
 * @param x              X coordinate of given point.
 * @param y              Y coordinate of given point.
 * @param lg             Local geometry information.
 * @param localDEM       The digital elevation model.
 * @param demNoDataValue Invalid DEM value.
 * @return The computed local illuminated area.
 */
private double computeLocalIlluminatedArea(final int xMin,final int yMin,final int x,final int y,final LocalGeometry lg,final double[][] localDEM,final double demNoDataValue){
  final int yy=y - yMin + 1;
  final int xx=x - xMin + 1;
  final double h00=localDEM[yy][xx];
  final double h01=localDEM[yy - 1][xx];
  final double h10=localDEM[yy][xx + 1];
  final double h11=localDEM[yy - 1][xx + 1];
  if (h00 == demNoDataValue || h01 == demNoDataValue || h10 == demNoDataValue || h11 == demNoDataValue) {
    return noDataValue;
  }
  final double[] t00=new double[3];
  final double[] t01=new double[3];
  final double[] t10=new double[3];
  final double[] t11=new double[3];
  GeoUtils.geo2xyzWGS84(lg.t00Lat,lg.t00Lon,h00,t00);
  GeoUtils.geo2xyzWGS84(lg.t01Lat,lg.t01Lon,h01,t01);
  GeoUtils.geo2xyzWGS84(lg.t10Lat,lg.t10Lon,h10,t10);
  GeoUtils.geo2xyzWGS84(lg.t11Lat,lg.t11Lon,h11,t11);
  final double[] s={lg.sensorPos[0] - lg.centerPoint[0],lg.sensorPos[1] - lg.centerPoint[1],lg.sensorPos[2] - lg.centerPoint[2]};
  Maths.normalizeVector(s);
  final double t00s=Maths.innerProduct(t00,s);
  final double t01s=Maths.innerProduct(t01,s);
  final double t10s=Maths.innerProduct(t10,s);
  final double t11s=Maths.innerProduct(t11,s);
  final double[] p00={t00[0] - t00s * s[0],t00[1] - t00s * s[1],t00[2] - t00s * s[2]};
  final double[] p01={t01[0] - t01s * s[0],t01[1] - t01s * s[1],t01[2] - t01s * s[2]};
  final double[] p10={t10[0] - t10s * s[0],t10[1] - t10s * s[1],t10[2] - t10s * s[2]};
  final double[] p11={t11[0] - t11s * s[0],t11[1] - t11s * s[1],t11[2] - t11s * s[2]};
  final double p00p01=distance(p00,p01);
  final double p00p10=distance(p00,p10);
  final double p11p01=distance(p11,p01);
  final double p11p10=distance(p11,p10);
  final double p10p01=distance(p10,p01);
  final double h1=0.5 * (p00p01 + p00p10 + p10p01);
  final double h2=0.5 * (p11p01 + p11p10 + p10p01);
  return Math.sqrt(h1 * (h1 - p00p01) * (h1 - p00p10)* (h1 - p10p01)) + Math.sqrt(h2 * (h2 - p11p01) * (h2 - p11p10)* (h2 - p10p01));
}

Fixed version (ground truth):
/** 
 * Compute local illuminated area for given point.
 * @param xMin           Start of the simulated area in range direction.
 * @param yMin           Start of the simulated area in azimuth direction.
 * @param x              X coordinate of given point.
 * @param y              Y coordinate of given point.
 * @param lg             Local geometry information.
 * @param localDEM       The digital elevation model.
 * @param demNoDataValue Invalid DEM value.
 * @return The computed local illuminated area.
 */
private double computeLocalIlluminatedArea(final int xMin,final int yMin,final int x,final int y,final LocalGeometry lg,final double[][] localDEM,final double demNoDataValue){
  if (lg.t00Height == demNoDataValue || lg.t01Height == demNoDataValue || lg.t10Height == demNoDataValue || lg.t11Height == demNoDataValue) {
    return noDataValue;
  }
  final double[] t00=new double[3];
  final double[] t01=new double[3];
  final double[] t10=new double[3];
  final double[] t11=new double[3];
  GeoUtils.geo2xyzWGS84(lg.t00Lat,lg.t00Lon,lg.t00Height,t00);
  GeoUtils.geo2xyzWGS84(lg.t01Lat,lg.t01Lon,lg.t01Height,t01);
  GeoUtils.geo2xyzWGS84(lg.t10Lat,lg.t10Lon,lg.t10Height,t10);
  GeoUtils.geo2xyzWGS84(lg.t11Lat,lg.t11Lon,lg.t11Height,t11);
  final double[] s={lg.sensorPos[0] - lg.centerPoint[0],lg.sensorPos[1] - lg.centerPoint[1],lg.sensorPos[2] - lg.centerPoint[2]};
  Maths.normalizeVector(s);
  final double t00s=Maths.innerProduct(t00,s);
  final double t01s=Maths.innerProduct(t01,s);
  final double t10s=Maths.innerProduct(t10,s);
  final double t11s=Maths.innerProduct(t11,s);
  final double[] p00={t00[0] - t00s * s[0],t00[1] - t00s * s[1],t00[2] - t00s * s[2]};
  final double[] p01={t01[0] - t01s * s[0],t01[1] - t01s * s[1],t01[2] - t01s * s[2]};
  final double[] p10={t10[0] - t10s * s[0],t10[1] - t10s * s[1],t10[2] - t10s * s[2]};
  final double[] p11={t11[0] - t11s * s[0],t11[1] - t11s * s[1],t11[2] - t11s * s[2]};
  final double p00p01=distance(p00,p01);
  final double p00p10=distance(p00,p10);
  final double p11p01=distance(p11,p01);
  final double p11p10=distance(p11,p10);
  final double p10p01=distance(p10,p01);
  final double h1=0.5 * (p00p01 + p00p10 + p10p01);
  final double h2=0.5 * (p11p01 + p11p10 + p10p01);
  return Math.sqrt(h1 * (h1 - p00p01) * (h1 - p00p10)* (h1 - p10p01)) + Math.sqrt(h2 * (h2 - p11p01) * (h2 - p11p10)* (h2 - p10p01));
}