Graphics Reference
In-Depth Information
V
0
V
1
V
2
t
0
t
1
t
2
t
3
t
4
Fig. 9.13.
Linearly interpolating between several values.
To understand the action of the blending function let's concentrate on
one particular value
B
1
(
t
). When
t
is less than
t
1
or greater than
t
3
,the
function
B
1
(
t
) must be zero. When
t
1
≤
t
3
, the function must return a
value reflecting the proportion of
V
1
that influences
V
(
t
). During the span
t
1
≤
t
≤
t
≤
t
2
,V
1
has to be blended in, and during the span
t
1
≤
t
≤
t
3
,V
1
has
to be blended out. The blending in is effected by the ratio
t
−
t
1
(9.29)
t
2
−
t
1
and the blending out is effected by the ratio
t
3
−
t
(9.30)
t
3
−
t
2
Thus
B
1
(
t
) has to incorporate both ratios, but it must ensure that they only
become active during the appropriate range of
t
. Let's remind ourselves of this
requirement by subscripting the ratios accordingly:
B
1
(
t
)=
t
+
t
3
−
−
t
1
t
(9.31)
t
2
−
t
1
t
3
−
t
2
1
,
2
2
,
3
We can now write the other two blending terms
B
0
(
t
)and
B
2
(
t
)as
B
0
(
t
)=
t
+
t
2
−
−
t
0
t
(9.32)
t
1
−
t
0
t
2
−
t
1
0
,
1
1
,
2
B
2
(
t
)=
t
+
t
4
−
−
t
2
t
(9.33)
t
3
−
t
2
t
4
−
t
3
2
,
3
3
,
4
You should be able to see a pattern linking the variables with their subscripts,
and the possibility of writing a general linear blending term
B
i
(
t
)as
B
i
(
t
)=
t
+
t
i
+2
−
t
i
t
i
+1
−
−
t
(9.34)
t
i
t
i
+2
−
t
i
+1
i,i
+1
i
+1
,i
+2
This enables us to write (9.28) in a general form as
2
B
i
(
t
)
V
i
V
(
t
)=
(9.35)
i
=0