Devine's suggestion to try to live with just freehand
https://merveilles.town/@neauoire/108301005736317873 Drawbacks: Smoothing eliminates high-frequency noise but not low-frequency bumps. Making a drawing end at the start point is very challenging. Still perhaps a useful addition to the toolbox for now. I'm going to need a cambrian explosion of tools in the toolbox for a while before I prune.
This commit is contained in:
parent
5e39aea97d
commit
a1893a44d0
17
main.lua
17
main.lua
|
@ -197,6 +197,11 @@ function keychord_pressed(chord)
|
|||
if drawing then
|
||||
convert_horvert(drawing,i,shape)
|
||||
end
|
||||
elseif chord == 'C-s' then
|
||||
local drawing,i,shape = select_shape_at_mouse()
|
||||
if drawing then
|
||||
smoothen(shape)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -235,5 +240,17 @@ function convert_horvert(drawing, i, shape)
|
|||
end
|
||||
end
|
||||
|
||||
function smoothen(shape)
|
||||
for _=1,7 do
|
||||
for i=2,#shape-1 do
|
||||
local a = shape[i-1]
|
||||
local b = shape[i]
|
||||
local c = shape[i+1]
|
||||
b.x = (a.x + b.x + c.x)/3
|
||||
b.y = (a.y + b.y + c.y)/3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function love.keyreleased(key, scancode)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue