Do you guys know any math theory that allows you to fill a space with random objects, so that they don’t overlap?
- Has been a member for 5-6 years
- Item was Featured
- Author was Featured
- Exclusive Author
- Sold between 100 000 and 250 000 dollars
- Bought between 10 and 49 items
- Spain
- Referred between 500 and 999 users
- Has been a member for 4-5 years
- Won a Competition
- Contributed a Tutorial to a Tuts+ Site
- Contributed a Blog Post
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Beta Tester
- Exclusive Author
- Sold between 1 000 and 5 000 dollars
- Bought between 50 and 99 items
- United Kingdom
- Referred between 10 and 49 users
- Has been a member for 2-3 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Author had a Free File of the Month
- Author was Featured
- Exclusive Author
- Sold between 10 000 and 50 000 dollars
- Bought between 1 and 9 items
- Croatia
- Referred between 1 and 9 users
I remember 2 threads on kirupa recently, however I only managed to find one:
http://www.kirupa.com/forum/showthread.php?t=331645&highlight=AS3+Random+Grid+sized+tiles
- Has been a member for 5-6 years
- Featured in a Magazine
- Envato Staff
- Reviewer
- Author had a Free File of the Month
- Item was Featured
- Author was Featured
- Exclusive Author
- Sold between 100 000 and 250 000 dollars
- Bought between 10 and 49 items
- Australia
- Referred between 10 and 49 users
What kind of shape ? It’s quite impossible if you place object with random shape …
- Has been a member for 2-3 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Author had a Free File of the Month
- Author was Featured
- Exclusive Author
- Sold between 10 000 and 50 000 dollars
- Bought between 1 and 9 items
- Croatia
- Referred between 1 and 9 users
Ok, here is another one:
http://www.kirupa.com/forum/showthread.php?t=333547&highlight=Random+movieclip+location+overlap
- Has been a member for 5-6 years
- Item was Featured
- Author was Featured
- Exclusive Author
- Sold between 100 000 and 250 000 dollars
- Bought between 10 and 49 items
- Spain
- Referred between 500 and 999 users
On a rectangle. Not fill it, but place the objects so that they don’t overlap, and so that it looks organic (not all put evenly, nor in a corner).
- Has been a member for 4-5 years
- Item was Featured
- Exclusive Author
- Sold between 5 000 and 10 000 dollars
- Bought between 10 and 49 items
- Netherlands
- Referred between 10 and 49 users
I did that once, a long time ago. What I did was create a grid to place the items on, mathematically.
First you get the square root of the number of items you have, and Math.ceil() that. That number you have now is the number of rows as well as number of columns.
This means you have created yourself a grid with those rows and columns, which you can use to place your item in a certain cell somewhere in that grid.
Using Math.random() you can randomly chose a cell to add a little randomness.
The only problem is when the items are not equal size, then my solution wont really work that well.. But it might help you out a bit 
- Has been a member for 5-6 years
- Interviewed on the Envato Notes blog
- Item was Featured
- Author was Featured
- Exclusive Author
- Sold between 100 000 and 250 000 dollars
- Bought between 10 and 49 items
- Referred between 200 and 499 users
may be http://www.box2dflash.org/?
I did the following project using http://www.box2dflash.org/ in which bubbles collide with each other but they don’t overlap: http://www.luftforalle.no/
Learning box2d flash is a bit pain but its a nice library.
Following website has one of the best tutorials/articles on box2dflash: http://www.emanueleferonato.com/
- Has been a member for 5-6 years
- Item was Featured
- Author was Featured
- Exclusive Author
- Sold between 100 000 and 250 000 dollars
- Bought between 10 and 49 items
- Spain
- Referred between 500 and 999 users
I did that once, a long time ago. What I did was create a grid to place the items on, mathematically.First you get the square root of the number of items you have, and Math.ceil() that. That number you have now is the number of rows as well as number of columns.
This means you have created yourself a grid with those rows and columns, which you can use to place your item in a certain cell somewhere in that grid.
Using Math.random() you can randomly chose a cell to add a little randomness.
The only problem is when the items are not equal size, then my solution wont really work that well.. But it might help you out a bit![]()
Yep, I know I can use a grid, but I want a more organic solution, not evenly positioned elements. There must be some math theories to do that. 
- Has been a member for 4-5 years
- Won a Competition
- Contributed a Tutorial to a Tuts+ Site
- Contributed a Blog Post
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Beta Tester
- Exclusive Author
- Sold between 1 000 and 5 000 dollars
- Bought between 50 and 99 items
- United Kingdom
- Referred between 10 and 49 users
my guess is you’re building a gallery of some kind so can we assume the objects are of four sides or are they totally random?
