quick and dirty php implementation for a box packing problem
Switch branches/tags
Nothing to show
Latest commit a4816be Jun 18, 2015 @yetzt yetzt Merge pull request #7 from allanlaal/master
FIX issue #4 and ADD public getters for inside and outside volume
Failed to load latest commit information.
boxing.class.php ADD Public getters for inner and outer volume Jun 17, 2015
readme.md make the readme more readable Apr 18, 2014



this some kind of box packing algorithm, check if n boxes fit in n bigger boxes. i use this for checking if items will fit a packaging box. if this algorithm says true: they do definitely fit, if this algorithm says false: they most probably will not fit, but this is a program, not a cop.


this is not an accurate solution for knapsack or any of those fancy np-complete combinatory problems. i am not a mathematican, i have no idea what i am talking about, and also the german wikipedia sucks on this topic. quick and dirty, works for me, public domain, donations very welcome.


sebastian vollnhals


$b = new boxing();

$b->add_outer_box(40,30,30); // our quantum box; l, w, h

$b->add_inner_box(20,30,40); // schroedingers cat; l, w, h
$b->add_inner_box(10,5,5); // the poison; l, w, h
$b->add_inner_box(5,5,10); // some katzenstreu; l, w, h

if ($b->fits()) {

	// schroedingers cat and schroedingers stuff do fit in the box