ruby-processing.rb
def grid(cols, rows, col_size=1, row_size=1)
      (0..cols*rows).map do |i|
        x = col_size * (i % cols)
        y = row_size * i.div(cols)
        yield x, y
      end
    end
# A nice method to run a given block for a grid.
# Lifted from action_coding/Nodebox.
A nice method to run a given block for a grid.
A nice method to run a given block for a grid .
def grid(cols, rows, col_size=1, row_size=1)
      (0..cols*rows).map do |i|
        x = col_size * (i % cols)
        y = row_size * i.div(cols)
        yield x, y
      end
    end
def grid ( cols , rows , col_size = 1 , row_size = 1 ) ( 0 .. cols * rows ) . map do | i | x = col_size * ( i % cols ) y = row_size * i . div ( cols ) yield x , y end end
A nice method to run a given block for a grid.
A nice method to run a given block for a grid .
cols
rows
col_size
row_size