title: Two Rectangles intersection
body: <p>I have two rectangles characterized by 4 values each : </p>
  
  <p>Left position <code>X</code>, top position <code>Y</code>, width <code>W</code> and height <code>H</code>:</p>
  
  <pre><code>X1, Y1, H1, W1
  X2, Y2, H2, W2
  </code></pre>
  
  <p>Rectangles are not rotated, like so:</p>
  
  <pre><code>+--------------------&gt; X axis
  |
  |    (X,Y)      (X+W, Y)
  |    +--------------+
  |    |              |
  |    |              |
  |    |              |
  |    +--------------+
  v    (X, Y+H)     (X+W,Y+H)
  
  Y axis
  </code></pre>
  
  <p>What is the best solution to determine whether the intersection of the two rectangles is empty or not?</p>