From 74dd8b6b857edcbeb12cbeca8c559b2ebbc2e79e Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Jan 2024 19:50:04 +0000 Subject: fix edges --- main.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index ae9595c..0f224d2 100644 --- a/main.lua +++ b/main.lua @@ -4,13 +4,14 @@ local function plot(f,x0,xn) local n = 30 x0 = x0 or G.inverseTransformPoint(0,0) xn = xn or G.inverseTransformPoint(G.getDimensions(),0) + local h = (xn-x0)/n local ps = {} - for x=x0,xn+h,h do + for i=0,n do + local x = x0 + i*h local y = f(x) table.insert(ps,x) table.insert(ps,y) - print(x,xn) end G.line(ps) end @@ -33,7 +34,7 @@ local function solve_for_A(r) return A end -local L = 20 +local L = 3 function love.wheelmoved(x,y) L = L + (y/5) end -- cgit v1.2.3