Page 1 of 1

Bezier Curve

Posted: Sat May 05, 2012 1:50 pm
by Arthes
Hi.
How to draw the Bezier Curve in Love2D?
Thanks for replies.

Re: Bezier Curve

Posted: Sat May 05, 2012 5:19 pm
by richapple
You have 2 options:
  1. Make one yourself (see below)
  2. Use a library by vrld

How to make a curve yourself:
  1. Make a table for curve values
  2. Interpolate values for bézier curve function based on this: (depending on whenever you want a quadratic or cubic curve)
    Quadratic:
    Image
    Cubic:
    Image
    for example, this is cubic function in Lua:

    Code: Select all

    function cubic(a, b, c, d, t)
    	return (((1-t)^3)*a + 3*((1-t)^2)*t*b + 3*(1-t)*(t^2)*c + (t^3)*d)
    end
    Make a quadratic yourself ;)
  3. And draw them ofcourse

also
Arthes wrote:How to draw the Bezier Curve in Love2D?
The library is called LÖVE or Löve. love2d is used only for site domain