Comments (3)
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 );
from binpackingjs.
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 );
from binpackingjs.
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?
from binpackingjs.
Related Issues (12)
- 3D Bin Packing Demo code HOT 1
- [Feature] Disable multiple bin packing HOT 3
- Question on 3D intersect function
- Would it be possible to make it optimize between boxes? HOT 4
- Paper link for 2d packing is broken
- The algorithm does not seem to behave correctly with boxes that are more rectangular than square. HOT 1
- 3D packing depth issue?
- 3D bin packing won't fit HOT 1
- Centered bin packing HOT 1
- Determine smallest possible size bin to use HOT 2
- New minified build throws error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binpackingjs.