Graphics Reference
In-Depth Information
Y
n
v
X
Z
Figure 6.10.
The plane equation is given by
−
k
=−
10
and the line equation is given by
=
p
v
where
v
=
i
+
j
+
10
k
Therefore,
d
−
n
·
t
−
10
−
−
k
·
0
=
=
n
·
v
−
k
·
i
+
j
+
10
k
=
−
10
−
10
=
1
and the point of intersection is given by
p
=
i
+
j
+
10
k
P
=
1 1 10
which is correct.
6.8 A line intersecting a sphere
The line-sphere intersection problem is central to ray tracing and is worth investigating.
However, before we start exploring the associated geometry, let's pause and remember the case
of the line-circle intersection problem in Section 6.3.
Figure 6.3 shows a line intersecting a circle, but Fig. 6.11 is the same diagram with a z-axis
and illustrates a line intersecting a sphere. Therefore, surely, the same vector analysis applies,
apart from the fact that the vectors are now 3D rather than 2D.
Now the equation of a sphere is
x
2
y
2
z
2
r
2
+
+
=
(6.16)
where r is the radius and the sphere's center is located at the origin.