# COMPUTER AIDED GEOMETRIC DESIGN

ELSEVIER Computer Aided Geometric Design 14 (1997) 111-134

**A new approach to the surface intersection problem Thomas A. Grandine*, Frederick W. Klein IV
**

MS 7L-21, Boeing Information and Support Services, P.O. Box 3707, Seattle, WA 98124-0346, USA

Received September 1995; revised April 1996

Abstract

Planar cut and surface intersection software is an important part of any computer aided design system. This paper presents two new ideas in the numerical solution of such problems. The first is the notion of topology resolution. In this process, the structure of the intersection curves, including the identification of closed interior loops, is determined prior to their actual numerical solution. The second idea is to compute the intersection curves as the numerical solution of a differential algebraic equation, yielding intersection curves which are (nearly) parametrized by arclength.

O. Introduction

Planar cut and surface intersection software is an important part of any computer aided design system. A number of different fundamental approaches to this problem are followed in these systems, including geometric methods for quadric sections (Miller, 1987; Piegl, 1989), subdivision-based methods (Filip et al., 1986; Houghton et al., 1985), implicit schemes (Asteasu, 1988; Bajaj et al., 1988; Garrity and Warren, 1989), and curve tracing schemes (Appel, 1976; Barnhill et al., 1987; Bamhill and Kersey, 1990; Chen and Ozsoy, 1988; Sederberg and Nishita, 1991; Zhao, 1995). The latter schemes are often referred to as "marching" or "curve following" schemes in the literature. Of these, the quadric section methods are of limited interest in the general context, and implicit schemes are useful only in CAD systems which support implicit surface definition. The remaining two techniques, subdivision and curve tracing, have proven useful for solving a wide variety of intersection problems, but both give rise to tolerance setting problems and issues that are very difficult to resolve. A comprehensive bibliography of the surface intersection problem can be found in (Farin, 1992). * Corresponding author. 0167-8396/97/$17.00 Copyright © 1997 Elsevier Science B.V. All rights reserved

SSDI 0167- 8396(96)00024-6

112

T.A. Grandine, EW. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134

In recent years, "loop detection" has become the hot topic in this field (Sinha et al., 1985; Sederberg and Meyers, 1988; Cheng, 1989; Sederberg et al., 1989; Kriezis et al., 1992). This technique guarantees that all branches of the intersection curves will be found, and it has become an almost essential add-on to the curve tracing algorithms mentioned above. Despite the obvious benefits of this technology, "loop detection" does not guarantee that the topology of the intersection curves will be correctly resolved. This responsibility is usually imposed on the curve tracking scheme. These schemes solve a sequence of initial value problems, each of which is terminated when the solution passes one of the possible candidate stopping points. Because it is impossible to predict the parameter value at which such a passing might occur, a heuristic stopping mechanism must be built into the tracking scheme. This mechanism usually depends upon properly setting some tolerances, a tricky process which can demand different settings for different problems. An alternative approach is to determine which of the candidate stopping points is the actual stopping point prior to marching. In this case, the initial value problem over an unknown parameter interval can be replaced by a boundary value problem over a fixed, specified interval. This has the added benefit of eliminating the bias built into some curve tracking schemes which arises because of the direction in which the intersection curves are tracked. The setup in this paper formulates the intersection problem as a differential algebraic equation and determines the basic topology of the contours so that it can be solved as a boundary value problem instead of an initial value problem. Our experiments suggest that paying the price to compute the boundary conditions prior to tracking the contours can pay handsome rewards. Our scheme for determining the boundary conditions for the curve tracker requires that the surfaces be restricted to any class of surfaces for which a robust capability for determining all solutions to a nonlinear system of equations. In general, no such capability is possible without some simplifying assumptions or extra knowledge of the structure of the nonlinear system. The simplifying assumption that we have made in our software is that the surfaces we are intersecting are tensor product spline surfaces. This restriction is sufficient to enable a robust nonlinear system capability to be developed, and we have done so. A similar capability could be developed for piecewise polynomial functions over triangles and irregularly shaped regions as well as algebraic and piecewise algebraic surfaces, though we have not implemented this. The method used to track the actual intersection curves does not require finding all solutions to a nonlinear system, so its applicability is not limited to special classes of surfaces. However, it does require the surfaces to be (71 . If the surfaces are not (71, then they can be broken up into pieces which are. These pieces can then be intersected, and the resulting intersection curves pieced back together to form the intersection curves for the original surfaces. This is the approach we have adopted in cases where we have, for example, a pair of bilinear surfaces we wish to intersect. In the generic case, the intersection of a pair of surfaces will be a collection of curves. Of course, it is possible for two surfaces to coincide over an entire region. The problem of finding the boundary of such a region is very different from the problem of finding intersection curves, and will not be considered in this paper.

Section 3 describes the extension of the ideas outlined in the first two sections to the general problem. and it is designed to determine the number of contour branches as well as endpoints for each of those branches. l] -+ [0. 1. This is done is Section 3. Another special feature is the requirement that all branches of a given contour be found.A.e. Section 4 discusses a method for solving the two point boundary value problems that arise. i. Some numerical examples are presented in Section 5. 1] 2. so a ~< u ~< b and c ~< v <~ d. 1 Consider also a plane whose implicit equation is a z + by + cz = d. J The surface is parametrized over a rectangle. d] can both be assumed to be [0. Grandine. This is designed to achieve arbitrary accuracy and is discussed in Section 4. for arbitrary tensor product spline surfaces. the problem is divided into two parts.2)
for a given tensor product spline function f and all t E [0.1) becomes aFl(u. The notation (u. Eq. where w(u. v(t)) = 0 (1. (1. 2If F is a rational spline. is analyzed and discussed elsewhere in more detail. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
113
Section 1 of this paper describes a scheme for determining the topology for the planar cut problem. b] and [c. 1]. and the topology determination scheme for it can be extended to the general problem for tensor product spline surfaces in a straightforward way. but it has some special features. v) which lie on the plane. In order to satisfy both of these special requirements. This special case of the general surface intersection problem is easier to analyze. l] 2 with components u and v such that f ( u ( t ) . v) + cF3(u. One is that the requested accuracy of the computed contours is expected to be much higher than what would be required in a typical computer graphics application. The goal is to find all points F ( u . v) . v) is the denominator. This method. This is the classic contouring problem. 1].v) = 0. Section 2 discusses some of the singular cases for the planar cut problem and how they can be handled within the context of the algorithm outlined in the first section. (1. The intervals [a.. Determining planar cut topology
Overview Consider a parametric surface F parametrized by u and v over [0. but is presented here for completeness. all u and v which satisfy a F j ( u .v) + bF2(u. v) E [0.d = 0. 2 Thus.T. the planar cut problem is equivalent to the problem of computing zero contour lines for a bivariate function.1)
Thus. for some smooth spline function f . 1]2 denotes this setup. The algorithm can be motivated by considering the example shown in Fig.
1.
. EW. The first part of the algorithm is a topology resolution scheme. the problem is equivalent to the problem of finding all mappings from [0. Finally. One part is a spline collocation method for approximating the contours.v) + cF3(u. and conclusions and future directions presented in Section 6.v) . v) + bF2(u.dw(u. which is a general contouring method.

We have chosen to call such points turning points. 2. A typical collection of panels is depicted in Fig.
/ f J J J 1 / ig
I
u--~
u---+
Fig.1r/2] and constant for all panel boundaries. Suppose further that the contours of f do not cross and that the contour has no closed loops. Each panel boundary is determined by an arbitrary fixed direction 0 and its distance from the origin. Grandine. the region can be divided into ordered panels in which the contours themselves remain ordered. as shown in Fig.114
T. To determine which topology is correct. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
T
V
u---+ Fig. and they can be characterized by the fact that
. The panel boundaries will be parallel lines ordered by distance from the origin. The direction 0 is assumed to be in [0. In this case. 0). 2. v = 0.sin 0. and v = 1 have been found.A. 1. say two along each vertical edge. so the vector ( .
Suppose that all zeros of f for fixed u = 0. Determining the locations of the panel boundaries is accomplished by finding the places where contours turn back on themselves relative to a panel boundary. 1). u = 1. The parametric domain of f. cos 0) is parallel to each of them. EW. the contours must have one of the two possible topologies depicted in Fig. since f is smooth and none of the contour components disappear in the interior of the parametric region. Possible topologies of the zero contour. while the last panel will contain (1. 3. 3. The first panel will contain the point (0.

Vn). 3 Eq.
(1. 1].3)
Such points can be determined by differentiating the contouring Eq. Thus. vl). sin0).TA. Grandine.7)
3 The notation fu is an abbreviation for either Duf(u(t). v(t)) or Duf(u. then
u'(t) cos 0 + v'(t) sin 0 = 0. these points must be solutions to Eqs.5)
Thus. fu~. (1.2) with respect to the contour parameter. so (f~. the tangent to the contour at such points will be perpendicular to the panel direction. Contours can only cross at critical points. The point (u(t). sin 0).6) as well. (1. and f. (1. Suppose that n solutions to (1. are analogous abbreviations. v).4)
for all t E [0.6) exist and are given by (Ul. c o s ~ u---+ Fig. fv). which are points on the contour for which the gradient of the function vanishes.3) says that (u'(t). Eq. However.
(1. depending on context. This gives
fuu'(t) + fvv'(t) = 0
(1.6)
Note that the solution set to these equations must contain all points where contours cross. v) = 0.
fu sin 0 . v(t)) will be a turning point whenever fu sin 0 . v(t)) is a turning point. fv) must be a multiple of (cos 0. (u2. so there is no possibility of missing them if all solutions to those equations are found.v'(t)) is perpendicular to (cos0.4) says that the vector (u'(t). Klein IV/Computer Aided Geometric Design 14 (1997) 111-134
115
( . (1.v'(t)) is always perpendicular to the vector (f~. Possible panels of the parametric domain of f. (1. 3. For each of these points. if (u(t). cos 0 = 0. fur..fv cos0 = 0.f . f . . all of the turning points can be located by finding all solutions to the 2 × 2 system of equations
f ( u .sin0. determine the distance of its panel from the origin
di = ui cos 0 + vi sin 0.
. v2). EW. • • •. (Un. (1.

solutions to (1.A. go to Step (6). A point corresponds to a starting contour if it continues in the increasing panel direction. (6) Determine whether the point corresponds to a contour which is starting or ending at the given point. (7) Determine whether the point is a turning point or a critical point. In this case. it is now impossible for contours either to cross or to double back on themselves within a panel. go to Step (7). (3) Take all the points found in Step (1) and Step (2) and order them by distance in the 0 direction from the origin. Indeed. If it is a boundary point. If it is starting and the point is on the u = 0 or v = 1 edge. In Step (1). we will assume that the point is a turning point and defer the discussion of critical points to Section 2. assume that the points are ordered by increasing d~. as that would require contours doubling back on themselves.
Description of Algorithm
With this location of panel boundaries. no contours will be on the list at first. In practice. depending upon which edge the point is on.6) are no longer isolated points. Determine whether two contours start or two contours end at the turning point.6). Place panel boundaries at the distances d~ from the boundary. For now. an entire contour or portion of one may lie along a panel boundary. Either insert two new contours in the list or delete two existing ones from the list. and it will be well ordered with respect to the other points. E W. and the problem of determining the turning points becomes just as difficult as the contouring problem we are trying to solve.
Discussion
These steps can be tricky. Further. stop. (2) Find all zeros of f on the boundary of [0. Locate the two contours in the list of contours by finding all points which lie on both the panel boundary and on the contour. only one possible topological configuration of the contours can exist within each panel. Grandine. (4) Initialize an ordered list of contours.116
T. Thus. Go back to Step (5). Unless a contour starts right at the origin. vertical contours arise with alarming frequency. 1]2. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
Without loss of generality. The turning point will be one of these. Go back to Step (4). so that d~+l >~ di for all i. which ensures that all of the turning points and critical points lie on the panel boundaries. take the next closest point. then delete a contour from either the beginning or the end of the list. an earlier version of our software used 0 = 0 exclusively.
. and our code suffered a high rate of failure. If it is an ending point. These observations give rise to the following algorithm: (1) Choose 0 and find all solutions to (1. If it is starting and the point is on the v = 0 or u = 1 edge. and it corresponds to an ending contour if it continues in the decreasing panel direction. add a new contour to the end of the ordered list. add a new contour to the front of the ordered list of contours with the given point as an endpoint. (5) If no points remain to be processed. Otherwise. no closed loops can exist within the interior of a panel. Otherwise.

this is a turning point. the condition is (1. then it is a single point contour in the corner..s i n S .13)
which works along both vertical edges. cos O). sint9 .f ~ ( f . Grandine. Thus. It doesn't matter which one because the particular value of 0 used does not affect the accuracy of the contour that eventually gets tracked.fv cos 0) > 0 is true.
As before. If one is true and one is false.TA.v) f~ (f~.fvCOSO) > 0.fv cos0) > 0. Making this substitution indicates that the contour will be a starting contour whenever
fu(f~sinO . the contour will be a starting contour if the (u'(t). for any given problem. Step (6) has a similar sign determination that needs to be carried out to determine whether the turning point starts two new contours or ends two old ones.5)fv(fu sinO . However.15)
.
(1. This condition is
v'(t)(v'(t) sin0 + u'(t) cos0) > 0.v'(t)) is perpendicular to (f~. This will be the case when the cross products (1.v'(t)) must lie between the vectors (1. In Step (5).14)
The problem checking this is that the values ut'(t) and v'l(t) are not known.
(1. v'(t)) and (u'(t). .10)
Thus. f ~ ) .8)
Since (u'(t).0.
Along the top edge.
(1. In the corners. fv).11)
u'(t)(v'(t) s i n O + u'(t)cos0) > 0. it must be a multiple of ( .fvCOSO) > 0
(1. In other words. when their product is positive. the condition is . sin 0 . values of 0 which do not lead to a continuum of turning points must exist. Along the bottom edge.9)
(1. . E W. both conditions must be true for it to be a starting point. i.0) and ( . Two new contours will start at the turning point if the vector (u"(t).e. We have built into our software a simple strategy for choosing one of these. v"(t)) lies in the new panel.0) x (u'(t). the contour will be a starting contour along either of the horizontal edges whenever (0. Klein IV~Computer Aided Geometric Design 14 (1997) 111-134
117
This problem has been overcome b y noting that. v'(t)) direction lies within the cone given by the u axis and the panel boundary direction.v'(t)) × ( .12)
(u . so f~ \ sin0 (1. determining whether a contour is starting or ending requires a sign determination.5 .f . the vector (u'(t). this condition is equivalent to
(1. and two old contours will end if it lies in the old panel. two contours will start whenever
u"(t) cos0 + v"(t) sinO > 0.s i n 0. Along the left edge. both must be false for it to be an ending point. cos0) are both positive or both negative.

. v) = O..~):+ (. These points satisfy
f(u.17 + (~.~o):.~) ((.
(1.19)
The term f12/~ has the same sign as o~.
(u'(t)) (. Discovering the topology of this zero set will be the goal of the algorithm.~cos0 + f ~ s i n & Thus. This question can be answered by finding all points which lie on the panel boundary and on the contour.. Klein IV/Computer Aided GeometricDesign 14 (1997) 111-134
for some c~. the condition (1. With O = 7r/6.I) 2 -
~) ((~.15) and (1. The first step of the algorithm calls for choosing 0 and finding the turning points. 4. Grandine.A.118
T. u'(t).14) is equivalent to
(f~cosO+f~sinO)(f~usin20-2f~sinOcosO+f~vcos20)
<0.~)-
A contour map of the zeros of f are given in Fig. fv.~ ) : . o~
(1.17)
a relationship that must hold for all points on the contour.20)
This test determines whether or not to add or delete two contours from the list of contours.4) is differentiated
(fu~u'(t) + fuvv'(t))u'(t) + fuu"(t) + (f~u'(t) + f~v'(t))v'(t) + f~v"(t) = 0.2fu~ sin 0 cos 0 + f ~ cos 2 0)
+ o~(u"(t)cos0 + v"(t)sin0) = O. the function f has turning points located at
.2~) ×(u: + (v. and the ordering of the turning point with respect to the others is clear.15) with the vector (cosO.~):.f12 ( f ~ sin 2 ~9. Taking the inner product of both sides of (1.18)
(1. Consider the function f given by
f(~.21) where d is the distance to the origin of the panel edge. The points can be ordered along the panel edge.2fu~ sin 0 cos 0 + f ~ cos 2 0).v) = (~: + ( v .16)
for some ft. sinO) reveals that o~ = f. and v'(t) given by (1.
Example
An example clarifies much of the discussion. E W.16) give f12 ( f ~ sin 2 0 .
which can be solved for the desired expression to get u"(t) cos 0 + v" (t) sin 0 = . This information can be used in the equation that results when (1. but it does not necessarily answer the question of where in the list they need to be added to or deleted from.
(1.sin0) v'(t) = fl cos0
(1.
ucosO + vsinO = d. Similarly. (1. Making the substitutions for f~.

These are
(us.5).44641016 d3 = 0. An example contour problem. one contour is added to C to reflect that the next panel must have one contour passing through it. This contour will have as one of its endpoints (us. v4) = (0. (u2. v6).
(UlO. E W.
dl = 0. 0. (u3.
d5 = 0.T.85).575 d2 = 0. and their corresponding distances are computed. the boundary points are calculated. The next point to consider is (u6. v3) = (0.95). (u4.
d5 < d6 < d2 < d7 < dl < d4 < d3 < d8 < d9 < d10.o.5). the point (us.A. so condition (1. v7) = (0.82679492.125 d6 = 0. This list has no contours on it to begin with. 0. In Step (2). It is a boundary point on a vertical boundary.13). v5) is the first one to be processed.
These points and their corresponding panel boundaries are shown in Fig.1160254
dlo = 1. 0.57320508.25). 0. a list of contours C is initialized.475
(~8. 4.
(ul.
('//'6.
(U9. but this changes as the first point is processed.0.0. v5).9160254
d9 = 1. and this quantity is positive. Because d5 is the smallest of the distances.84641016 d4 = 0.75). vl) = (0.Vlo) = (1. Thus. v5) = (0.13) is tested.8160254
with the distances as indicated. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
119
u--+
Fig. and it too satisfies inequality (1. 'O6) = (0.1).0.17320508.0065019587. so it is a starting
. This is also a point on a vertical boundary. 0.55).v8) = (1.2)9) = (1. Grandine.
(u7. In Step (3). The ordering of the distances is
d8 = 0.275 d7 = 0.22679492. v2) = (0. 0.7).2).2410254. 5. The value of the left hand side of the inequality is 0.

k \ \k \ x\. so the last two contours end there. ~). E ~ Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
\ \\ \ \ \
\1 . vv). ~2).5. Therefore. 0.62391682 "
Since the turning point is the middle of these three. (~6. and end at (uv. it must be that the two new contours start in between the other two. v~). v6) }. \ \ \
\\ \ \\ \
\
\\ \ \\ \ \\ \
\\
\
\~ x \ \
x\ \~. ~2). This point is a turning point for which the value on the left hand side of (1.120
TA.20) with d = d l and ordering the solutions along the panel boundary yields 0. vz).
The next point up is (u2. The current situation now has
. so the inequality (1. Vl). but once again it is not clear which two.5 J ' 0. two contours end here.vl). after processing the first two points. Thus. This reveals the three solutions. v 6 ) .29808608 ' \ 0. (u2. Thus. U--+
\ \
\\4 \ \ ~\
\\ \\
Fig. (~2. two new contours must start here. (~6. ordered from bottom to top along the panel boundary.
The next point in the lineup is (Ul.0048229398. (~2.34062956)' 0. two new contours.x \
\
\
\\\ \\ ~
\ \
\
\
tO
\'I v \
"r
6 x\ \ \. (~7. both starting at (u2.13). so it must get added to the list at the end. one of the contours must start at the left edge a t ( u 6 . (u6. so the inequality is satisfied. where to place them within C is not known. point. Solving (1.vT). Now the list is
c = {(~5. the list of contours must now be
c:
{ (. Thus.20) is 0.20) is checked. Thus. Grandine.00040825416. a new contour must be added to the end of the list.40250666 ' \0. v5). However. ~2).\2 \
\ \
b
\\
\
~. This is a turning point. ~7)}. ~5)..21) must be solved with d = d2. ~2). (~. Because it is on the left boundary.
Next up is (uT.85 J"
The last one is (Ul. so system (1. pass through (u]. The value on the left hand side of this inequality is -0. Vl). Example boundary and turning points. This is a point along the left edge which satisfies condition (1. v6)}. 5.72608318J' 0. v2) get added to the list to get
c = {(~5.

77658454)"
The first of these is the turning point. Solving (1.82679492"~ 0. At this point the situation is
c = {(u4. so two new turning points start here.. The next step is to process (u4. the topology of another contour is now known. These two can be combined into a single contour which starts at (us. and each of these is a point along the right boundary. is also a turning point. VlO). (u3. so two contours end. E g~ Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
\\ \ \ \ \
121
1
xx \
\\
x
\
\
\
\ \
\
\\ 3
\q \ \\ \
tO
\
2 •
5
\\ \
\\
\
\\
\
\\ \ \\4\ \\ \\
it-+
Fig. Thus. 4.21) with d = d3 and ordering the results reveals that the two contours which end are the last two. The first starts at (u. vz) and passes through (u3.043007984. test (1. 7.
v2)}.20) for this point is -0. vlo). This is another turning point. The endpoints of each of the contours are now correct and accurate. and in each case the condition is not satisfied. vs). a fact clarified by comparing this picture with the true contours shown in Fig.A. Identification of the first contour.
The next point. (u2. vs) and ends at (ulo. v9). This one is a closed loop which starts at (u2. The last three points to get processed are (us. and (ulo. so three more contours get removed from C. C = { (us.20) is not satisfied. v3).13) is performed in each case.21) with d = d4 gives (0. The last one is a contour which starts at (us. As these are vertical boundaries. v4). v8).
with the endpoints of two contours already identified.T. ' 0 9 ) . Thus.
(u4. v9).
(us. Grandine. v2) again. v4) and ends at (us. v4). 6.59303071J' { 0.2 J' {0.59987854"~ \0. passes through (u4. v8). 6. Solving (1. The second starts at (u4. vs).49390368"~ \0. and the value on the left hand side of (1.
(u2. and ends up at (u9.
. v4) and ends at (ug. contours end at each place. (u2.
(us.45199213' 0. ( U 9 . so two new contours get added to the start of the list:
c = {(u4. v3) before ending up at (u2. v2). The topology uncovered by this approach is depicted in Fig. but this time (1. v2) } with one contour identified as in Fig.6813072)( \0.

13). The topology of all the contours. The trick in all cases is to set up an eigenvalue problem and determine all solutions to a system of polynomial equations (Allgower et al. EIE Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134 7
1
]
10
u ---).
2. In the second case. an indeterminate result means that the turning point is a critical point. An alternative approach is to use the projected polyhedron algorithm as outlined in (Sherbrooke and Patrikalakis. sin 0 . but the details of the topology determination are sufficiently interesting to warrant it. 7. 1994). one detail got buried under the covers. This example is rather long. based on resultants. This happens. Fig. Manocha and Demmel. (1.. and (1. poses and solves a sequence of eigenvalue problems to guarantee finding all solutions. ray tracing. in the cases (1.. with minor modifications. the tests (1. at least three effective methods for doing this exist. In the case of (1. 1993). and curve/surface intersection). As presented in (Sherbrooke and Patrikalakis. too. Our particular software uses this latter approach. 1989). Grandine.13).11). 1992.11). 1993). so the point must be a turning point. either fu or f~. when the contour itself is tangent to either the edge of the parametric domain or to the panel boundary (see Fig. In the discussion. This is outlined in several papers by Manocha in a number of different contexts (e.122
ZA.g. 8). Topology resolution of singular cases
In some cases. Another approach. The first would be an interval Newton approach whose one dimensional version was discussed in (Grandine.13) is indeterminate. In the case of (1. When (1. In the case of tensor product spline systems. and that is that the algorithm requires a method for determining all solutions to a nonlinear system of equations. the contour is tangent to the panel boundary.11) and (1.20).fv cos 0 is zero. However. the algorithm works in the more general case of a spline system of equations.
. but software based on eigenvalue problems and resultants or interval arithmetic should work.11) or (1. this algorithm is used to determine all real solutions to a system of polynomial equations over a rectangle. curve intersection. the contour is tangent to either the edge of the parametric domain or to the panel boundary.20) are indeterminate. The first step is to figure out which of the pieces is zero. Each of these cases requires checking of higher order derivatives.

If f~. Assuming the intervals can be detected. In this case. sin 2 0 -
2fur sin 0 cos 0 +
fvv cos 2 0) < 0.5 -
v)v"(t)
> 0. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
123
\ \ \ \ \
73
\ \
J
u--~
Fig. In this case.3)
Another degeneracy occurs when the intersection of the boundary with the contours contains more than just isolated points. then the turning point is a local minimum or maximum of the function and hence an isolated turning point.5 -
v)fv (f~. This usually requires one of the tests (2. Grandine. When the test (1. Degenerate boundary contours.17) and the fact that f. If it lies outside. then the boundary intersection point can be ignored.
(2. a higher order check must be performed to determine whether the contour itself lies inside or outside the parametric region. The only difference in this case is that. this condition gives rise to (0.u sin 2 0 -
2f~.3). they can be ignored provided that their endpoints are correctly labeled as starting or ending points.20).TA. the local character of the function can be ascertained by examining the determinant of the Hessian matrix
f~. In this case. then the contour is tangent to the edge itself. intervals along the boundary coincide with pieces of the contour. the correct higher order condition is (u . the turning point in question is a critical point.
(2.2)
A similar condition can be checked along the vertical edges whenever fv = 0. as the contours themselves are usually smooth. If it lies inside.~.v sin 0 cos 0 + f ~ cos 2 0) < 0. This case gets handled properly by performing check (1. = 0..2) or (2.20) is indeterminate. In this case.5)f~. On the other hand. 8. if the determinant
. since the turning point is on the boundary. f~. then the point is an isolated contour point. ( f ~ .~ f~.
(2. The contour will lie inside the parametric region whenever (0.1)
Using Eqs. = 0. (1.0.~ f~v"
If this determinant is positive. only one new contour starts or ends instead of two. EW.

they are trajectories in [0. (Strictly speaking. so two contours cross there.a r t ' ( 7 ) = 0. EW. Grandine. v.) The tests (2. F~. will be an abbreviation for F~. depending on context.3) may also be indeterminate. 1]. with the same result. but it is not difficult.3)
which must hold for all r E [0. the idea will be to find all mappings from [0.(u(r). v).
. it is possible that the determinant may be zero. Similar abbreviations Fv. Differentiating the contouring equation (3. One additional complication is the possibility of open contours which start or end in the middle of the region. then the point is a saddle point. v = 0. s. v(7)) .1)
As before. In this case.(u. only four of which are accounted for by u = 0. (3. some information may be derived from the individual matrix entries without checking higher order derivatives. s. In the surface intersection case. t(7)) = 0
(3. 1] --+ [0.a(s(7). as in the planar cut case. but not enough to ascertain the topology of the contours completely. and v = 1. the desired contours are trajectories in [0.3)
Deriving a usable equation to get turning points takes a little more work than before. 1]2. a turning point is still characterized by u' (r) cos 0 + v' (r) sin 0 = 0. 1]2. in which case even higher order conditions must be checked.
(3.v) . (1. In the planar cut case. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
is negative. These can occur because the parametric region in [0. 1]4. Of course. Consider a parametric surface F parametrized by u and v and a parametric surface G parametrized by s and t. and t which satisfy
F(u.
3. Without loss of generality. As before.2)
A similar algorithm to that used for planar cuts can be used in the general surface intersection case. In this more general case. This will likely be an enhancement made to a future version of the software. 1] 4 n o w has eight boundaries consisting of each variable fixed at its upper or lower limit.2) with respect to the parameter r yields F u u ' ( 7 ) + f ~ v ' ( 7 ) .124
T.A. v. 1]4 (with components u.t) = 0. Here. The goal will be to find all points u. To make the algorithm work. the appropriate equations for turning points and the appropriate checks for starting and ending contours must be derived. Topology resolution for surface surface intersection
The surface intersection problem is harder than the planar cut problem.a s s ' ( 7 ) . u = 1. and t) such that
F(u(7). the topology can still be resolved by keeping track of the parts of the contours as they wend their way through the parameter space for F.2) and (2. These higher order conditions are not derived here. nor have we implemented them in our code. assume that each is parametrized over [0. it is a simple matter to identify the two appropriate contours in the list of current contours and interchange their positions.G(s. v(r)) or F~.

The four cases s = 0. (1. s ' ( r ) .5)
All the turning points and critical points will be solutions to this system of equations. the cases for the boundary of F and the boundary of G need to be processed separately.Fv cos 0) . the condition along the vertical edges can be derived.6) (3. Gs x Gt)(FusinO .7)
If the boundary point is on the boundary of G.8)
As above. 7@ i. the vector (u'(r).a ( 8 .G~ x Gt = 0. are used. the vector ( u ' ( r ) . Thus.t'(r)) must be a multiple of (3. FIE Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
125
Gs. Along the horizontal edges (v = 0 and v = 1). The null space of this matrix is given by
multiples of the vector
-I Fu Gs Gt l
-IF.1 d'-~" d. takes into account separately the signs of value in the range [-Tr. Grandine.G t ) . so the condition to check is (0.9) as the inverse trigonometric function which the numerator and denominator and returns a F O R T R A N a t : a n 2 function. and t = 1 generate contours which can start anywhere in the domain of F .v)(F~. (F~ sin 0 . In this case. u = 1.0 .3) becomes (F~ sin 0 .5 . Gt. t) = 0. a test that would work would be to compute du COS 0 + d~ sin 0 t a n .~. s'(r). that says that as s increases (3. (3.~ IFu Fv Fv Gtl GsI '
(3.. it can also be tested to determine whether it is a starting point or an ending point. and v = 1 this generates contours which start or end on the boundary of the surface F .5 . t = 0.G s . v ' ( r ) .4). s = 1.FvcosO).e. etc. (1. v'(T). t'(r)) is in the null space of the 3 x 4 matrix (Fu Fv . Similarly. In the case of the s = 0 boundary. and it is (u . v) . the condition is (0.T~ cos 0 ' d~ a-S where tan -~ is interpreted. Finding the contours which start on a boundary can be accomplished by setting one of the four parameters to zero or one and solving the remaining 3 x 3 system.A. Gs x Gt > 0. If the boundary point is on the boundary of F . (3.4)
where each of the entries is the determinant of the indicated 3 x 3 matrix. For the cases u = 0. G~ x Gt)(F. v = 0.Fv cos 0) • Gs x Gt = 0. Thus. 5 ) ( F ~ . the turning points will be solutions of the 4 x 4 system F ( ~ ..sinO .~ sin 0 -. If this quantity (the contour moves away from its boundary
.T. then it can be tested to determine whether it is a starting point or an ending point. F. in this case..F ~ c o s 0 ) . Gs x Gt > 0. Thus. the C or is positive.V)V'(T)(V'(T) sin 0 + ~fl(-r) cos 0) > 0.8) (3.

so it must be a start point for a new contour.14)
must be checked.t ) ( ~ s i n 0 .10)
The quantities d u / d s and d v / d s can be determined by parametrizing the contour locally by s at the edge point. the contour heads in the parameter space of F in the increasing panel direction.11)
This is a 3 x 3 linear system of equations in the variables du/ds. One easy way to do this would be to multiply both the numerator and the denominator of (3.12)
can be computed by plugging in the values du/dt and d v / d t which are generated by solving the 3 x 3 linear system du F dV F. that of determining whether two new contours start or two old contours end at a turning point. dt s (3. In particular. they can be ordered according to the magnitude of (3.t ) ( ~ c o s 0 + dv sin 0) ~tan-I ( 1 / 2 . This requires negating the values d u / d s and dv/ds. so some quantities are known. then it must be an endpoint for an old contour.s) prior to computing the inverse tangent
(1/2 c o s e + dv sin 0)
tan-I ( 1 / 2 -
s) ( ~ s i n 0 -
~dvCOS0)"
(3. since the contour must head in the increasing panel direction as s decreases. As before.. Similarly.14)
. F~ Gs x Gt = a \ sin0
cos0)
(3. For the t = 0 and t = 1 edges. dv/ds.. EV~ Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
in G).~-d~ COS0) (3. Grandine. For this. where the following equation must be satisfied duF.. Larger values will correspond to contours which lie above smaller values in either the previous or the next panel. Solving this system generates the values that can be plugged into (3.9) by (1/2 .9). One final problem remains. if the quantity is negative. and their magnitudes differentiate the various contour brances if there is more than one starting or ending contour at a point. dt ~' + dt v dS G .Gt = 0. the quantity ( 1 / 2 .126
TA. The condition for the s = 1 boundary is the opposite. the condition u" (r) cos 0 + v" (~-) sin 0 > 0 (1. this is known to be a turning point. (3. and dt/ds. dv F _ G s at ds u + ds ~ --~sGt =0.10) to determine whether it is a starting or ending point (and how it should be ordered if there is more than one).13)
The sign of these values again determine whether points are starting or ending points. If multiple contours start or end at that point.

17)
7 = (Fu~.15)
for some/3. The one dimensional contouring problem is the problem of finding the zero set of a mapping f : R '~+j -+ R ' . G~ x G t ) ( F ~ . (3.~ • Gs x G t ) ( F ~ . Gs x Gt)(P~. Contour tracking via spline collocation
Both the planar cut problem and the surface intersection problem are special cases of the more general contouring problem. Fv x G~
F~. If it is zero. F~ × Fv)
.20) (3. In general. x Fv) 2
+ 2(as~ • a s x a~)(as. Fv x a s
(3. Finally.
4. 1].3) yields
(F~. 1]. the zero set of f will be a one dimensional manifold whose various pieces can each be parametrized over [0. and two will end if it is negative. sin0) gives c~ : cos 0F~L • Gs x Gt + sinOFv • G~ x Gt.15) yield (~/32.. (Clark and
.(Gsss'(9-) + Gstt'(T))S'(T) -.
127
s'(~-) ] =/3
t' (~-) /
. x Fv). Similarly. Gs x Gt) 2
.F ~ .~ × rv)(a~.
The inner product of (3.19) (3.v'('r))u'('r) + (F. as × a. but their infrequency coupled with our ability to change the angle 0 if such an event occurs has allowed us to resist the temptation to do so here. Thus.14) with (cos0. Grandine.14) and (3..2(fu.)(F~.
(3..(Gs~ • G~ x G t ) ( G t " F. then higher order derivative conditions must be checked.16)
The inner product of this equation with Gs x Gt together with the substitutions (3. Gs x Gt)
+ (Fvv. 1] --+ ]I~n + l such that f ( x ( t ) ) = 0 for all t C [0.TA.v'(w))v'('r) . to find a mapping x: [0. Such conditions can be derived.(Gtt" Gs x Gt)(Gs • F. for each piece of the contour..y + U"(T) COS0 + v"(9-) sin 0 = 0.vu'('r) + Fv~.. F. the goal will be..18)
there. EN Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
for some c~.uu'(w) + F. where (3. two new contours will start at the given turning point if c~"/< 0 (3.(Gsts'(T) + Gttt'(T))t'(T) = O. a s x a t ) 2
. We propose to solve this problem by applying spline collocation to a two point boundary value problem for a differential algebraic equation of index two (cf.. Differentiating Eq.

Specifically. This technique has been analyzed in (Clark and Petzold. x " ( 0 • x ' ( t ) = 0.
x(o) =
(4. Grandine.
z(1) =zl. Thus. if z0 and acl are endpoints for the desiredpiece of the contour. m -
2. 1989) for the linearized version of this problem. . i.2) exactly at the collocation points. which depicts the analytical solution. the function z which is parametrized by arclength.
~'(t~) = 0. 9. E l~ Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
Petzold. 1989)). Solving this problem numerically is straightforward with standard techniques.
can be solved for a unique 2 C S.
This problem is well-posed whenever the desired contour of f is well defined. .
. 4 The goal will be to find 2 E S such that the distance between z and ~ is less than a user-specified error. but other techniques could also be used. One simple example is the planar cut example shown in Fig. from all possible functions which map to the contour. Our software uses the spline collocation method of de Boor and Swartz (1973). The first equation demands that the function z map to the contour. which. then the problem is to find the mapping z satisfying
=0. The computed solution is shown in Fig. make 2 satisfy Eqs.
2"(ti). 4.
(4. The second equation selects.
(4.3)
~(l) =x~. say
0 '~ tl < t2 < ' ' " < tin--2 "Q 1. (4. in this setup.. Numerical examples
We have tested our code on a number of examples. including shooting and finite differencing. i = 1 . . Spline collocation requires the selection of a spline space S whose members are all C I.2 collocation points are selected.128
T. and we have generated rendered images for some of them. where the red surface is the graph of the function (viewed from the upper right corner of 4A function is said to be G'k if the function and all of its derivatives up through order k are continuous functions. This makes the solution unique in a neighborhood of the desired contour and forces it to be parametrically wellbehaved. .2)
and the nonlinear system
~(0) = z0. if the dimension of the spline space is m. Many such functions have this property.
5.
f('2(t~))
=0.1)
z0. are chosen to be the Gauss points of each of the polynomial intervals of the spline space. then m . The approach is to use spline collocation.A.e.

TA. Gratzdinc. II.t
c
L
I. IO
v.
--.
Fig. E W Klein IV / Computer Aided Gcmzetric Design 14 (1997)
111-134
129
t e
Fig.
Fig. 9.
.

\
Fig. 8 . t4.+
// \
Fig.1.~
8
)"
Fig.130
ZA.
t
U.
. E I~ Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
I). Grandine.
\
\ /
"ll . 16.
Fig.
\. 17. 15.

A useful feature of our implementation of the planar cut algorithm is its ability to handle an arbitrary number of dependent variables.1) and (1. while the second plot corresponds to the blue surface. and one in blue. EW. one in red. and all of the contours passing through each of the panel boundaries. Resolving the topology and solving the four differential algebraic equations for the four components of the solution required 1.5 0. Grandine.T. The third column is the number of contour components in the solution. (1.3 12.2) requires the number of dependent variables to be three. Each figure consists of three parts.3 seconds of CPU time on the Sun Sparcstation 20.1 37. The first plot corresponds to the red surface. this allows for contouring of functions. in a simple and elegant way. In practice. as shown in Table 1 which reports CPU times for the Sparcstation 20. The second case is perhaps the most difficult of all. The solution consists of 28 separate components. to locate constant pressure curves along the wing using exactly the same software as is used to determine pressure profiles along airfoil sections. Some examples constructed using the surface intersection code are shown in Figs.3
28 11 2 1 2 1 4 1
parameter space). as in this case. and the yellow curves are graphs of the computed intersection curves.7 14. The curves in parameter space are shown in the right figure. This represents a very large number of nonlinear systems which must be solved. The second parts are the curves plotted in the parameter spaces of the two surfaces.8 8. The CPU requirements for each of these cases varied.7 3. A typical example might be pressure on an aircraft wing. all of the turning points (42 in all). the blue surface is the plane z = 0.3
Components
4
2 3 4 5 6 7 8 9
118. Our algorithm must find all of the points along the boundary (52 in all). and the computed intersection curves shown in yellow.A. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
131
Table 1 Case
1
Time (sec)
1. which can be modeled as a tensor product spline with four dependent variables (three geometric components for the wing surface and one component for the pressure field). Failure to find even one solution of one of the systems is likely to cause the
. The first part is a color picture of the two surfaces. as well as planar cutting of geometry.0 10. It has also proved useful in some analysis applications which have larger numbers of dependent variables. 10 through 17. Nothing in Eqs. This makes it possible.

which suggested several improvements to earlier versions of the algorithm and code. This case is difficult because of the presence of crossing contours. One additional interesting feature is the presence of closed. The planes which pass just above them generate three contours. the contours look very different in the parameter spaces of the two surfaces. E IE Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
entire algorithm to fail. Acknowledgements
This work is the culmination of several efforts undertaken by the authors during the course of the last five years. Nevertheless. namely the presence of contour portions very close to each other in the parameter space of the second surface. 10. all of which are found and resolved by our topology resolution code. Eric Brechner for his assistance in visualizing our results. but neither intersects the parametric boundary. In addition.132
T.
6. including four small pieces in the corners that do not even appear in the parameter space graph. and the surface intersection code. as well as his contribution of the ninth example. our spline system solver found everything it was supposed to find. This case is interesting because of the differences in scale between the two parametric regions. We thank Dr. The planes which pass just below them generate two contours which pass near each other at two points. nested loops in the interior. An intersection which runs completely across one parametric domain is only a tiny fraction of the other. after establishing the existence of the 28 intersection components. The ninth case is due to Bob Ames. but the picture of the torus intersecting the saddle surface from the sixth case is such a nice picture that we decided to show it. but not quite as nasty. We appreciate the funding and support for this work provided by Navy Contract #N61533-90-D-0033. The sixth case is a plane intersecting a surface through two of its saddle points. Our experiments. It shows half a ship hull intersecting the water. This problem is included here because some marching scheme codes have struggled with this phenomenon. solved all 28 differential algebraic equations to obtain the solutions shown in Fig. but it does demonstrate that contours can start and stop in the middle of parametric regions and that our code handles that case. The case shown here is the three contour case. one of which is closed. We continue to explore additional opportunities for expanding its capability and increasing its reliability. We tested this case for a plane which cuts right through the saddle points as well as for planes which pass just above and just below them. The eighth case is also pretty simple. It is characterized by 11 intersection components. suggest that our surface intersection code is very robust and efficient. The fifth case presents only one difficulty. It does demonstrate that contours closed in one parametric domain may not be closed in the other.
. coupled with our mathematical analysis of the surface intersection problem. The third case is similar. We are indebted to Bob Ames for his continual interest in and support of this effort. Grandine. The fourth case contains just two components.A. The seventh case is very simple.

R. Piegl. (1988). Numerical Solution of Boundary Value Problems in Differential-Algebraic Systems. J. Manocha. An improved test for closed loops in surface intersections.. Comput. C. T. H. Factor. Intersection of arbitrary surfaces.
References
Allgower.R. eds. Grandine. E. 205-207. Computer Aided Geometric Design 3. S. we thank Dr.. Computer-Aided Design 20. (1985)..TA. The method of resultants for computing real solutions of polynomial systems.W. 10. (1989). J. 3-16. R. 257-280. Geometric method of intersecting natural quadrics represented in trimmed surface form. B. L. Sederberg. Surlhce algorithms using bounds on derivatives. Topological and differential equation methods for surface intersections. (1988). de Boor. and Swartz. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
133
Most of all.. (1992).M. Jordan. M.. Berlin. J. (1988). in: Strasser. Sederberg.D. Bajaj. Kriezis. ed.295-311. D. R. 41-55. Chen.. A. (1987). and his keen insight.. Georg. Geometric approaches to nonplanar quadric surface intersection curves. R. Collocation at Gaussian points. David Ferguson for his unending support and encouragement of our work. and Markot.E. Hoffmann. Barnhill. An SSI Bibliography. Surface/surface intersection. Implementation of a divideand-conquer method for intersection of parametric surfaces. Asteasu. Christiansen. (1989). 347-352. 10. Tracing surface intersections. Computer-Aided Design 20.
. 915-936. On computing the intersection of a pair of algebraic surfaces. (1987). C. Sci. Detecting and rendering intersections of complex surfaces. (1989). advice.R. Filip. ACM Transactions on Graphics 6. 129-136. (1976)..N. H. Garrity. G. and Ozsoy. Computer Aided Geometric Design 5. C. 187-204. R. Loop detection in surface patch intersections.. SIAM. K. EW. and Wolter. C. ACM Transactions on Graphics 13. B.L. 285-307. N. K. L.505-508. in: Barnhill. 3527-3529.F. Geometry Processing for Design and Manufacturing. Farin. 274-307.D.J.. E. J. (1973). IBM Technical Disclosure Bulletin 18. and Miranda.M. 161-171. Computing zeros of spline functions. Computer-Aided Design 21.L. Kenneth. and Demmel. 73-100. (1989). and Kersey. T. (1990). Computer Aided Geometric Design 6. and Meyers. Magedson. 173-183. Computer Aided Geometric Design 2. G. Springer.-P. T.-P.G. Appel. 137-153. (1988). Miller. Patrikalakis.N... T.L. 533-538. Statist. R. R. C. Houghton. Computer Aided Geometric Design 4.R. Anal. (1986). Hopcroft.E. Computer Aided Geometric Design 5. Cheng.E. and Petzold.W. R. and Piper. (1989). Computer Aided Geometric Design 6. and experience freely shared along the way.E. A marching method for parametric surface/surface intersection. Computer-Aided Design 24. and Seidel. (1992).A. 582-606. and Warren. 831-844. SIAM J. C. Computer Aided Geometric Design 7. Grandine. Emnett. Algorithms for intersecting parametric and algebraic curves. W. (1989). J. G. Barnhill. (1992). D.A. S. Using plane vector fields to obtain all the intersection curves of two general surfaces. and Sabharwal.201-212. Part I: Simple intersections. (1994). R.M. Computer-Aided Design 21.. Predictor-corrector type of intersection algorithm tbr C 2 parametric surfaces.J. and Lynch. J. SlAM J. E-E. Numer. SIAM Journal of Numerical Analysis 29. and Katz. T. Farin. Theory and Practice of Geometric Modeling..

Klassen. Klein IV~ Computer Aided Geometric Design 14 (1997) 111-134
Sederberg. N. E. (1993).134
T. and Patrikalakis. (1991).
. Geometric Hermite approximation of surface patch intersection curves.K. and Wang. Sinha. P. in: Proceedings ACM Symposium on Computational Geometry. Kang (1995). Zhao. T. K. Preprint. Computation of the real solutions of nonlinear polynomial systems. Computer Aided Geometric Design 8. Grandine. Sherbrooke.W. EW. 97-114. T.. Exploiting topological and geometric properties for selective subdivision.C. Parametrization invariant marching method for SSI. MIT Ocean Engineering Design Laboratory Memorandum 91-12. E. and Nishita. (1985).M.A. 39--45.