code: public boolean refine(Point2D_F64 a, Point2D_F64 b, LineGeneral2D_F64 found) {
  
  		// determine the local coordinate system
  		center.x = (a.x + b.x)/2.0;
  		center.y = (a.y + b.y)/2.0;
  		localScale = a.distance(center);
  
  		// define the line which points are going to be sampled along
  		double slopeX = (b.x - a.x);
  		double slopeY = (b.y - a.y);
  		double r = Math.sqrt(slopeX*slopeX + slopeY*slopeY);
  
  		// tangent of unit length that radial sample samples are going to be along
  		// Two choices for tangent here.  Select the one which points to the "right" of the line,
  		// which is inside of the edge
  		double tanX = slopeY/r;
  		double tanY = -slopeX/r;
  
  		// set up inputs into line fitting
  		computePointsAndWeights(slopeX, slopeY, a.x, a.y, tanX, tanY);
  
  		if( samplePts.size() >= 4 ) {
  			// fit line and convert into generalized format
  			if( null == FitLine_F64.polar(samplePts.toList(), weights.data, polar) ) {
  				throw new RuntimeException("All weights were zero, bug some place");
  			}
  			UtilLine2D_F64.convert(polar, found);
  
  			// Convert line from local to global coordinates
  			localToGlobal(found);
  
  			return true;
  		} else {
  			return false;
  		}
  	}
docs: Fits a line defined by the two points. When fitting the line the weight of the edge is used to determine.
  how influential the point is.  Multiple calls might be required to get a perfect fit.
  
  @param a Start of line
  @param b End of line..
  @param found (output) Fitted line to the edge
  @return true if successful or false if it failed