Program: 58664
Project: 58664
Buggy source:
/** 
 * Function used for updating position of block (block of elements rendered in level 3) in case of dragging
 * @param gl
 */
private void handleBlockDraggingLevel2(final GL gl){
  Point currentPoint=glMouseListener.getPickedPoint();
  float[] fArTargetWorldCoordinates=new float[3];
  int iselElement;
  fArTargetWorldCoordinates=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
  float fTextureHeight=viewFrustum.getHeight() - 0.6f;
  float fStep=fTextureHeight / iSamplesLevel2;
  float fYPosMouse=fArTargetWorldCoordinates[1] - 0.4f;
  iselElement=(int)Math.floor((fTextureHeight - fYPosMouse) / fStep);
  if (iSamplesPerHeatmap % 2 == 0) {
    if ((iselElement - (int)Math.floor(iSamplesPerHeatmap / 2) + 1) >= 0 && (iselElement + (int)Math.floor(iSamplesPerHeatmap / 2)) < iSamplesLevel2) {
      iFirstSampleLevel2=iselElement - (int)Math.floor(iSamplesPerHeatmap / 2) + 1;
      fPosCursorFirstElementLevel2=fTextureHeight - (iFirstSampleLevel2 * fStep);
      iLastSampleLevel2=iselElement + (int)Math.floor(iSamplesPerHeatmap / 2);
      fPosCursorLastElementLevel2=fTextureHeight - ((iLastSampleLevel2 + 1) * fStep);
    }
  }
 else {
    if ((iselElement - (int)Math.ceil(iSamplesPerHeatmap / 2)) >= 0 && (iselElement + (int)Math.floor(iSamplesPerHeatmap / 2)) < iSamplesLevel2) {
      iFirstSampleLevel2=iselElement - (int)Math.ceil(iSamplesPerHeatmap / 2);
      fPosCursorFirstElementLevel2=fTextureHeight - (iFirstSampleLevel2 * fStep);
      iLastSampleLevel2=iselElement + (int)Math.floor(iSamplesPerHeatmap / 2);
      fPosCursorLastElementLevel2=fTextureHeight - ((iLastSampleLevel2 + 1) * fStep);
    }
  }
  setDisplayListDirty();
  setEmbeddedHeatMapData();
  if (glMouseListener.wasMouseReleased()) {
    bIsDraggingWholeBlockLevel2=false;
    bDisableCursorDraggingLevel2=false;
    bActivateDraggingLevel2=false;
  }
}

Fixed version (ground truth):
/** 
 * Function used for updating position of block (block of elements rendered in level 3) in case of dragging
 * @param gl
 */
private void handleBlockDraggingLevel2(final GL gl){
  Point currentPoint=glMouseListener.getPickedPoint();
  float[] fArTargetWorldCoordinates=new float[3];
  int iselElement;
  fArTargetWorldCoordinates=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
  float fTextureHeight=viewFrustum.getHeight() - 0.6f;
  float fStep=fTextureHeight / iSamplesLevel2;
  float fYPosMouse=fArTargetWorldCoordinates[1] - 0.4f;
  iselElement=(int)Math.floor((fTextureHeight - fYPosMouse) / fStep);
  if (iSamplesPerHeatmap % 2 == 0) {
    if ((iselElement - (int)Math.floor(iSamplesPerHeatmap / 2) + 1) >= 0 && (iselElement + (int)Math.floor(iSamplesPerHeatmap / 2)) < iSamplesLevel2) {
      iFirstSampleLevel2=iselElement - (int)Math.floor(iSamplesPerHeatmap / 2) + 1;
      fPosCursorFirstElementLevel2=fTextureHeight - (iFirstSampleLevel2 * fStep);
      iLastSampleLevel2=iselElement + (int)Math.floor(iSamplesPerHeatmap / 2);
      fPosCursorLastElementLevel2=fTextureHeight - ((iLastSampleLevel2 + 1) * fStep);
    }
  }
 else {
    if ((iselElement - (int)Math.ceil(iSamplesPerHeatmap / 2)) >= 0 && (iselElement + (int)Math.floor(iSamplesPerHeatmap / 2)) < iSamplesLevel2) {
      iFirstSampleLevel2=iselElement - (int)Math.ceil(iSamplesPerHeatmap / 2);
      fPosCursorFirstElementLevel2=fTextureHeight - (iFirstSampleLevel2 * fStep);
      iLastSampleLevel2=iselElement + (int)Math.floor(iSamplesPerHeatmap / 2);
      fPosCursorLastElementLevel2=fTextureHeight - ((iLastSampleLevel2 + 1) * fStep);
    }
  }
  setDisplayListDirty();
  if (glMouseListener.wasMouseReleased()) {
    bIsDraggingWholeBlockLevel2=false;
    bDisableCursorDraggingLevel2=false;
    bActivateDraggingLevel2=false;
  }
}