Finding free non-intersecting rectangle shaped areas between rectangles in C#
<p>I have a following problem. A large rectangle contains smaller non-intersecting rectangles (The black rectangles in the picture below) and I need to find an algorithm to fill remaining free area with non-intersecting rectangles(red ones in the picture below). Speed is not an issue for the algorithm. Also if someone would have an example source code of the algorithm I would really appreciate that.</p>

<p>Edit. Small clarification I need to get the coordinates of the red rectangles not to draw them. I am also working with point data not images.</p>

<p><img src="http://koti.mbnet.fi/niempi2/Squares.gif"></p>
