-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimum bin size by volume #16
Comments
There's not a built in method for this but the calculation should be pretty simple: let packer = new Packer();
packer.addItem(new Item("Item 1", 100, 100, 100, 100));
packer.addItem(new Item("Item 2", 100, 100, 100, 100));
packer.addItem(new Item("Item 3", 100, 100, 100, 100));
const totalVolume = packer.items.reduce( ( vol, item ) => vol + item.getVolume(), 0 ); |
Thanks very much. For anyone else... to "unfactor precision" 🤷♂️ the result you can do this. There's probably a more elegant way. Sorry, I'm not a math guy. let packer = new Packer();
let FACTOR = 5
packer.addItem(new Item("Item 1", 100, 100, 100, 100));
packer.addItem(new Item("Item 2", 100, 100, 100, 100));
packer.addItem(new Item("Item 3", 100, 100, 100, 100));
const totalVolume = packer.items.reduce( ( vol, item ) => vol + item.getVolume() / (10 ** FACTOR) ** 3 ); |
Is this solution though just returning the sum of the volumes of Items in a Packer? If so it doesn't really find the minimum box size that could fit them all taking into account empty space, pivots etc. Am I right? |
Hi there.
Is this able to return a minimum 3D bin size by volume given a set of supplied items?
Example use case: a custom box will be made up for the items for each shipment.
Thanks
Sean
The text was updated successfully, but these errors were encountered: