code: function freeJoin(p1, p2, bbox) {
  
          var p = new g.Point(p1.x, p2.y);
          if (bbox.containsPoint(p)) p = new g.Point(p2.x, p1.y);
          // kept for reference
          // if (bbox.containsPoint(p)) p = null;
  
          return p;
      }
docs: returns a point `p` where lines p,p1 and p,p2 are perpendicular and p is not contained in the given box