# pouët.net

## So what's everyone's favourite resources for Bezier curves?

category: code [glöplog]

Hi,
I've been studying my Foley and van Dam, and also scouring the web (found a tut on NeHe, but it was OpenGL code), but at the moment it's just going over my head, mainly cause I can't follow the math.
Can anyone suggest any BEGINNER's webpages for curved surfaces?
Thanks.
There's some pretty good animations on Wikipedia. Surfaces are just two curves that make up a patch.
Not exactly about Bezier curves, but a very good place to start :
http://sol.gfxile.net/interpolation/index.html
I should update the article, adding beziers and stuff. Was thinking of doing that at some point but got distracted.
Not that I'd actually explain what's going on, as the article is more about practical uses of stuff than trying to understand the workings of things..
Curves in and around Beziers:    What a fucking great way to post shit on a serious post and make it unreadable. Well done, here's your cookie.

To bitnaughty: this is a great resource as well and contains a lot of java things to play around with.
successful pouetization was successful.
anyway, mathworld also has a pretty good page on it. here.
@Preacher: thanks for the very interseting link!
isnt bezier curves just derivations of tangents? i did those a many years ago. but i dont think i knew much what i was doing. if you wanna do curved surfaces (actually understand them) you won't get around it without knowing some bunch of math.
I used De Casteljau algorithm (recursive subdivision, you can stop at any point when you have enough precision) in the past to create my Bezier curves:
http://www.cubic.org/docs/bezier.htm
Thanks so much you guys :) I was expecting a little to get sworn at for wanting a little hand holding, but that didn't happen :) pmdata, your link was especially simple.

Preacher, there I was just following your Assembly seminar last week, and here you are talking to me :) I enjoyed your talk. However, I'm ashamed to admit that I can't follow the equations on your page - does the dot mean the dot product, for example in the first equation:
x(t)=1 dot (1-t) square.... etc.?
@bitnaughty: the dot is another way of writing the standard multiplication.
(And why would people swear at you??? But what rudi says makes sense...)
This calculates a Catmull-Rom spline using forward differencing (Evaldraw code). I had planned to make it adaptive to curvature based on this, but couldn't wrap my head around math/code.
Code:``` cmr_forward(p0x, p1x, p2x, p3x, p0y, p1y, p2y, p3y, steps) { ax = p3x - 3 * p2x + 3 * p1x - p0x; ay = p3y - 3 * p2y + 3 * p1y - p0y; bx = 2 * p0x - 5 * p1x + 4 * p2x - p3x; by = 2 * p0y - 5 * p1y + 4 * p2y - p3y; stepsize = 1.0/steps; stepsize2 = stepsize * stepsize; stepsize3 = stepsize * stepsize2; px = p1x; py = p1y; dx = (stepsize3*0.5)* ax + (stepsize2*0.5)*bx + (stepsize*0.5)*(p2x - p0x); dy = (stepsize3*0.5)* ay + (stepsize2*0.5)*by + (stepsize*0.5)*(p2y - p0y); d2x = (stepsize3*3) * ax + stepsize2 * bx; d2y = (stepsize3*3) * ay + stepsize2 * by; d3x = (stepsize3*3) * ax; d3y = (stepsize3*3) * ay; moveto(p1x, p1y); setcol(255, 255, 0); for (i = 0; i < steps; i++) { px += dx; dx += d2x; d2x += d3x; py += dy; dy += d2y; d2y += d3y; lineto(px, py); } } ```
it think should be pretty easy to understand if you start with simple derivations of parametric curves and shit like that. :)
http://www.cs.dartmouth.edu/~fabio/teaching/graphics08/lectures/08_ParametricCur ves_Web.pdf

Holds your basic runthrough of different variants.

Otherwise I would recommend any book about numerical analysis (Should have a section on parametric curves and matlab examples).

And while your at it also maybe read something like "Elementary Linear Algebra with Supplemental Applications" - H. Anton, C. Rorres. For that beloved rotation, skewing etc...
Quote:
What a fucking great way to post shit on a serious post and make it unreadable. Well done, here's your cookie.

Well, to be fair, I've learnt a lot more looking at Manon Ricci's curves than any old, boring maths site :)
Just draw a few line segments and apply a low pass on them. Really simple to code and visualize.
Then again, Preacher has a point, though :-)