BezierCurve:render() generating unnecessary points
Posted: Sat May 11, 2019 4:22 am
LOVE's BezierCurve object creates unnecessary points when rendering out to a list of coordinates.
Here is this example rendered at a depth of 2, but this happens regardless of depth...
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?
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?