6 Chapter 1 Introduction
The numerical problems with finding roots might be viewed simply as a side ef-
fect of using floating-point numbers, one that does not occur frequently. However,
sometimes the problems occur because of the very nature of the geometric query!
Consider the problem of detecting when two moving ellipses intersect for the first
time. Assuming the ellipses have different axis lengths, at the first time of contact the
intersection consists of a single point. Moreover, at that time the fourth-degree poly-
nomial that must be solved to produce the root has, by the construction, a root of even
multiplicity. Therefore, your root finder absolutely must be able to handle even mul-
tiplicity roots. When dealing with intersection of objects, the concepts of odd and
even multiplicity are related to transversality and tangency. If one curve intersects an-
other and the respective tangent lines of the curves at the point of intersection are not
parallel, the intersection is transverse. Any polynomial equation related to the inter-
section will have a root of odd multiplicity corresponding to that intersection. If the
tangent lines are parallel, the contact is tangential and the polynomial equation will
have a root of even multiplicity. Tangential contact is important in many applications,
especially in collision detection of moving objects.
Finally, a phenomenon that is less frequently considered when implementing an
algorithm is order-dependence of the input parameters. For example, if you imple-
ment a function
TestIntersection(Segment,Segment) that tests if two line segments
intersect (the return value is either
true or false), it is desirable that TestIntersec-
tion(S0,S1)
and TestIntersection(S1,S0) produce the same result for any pair of
inputs
S0 and S1. If the function fails to satisfy this constraint, it could be due to a
poor algorithmic design, but more likely it is due to incorrect handling of floating-
point issues in the implementation.
1.3 A Summary of the Chapters
For those readers wishing to review the basic concepts in vector and matrix algebra,
we have provided three chapters (2, 3, and 4). A summary of many of the numerical
methods used in the algorithms in the book is provided in Appendix A. Formulas
from trigonometry may be found in Appendix B. Appendix C is a quick reference for
basic formulas for some of the geometric primitives encountered in the book.
Chapter 5 provides the definitions for the various two-dimensional objects to
which the geometric queries apply. These include lines, rays, line segments, polygons,
conic sections (curves defined by quadratic equations), and polynomial curves. The
main geometric queries are distance measurements, discussed in Chapter 6, and
intersection queries, discussed in Chapter 7. Miscellaneous queries of interest are
provided in Chapter 8.
Chapter 9 provides the definitions for the various three-dimensional objects to
which the geometric queries apply. These include lines, rays, line segments, planes
and planar objects (two-dimensional objects embedded in a plane in three dimen-
sions), polyhedra and polygon meshes, quadric surfaces (surfaces defined by qua-