double _boundaryDistance ( Point2D pt ) { if ( isEmpty ( ) ) return NumberUtils . NaN ( ) ; if ( pt . x == xmin ) return pt . y - ymin ; double height = ymax - ymin ; double width = xmax - xmin ; if ( pt . y == ymax ) return height + pt . x - xmin ; if ( pt . x == xmax ) return height + width + ymax - pt . y ; if ( pt . y == ymin ) return height * 2.0 + width + xmax - pt . x ; return _boundaryDistance ( _snapToBoundary ( pt ) ) ; }
function ) .