Graphics Reference
In-Depth Information
As shown in Fig. 2.39, the interpolated vector should be
√
2
2
√
2
2
=
+
w
i
j
Using Eq. (2.31), we find that
sin 45
sin 9
0
sin 45
si
n
90
w
=
i
+
j
√
2
2
√
2
2
w
=
i
+
j
Although Eq. (2.31) assumes that
u
and
ˆ
v
are unit vectors, it will work with non-unit vectors.
ˆ
For example, if
u
90
.
Now let's find the interpolated vector when
=
2
i
and
v
=
4
j
, then
=
=
05.
Therefore,
√
2
2
√
2
2
=
√
2
i
2
√
2
j
w
=
2
i
+
4
j
+
The magnitude of
w
is
√
2
2
2
√
2
2
√
10
w
=
+
=
=
3162
So, even though the rotated angle is 50% of the separating angle, the vector's length exceeds the
half-way point between 2 and 4, which is because the interpolation is spherical rather than linear.
If the length of the interpolated vector is required to be linearly related to , then we must
normalize
u
and
v
and scale the interpolated vector as follows:
sin1
v
sin
−
sin
sin
ˆ
w
=
1
−
u
+
v
u
ˆ
+
For instance, using the above example, where
u
=
2
i
,
v
=
4
j
, and
=
05
then
4
sin 45
sin 90
j
sin 45
sin 90
w
=
05
×
2
+
05
×
i
+
and
3
√
2
2
j
√
2
2
w
=
i
+
which are correct.
Needless to say, the interpolation works in 3D as well as 2D.