Mathematics of animation curves
Current time:0:00Total duration:2:21
2. Repeated linear interpolation
- Now that we've looked at linear interpolation, let's see how we can get smoother motion using Bézier curves. The shape of each segment of this curve is controlled by four points. So how can we write an equation that gives us a smooth curve out of these four points? You may remember we faced a similar problem in the environment modeling lesson. There, we were trying to make curved blades of grass. We saw how to use three points to define a parabolic arc using the string art method. So let's review how that string art method actually works. Let's label our points A, B, and C. We've also got a parameter we'll call t, which is how far along each line segment we are. First, we can calculate a point on A B using a weighted average of these two end points. This is another kind of linear interpolation, but instead of using the slope intercept form, we're using what's called a parametric form. The parameter is t, which tells us how far along the line we are. As t goes from zero to one, our new point, let's call it Q, goes from A to B. Let's do the same thing for the other line segment, calculating a point R between B and C. Finally, we'll use the same method between Q and R to calculate P, which is a point on our curve. As t goes from zero to one, P traces out the smooth curve. You can think of this construction method as repeated linear interpolation since Q, R, and P are all computed using linear functions of t. This method of repeated linear interpolation is called deCastlejau's algorithm. It's named after Paul deCastlejau who actually discovered the math for this a few years before Pierre Bézier, but wasn't able to publish it until after Bézier had scooped in. We've seen how deCastlejau's algorithm can be used to make a smooth curve out of three points, but for animation, we want to use four points to control the curve. Take a few minutes with pencil and paper and see if you can work out how to get a smooth curve starting with four points instead of three.