    util.shapePerimeterConnectionPoint(linkView, view, magnet, ref)

This function can be directly used in the dia.Paper `linkConnectionPoint` parameter. When used, links will try to find the best connection point right on the perimeter of the connected shape rather than only on the bounding box. See the image below.

    var paper = new joint.dia.Paper({
       // ...
       linkConnectionPoint: joint.util.shapePerimeterConnectionPoint
       // ...
    })