BezierCurve and renderSegment error

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
RussDragon
Prole
Posts: 1
Joined: Thu Jun 15, 2017 11:22 am

BezierCurve and renderSegment error

Post by RussDragon »

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:

Code: Select all

local curve = love.math.newBezierCurve(200, 200, 500, 300, 400, 400)
love.graphics.line(curve:renderSegment(0.55, 0.56))
If I increase number of subdivision steps, it seems to work. But, it also increase a number of computation.
Post Reply

Who is online

Users browsing this forum: Roland Chastain and 77 guests