local M = {} function M.lerp(a,b,t) return (1-t)*a + t*b end function M.smoothstep(x) if x<0 then return 0 end if x>1 then return 1 end return x*x*(3 - 2*x) end function M.slerp(a,b,t) return M.lerp(a,b,M.smoothstep(t)) end function M.sign(x) if x == 0 then return 0 elseif x < 0 then return -1 elseif x > 0 then return 1 end end function M.clamp(x,minv,maxv) return math.min(math.max(x,minv),maxv) end return M