boolean removeCornerAndSavePolyline ( Element < Corner > corner , double sideErrorAfterRemoved ) { // System.out.println("removing a corner idx="+target.object.index); // Note: the corner is "lost" until the next contour is fit. Not worth the effort to recycle Element < Corner > p = previous ( corner ) ; // go through the hassle of passing in this value instead of recomputing it // since recomputing it isn't trivial p . object . sideError = sideErrorAfterRemoved ; list . remove ( corner ) ; // the line below is commented out because right now the current algorithm will // never grow after removing a corner. If this changes in the future uncomment it // computePotentialSplitScore(contour,p); return savePolyline ( ) ; }
Remove the corner from the current polyline . If the new polyline has a better score than the currently saved one with the same number of corners save it