#! /usr/bin/lua local points = {} local lines = {} local x = {} local y = {} while true do local line = io.read() if line == nil then break end local f = {} for v in string.gmatch(line,'%d+') do table.insert(f,v) end for i = 1, #f do if i % 2 == 1 then table.insert(x,f[i]) else table.insert(y,f[i]) end end if #f == 4 then table.insert(lines,f) elseif #f == 2 then table.insert(points,f) end end local mnx = math.min(table.unpack(x)) local mxx = math.max(table.unpack(x)) local mny = math.min(table.unpack(y)) local mxy = math.max(table.unpack(y)) local lo = { mnx - (mxx-mnx)/10, mny - (mxy-mny)/10, } local hi = { mxx + (mxx-mnx)/10, mxy + (mxy-mny)/10, } local w = hi[1] - lo[1] local h = hi[2] - lo[2] print('') print('') print(string.format( '', w,h,lo[1],lo[2],w,h )) if #lines > 0 then print(' ') for k,p in pairs(lines) do print(string.format(' ',table.unpack(p))) end print(' ') end if #points > 0 then print(' ') for k,p in pairs(points) do print(string.format(' ') end print('')