How do i pack multiple rectangles in a 2d box tetris style

Posted by mglmnc on Stack Overflow See other posts from Stack Overflow or by mglmnc
Published on 2010-04-03T04:56:32Z Indexed on 2010/04/03 5:03 UTC
Read the original article Hit count: 295

Filed under:
|

I have a number of rectangles of various widths and heights. I have a larger rectangular platform to put them on. I want to pack them on one side of the platform so they spread in the lengthwise (X) dimension but keep the widthwise (Y) dimension to a minimal. That is to place them like a tetris game. There can be no overlaps but there can be gaps. Is there an algorithm out there to do this?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about geometry