I’m trying to make a perfect curve, but it’s acting up a little.
local function Lerp(p0,p1,a)
return (1 - a) * p0 + a * p1
end
local function Quadratic(p0,p1,p2,a)
local L1 = Lerp(p0,p1,a)
local L2 = Lerp(p1,p2,a)
return Lerp(L1,L2,a)
end
for i = 0, 1, 0.1 do
print(Quadratic(0, 100, 0, i))
end
Instead of outputting 0 when it is 1, it outputs 2.220446 something.
Is there a reason for this? Am I doing it wrong?