Algorithm
Consider this layout:
+-------------+ | | | | | +--+ | | |##| | | |##| | | +--+------+ | |######| | |######| +------+------+
The black part is the occupied space. Now I need an algorithm that returns the largest remaining rectangular spaces. (Ordered from top to bottom, left to right.)
Like this:
1 2 3 4
+-------------+ +---- -------+
|#############| |### ######|
|#############| |### ######|
| +--+ | |###+ +######|
|###| |######|
|###| |######|
|###+ +------| | +--+
|### |######|
|### |######|
+---- +------+
Input
The width and height of the enclosing container. (A page in my code.)
A list of already occupied rectangles. They can be in any form that you like. E.g. (x,y,width,height) or (x1,y1,x2,y2)
I'm dealing with floats, therefore a mathematical solution would be preferred.