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:
*later edit clarify things:
i want able draw in piece of software. so, need closer algorithm.
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
Post a Comment