pouët.net

pouët is read-only for now. A critical security fix for PHP, the language pouët runs on, comes out today, 21 October 2026. Until it's installed on our server, we refuse everything that sends data to the site: you can browse and log in as usual, but you can't comment, vote, post on the BBS or the oneliner, submit or edit anything, or upload files.
Go to bottom

tiling algorithm

category: code [glöplog]
 
Does anyone know of a good algorithm to tile squares together?
added on the 2018-08-04 00:31:30 by sigflup sigflup
how do you mean?
added on the 2018-08-04 00:41:55 by psenough psenough
an algorithm to pack various size squares as tight as possible
added on the 2018-08-04 00:46:23 by sigflup sigflup
The thing you should look out for is called packing problems in mathematics (not tiling). There are many different packing problems based on different geometric shapes.
Maybe this code and algorithm description is helpful to you: https://www.codeproject.com/Articles/210979/Fast-optimizing-rectangle-packing-algorithm-for-bu
What you're looking for is called 2d bin/rect packing, commonly used algorithms are the "shelf" algorithm and the "guillotine" algorithm, however (speaking for textures) things become quite tricky once interpolation, filtering, wrapping and god forbid mip mapping come into play.
added on the 2018-08-04 01:02:52 by LJ LJ
Perhaps Smart2DCutting ?
added on the 2018-08-04 02:31:39 by neoneye neoneye
Squares or rectangles?
added on the 2018-08-04 09:56:36 by Gargaj Gargaj
my bad, rectangles
added on the 2018-08-04 15:30:20 by sigflup sigflup
That Blackpawn article is an old classic, which I can also recommend having used it myself with good results.
added on the 2018-08-04 17:02:20 by fizzer fizzer
Thanks everyone!!!!!!!!!!
added on the 2018-08-04 22:47:33 by sigflup sigflup

login

Go to top