Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 755 Bytes

readme.md

File metadata and controls

14 lines (9 loc) · 755 Bytes

Attempts to pack rectangles into as small and square a space as possible by packing two opposing corners.

Works as follows:

  1. Sort rectangles by descending perimeter.
  2. Alternate between placing each rectangle in the "top-left" and "bottom-right" corners of an indeterminately sized rectangular region.
  3. Place each rectangle as close to the corner as possible (e.g. as "up" and "to the left" as possible).
  4. "Glue" each corner together, determining the final rectangular region and rectangle coordinates.

Performs poorly when there is a small number of rectangles with a large variance in size. Does not rotate rectangles.

For a general-use rectangle packer, use Kryptan's rect-packer.