whole_func_string: function findMiddleVertex(p1, p2, preferredDirection) {
              
              var direction = bestDirection(p1, p2, preferredDirection);
              if (direction === 'down' || direction === 'up') {
                  return { x: p1.x, y: p2.y, d: direction };
              }
              return { x: p2.x, y: p1.y, d: direction };
          }
func_code_string: function findMiddleVertex(p1, p2, preferredDirection) {
              
              var direction = bestDirection(p1, p2, preferredDirection);
              if (direction === 'down' || direction === 'up') {
                  return { x: p1.x, y: p2.y, d: direction };
              }
              return { x: p2.x, y: p1.y, d: direction };
          }
func_documentation_string: Find a vertex in between the vertices `p1` and `p2` so that the route between those vertices is orthogonal. Prefer going the direction determined by `preferredDirection`.