whole_func_string: function(end, selectorOrPoint, referenceSelectorOrPoint) {
  
          var spot;
  
          if (this._isPoint(selectorOrPoint)) {
  
              // If the source is a point, we don't need a reference point to find the sticky point of connection.
              spot = g.point(selectorOrPoint);
  
          } else {
  
              // If the source is an element, we need to find a point on the element boundary that is closest
              // to the reference point (or reference element).
              // Get the bounding box of the spot relative to the paper viewport. This is necessary
              // in order to follow paper viewport transformations (scale/rotate).
              // `_sourceBbox` (`_targetBbox`) comes from `_sourceBboxUpdate` (`_sourceBboxUpdate`)
              // method, it exists since first render and are automatically updated
              var spotBbox = end === 'source' ? this._sourceBbox : this._targetBbox;
              
              var reference;
              
              if (this._isPoint(referenceSelectorOrPoint)) {
  
                  // Reference was passed as a point, therefore, we're ready to find the sticky point of connection on the source element.
                  reference = g.point(referenceSelectorOrPoint);
  
              } else {
  
                  // Reference was passed as an element, therefore we need to find a point on the reference
                  // element boundary closest to the source element.
                  // Get the bounding box of the spot relative to the paper viewport. This is necessary
                  // in order to follow paper viewport transformations (scale/rotate).
                  var referenceBbox = end === 'source' ? this._targetBbox : this._sourceBbox;
  
                  reference = g.rect(referenceBbox).intersectionWithLineFromCenterToPoint(g.rect(spotBbox).center());
                  reference = reference || g.rect(referenceBbox).center();
              }
  
              // If `perpendicularLinks` flag is set on the paper and there are vertices
              // on the link, then try to find a connection point that makes the link perpendicular
              // even though the link won't point to the center of the targeted object.
              if (this.paper.options.perpendicularLinks) {
  
                  var horizontalLineRect = g.rect(0, reference.y, this.paper.options.width, 1);
                  var verticalLineRect = g.rect(reference.x, 0, 1, this.paper.options.height);
                  var nearestSide;
  
                  if (horizontalLineRect.intersect(g.rect(spotBbox))) {
  
                      nearestSide = g.rect(spotBbox).sideNearestToPoint(reference);
                      switch (nearestSide) {
                        case 'left':
                          spot = g.point(spotBbox.x, reference.y);
                          break;
                        case 'right':
                          spot = g.point(spotBbox.x + spotBbox.width, reference.y);
                          break;
                      default:
                          spot = g.rect(spotBbox).center();
                          break;
                      }
                      
                  } else if (verticalLineRect.intersect(g.rect(spotBbox))) {
  
                      nearestSide = g.rect(spotBbox).sideNearestToPoint(reference);
                      switch (nearestSide) {
                        case 'top':
                          spot = g.point(reference.x, spotBbox.y);
                          break;
                        case 'bottom':
                          spot = g.point(reference.x, spotBbox.y + spotBbox.height);
                          break;
                      default:
                          spot = g.rect(spotBbox).center();
                          break;
                      }
                      
                  } else {
  
                      // If there is no intersection horizontally or vertically with the object bounding box,
                      // then we fall back to the regular situation finding straight line (not perpendicular)
                      // between the object and the reference point.
  
                      spot = g.rect(spotBbox).intersectionWithLineFromCenterToPoint(reference);
                      spot = spot || g.rect(spotBbox).center();
                  }
                  
              } else {
              
                  spot = g.rect(spotBbox).intersectionWithLineFromCenterToPoint(reference);
                  spot = spot || g.rect(spotBbox).center();
              }
          }
  
          return spot;
      }
func_code_string: function(end, selectorOrPoint, referenceSelectorOrPoint) {
  
          var spot;
  
          if (this._isPoint(selectorOrPoint)) {
  
              // If the source is a point, we don't need a reference point to find the sticky point of connection.
              spot = g.point(selectorOrPoint);
  
          } else {
  
              // If the source is an element, we need to find a point on the element boundary that is closest
              // to the reference point (or reference element).
              // Get the bounding box of the spot relative to the paper viewport. This is necessary
              // in order to follow paper viewport transformations (scale/rotate).
              // `_sourceBbox` (`_targetBbox`) comes from `_sourceBboxUpdate` (`_sourceBboxUpdate`)
              // method, it exists since first render and are automatically updated
              var spotBbox = end === 'source' ? this._sourceBbox : this._targetBbox;
              
              var reference;
              
              if (this._isPoint(referenceSelectorOrPoint)) {
  
                  // Reference was passed as a point, therefore, we're ready to find the sticky point of connection on the source element.
                  reference = g.point(referenceSelectorOrPoint);
  
              } else {
  
                  // Reference was passed as an element, therefore we need to find a point on the reference
                  // element boundary closest to the source element.
                  // Get the bounding box of the spot relative to the paper viewport. This is necessary
                  // in order to follow paper viewport transformations (scale/rotate).
                  var referenceBbox = end === 'source' ? this._targetBbox : this._sourceBbox;
  
                  reference = g.rect(referenceBbox).intersectionWithLineFromCenterToPoint(g.rect(spotBbox).center());
                  reference = reference || g.rect(referenceBbox).center();
              }
  
              // If `perpendicularLinks` flag is set on the paper and there are vertices
              // on the link, then try to find a connection point that makes the link perpendicular
              // even though the link won't point to the center of the targeted object.
              if (this.paper.options.perpendicularLinks) {
  
                  var horizontalLineRect = g.rect(0, reference.y, this.paper.options.width, 1);
                  var verticalLineRect = g.rect(reference.x, 0, 1, this.paper.options.height);
                  var nearestSide;
  
                  if (horizontalLineRect.intersect(g.rect(spotBbox))) {
  
                      nearestSide = g.rect(spotBbox).sideNearestToPoint(reference);
                      switch (nearestSide) {
                        case 'left':
                          spot = g.point(spotBbox.x, reference.y);
                          break;
                        case 'right':
                          spot = g.point(spotBbox.x + spotBbox.width, reference.y);
                          break;
                      default:
                          spot = g.rect(spotBbox).center();
                          break;
                      }
                      
                  } else if (verticalLineRect.intersect(g.rect(spotBbox))) {
  
                      nearestSide = g.rect(spotBbox).sideNearestToPoint(reference);
                      switch (nearestSide) {
                        case 'top':
                          spot = g.point(reference.x, spotBbox.y);
                          break;
                        case 'bottom':
                          spot = g.point(reference.x, spotBbox.y + spotBbox.height);
                          break;
                      default:
                          spot = g.rect(spotBbox).center();
                          break;
                      }
                      
                  } else {
  
                      // If there is no intersection horizontally or vertically with the object bounding box,
                      // then we fall back to the regular situation finding straight line (not perpendicular)
                      // between the object and the reference point.
  
                      spot = g.rect(spotBbox).intersectionWithLineFromCenterToPoint(reference);
                      spot = spot || g.rect(spotBbox).center();
                  }
                  
              } else {
              
                  spot = g.rect(spotBbox).intersectionWithLineFromCenterToPoint(reference);
                  spot = spot || g.rect(spotBbox).center();
              }
          }
  
          return spot;
      }
func_documentation_string: Find a point that is the start of the connection. If `selectorOrPoint` is a point, then we're done and that point is the start of the connection. If the `selectorOrPoint` is an element however, we need to know a reference point (or element) that the link leads to in order to determine the start of the connection on the original element.