Graphics Reference
In-Depth Information
Q
b
R
r
r
y
θ
sphere
C
P
P
x
a
plane
(a)
(b)
Figure 6.24.
By making a and b orthogonal and using the parametric equation of a circle:
x
=
r cos
y
=
r sin
as shown in Fig. 6.24(b), we can define a position vector q pointing to any point Q on the
circle of intersection.
We already know that
p
=
c
+
n
ˆ
where
=
−ˆ
·
d
n
c
Therefore,
q
=
p
+
r cos a
+
r sin b
where
0
360
6.15 A sphere touching a triangle
Having seen how simple it is to detect a sphere touching or intersecting a plane, let's investigate
the problem of a sphere touching a triangle. Basically, we need to follow three steps:
1. Derive the triangle's plane equation, probably using the cross product of two vectors taken
from the triangle's edges.
2. Determine whether the sphere touches the triangle's plane.
3. If a touch condition occurs, discover if the touch point is inside the triangle.
To illustrate how the above steps are implemented, let's investigate a simple example.
Figure 6.25 shows a triangle P 1 P 2 P 3 located near the origin and a sphere of radius R
=
1
with centre C 1 1 2.
 
Search WWH ::




Custom Search