code: function intersects(num, pos, angle)
  {
      angle %= 4;
      var fig = getTransformedFigure(num, angle, pos);
      for (var i=0; i < fig.length; i+= 2)
      {
          var x = fig[i];
          var y = fig[i+1]
          if (y < 0)
              return true;
          if (x < 0)
              return true;
          if (x >= cupsize[0])
              return true;
          if (y >= cupsize[1])
              return true;
          if (cup[x + y*cupsize[0]])
              return true;
      }
      return false;
  }
docs: 0: x = 1x + 0y, y =  0x + 1y 1: x = 0x - 1y, y =  1x + 0y 2: x =-1x + 0y, y =  0x - 1y 2: x = 0x + 1y, y = -1x + 0y;