Code: Select all
curve = love.math.newBezierCurve(0, 0, 100, 0, 100, -100) -- A simple curve with only three points
...
if dirty then
coordinates = curve:render() -- Always best to store the result and only update again when the control points change
dirty = false
end
...
love.graphics.line(coordinates)
The function uses De Casteljau's algorithm, but ends up generating extra mid points before returning the list. This is incredibly inefficient for drawing and wastes a good chunk of memory.
Was this intentional? Am I missing something?