#! /usr/bin/ruby points = [] lines = [] x = [] y = [] while line = gets f = line.chomp.split(",").collect { |i| i.to_i } f.each_with_index do |v,i| if i % 2 == 0 then x.push(v) else y.push(v) end end if f.length == 4 then lines.push(f) elsif f.length == 2 then points.push(f) end end mnx = x.min mxx = x.max mny = y.min mxy = y.max lo = [ mnx - (mxx-mnx)/10, mny - (mxy-mny)/10 ] hi = [ mxx + (mxx-mnx)/10, mxy + (mxy-mny)/10 ] w = hi[0] - lo[0] h = hi[1] - lo[1] print('' + "\n") print('' + "\n") print("\n") if lines.length > 0 then print(" \n") lines.each do |p| print(" \n") end print(" \n") end if points.length > 0 then print(" \n") points.each do |p| print(" \n") end print(" \n") end print("\n")