KCIM5UTVV4KIL7SNRZFOW6FUQHGWAPOGQO4QTVNIWWBWMVG6GYNQC O2UFJ6G3MDBJFSABWAJWTZGP6VAKRMQ6XCMILLQRRSS43C3UF2OQC XX7G2FFJ4QCGQGD4REAW5QFHVYAKCFUPGZCK7L6DFGS5ISVBYBQQC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC G77XIN7MLX465AXLXDUJDGEHXXCMR2Q7K25UAMKQERBJGNJPNW6AC JVRL5TWLBTWMTHJDZSDN5XQDMEIIPVAZBKUP75HMO7JHURAYWG5QC EFMLTMZG5TUEGLSYLVKOKDSTGVSVWSKOMS7CJWOUGK5LADSH4YTQC 6LJZN727CRPYR34LV75CQF55YZI3E7MGESYZSFSYAE73SNEZE3FAC D2GCFTTT2RNUBFB243YTA4F2H5ZXFTFHBSKHLZ2CX4JSKRZFTUUQC T76KKDWZLQSWMXT2ZE2PPNKBKB4W5M4BW5E6ICHKEBDAUBN6FMZAC 3XD6M3CFKZJR365MHXUWJ4HGSDTPYO6WYZ4RGW7ECBBITKVQX24QC love.graphics.line(pixels(shape.x1)+12,pixels(shape.y1)+line.y, pixels(shape.x2)+12,pixels(shape.y2)+line.y)
prev = nilfor _,point in ipairs(shape) doif prev thenlove.graphics.line(pixels(prev.x)+12,pixels(prev.y)+line.y, pixels(point.x)+12,pixels(point.y)+line.y)endprev = pointend
if line.pending.x1 thenlove.graphics.line(pixels(line.pending.x1)+12,pixels(line.pending.y1)+line.y, love.mouse.getX(),love.mouse.getY())
prev = nilfor _,point in ipairs(line.pending) doif prev thenlove.graphics.line(pixels(prev.x)+12,pixels(prev.y)+line.y, pixels(point.x)+12,pixels(point.y)+line.y)endprev = point
endfunction love.mousereleased(x,y, button)if lines.current thenif lines.current.pending thenlines.current.pending.x2 = coord(x-12)lines.current.pending.y2 = coord(y-lines.current.y)table.insert(lines.current.shapes, lines.current.pending)lines.current.pending = {}lines.current = nilendend
endfunction convert_line(drawing, i, shape)-- Perhaps we should do a more sophisticated "simple linear regression"-- here:-- https://en.wikipedia.org/wiki/Linear_regression#Simple_and_multiple_linear_regression-- But this works well enough for close-to-linear strokes.drawing.shapes[i] = {shape[1], shape[#shape]}
if math.abs(shape.x1-shape.x2) > math.abs(shape.y1-shape.y2) thenshape.y2 = shape.y1
local x1,y1 = shape[1].x, shape[1].ylocal x2,y2 = shape[#shape].x, shape[#shape].yif math.abs(x1-x2) > math.abs(y1-y2) thendrawing.shapes[i] = {{x=x1, y=y1}, {x=x2, y=y1}}