BezierCurve and renderSegment error
Posted: Thu Jun 15, 2017 1:59 pm
Hello. Few days ago I was working with a bezier curve and noticed some kind of bug. If we call renderSegment with arguments like 0.12 and 0.13, and then use a result in love.graphics.line, in some cases it will throw an error: "Need at least 2 vertices to draw a line". Firstly I thought that the problem in number of subdivision steps, but most of time it works well and breaks with random curves. I've tried to google that, but haven't found anything.
I believe, the problem could be in the rounding from 52-bit lua numbers to C's floats.
Code sample:
If I increase number of subdivision steps, it seems to work. But, it also increase a number of computation.
I believe, the problem could be in the rounding from 52-bit lua numbers to C's floats.
Code sample:
Code: Select all
local curve = love.math.newBezierCurve(200, 200, 500, 300, 400, 400)
love.graphics.line(curve:renderSegment(0.55, 0.56))