Graphics Reference
In-Depth Information
12.12 Calculate if a Sphere Touches a Plane
A sphere will touch a plane if the perpendicular distance from its centre to the
plane equals its radius. The geometry describing this condition is identical to
finding the position and distance of the nearest point on a plane to a point.
Figure 12.14 shows a sphere located at P with position vector p . A pote-
ntial touch condition occurs at Q , and the objective of the analysis is to
discover its position vector q . Given the following plane equation
ax + by + cz + d =0
its surface normal is
n = a i + b j + c k
The nearest point Q on the plane to a point P is given by the position vector
q = p + λ n
(12.19)
where
.
n
p + d
n
. n
λ =
the distance
PQ =
λ n
If P is the centre of the sphere with radius r , and position vector p the touch
point is also given by (12.19)
when
PQ =
λ n
= r
Let's test the above equations with a simple example, as shown in Figure 12.15.
Figure 12.15 shows a sphere with radius r = 1 and centred at P (1,1,1)
The plane equation is
y
2=0
Y
n
P
r
p
Q
q
Z
X
Fig. 12.14. The vectors used to detect when a sphere touches a plane.
Search WWH ::




Custom Search