mapbox / shelf-pack

A 2D rectangular bin packing data structure that uses the Shelf Best Height Fit heuristic
ISC License
129 stars 17 forks source link

Set maxh to shelf height when packing small bin on large shelf #32

Closed bhousel closed 8 years ago

bhousel commented 8 years ago

Following from #29.. Now that we are tracking the max height a bin can be (so that bins be reused), we should set maxh to the total shelf height when packing a small bin on a larger shelf.

I padded the maxh/maxw free space in black here to make it easier to see what I mean. Many lower case letters are packed on uppercase shelves. If that space is ever to be reused, maxh needs to be the size of the shelf, otherwise those slivers of space can never be reused.

screenshot 2016-08-14 23 05 54
bhousel commented 8 years ago

Much better! 👌

screenshot 2016-08-14 23 44 01