Algorithm to distribute objects in a box (like InDesign, Illustrator, Draw!)

Posted by Rafael Almeida on Stack Overflow See other posts from Stack Overflow or by Rafael Almeida
Published on 2010-01-30T19:44:58Z Indexed on 2010/05/15 20:14 UTC
Read the original article Hit count: 265

I have a set of rectangles with their corresponding positions and a big rectangle which serves as the 'bounding box' for these rectangles.

I would like to know of an algorithm that would 'distribute the free space' evenly among the rectangles. Some of you may be familiar with the Distribute Spacing option in Adobe InDesign and similar layout-oriented apps. That would be what I'm looking for.

I did try looking it up, but I'm not familiar with 'graphical' algorithms terminology and trying only terms relating to 'distribute' mainly yields results about Distributed Computing. So, even the names of the algorithms or better terms to look up would be a big help.

Finally, the algorithm doesn't need to be rigorously the same as InDesign's one: pretty much any algorithm that 'distributes' objects inside a region will work fine. In fact, since I'm striving for visual appeal mainly, the more suggestions the better. =D

© Stack Overflow or respective owner

Related posts about graphical-programming

Related posts about graphical-algorithm