Butter Up
README.md
panSim
The Butter Up pan simulation, with no engine calls: a pat of butter sliding on a tilted pan floor, melting by a heat map, and stamping what melts into a coverage grid that counts how much of the pan is coated.
local PanSim = require("butterUp.panSim")
local sim = PanSim.new(PanSim.defaultStats())
sim:dropPat(0, 0)
sim:step(1/60, gx, gz) -- gx, gz: gravity along the floor (m/s^2), from the pan's tilt
print(sim.coverage) -- 0..1
Floor frame: x and z in metres, origin at the pan's centre, the floor a disc of
stats.panRadius. The grid is N x N cells over the square of half-width
gridRadius (a little wider than the floor so a smear reaches the corner); a
cell counts toward coverage when its centre is on the floor. coat[i] runs 0..2
(1 = fully coated, above 1 = pooled); fresh[i] is 1 when butter has just been
laid there and decays. dirty is set whenever the grid changes.