docs: protected boolean optimize(Polygon2D_F64 seed , Polygon2D_F64 current ) {
  
  		previous.set(seed);
  
  		// pixels squares is faster to compute
  		double convergeTol = convergeTolPixels*convergeTolPixels;
  
  		// initialize the lines since they are used to check for corner divergence
  		for (int i = 0; i < seed.size(); i++) {
  			int j = (i + 1) % seed.size();
  			Point2D_F64 a = seed.get(i);
  			Point2D_F64 b = seed.get(j);
  			UtilLine2D_F64.convert(a,b,general[i]);
  		}
  
  		boolean changed = false;
  		for (int iteration = 0; iteration < maxIterations; iteration++) {
  			// snap each line to the edge independently.  Lines will be in local coordinates
  			for (int i = 0; i < previous.size(); i++) {
  				int j = (i + 1) % previous.size();
  				Point2D_F64 a = previous.get(i);
  				Point2D_F64 b = previous.get(j);
  
  				before.set(general[i]);
  
  				boolean failed = false;
  				if( !optimize(a,b,general[i]) ) {
  					failed = true;
  				} else {
  					int k = (i+previous.size()-1) %previous.size();
  
  					// see if the corner has diverged
  					if( Intersection2D_F64.intersection(general[k], general[i],tempA) != null &&
  							Intersection2D_F64.intersection(general[i], general[j],tempB) != null ) {
  
  						if( tempA.distance(a) > maxCornerChangePixel || tempB.distance(b) > maxCornerChangePixel ) {
  							failed = true;
  						}
  					} else {
  						failed = true;
  					}
  				}
  
  				// The line fit failed.  Probably because its along the image border.  Revert it
  				if( failed ) {
  					general[i].set(before);
  				} else {
  					changed = true;
  				}
  			}
  
  			// Find the corners of the quadrilateral from the lines
  			if( !UtilShapePolygon.convert(general,current) )
  				return false;
  
  			// see if it has converged
  			boolean converged = true;
  			for (int i = 0; i < current.size(); i++) {
  				if( current.get(i).distance2(previous.get(i)) > convergeTol ) {
  					converged = false;
  					break;
  				}
  			}
  			if( converged ) {
  //				System.out.println("Converged early at "+iteration);
  				break;
  			} else {
  				previous.set(current);
  			}
  		}
  
  		return changed;
  	}