{"_id":"binpacking","_rev":"411060","name":"binpacking","description":"binary tree based bin packing algorithm","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"jsmarkus","email":"me@jsman.ru"}],"time":{"modified":"2021-08-04T05:08:39.000Z","created":"2012-02-27T10:03:31.959Z","0.0.1":"2012-02-27T10:03:31.959Z"},"users":{},"author":{"name":"Jake Gordon"},"repository":{"type":"git","url":"git://github.com/jsmarkus/node-bin-packing.git"},"versions":{"0.0.1":{"name":"binpacking","version":"0.0.1","author":{"name":"Jake Gordon"},"description":"binary tree based bin packing algorithm","contributors":[{"name":"Markus","email":"nixmrak@gmail.com"}],"main":"./js/index.js","repository":{"type":"git","url":"git://github.com/jsmarkus/node-bin-packing.git"},"keywords":["bin packing","2d","geometry","css-sprites"],"license":"MIT","engine":{"node":">=0.4"},"_npmUser":{"name":"jsmarkus","email":"nixmrak@gmail.com"},"_id":"binpacking@0.0.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"e82e43e8eb17064681e43f9c8dbc731e317d1892","size":39880,"noattachment":false,"key":"/binpacking/-/binpacking-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binpacking/download/binpacking-0.0.1.tgz"},"maintainers":[{"name":"jsmarkus","email":"me@jsman.ru"}],"directories":{},"publish_time":1330337011959,"_cnpm_publish_time":1330337011959,"_hasShrinkwrap":false}},"readme":"Binary Tree Algorithm for 2D Bin Packing\n========================================\n\nThis project is a javascript experiment to write a binary tree based\nbin packing algorithm that is suitable for generating\n[CSS sprites](https://github.com/jakesgordon/sprite-factory).\n\n * You can play with the [demo here](http://codeincomplete.com/posts/2011/5/7/bin_packing/example/)\n * You can find a [description here](http://codeincomplete.com/posts/2011/5/7/bin_packing/)\n\n\nNodeJS demo\n============\n\n > Note: the node demo is quick and dirty. Npm support, test suite coming soon...\n\nClone this repository:\n\n    git clone https://github.com/jsmarkus/node-bin-packing\n\nSee usage example: https://github.com/jsmarkus/node-bin-packing/blob/master/node-test.js\n\nRun the demo:\n\n    node node-test.js\n\nDemo\n====\n\nClone this repository\n\n    git clone https://github.com/jsmarkus/node-bin-packing\n\nView the index.html file in your favorite browser for examples of algorithm in use with lots of configurable options.\n\nUsage\n=====\n\nIf you want to use this in your own javascript projects, you need something like this:\n\n    <script src='packer.growing.js'></script>\n    <script>\n      var packer = new Packer(1000, 1000);   // or:  new GrowingPacker();\n      var blocks = [\n        { w: 100, h: 100 },\n        { w: 100, h: 100 },\n        { w:  80, h:  80 },\n        { w:  80, h:  80 },\n        etc\n        etc\n      ];\n\n      blocks.sort(function(a,b) { return (b.h < a.h); }); // sort inputs for best results\n      packer.fit(blocks);\n  \n      for(var n = 0 ; n < blocks.length ; n++) {\n        var block = blocks[n];\n        if (block.fit) {\n          DrawRectangle(block.fit.x, block.fit.y, block.w, block.h);\n        }\n      }\n    </script>\n\nSee source code comments for more details.\n\nLicense\n=======\n\nSee [LICENSE](https://github.com/jakesgordon/bin-packing/blob/master/LICENSE) file.\n\nContact\n=======\n\nIf you have any ideas, feedback, requests or bug reports, you can reach me at\n[jake@codeincomplete.com](mailto:jake@codeincomplete.com), or via\nmy website: [Code inComplete](http://codeincomplete.com/posts/2011/5/7/bin_packing/)\n\n","_attachments":{},"license":"MIT"}