simplest possible way to straighten strokes
[?]
May 12, 2022, 5:27 AM
WAZVXUV2LMNGGR6WQ3NIFGSKYYLHMQAOM6VPRU4O2A3IJVLSSEZACDependencies
Change contents
- edit in main.lua at line 174
elseif chord == 'C-l' thenfor i,drawing in ipairs(lines) doif type(drawing) == 'table' thenlocal x, y = love.mouse.getX(), love.mouse.getY()if y >= drawing.y and y < drawing.y + drawing.h and x >= 12 and x < 12+drawing.w thenfor j,shape in ipairs(drawing.shapes) doif on_freehand(love.mouse.getX(),love.mouse.getY(), shape) thenconvert_line(drawing,j,shape)endendendendend - edit in main.lua at line 188[4.607][5.325]
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]}