Bezier curves

17 Ⅰ 2010

Ok, so once again, this is mostly here so I can remember…

For my Entoforms project I’ve been using sine waves to calculate nice “increases” and “decreases”, but… a sine wave is only so flexible. Thus I had a look at using beziers in stead. Now… I am an artist, and not a math wizz, so it was tricky to get my head around…

The concept

Because I’m just using this bit of math to calulate how much I want to transform stuff, I’m only doing it in 2D. And to keep it simple only with curves with a single segment (though you can combine multiple curves). Below here are a few nice ones.

Now in my case I only care about the “inside” of the curve… so we’re ignoring the black (unselected) handles. This results in each curve being defined by 4 points… 2 nodes (where the curve starts and ends) and 2 handles (that define the shape of the curve). So we have p0 (the first node), p1 (the handle for the first node), p2 (the handle for the second node), p3 (the second node).

The math

I was lucky enough to find some very basic math for this on the net… I really don’t know much about what it actually does, but it works great! So here’s a simple script that places empties along a bezier curve.