code: function getBearing(from, to) {
  
          if (from.x === to.x) return (from.y > to.y) ? 'N' : 'S';
          if (from.y === to.y) return (from.x > to.x) ? 'W' : 'E';
          return null;
      }
docs: simple bearing method (calculates only orthogonal cardinals)