binpack 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/binpack.rb +12 -1
  2. data/lib/binpack/version.rb +1 -1
  3. metadata +1 -1
@@ -40,7 +40,7 @@ module Binpack
40
40
  @rows[i + @padding, item.height].each{ |s|
41
41
  s[idx + @padding, item.width] = "#{g}" * item.width
42
42
  }
43
- @items.push([item, idx + @padding, i + @padding])
43
+ @items.push([item, idx, i])
44
44
  return item
45
45
  }
46
46
  nil
@@ -75,3 +75,14 @@ module Binpack
75
75
  end
76
76
  end
77
77
  end
78
+
79
+ items = []
80
+ 12.times do |i|
81
+ items << Binpack::Item.new("Associated object #{i+1}", (rand(10)+2)/2.0, (rand(10)+2)/2.0)
82
+ end
83
+
84
+ # Pack the array of items into a bin where the default bin size is 16x10 with a padding of 1
85
+ bins = Binpack::Bin.pack(items, [], Binpack::Bin.new(16, 10, 1))
86
+
87
+ puts bins.join("\n\n")
88
+ puts bins[0].items.inspect
@@ -1,3 +1,3 @@
1
1
  module Binpack
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: