lib/ph.rb
# Slices 2D vector into a 1D version
#
Slices 2D vector into a 1D version
Slices 2D vector into a 1D version
def flat1d(coords, pixels_2d)
    slice = []
    x, y = coords
    Array.new(x) do |i|
      Array.new(y) do |j|
        slice << pixels_2d[i][j]
      end
    end
    slice
  end
def flat1d ( coords , pixels_2d ) slice = [ ] x , y = coords Array . new ( x ) do | i | Array . new ( y ) do | j | slice << pixels_2d [ i ] [ j ] end end slice end
Slices 2D vector into a 1D version
Slices 2D vector into a 1D version
coords
pixels_2d