3D packing depth issue?
pward123 opened this issue · 0 comments
pward123 commented
If I run this:
'use strict'
const {BP3D: { Item, Bin, Packer}} = require('binpackingjs')
const item = [18.75, 7.25, 4, 1]
const binOfFour = ['bin_of_4', 18.75 * 2, 7.25 * 2, 4 * 1, 10000]
const binOfEight = ['bin_of_8', 18.75 * 2, 7.25 * 2, 4 * 2, 10000]
const packIt = (itemProps, itemCount, binProps) => {
const packer = new Packer()
const bin = new Bin(...binProps)
packer.addBin(bin)
for (let i = -1; ++i < itemCount; ) {
packer.addItem(new Item(`item_${i + 1}`, ...itemProps))
}
packer.pack()
return {
...bin,
items: bin.items.length,
}
}
console.log(JSON.stringify(packIt(item, 20, binOfFour), null, 4))
console.log(JSON.stringify(packIt(item, 20, binOfEight), null, 4))
the result is this:
{
"name": "bin_of_4",
"width": 3750000,
"height": 1450000,
"depth": 400000,
"maxWeight": 1000000000,
"items": 4
}
{
"name": "bin_of_8",
"width": 3750000,
"height": 1450000,
"depth": 800000,
"maxWeight": 1000000000,
"items": 6
}
correct me if I'm wrong, but for bin_of_8 if i have a bin that's 2 times the width, 2 times the height and 2 times the depth of the items it holds, then 8 items should fit in the bin