Graphics Reference
In-Depth Information
Note that if
n
is a unit vector, written as
n
, then
ˆ
v
out
=
v
in
−
2
n
ˆ
·
v
in
n
ˆ
We now need to find P and its position vector
p
. From Fig. 5.1, we see that
p
=
r
+
v
in
(5.7)
where is a scalar. Equating (5.1) and (5.7) gives
t
+
v
=
r
+
v
in
(5.8)
We multiply Eq. (5.8) throughout by
n
and obtain
n
·
t
+
n
·
v
=
n
·
r
+
n
·
v
in
but
n
·
v
=
0
Therefore,
n
·
t
−
n
·
r
=
n
·
v
in
and
·
−
n
t
r
=
(5.9)
n
·
v
in
Substituting Eq. (5.9) in Eq. (5.7) gives
n
v
in
·
t
−
r
p
=
r
+
(5.10)
n
·
v
in
Therefore, the reflected ray originates at P with direction
v
out
.
Let's test these results with an example. Figure 5.2 shows a simple scenario that permits us
to predict the outcome. As the reflecting line makes an angle of 45
with the x-axis, and
v
in
is
parallel with the x-axis, the reflected ray will be vertical, and the point of reflection is 11.
Y
T
2
v
v
out
n
v
in
R
t
P
p
r
2
X
Figure 5.2.