Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Grant, AndrewAMD, ozgur, Quad, TipmyPip), 29,980 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 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