how to programtically build a grid of interlocking but random sized squares

Posted by Mrwolfy on Programmers See other posts from Programmers or by Mrwolfy
Published on 2012-11-19T17:48:46Z Indexed on 2012/11/19 23:22 UTC
Read the original article Hit count: 377

I want to create a two dimensional layout of rectangular shapes, a grid made up of random sized cubes. The cubed should fit together and have equal padding or margin (space between). Kind of like a comic book layout, or more like the image attached.

How could I do this procedurally?

Practically, I would probably be using Python and some graphic software to render an image, but I don't know the type of algorithm (or whatnot) I would need to use to generate the randomized grid.

random cubes

© Programmers or respective owner

Related posts about programming-practices

Related posts about python