title: Combining many rectangles into fewer rectangles
body: <p>I want to compress many non-overlapping rectangles into larger rectangles When they are adjacent.</p>
  
  <p>Pseudo-code for my current algorithm:</p>
  
  <pre><code>do
     compress horizontally using sweep and prune
     compress horizontal output vertically using sweep and prune
  while (this output is small than previous output)
  </code></pre>
  
  <p>Here's a <a href="http://en.wikipedia.org/wiki/Sweep_and_prune" rel="nofollow">link to sweep and prune</a>.</p>
  
  <p>This is working well, but I want to know if there are approaches which result in fewer rectangles output. I figure there's more sophisticated than what I'm doing now.</p>