Bizzare (Bezier) Curves and Pure Maths

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Ekamu
Party member
Posts: 178
Joined: Fri Sep 20, 2013 11:06 am

Bizzare (Bezier) Curves and Pure Maths

Post by Ekamu »

Wikipedia Article

I see this used in a lot of 2.5D racing games. So how does this work? Is it possible with love.graphics.line() or is there a special function just for this?

I've learned about the equation of a curve in pure maths before and stuff like points of inflection and sketching functions.

y = f(x) for which f"(x) = 0, if f''(x) < 0 we have a maximum point, if f"(x) > 0 we have a point of inflexion.

General Method for sketching a function.
for the function y = f(x) we can plot values of x against the corresponding values of y and obtain an accurate graph of the function.

And it goes on and on about more detailed examples.

Basically I'm having problems learning pure math in general. I feel like i'm really book smart. I can handle most examination questions and I get most of the proofs right but to be honest I have no idea what I'm even doing when it comes to videogames. Its like everythings upside down or the wrong way up and then the math is very scary and confusing for me. I don't know where to apply this stuff.

Do you guys know any cool math sites that teach for games with practical examples?

I think I might have asked this eons ago but I promised no more necroposting.
User avatar
Ikroth
Citizen
Posts: 79
Joined: Thu Jul 18, 2013 4:44 am

Re: Bizzare (Bezier) Curves and Pure Maths

Post by Ikroth »

If you're not concerned with writing the function yourself, you can use love.math.newBezierCurve.

https://www.love2d.org/wiki/love.math.newBezierCurve
User avatar
pgimeno
Party member
Posts: 3582
Joined: Sun Oct 18, 2015 2:58 pm

Re: Bizzare (Bezier) Curves and Pure Maths

Post by pgimeno »

I don't know of any such sites.

As for Bézier curves, note that they are not explicit functions of the form y = f(x); they are instead parametric functions of the form x = f(t), y = g(t), and you usually either iterate over t from 0 to 1 in regular intervals, or use an algorithm called De Casteljau's. An explicit formula may or may not exist, not sure right away, but in many cases it would not be a function in the pure sense of the word (a requisite for a formula to be a function is that every input has at most one unique output, and many Bézier curves don't meet that requisite).

Note that LÖVE includes generation of Bézier curves, look up [wiki]love.math.newBezierCurve[/wiki].

You can get some training in how Bézier curves look like, and how they are used and manipulated, using e.g. Inkscape or Gimp or about any graphics program with support for curves. Once you get the idea you can extrapolate it to your own purposes.
Ekamu
Party member
Posts: 178
Joined: Fri Sep 20, 2013 11:06 am

Re: Bizzare (Bezier) Curves and Pure Maths

Post by Ekamu »

Thanks. I completely forgot love had a bonus math module from Lua's.

I'm learning Shaders the same way with effects in Paint.NET like Buldge and Glow e.t.c just so I can grasp the idea.
User avatar
mr_happy
Citizen
Posts: 84
Joined: Fri Mar 18, 2016 8:57 pm

Re: Bizzare (Bezier) Curves and Pure Maths

Post by mr_happy »

Here's a page that might prove useful:

http://devmag.org.za/2011/04/05/bzier-c ... -tutorial/
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests