Re: Compose rectangles within another rectangle

Jason Hughes <[email protected]>
Newsgroups gmane.games.devel.algorithms
Organization Steel Penny Games, Inc.
Message-ID <[email protected]>
This is called bin packing.  You'll find much research on it, and even 
this very question has been answered a few times in the archives of this 
list.  To save you a few seconds, some folks suggest an approach similar 
to Tetris.  Personally, I sort rectangles by the longest axis and pack 
from longer to shorter, minimizing the distance to the origin of the 
texture sheet when placing them.  That tends to work pretty well.  If 
you can do it offline, slowly shuffling the order you submit the 
rectangles a little bit can get you some good gains over the simple 
sorting method, but it all depends on how much effort you want to put 
into it.

Best of luck,
JH

Jason Hughes
President
Steel Penny Games, Inc.
Austin, TX



Arno Gerretsen wrote:
> Hi,
>
> I am looking for an algorithm that can help me to compose a number of 
> rectangles, with different sizes, within a bigger rectangle. So I want 
> to pack them most efficiently within the bigger rectangle. Does anybody 
> know the best approach to this, except for just trial and error.
>
> The background is that I want to compose a big texture sheet from a 
> collection of smaller texture pieces automaticaly.
>
>   

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.