boolean candidateIsMuchCloser ( SquareNode node0 , SquareNode node1 , double distance2 ) { double length = Math . max ( node0 . largestSide , node1 . largestSide ) * tooFarFraction ; length *= length ; if ( distance2 > length ) return false ; return distance2 <= length ; }
Checks to see if the two corners which are to be connected are by far the two closest corners between the two squares