How mushishi78/box_packer works
BoxPacker is a small Ruby library that applies a first-fit 3D bin-packing heuristic with a weight limit. A caller supplies a container and ordered items to BoxPacker.pack; the routine checks weight, attempts existing packings, creates a new packing when needed, and returns packings with placements and weights. place handles orientation and fit, while break_up_space creates remaining candidate spaces. These responsibilities share one source file. The graph reflects the excerpted implementation and README; there are no separate service or storage layers.
Main entry points: box_packer.rb First-fit packing
Components 5
Packing algorithm
- First-fit packing
box_packer.rb - Packings result
box_packer.rb
Placement geometry
- Orientation fit
box_packer.rb - Free-space splitting
box_packer.rb
Other components
- Library caller
Connections 4
- Library caller → First-fit packing: calls
README.md - First-fit packing → Orientation fit: tries placement
box_packer.rb - First-fit packing → Free-space splitting: splits spaces
box_packer.rb - First-fit packing → Packings result: returns
box_packer.rb