Graphics Reference
In-Depth Information
Rather than using (1
−
t
) as a multiplier, it is convenient to make a substitution
such as
s
=1
−
t
, and we have
V
=
sA
+
tB
where
s
=1
−
t
and
s
+
t
= 1 (11.10) is called a
linear interpolant
as it linearly interpolates
between
A
and
B
using the parameter
t
. It is also known as a
lerp
. The terms
s
and
t
are the barycentric coordinates of
V
as they determine the value of
V
relative to
A
and
B
.
Now let's see what happens when we substitute coordinates for scalars.
We start with 2D coordinates
A
(
x
A
,y
A
)and
B
(
x
B
,y
B
), and position vectors
A
,
B
and
V
and the following linear interpolant
V
=
s
A
+
t
B
where
s
=1
−
t
and
s
+
t
=1
then
x
V
=
sx
A
+
tx
B
y
V
=
sy
A
+
ty
B
Figure 11.12 illustrates what happens when
t
variesbetween0and1.
The point
V
slides along the line connecting
A
and
B
.When
t
=0,
V
is
coincident with
A
,andwhen
t
=1,
V
is coincident with
B
. The reader should
not be surprised that the same technique works in 3D.
Y
B
y
B
t
= 1
V
y
V
A
y
A
t
= 0
x
A
x
V
x
B
X
Fig. 11.12.
The position of
V
slides between
A
and
B
as
t
varies between 0 and 1.