J
J
justslipknot2021-09-06 00:21:43
Algorithms
justslipknot, 2021-09-06 00:21:43

What are rectangle packing algorithms?

Let's say I have a 10k by 10k pixel rectangle. And N-th number of rectangles of different lengths and widths. Are there any algorithms that allow you to pack all the rectangles from the list in the main rectangle as optimally as possible?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Developer, 2021-09-06
@samodum

This is the classic "knapsack problem" https://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B4%D...
Also see "2-Dimensional Strip Packing, 2DSP"
https: //en.wikipedia.org/wiki/%D0%97%D0%B0%D0%B4%D...
https://en.wikipedia.org/wiki/Bin_packing_problem

W
Wataru, 2021-09-06
@wataru

Just overkill. Or, if a good enough solution comes up - all sorts of heuristics with greed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question