472 Chapter 10 Distance in 3D
its projection being another interior point of the object, and this new pair of points
attains smaller distance than the previous pair, a contradiction to the previous pair
attaining minimum distance. Finally, if the line is parallel to the plane, then the closest
points on the object to the line may be selected from the object boundary. Thus, the
algorithm amounts to determining if the line intersects the object. If so, the distance
is zero; if not, the distance is computed from line to object boundary.
10.13.3 Distance between Planar Curves
If two planar curves lie on the same 3D plane ˆn · (X −C) = 0, the distance between
them can be calculated by using planar coordinates, effectively reducing the problem
to one in two dimensions. That is, if ˆn is unit length and if ˆu and ˆv are unit-length
vectors such that {ˆu, ˆv, ˆn} is an orthonormal set, then any point on the plane is
represented by X =C +r ˆu + s ˆv + t ˆn for some choice of scalars r, s, and t. Distance
calculations are made within the plane by projecting out the normal component.
The projected points are C +r ˆu + s ˆv. The two-dimensional distance algorithms are
applied to points (r, s). In 3D, the point C corresponds to the origin (0, 0) of the 2D
system.
An application might require distance calculations between planar curves that do
not lie in the same plane. In this case the problem requires calculations in the full
three-dimensional space. We present two types of methods for handling such curves.
One method applies if the planar curves are represented in some parametric form.
The other method applies if the sets of points for the planar curves are represented as
solution sets to systems of algebraic equations.
Parametric Representation
Let the curves be represented parametrically as X(s) for some domain [s
min
, s
max
]
and Y(t) for some domain [t
min
, t
max
]. The squared distance between a pair of
points, one on each curve, is F(s, t) =X(s) − Y(t)
2
. Finding the minimum dis-
tance between the curves requires computing a parameter pair (s, t) ∈ [s
min
, s
max
]×
[t
min
, t
max
] that minimizes F . A numerical minimizer can be applied directly to F ,
especially if either X or Y is not continuously differentiable. If both curves are con-
tinuously differentiable, then a calculus solution can be applied. Specifically, the
minimum occurs either at an interior point of the domain where ∇F =
0orata
boundary point of the domain. Each edge of the boundary provides a minimization
problem in one less dimension. The set of points (s, t) for which F is evaluated and
the minimum chosen from all such evaluations consists of these critical points:
1. ∇F(s, t) =
0 for (s, t)∈ (s
min
, s
max
) × (t
min
, t
max
)
2. ∂F(s
min
, t)/∂t = 0 for t ∈ (t
min
, t
max
)
3. ∂F(s
max
, t)/∂t = 0 for t ∈ (t
min
, t
max
)