def rectangle(x1,y1,x2,y2) puts "draw (#{x1},#{y1})--(#{x2},#{y1})--(#{x2},#{y2})--(#{x1},#{y2})--(#{x1},#{y1});"; end #require "GD" zzz = File.open("1.txt"); #im = GD::Image.new(2000,2000) M = 10; kol = 0; #hite = im.colorAllocate(255,255,255) #black = im.colorAllocate(0,0,0) #red = im.colorAllocate(255,0,0) #blue = im.colorAllocate(0,0,255) puts "beginfig(1);"; while !zzz.eof() do kol = kol+1; s = zzz.readline() a = s.split(); # a.each{|p| p = p.to_f} # puts a[0]*M+" "+a[1]+" "+a[2]+" "+a[3]+"\n"; # im.filledRectangle(0,0,100,100,red); rectangle((a[0].to_f*M).to_i,(a[1].to_f*M).to_i,(a[2].to_f*M).to_i,(a[3].to_f*M).to_i); # puts x[0]; end puts "endfig;"; puts "end;"; #puts "Let's write PNG!" #f = File.new("ans.png","w"); #im.png f #f.close;