# Find the empty spot with math?

**URL:** <https://forum.kirupa.com/t/find-the-empty-spot-with-math/311122>\
**Category:** Uncategorized\
**Created:** [June 28, 2010, 3:22pm UTC](https://forum.kirupa.com/t/find-the-empty-spot-with-math/311122 "2010-06-28T15:22:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![webreake](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@webreake](https://forum.kirupa.com/u/webreake)\
**Post date:** [June 28, 2010, 3:22pm UTC](https://forum.kirupa.com/t/find-the-empty-spot-with-math/311122/1 "2010-06-28T15:22:50Z")

</div>

Hi  
im trying to create an image gallery where i place my images randomly over the stage but i want to place the images in the next most empty spot over the stage, for example if all the images somehow have been placed at the right of the stage i want to use math to detect that and find the empty left position .

Im sure there is a math formula to do it , will somebody knows the name for it ? or a link ?

i found this but uses hitTest and thats not efficient and it doesnt finds the big empty spot:

> **[Duplicate without overlapping?](https://www.kirupa.com/forum/showthread.php?222263-Duplicate-without-overlapping&s=7787605abd2fdec7cc4ea6f182431133&p=1866084#post1866084)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!
