Partition a rectangle into near-squares of given areas

Posted by Marko Dumic on Stack Overflow See other posts from Stack Overflow or by Marko Dumic
Published on 2010-03-28T14:32:29Z Indexed on 2010/03/28 15:23 UTC
Read the original article Hit count: 195

Filed under:
|

I have a set of N positive numbers, and a rectangle of dimensions X and Y that I need to partition it in N smaller rectangles such that:

  • the surface area of each smaller rectangle is proportional to it's corresponding number in given set
  • all space of big rectangle is occupied and there is no leftover space between smaller rectangles
  • each small rectangle should be shaped as close to square as feasible
  • the execution time should be reasonably small

I need directions on this. Do you know of such algorithm described on the web? Do you have any ideas (pseudo-code is fine)?

Thanks.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about rectangles