Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 17,605 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Free Space Detection Algorithm #443379
07/14/14 21:18
07/14/14 21:18
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline OP
Expert
Tempelbauer  Offline OP
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
I need an algorithm to detect free space on a 2D plane. As input I have a canvas (size) and a list of items (their bounding boxes). I want the biggest rectangle which does not intersect with any item (the biggest free space). It does not have to be perfect.
Random positioning is my fallback solution, but I want something better.

I don´t need code, just an idea or the name of an algorithm that provides this. For some reason i´m unable to find it myself (this is maybe the aftermath from the worldcup party tongue )

Thanks

Re: Free Space Detection Algorithm [Re: Tempelbauer] #443416
07/15/14 22:14
07/15/14 22:14
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I would probably reduce that rather complex problem to a one-dimensional problem first and extend it then to two dimension.

Try to find the longest intervals/ biggest free space on for example the x-axis using only item.pos_x+min_x/max_x (shouldn't be trivial) and (optionally?) sort them by length. Then do the same for the y-axis and somehow multiply all (big enough) spaces/ intervals with each of those on the other axis - or somehow like that, I cannot really imagine it right now in my head.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1