12 Point.new(@x + other.x, @y + other.y)
16 Point.new(@x - other.x, @y - other.y)
20 Point.new(@x * k, @y * k)
25 if x.respond_to? :x and x.respond_to? :y
38 @grid = Array.new(size.x * size.y)
43 @grid[p.x + p.y * size.x]
49 @grid[p.x + p.y * size.x] = val
53 res = self.class.new(@size)
59 return false unless @size == other.size
61 return false unless self[i] == other[i]
67 @grid.each {|i| yield Point.new(i % size.x, i / size.x) }
87 def self.register(name, var)