I’m in a bit of a mental block (perhaps it’s getting too late once again, and too many nights without enough sleep thanks to my addiction to helping random strangers online with AS3.
I was wanting to do a quick class that generates an image from another image similar to the way the Killers “Day and Age” album looked like:
The problem I’m running into (mentally, haven’t started coding yet) is that I’m not sure how to place all those randomly sized and placed circles on the stage in such a way that they will completely fill it.
I have thought of two methods, but both seem inefficient:
- Use Box2D to create a new area where randomly sized circles drop from the top of the screen and fill the screen. Then, when all circles have settled, just track the size and position of each.
- Select a random spot on the screen. Create a new circle, and test how big it’s maximum diameter can be until it bumps into other circles or reaches a set maximum diameter. If it cannot become larger than the smallest allowed diameter, don’t place a circle there, but move on. Repeat until too many tries in a row don’t allow you to place any more circles.
Any other ideas?
The goal is to FILL the screen with small circles of various sizes.