6
$\begingroup$

I am working on tool for merging smaller textures into one larger for use on Android app.

I have $n$ rectangles of given size $(w_k, h_k)$, where $k=1,\ldots,n$ and I need to position them within master rectangle of size $2^l \times 2^m$, where $l, m \leq 9$ so none overlapping occur and $2^l \times 2^m$ has minimal possible value. The result should be $(x_k, y_k)$, a position of each of the $n$ base rectangles or information that such positioning is impossible.

  • 1
    Minus the specific dimensions you list, your problem is known as "bin packing" in the literature. And the literature is vast. See [the Wikipedia article](http://en.wikipedia.org/wiki/Bin_packing) for a start.2011-09-28

2 Answers 2