Graphics Reference
In-Depth Information
For a miss condition
. v ) 2
2 + r 2 < 0
( s
s
For a touch condition
. v ) 2
2 + r 2 =0
( s
s
For an intersect condition
. v ) 2
2 + r 2 > 0
( s
s
To test these formulae we will create all three scenarios and show that the
equations are well behaved.
Figure 12.13 shows a sphere with three lines represented by their direction
vectors λ v 1 v 2 and λ v 3 .
The sphere has radius r = 1 and is centred at C with position vector
c = i + j
whilst the three lines L 1 ,L 2 and L 3 miss, touch and intersect the sphere
respectively.
The lines are of the form
p = t + λ v
therefore
p 1 = t 1 + λ v 1
p 2 = t 2 + λ v 2
p 3 = t 3 + λ v 3
where
1
2 i +
1
2 j
t 1 =2 iv 1 =
t 2 =2 iv 2 = j
1
2 i +
1
2 j
t 3 =2 iv 3 =
Y
P 3 ¢
l v 2
l v 1
l v 3
r
C
P 2
P 3
c
T
t
X
Z
L 1
L 3
L 2
Fig. 12.13. Three lines that miss, touch and intersect the sphere.
Search WWH ::




Custom Search