How to create a grid based on random shapes?


How to create a "grid" using actionscript like the image below?

Basically you have an area of 1100x615 which should be filled with shapes that could be rotated and scaled...

Collision detection perhaps or something less cpu intensive for flash (as3) to manage?

Thanks

Grid


Answers:


You probably could adapt some of the word placement algorithms because in the end they place irregularly shaped polygons. There's wordle here http://mrfeinberg.com and here http://mrfeinberg.com. An action script version here http://blog.int3ractive.com/2011/02/as3-wordle-tag-cloud.html

A very nice javascript version is here http://www.jasondavies.com/wordcloud/#http%3A%2F%2Fwww.jasondavies.com%2Fwordtree%2Fcat-in-the-hat.txt

Note: If you are going to mobile you might want to consider optimizations because these packing algorithms can be computationally intensive. I used vector data elements for their speed and integers for numbers though floats might be ok on many devices.