Program: 58987
Project: 58987
Buggy source:
private void handleAngularBrushing(final GL gl){
  if (bIsAngularBrushingFirstTime) {
    fCurrentAngle=fDefaultAngle;
    Point currentPoint=linePick.getPickedPoint();
    float[] fArPoint=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
    vecAngularBrusingPoint=new Vec3f(fArPoint[0],fArPoint[1],fArPoint[2]);
    bIsAngularBrushingFirstTime=false;
  }
  alIsAngleBlocking.get(0).clear();
  int iPosition=(int)(vecAngularBrusingPoint.x() / fAxisSpacing);
  int iAxisLeftIndex;
  int iAxisRightIndex;
  iAxisLeftIndex=set.getVA(iAxisVAID).get(iPosition);
  iAxisRightIndex=set.getVA(iAxisVAID).get(iPosition + 1);
  Vec3f vecLeftPoint=new Vec3f(0,0,0);
  Vec3f vecRightPoint=new Vec3f(0,0,0);
  if (bRenderStorageHorizontally) {
    vecLeftPoint.setY(set.get(iSelectedLineID).getFloat(EDataRepresentation.NORMALIZED,iAxisLeftIndex) * renderStyle.getAxisHeight());
    vecRightPoint.setY(set.get(iSelectedLineID).getFloat(EDataRepresentation.NORMALIZED,iAxisRightIndex) * renderStyle.getAxisHeight());
  }
 else {
    vecLeftPoint.setY(set.get(iAxisLeftIndex).getFloat(EDataRepresentation.NORMALIZED,iSelectedLineID) * renderStyle.getAxisHeight());
    vecRightPoint.setY(set.get(iAxisRightIndex).getFloat(EDataRepresentation.NORMALIZED,iSelectedLineID) * renderStyle.getAxisHeight());
  }
  vecLeftPoint.setX(iPosition * fAxisSpacing);
  vecRightPoint.setX((iPosition + 1) * fAxisSpacing);
  Vec3f vecDirectional=vecRightPoint.minus(vecLeftPoint);
  float fLength=vecDirectional.length();
  vecDirectional.normalize();
  Vec3f vecTriangleOrigin=vecLeftPoint.addScaled(fLength / 4,vecDirectional);
  Vec3f vecTriangleLimit=vecLeftPoint.addScaled(fLength / 4 * 3,vecDirectional);
  Rotf rotf=new Rotf();
  Vec3f vecCenterLine=vecTriangleLimit.minus(vecTriangleOrigin);
  float fLegLength=vecCenterLine.length();
  if (bIsAngularDraggingActive) {
    Point pickedPoint=pickingTriggerMouseAdapter.getPickedPoint();
    float fArPoint[]=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,pickedPoint.x,pickedPoint.y);
    Vec3f vecPickedPoint=new Vec3f(fArPoint[0],fArPoint[1],fArPoint[2]);
    Vec3f vecTempLine=vecPickedPoint.minus(vecTriangleOrigin);
    fCurrentAngle=getAngle(vecTempLine,vecCenterLine);
    bIsDisplayListDirtyLocal=true;
    bIsDisplayListDirtyRemote=true;
  }
  rotf.set(new Vec3f(0,0,1),fCurrentAngle);
  Vec3f vecUpperPoint=rotf.rotateVector(vecCenterLine);
  rotf.set(new Vec3f(0,0,1),-fCurrentAngle);
  Vec3f vecLowerPoint=rotf.rotateVector(vecCenterLine);
  vecUpperPoint.add(vecTriangleOrigin);
  vecLowerPoint.add(vecTriangleOrigin);
  gl.glColor4fv(ANGULAR_COLOR,0);
  gl.glLineWidth(ANGLUAR_LINE_WIDTH);
  gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.ANGULAR_UPPER,iPosition));
  gl.glBegin(GL.GL_LINES);
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  gl.glVertex3f(vecUpperPoint.x(),vecUpperPoint.y(),vecUpperPoint.z() + 0.02f);
  gl.glEnd();
  gl.glPopName();
  gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.ANGULAR_UPPER,iPosition));
  gl.glBegin(GL.GL_LINES);
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  gl.glVertex3f(vecLowerPoint.x(),vecLowerPoint.y(),vecLowerPoint.z() + 0.02f);
  gl.glEnd();
  gl.glPopName();
  gl.glColor4fv(ANGULAR_POLYGON_COLOR,0);
  gl.glBegin(GL.GL_POLYGON);
  rotf.set(new Vec3f(0,0,1),-fCurrentAngle / 10);
  Vec3f tempVector=vecCenterLine.copy();
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  for (int iCount=0; iCount <= 10; iCount++) {
    Vec3f vecPoint=tempVector.copy();
    vecPoint.normalize();
    vecPoint.scale(fLegLength);
    gl.glVertex3f(vecTriangleOrigin.x() + vecPoint.x(),vecTriangleOrigin.y() + vecPoint.y(),vecTriangleOrigin.z() + vecPoint.z() + 0.02f);
    tempVector=rotf.rotateVector(tempVector);
  }
  gl.glEnd();
  gl.glBegin(GL.GL_POLYGON);
  rotf.set(new Vec3f(0,0,1),fCurrentAngle / 10);
  tempVector=vecCenterLine.copy();
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  for (int iCount=0; iCount <= 10; iCount++) {
    Vec3f vecPoint=tempVector.copy();
    vecPoint.normalize();
    vecPoint.scale(fLegLength);
    gl.glVertex3f(vecTriangleOrigin.x() + vecPoint.x(),vecTriangleOrigin.y() + vecPoint.y(),vecTriangleOrigin.z() + vecPoint.z() + 0.02f);
    tempVector=rotf.rotateVector(tempVector);
  }
  gl.glEnd();
  for (  Integer iCurrent : set.getVA(iPolylineVAID)) {
    if (bRenderStorageHorizontally) {
      vecLeftPoint.setY(set.get(iCurrent).getFloat(EDataRepresentation.NORMALIZED,iAxisLeftIndex) * renderStyle.getAxisHeight());
      vecRightPoint.setY(set.get(iCurrent).getFloat(EDataRepresentation.NORMALIZED,iAxisRightIndex) * renderStyle.getAxisHeight());
    }
 else {
      vecLeftPoint.setY(set.get(iAxisLeftIndex).getFloat(EDataRepresentation.NORMALIZED,iCurrent) * renderStyle.getAxisHeight());
      vecRightPoint.setY(set.get(iAxisRightIndex).getFloat(EDataRepresentation.NORMALIZED,iCurrent) * renderStyle.getAxisHeight());
    }
    vecLeftPoint.setX(iPosition * fAxisSpacing);
    vecRightPoint.setX((iPosition + 1) * fAxisSpacing);
    Vec3f vecCompareLine=vecRightPoint.minus(vecLeftPoint);
    float fCompareAngle=getAngle(vecCompareLine,vecCenterLine);
    if (fCompareAngle > fCurrentAngle || fCompareAngle < -fCurrentAngle) {
      alIsAngleBlocking.get(0).add(iCurrent);
    }
  }
  if (pickingTriggerMouseAdapter.wasMouseReleased()) {
    bIsAngularDraggingActive=false;
  }
}

Fixed version (ground truth):
private void handleAngularBrushing(final GL gl){
  if (bIsAngularBrushingFirstTime) {
    fCurrentAngle=fDefaultAngle;
    Point currentPoint=linePick.getPickedPoint();
    float[] fArPoint=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
    vecAngularBrusingPoint=new Vec3f(fArPoint[0],fArPoint[1],0);
    bIsAngularBrushingFirstTime=false;
  }
  alIsAngleBlocking.get(0).clear();
  int iPosition=(int)(vecAngularBrusingPoint.x() / fAxisSpacing);
  int iAxisLeftIndex;
  int iAxisRightIndex;
  iAxisLeftIndex=set.getVA(iAxisVAID).get(iPosition);
  iAxisRightIndex=set.getVA(iAxisVAID).get(iPosition + 1);
  Vec3f vecLeftPoint=new Vec3f(0,0,0);
  Vec3f vecRightPoint=new Vec3f(0,0,0);
  if (bRenderStorageHorizontally) {
    vecLeftPoint.setY(set.get(iSelectedLineID).getFloat(EDataRepresentation.NORMALIZED,iAxisLeftIndex) * renderStyle.getAxisHeight());
    vecRightPoint.setY(set.get(iSelectedLineID).getFloat(EDataRepresentation.NORMALIZED,iAxisRightIndex) * renderStyle.getAxisHeight());
  }
 else {
    vecLeftPoint.setY(set.get(iAxisLeftIndex).getFloat(EDataRepresentation.NORMALIZED,iSelectedLineID) * renderStyle.getAxisHeight());
    vecRightPoint.setY(set.get(iAxisRightIndex).getFloat(EDataRepresentation.NORMALIZED,iSelectedLineID) * renderStyle.getAxisHeight());
  }
  vecLeftPoint.setX(iPosition * fAxisSpacing);
  vecRightPoint.setX((iPosition + 1) * fAxisSpacing);
  Vec3f vecDirectional=vecRightPoint.minus(vecLeftPoint);
  float fLength=vecDirectional.length();
  vecDirectional.normalize();
  Vec3f vecTriangleOrigin=vecLeftPoint.addScaled(fLength / 4,vecDirectional);
  Vec3f vecTriangleLimit=vecLeftPoint.addScaled(fLength / 4 * 3,vecDirectional);
  Rotf rotf=new Rotf();
  Vec3f vecCenterLine=vecTriangleLimit.minus(vecTriangleOrigin);
  float fLegLength=vecCenterLine.length();
  if (bIsAngularDraggingActive) {
    Point pickedPoint=pickingTriggerMouseAdapter.getPickedPoint();
    float fArPoint[]=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,pickedPoint.x,pickedPoint.y);
    Vec3f vecPickedPoint=new Vec3f(fArPoint[0],fArPoint[1],0);
    Vec3f vecTempLine=vecPickedPoint.minus(vecTriangleOrigin);
    fCurrentAngle=getAngle(vecTempLine,vecCenterLine);
    bIsDisplayListDirtyLocal=true;
    bIsDisplayListDirtyRemote=true;
  }
  rotf.set(new Vec3f(0,0,1),fCurrentAngle);
  Vec3f vecUpperPoint=rotf.rotateVector(vecCenterLine);
  rotf.set(new Vec3f(0,0,1),-fCurrentAngle);
  Vec3f vecLowerPoint=rotf.rotateVector(vecCenterLine);
  vecUpperPoint.add(vecTriangleOrigin);
  vecLowerPoint.add(vecTriangleOrigin);
  gl.glColor4fv(ANGULAR_COLOR,0);
  gl.glLineWidth(ANGLUAR_LINE_WIDTH);
  gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.ANGULAR_UPPER,iPosition));
  gl.glBegin(GL.GL_LINES);
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  gl.glVertex3f(vecUpperPoint.x(),vecUpperPoint.y(),vecUpperPoint.z() + 0.02f);
  gl.glEnd();
  gl.glPopName();
  gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.ANGULAR_UPPER,iPosition));
  gl.glBegin(GL.GL_LINES);
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  gl.glVertex3f(vecLowerPoint.x(),vecLowerPoint.y(),vecLowerPoint.z() + 0.02f);
  gl.glEnd();
  gl.glPopName();
  gl.glColor4fv(ANGULAR_POLYGON_COLOR,0);
  gl.glBegin(GL.GL_POLYGON);
  rotf.set(new Vec3f(0,0,1),-fCurrentAngle / 10);
  Vec3f tempVector=vecCenterLine.copy();
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  for (int iCount=0; iCount <= 10; iCount++) {
    Vec3f vecPoint=tempVector.copy();
    vecPoint.normalize();
    vecPoint.scale(fLegLength);
    gl.glVertex3f(vecTriangleOrigin.x() + vecPoint.x(),vecTriangleOrigin.y() + vecPoint.y(),vecTriangleOrigin.z() + vecPoint.z() + 0.02f);
    tempVector=rotf.rotateVector(tempVector);
  }
  gl.glEnd();
  gl.glBegin(GL.GL_POLYGON);
  rotf.set(new Vec3f(0,0,1),fCurrentAngle / 10);
  tempVector=vecCenterLine.copy();
  gl.glVertex3f(vecTriangleOrigin.x(),vecTriangleOrigin.y(),vecTriangleOrigin.z() + 0.02f);
  for (int iCount=0; iCount <= 10; iCount++) {
    Vec3f vecPoint=tempVector.copy();
    vecPoint.normalize();
    vecPoint.scale(fLegLength);
    gl.glVertex3f(vecTriangleOrigin.x() + vecPoint.x(),vecTriangleOrigin.y() + vecPoint.y(),vecTriangleOrigin.z() + vecPoint.z() + 0.02f);
    tempVector=rotf.rotateVector(tempVector);
  }
  gl.glEnd();
  for (  Integer iCurrent : set.getVA(iPolylineVAID)) {
    if (bRenderStorageHorizontally) {
      vecLeftPoint.setY(set.get(iCurrent).getFloat(EDataRepresentation.NORMALIZED,iAxisLeftIndex) * renderStyle.getAxisHeight());
      vecRightPoint.setY(set.get(iCurrent).getFloat(EDataRepresentation.NORMALIZED,iAxisRightIndex) * renderStyle.getAxisHeight());
    }
 else {
      vecLeftPoint.setY(set.get(iAxisLeftIndex).getFloat(EDataRepresentation.NORMALIZED,iCurrent) * renderStyle.getAxisHeight());
      vecRightPoint.setY(set.get(iAxisRightIndex).getFloat(EDataRepresentation.NORMALIZED,iCurrent) * renderStyle.getAxisHeight());
    }
    vecLeftPoint.setX(iPosition * fAxisSpacing);
    vecRightPoint.setX((iPosition + 1) * fAxisSpacing);
    Vec3f vecCompareLine=vecRightPoint.minus(vecLeftPoint);
    float fCompareAngle=getAngle(vecCompareLine,vecCenterLine);
    if (fCompareAngle > fCurrentAngle || fCompareAngle < -fCurrentAngle) {
      alIsAngleBlocking.get(0).add(iCurrent);
    }
  }
  if (pickingTriggerMouseAdapter.wasMouseReleased()) {
    bIsAngularDraggingActive=false;
  }
}