This commit is contained in:
aaron 2023-09-19 23:26:16 +01:00
parent 3eb4eb3009
commit bc472c02f3
2 changed files with 7 additions and 5 deletions

View file

@ -224,7 +224,7 @@ local function step_springs(dt: number)
local ff_123 = u_123*-c
local ff_456 = u_456*-c
data.a, data.b = fs_123.X, ff_123.X
--assert(math.abs(fs_123.X) >= (math.abs(ff_123.X)), "damping exceeds restoring")
-- calculate acceleration step

View file

@ -7,8 +7,8 @@ local function step(): number
local FPS = 60
local DT = 1/FPS
repeat until os.clock() - program_time >= DT
program_time += DT
repeat until os.clock() - program_time >= DT*10
program_time += DT*10
return DT
end
@ -40,7 +40,7 @@ local function main()
local effect = vide.effect
local value = source(MAX)
local sprung, data = (spring :: any)(value, 1, 19.16)
local sprung, data = (spring :: any)(value, 1, 19.6)
effect(function()
local v = sprung()
@ -49,7 +49,9 @@ local function main()
local offset = string.rep("\n", MAX - fv + OFFSET)
local bar = testkit.color.gray(remainder_to_block(v - fv) .. "\n" .. string.rep(BLOCK .. "\n", fv))
local num = "\n" .. v
print(reset .. offset .. bar .. num)
local test = "\n" .. (data.a or 0)
local test2 = "\n" .. (data.b or 0)
print(reset .. offset .. bar .. num .. test .. test2)
end)
local T = 1.5