Doug Wright

Results 76 comments of Doug Wright

Something like this (untested) ```php $packedBoxes = $packer->pack(); if ($packedBoxes->count() === 1) { return $packedBoxes; // only 1 box, is best fit } else { $possibleSingleBoxSolutions = []; foreach ($packedBoxes...

Yes, in the scenario where all items fit into a 1 box, `->pack()` will return the smallest possible such box

> You are correct; perhaps that solution won't work I'm not sure what you mean, I agreed with you

That will be automatic, see https://github.com/dvdoug/BoxPacker/blob/3.x/src/DefaultBoxSorter.php for the precise implementation

See https://github.com/dvdoug/BoxPacker/issues/189

No, virtual boxes is complicated for all of the reasons listed in that ticket, there is no built-in support for that at this time

Hi @eschiendorfer My first question to you would be why do you want to do that? Is it because smallest box isn't "best"? If so, there is a mechanism for...

Hi @jeffery9 No, this is something you'd need to build yourself if you wanted to have the logic in a separate place than the calling code

Hi @DavideWasTaken Happy to look into this, do you have an illustration that shows how the 29 fit in?

I did take a look and the algorithm tweak I thought might fix it didn't, but did help with some other cases. I do accept PRs so if you want...