Bezier Curve

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
Arthes
Prole
Posts: 10
Joined: Fri Dec 30, 2011 10:52 am

Bezier Curve

Post by Arthes »

Hi.
How to draw the Bezier Curve in Love2D?
Thanks for replies.
User avatar
richapple
Citizen
Posts: 65
Joined: Sun Dec 25, 2011 10:25 am

Re: Bezier Curve

Post 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
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 50 guests