Graphics Reference
In-Depth Information
where λ is a scalar, and
v
= 1
(12.13)
For an intersection at P
2 = r 2 or
2
r 2 =0
q
= r or
q
q
Using the cosine rule
2 =
2 +
2
q
λ v
s
2
λ v s
cos( θ )
(12.14)
2 = λ 2
2 +
2
q
v
s
2
v s
λ cos( θ )
substituting (12.13) in (12.14)
2 = λ 2 +
2
q
s
2
s
λ cos( θ )
(12.15)
identify cos( θ )
. v = s v cos( θ )
s
therefore
.
cos( θ )= s
v
s
(12.16)
substituting (12.16) in (12.15)
2 = λ 2
.
2
q
2 s
v λ +
s
therefore
2
r 2 = λ 2
.
2
r 2 = 0
q
2 s
v λ +
s
(12.17)
(12.17) is a quadratic where
( s
. v ±
. v ) 2
λ = s
s
2 + r 2
(12.18)
and
s = c t
the discriminant of (12.18) determines whether the line intersects, touches or
misses the sphere.
The position vector for P is given by
p = t + λ v
where
( s
. v ±
. v ) 2
λ = s
s
2 + r 2
and
s = c
t
 
Search WWH ::




Custom Search