algorithm - How can I divide a rectangular area into smaller rectangles that represent a percentage of the total area? -


basically i'm trying "nice" image small rectangles add big rectangle, kind like:

disk inventory x

*later edit clarify things:

  1. i want able draw in piece of software. so, need closer algorithm.

  2. all need rectangles. don't need them have predefined proportions rectangle. between square , 3:1 width/height (or height/width) fine. extremely naive approach divide width of enclosing rectangle percentage enclosed rectangles have create thin slices , of smaller percentage rectangles drop bellow 1px.

i need find way split rectangles on multiple rows.

*second edit: problem solved. looking treemap algorithm (as pointed out phpdna). once had keyword able find couple of python implementations satisfied requirements.

treemap algorithm can pack smaller rectangles map. can recursively subdivide plane smaller tiles example splitting plane along 2 axis , save result tree.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -