# Math - LERP

In this lecture we learnt all about linear interpolation (or LERP for short),

LERPing can be used to find a value that sit between two discrete points and has a variety of different uses, from smoothing the movement of objects to blending between two colors.

What’s your favourite application of LERP?

For your challenge, we have an object that is moving between the points (-4, 3) an (8, 6) over the span of 4 seconds.
And our question is; what is the objects current position after 1, 2, and 3 seconds.

(1, 3.75)
(2, 4.5)
(5, 5.25)

1 Like

Nice work @Ajai_Raj. Looks like you made a small typo on the first one, but everything else is spot on

1 Like

1 Like

(-4,3) + ((8,6) - (-4,3) * 0.25 (then 0.50, and 0.75)
(-4,3) + (12, 3) * 0.25 = (-4,3)+(3, 0.75) = (-1, 3.75) at 1 second
(-4,3) + (12, 3) * 0.50 = (-4,3)+(6, 1.50) = (2, 4.50) at 2 seconds
(-4,3) + (12, 3) * 0.75 = (-4,3)+(9, 2.25) = (5, 5.25) at 3 seconds

1 Like

(-4, 3) to (8,6) over 4 seconds
LERP at 1 second, 2 seconds, and 3 seconds

(-4,3) + ((8,6)-(-4,3)).25 = (-4,3) + (12,3).25 = (-4,3) + (3,.75) = (-1,3.75)

(-4,3) + (12,3)*.5 = (-4,3) + (6,1.5) = (2,4.5)

(-4,3) + (12,3)*.75 = (-4,3) + (9,2.25) = (5, 5.25)

LERP at 4 seconds, or 100%, to double-check
(-4,3) + (12,3)*1 = (-4,3) + (12,3) = (8, 6)

1 Like

here is mine:

1 Like
1. (-1,3.75)
2. (2,4.5)
3.(5,5.25)

0 seconds (-4, 3)
1 second (-1, 3.75)
2 seconds (2, 4.5)
3 seconds (5, 5.25)
4 seconds (8, 6)

-1, 3.75
2, 4.5
5, 5.25

(-1,3.75) for 25%
(2,4.5) for 50%
(5,5.25) for 75%

25 % - (-1, 3.75)
50% - (2, 4.5)
75% - (5,5.25)

( -4 , 3 ) + (( 8 , 6 ) - ( -4 , 3 )) * 0.25 = ( -1 , 3.75 )
( -4 , 3 ) + (( 8 , 6 ) - ( -4 , 3 )) * 0.5 = ( 2 , 4.5 )
( -4 , 3 ) + (( 8 , 6 ) - ( -4 , 3 )) * 0.55 = ( 5 , 5.25 )

time x-axis y-axis
0 sec -4 3
1 sec -1 3.75
2 sec 2 4.5
3 sec 5 5.25
4 sec 8 6

(-1, 3.75)
( 2, 4.50)
( 5, 5.25)

(x, y) = (-4, 3) + (12, 3) * t

t = 0.25 (1/4 sec)
(-1, 3.75)

t = 0.5 (2/4 sec)
(2, 4.5)

t = 0,75 (3/4 sec)
(5, 5,25)

a + (b - a) * t at 25%
(-4, 3) + ((8, 6) - (-4, 3)) * 0.25
(-4, 3) + (12, 3)0.25
(-4, 3) + (3, 0.75) = (-1, 3.75)

at 50%
(-4, 3) + (12, 3)0.5
(-4, 3) + (6, 1.5) = (2, 4.5)

at 75%
(-4, 3) + (12, 3)075
(-4, 3) + (9, 2.25) = (5, 5.25)