Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Pack smaller rectangles into a larger rectangle
Contributed by: Jason Biggs, Wolfram Research
This paclet contains functions for packing rectangles into a rectangular area, the two-dimensional bin packing problem. No circles, no ovals, hexagons are right out as well. Squares, being a type of rectangle, are also processed, but other quadrilaterals are not.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["JasonB/RectanglePacking"]
Pack eight smaller rectangular areas, given as a list of {width, height} pairs, into a 20 by 30 rectangular space:
In[1]:= |
Out[1]= |
Visualize the results:
In[2]:= |
Out[2]= |
Create a mutable rectangle packing data structure:
In[3]:= |
Out[3]= |
Insert some rectangles:
In[4]:= |
Out[4]= |
Visualize the state of the packing object:
In[5]:= |
Out[5]= |
Add a fixed rectangle:
In[6]:= |
Out[7]= |
Add more rectangles:
In[8]:= |
Out[9]= |
Try to insert a rectangle that is too large to fit in the remaining space:
In[10]:= |
Out[10]= |
In[11]:= |
Out[6]= |
Wolfram Language Version 13.0