Program: 86546
Project: 86546
Buggy source:
/** 
 * This method performs the revertible insertion of a point in a triangle of the mesh. It first remember all the elements that will be needed to finalize the  reversion of the insertion, and then try it.<br/> Our goal here is to fail fast : as soon as we find an encroached edge, we stop our process and we revert our operations.
 * @param container
 * @param pt
 * @return
 * @throws DelaunayError 
 */
private DEdge insertInTriangleRevertible(DTriangle container,DPoint pt) throws DelaunayError {
  LinkedList<DEdge> badEdges=new LinkedList<DEdge>();
  Deque<DEdge> swapMem=new LinkedList<DEdge>();
  DEdge ret;
  DEdge eMem0=container.getEdge(0);
  DEdge eMem1=container.getEdge(1);
  DEdge eMem2=container.getEdge(2);
  DPoint mem=container.getOppositePoint(eMem0);
  ret=initPointInTriangle(pt,container,badEdges);
  if (ret != null) {
    revertPointInTriangleInsertion(container,pt,mem,eMem1,eMem2);
    return ret;
  }
  ret=revertibleSwapping(badEdges,swapMem,pt);
  if (ret != null) {
    Iterator<DEdge> it=swapMem.descendingIterator();
    proceedSwaps(it);
    if (!container.belongsTo(pt)) {
      eMem0.deepSwap();
    }
    checkMemEdges(eMem1,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    checkMemEdges(eMem2,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    revertPointInTriangleInsertion(container,pt,mem,eMem1,eMem2);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * This method performs the revertible insertion of a point in a triangle of the mesh. It first remember all the elements that will be needed to finalize the  reversion of the insertion, and then try it.<br/> Our goal here is to fail fast : as soon as we find an encroached edge, we stop our process and we revert our operations.
 * @param container
 * @param pt
 * @return
 * @throws DelaunayError 
 */
private DEdge insertInTriangleRevertible(DTriangle container,DPoint pt) throws DelaunayError {
  LinkedList<DEdge> badEdges=new LinkedList<DEdge>();
  Deque<DEdge> swapMem=new LinkedList<DEdge>();
  DEdge ret;
  DEdge eMem0=container.getEdge(0);
  DEdge eMem1=container.getEdge(1);
  DEdge eMem2=container.getEdge(2);
  DPoint mem=container.getOppositePoint(eMem0);
  ret=initPointInTriangle(pt,container,badEdges);
  if (ret != null) {
    revertPointInTriangleInsertion(container,pt,mem,eMem1,eMem2);
    return ret;
  }
  ret=revertibleSwapping(badEdges,swapMem,pt);
  if (ret != null) {
    Iterator<DEdge> it=swapMem.descendingIterator();
    proceedSwaps(it);
    eMem0.deepSwap();
    DTriangle actualContainer=container;
    if (eMem0.getLeft() != null && eMem0.getLeft().belongsTo(pt)) {
      actualContainer=eMem0.getLeft();
    }
 else     if (eMem0.getRight() != null && eMem0.getRight().belongsTo(pt)) {
      actualContainer=eMem0.getRight();
    }
    checkMemEdges(eMem1,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    checkMemEdges(eMem2,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    revertPointInTriangleInsertion(actualContainer,pt,mem,eMem1,eMem2);
  }
  return ret;
}