Graphics Reference
In-Depth Information
6.11 A line intersecting a cone
Another ray-tracing primitive is the cone, and once again this is normally aligned, like the
cylinder, with the z-axis, as shown in Fig. 6.16. The simplest form of the cone equation is
z
2
x
2
y
2
=
+
which makes the internal angle of the apex 90
.
Y
T
λ
v
t
P
p
X
Z
Figure 6.16.
If the line equation is given by
=
+
p
t
v
where is a scalar and
1.
Then for an intersection at P, we have
v
=
z
P
=
x
P
+
y
P
which means that
z
v
2
x
v
2
y
v
2
z
t
+
=
x
t
+
+
y
t
+
Expanding and simplifying gives
z
t
+
2
z
v
=
x
t
+
2
x
v
+
y
t
+
2
y
v
2z
t
z
v
+
2x
t
x
v
+
2y
t
y
v
+
2
x
v
+
z
v
+
y
v
−
x
t
+
y
t
−
z
t
0
=
2x
t
x
v
+
2y
t
y
v
−
2z
t
z
v
+
which is a quadratic in and solved using
±
√
B
2
=
−
B
−
4AC
2A