1

enter image description here

I am taking a graphics programming course, and I am looking at how Linear interpolation can be used to move points from one location to another location within a certain time.

My mathematics background information is poor, so can someone explain how the formula given for LERP (to animate movement) is used.

When it comes to programming, I can implement this in no time, but what is the point with out understanding the equation and technical information.

$$P(t) = (1-t)P + tQ $$

The above is the formula given. What I am confused about is are variables used. What is $P$ , and $Q$? are these the vector points, and if yes, can they be any letters, or is this a convention in maths?

Why does $t$ have to be between $0$ and $1$?

user860374
  • 4,131
Moynzy
  • 367

1 Answers1

2

According to your visual example, yes, $P$ and $Q$ are 2-dimensional vectors. The equation in terms of vectors is just a compact way of writing the equations for the two entries in the vector. $P(t)$ gives the position at time $t$ assuming you start at $P$ at $t = 0$ and end at $Q$ at $t = 1$, and travel with constant velocity. The reason why you should typically assume $0 \leq t \leq 1$ is that this is the range of the data you were given, i.e. you have a start point at $t = 0$ and an end point at $t = 1$.

user2566092
  • 26,142
  • So P and Q can be anything really? Ah, I see for the t is must be between 0 and 1 since it's the range. To calculate t giving the scenario above, since I have 4 steps t = t/steps. And to find the x and y value of each points, all I have to do is use the given equation; 'P(t)=(1−t)P+tQ'. So for step 2 it will be P(t) = (1-0.25)2+0.25*20 which gives the value if 6.5. Is this correct? – Moynzy Mar 05 '15 at 20:23