Main content

## Pixar in a Box

### Course: Pixar in a Box > Unit 10

Lesson 2: Mathematics of animation curves- Start here!
- 1. Mathematics of linear interpolation
- Linear interpolation
- 2. Repeated linear interpolation
- 3. De Casteljau's algorithm
- Constructing curves using repeated linear interpolation
- 4. What degree are these curves?
- Bonus: Equations from de Casteljau's algorithm

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# 2. Repeated linear interpolation

First we'll review De Casteljau's algorithm using three points. Then it's your turn to figure out how to do it with 4 points!

## Want to join the conversation?

- At2:05why would we want to use four points to control the animation?(12 votes)
- To create more realistic, more natural looking, animations.(29 votes)

- how do you do this in a hour(11 votes)
- You got to work fast , then you will be able to do this in an hour! Cheers :)(1 vote)

- What Did any of this mean?(11 votes)
- This is just the boring math...Except using it to make amazing animations :)(3 votes)

- at1:00which program is used in this video and can it be downloaded online(2 votes)
- Is the math behind animation even that important?(2 votes)
- I in 3rd grade and I don't know what algorithm is. Can any of you tell me? (or you could tell me what grade it is too)(1 vote)
- Algorithms get explained over here:

https://www.khanacademy.org/computing/computer-science/algorithms/intro-to-algorithms/v/what-are-algorithms

Don't worry about what grade something is taught in - do your best to understand what you can, and then build on what you know. Some people learn algorithms in college, other people start programming when they are very young. Here is an interview with Tanmay Bakshi, who first became interested in programming when he was 5:

https://www.youtube.com/watch?v=qfhGT3t_0wk(2 votes)

- Why should I use Castelijua's (tricky word) Algorithim if there are already Bezier curves?(1 vote)
- at0:36he talks about the stringar method. What is this?(1 vote)
- String art is a technique used by artists for the creation of abstracted images which are composed of straight lines of strings. String art is a technique for the creation of visual artwork where images emerge from a set of strings that are spanned between pins.(1 vote)

- I am on repeated linear interpretation. I get 100% right, but at the end it says 100% incorrect and won’t let me advance. What do I do ?(1 vote)
- I think I have a headache(1 vote)

## Video transcript

- 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.