Permalink
Browse files

added README and LICENSE file

  • Loading branch information...
1 parent f51408d commit 6d3013674edf691eae14657e48e6b83f146328ac @jakesgordon jakesgordon committed May 7, 2011
Showing with 80 additions and 0 deletions.
  1. +20 −0 LICENSE
  2. +60 −0 README.md
View
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Jake Gordon and contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
View
@@ -0,0 +1,60 @@
+Binary Tree Algorithm for 2D Bin Packing
+========================================
+
+This project is a javascript experiment to write a binary tree based
+bin packing algorithm that is suitable for generating
+[CSS sprites](https://github.com/jakesgordon/sprite-factory).
+
+Demo
+====
+
+Clone this repository
+
+ git clone https://github.com/jakesgordon/bin-packing
+
+View the index.html file in your favorite browser for
+
+Usage
+=====
+
+If you want to use GrowingPacker in your own javascript projects, you need something like this:
+
+ <script src='packer.growing.js'></script>
+ <script>
+ var packer = new GrowingPacker();
+ var blocks = [
+ { w: 100, h: 100 },
+ { w: 100, h: 100 },
+ { w: 80, h: 80 },
+ { w: 80, h: 80 },
+ etc
+ etc
+ ];
+
+ blocks.sort(function(a,b) { return (b.h < a.h); }); // sort inputs for best results (see demo.js for comprehensive sort options)
+ packer.fit(blocks);
+
+ for(var n = 0 ; n < blocks.length ; n++) {
+ var block = blocks[n];
+ if (block.fit) {
+ DrawRectangle(block.fit.x, block.fit.y, block.w, block.h);
+ }
+ }
+ </script>
+
+See source code comments for more details.
+
+License
+=======
+
+See [LICENSE](https://github.com/jakesgordon/bin-packing/blob/master/LICENSE) file.
+
+Contact
+=======
+
+If you have any ideas, feedback, requests or bug reports, you can reach me at
+[jake@codeincomplete.com](mailto:jake@codeincomplete.com), or via
+my website: [Code inComplete](http://codeincomplete.com/).
+
+
+

0 comments on commit 6d30136

Please sign in to comment.