10
Method for intersecting algebraic surfaces with rational polynomial patches G A Kriezis, P V Prakash* and N M Patrikalakis The paper presents a hybrid algorithm for the computation of the intersection of an algebraic surface and a rational polynomial parametric surface patch. This algorithm is based on analytic representation of the intersection as an algebraic curve expressed in the Bernstein basis; automatic computation of the significant points of the curve using numerical techniques, subdivision and convexity properties of the Bernstein basis; partitioning of the intersection domain at these points; and tracing of the resulting monotonic intersection segments using coarse subdivision and faceting methods coupled with Newton techniques. The algorithm described in the paper treats intersections of arbitrary order algebraic surfaces with rational biquadratic and bicubic patches and introduces efficiency enhancements in the partitioning and tracing parts of the solution process. The algorithm has been tested with up to degree four algebraics and bicubic patches. hybrid algorithm, Bernstein basis, algebraic surfaces, rational polynomial patches The computation of intersections of surfaces is a fundamental problem in computer-aided design and a widely needed operation in geometric modelling, analysis (finite element mesh generation) and simulation of manufacturing processes. The approaches to solution of surface intersection problems may be clasified into analytic, lattice, marching or subdivision methods. Analytic methods 1'2 can be used in a limited class of problems, where explicit representations of the intersection are available. Lattice evaluation methods 3'4 experience difficulties in recog- nizing the existence of small loops and singularities because of their discrete nature. Marching methods, s~ by far the most widely used, require starting points on every branch of the curve and may experience difficulties in tracing through regions where closely spaced features exist, because of the possibility of marching into incorrect portions of the curve. Starting points are commonly determined by combinations of lattice and subdivision methods 9. Subdivision methods ~° 18 have MIT, Department of Ocean Engineering, Design Laboratory, Massachusetts Instituteof Technology,Cambridge, MA, 02139, USA. * Prime Computer Inc Paper received: 10 July 1989. Revised:22 January1990 the important property that they are convergent in the limit but if used for high precision they lead to data proliferation and are consequently slow. In addition, if subdivision is stopped at some finite level, it may lead to missed loops and incorrect connectivity in the presence of singularities. Some of the recent algorithms combine one or more of the above methods, leading to hybrid techniques, which capitalize on the advantageous aspects of several simpler techniques. Recently Newton techniques to compute singular points of the intersection curve between two general parametric surfaces by exploiting the vector field of the distance function between the two surfaces were used 19. This methodology does not provide an automated way to determine initial approximations for these singular points nor a way to verify computation of all such points. A promising method 2° based on vector field ideas identifies components of the intersection set by marching along the so-called 'connecting curves', which are gradient lines of the vector field of the distance function. A common denominator of state-of-the-art techniques is the difficulty in handing singularities, surface overlap and efficiently identifying and resolving closely spaced features and small loops of the intersection curve. In the paper the authors introduce efficiency enhancements and coverage extensions to a new algorithm 21-23 to compute the intersection of an algebraic surface with a piecewise rational polynomial parametric surface patch such as a B-spline patch. The algorithm provides a capability to detect and describe all features of the intersection curve and trace them correctly. It is based on analytic representation of the intersection as an algebraic curve expressed in the Bernstein basis, automatic computation of the significant points of the curve using direct numerical techniques, verification of the computation of significant points using convexity properties of B-splines and subdivision, partitioning of the intersection domain at significant points and tracing of the resulting intersection segments using subdivision and faceting techniques. The new algorithm treats intersections of any algebraic surface with rational biquadratic and bicubic surface patches. Up to degree four algebraics and bicubic patches have been tested, although the implementation is not limited to such degree surfaces. In addition, the new algorithm allows computation of a class of intersections involving infinite singularities arising from surface tangency along volume 22 number 10 december 1990 0010-4485/90/100645-10 © 1990 Butterworth-Heinemann Ltd 645

Method for intersecting algebraic surfaces with rational polynomial patches

Embed Size (px)

Citation preview

Method for intersecting algebraic surfaces with rational polynomial patches G A Kriezis, P V Prakash* and N M Patrikalakis

The paper presents a hybrid algorithm for the computation of the intersection of an algebraic surface and a rational polynomial parametric surface patch. This algorithm is based on analytic representation of the intersection as an algebraic curve expressed in the Bernstein basis; automatic computation of the significant points of the curve using numerical techniques, subdivision and convexity properties of the Bernstein basis; partitioning of the intersection domain at these points; and tracing of the resulting monotonic intersection segments using coarse subdivision and faceting methods coupled with Newton techniques. The algorithm described in the paper treats intersections of arbitrary order algebraic surfaces with rational biquadratic and bicubic patches and introduces efficiency enhancements in the partitioning and tracing parts of the solution process. The algorithm has been tested with up to degree four algebraics and bicubic patches.

hybrid algorithm, Bernstein basis, algebraic surfaces, rational polynomial patches

The computation of intersections of surfaces is a fundamental problem in computer-aided design and a widely needed operation in geometric modelling, analysis (finite element mesh generation) and simulation of manufacturing processes.

The approaches to solution of surface intersection problems may be clasified into analytic, lattice, marching or subdivision methods. Analytic methods 1'2 can be used in a limited class of problems, where explicit representations of the intersection are available. Lattice evaluation methods 3'4 experience difficulties in recog- nizing the existence of small loops and singularities because of their discrete nature. Marching methods, s~ by far the most widely used, require starting points on every branch of the curve and may experience difficulties in tracing through regions where closely spaced features exist, because of the possibility of marching into incorrect portions of the curve. Starting points are commonly determined by combinations of lattice and subdivision methods 9. Subdivision methods ~° 18 have

MIT, Department of Ocean Engineering, Design Laboratory, Massachusetts Institute of Technology, Cambridge, MA, 02139, USA. * Prime Computer Inc Paper received: 10 July 1989. Revised: 22 January 1990

the important property that they are convergent in the limit but if used for high precision they lead to data proliferation and are consequently slow. In addition, if subdivision is stopped at some finite level, it may lead to missed loops and incorrect connectivity in the presence of singularities. Some of the recent algorithms combine one or more of the above methods, leading to hybrid techniques, which capitalize on the advantageous aspects of several simpler techniques. Recently Newton techniques to compute singular points of the intersection curve between two general parametric surfaces by exploiting the vector field of the distance function between the two surfaces were used 19. This methodology does not provide an automated way to determine initial approximations for these singular points nor a way to verify computation of all such points. A promising method 2° based on vector field ideas identifies components of the intersection set by marching along the so-called 'connecting curves', which are gradient lines of the vector field of the distance function. A common denominator of state-of-the-art techniques is the difficulty in handing singularities, surface overlap and efficiently identifying and resolving closely spaced features and small loops of the intersection curve.

In the paper the authors introduce efficiency enhancements and coverage extensions to a new algorithm 21-23 to compute the intersection of an algebraic surface with a piecewise rational polynomial parametric surface patch such as a B-spline patch. The algorithm provides a capability to detect and describe all features of the intersection curve and trace them correctly. It is based on analytic representation of the intersection as an algebraic curve expressed in the Bernstein basis, automatic computation of the significant points of the curve using direct numerical techniques, verification of the computation of significant points using convexity properties of B-splines and subdivision, partitioning of the intersection domain at significant points and tracing of the resulting intersection segments using subdivision and faceting techniques. The new algorithm treats intersections of any algebraic surface with rational biquadratic and bicubic surface patches. Up to degree four algebraics and bicubic patches have been tested, although the implementation is not limited to such degree surfaces. In addition, the new algorithm allows computation of a class of intersections involving infinite singularities arising from surface tangency along

volume 22 number 10 december 1 9 9 0 0010-4485/90/100645-10 © 1990 Butterworth-Heinemann Ltd 645

isoparametric curves. Finally, the efficiency and accuracy of the method is improved with a new partitioning scheme and the use of Newton iteration to refine the solution following a coarse subdivision and faceting.

The paper is structured as follows. First, the problem is formulated and the general method to compute the equation of the curve is provided. Next, a method to compute the significant points of the intersecting curve is summarized. Following that a new efficient partitioning scheme of the intersection domain is presented. Next an efficient and reliable tracing method for each branch of the curve is outlined. Finally, examples illustrating the properties of our algorithm are presented.

GOVERNING EQUATIONS

Given a rational parametric polynomial patch R(u, v) expressed in the Bernstein basis with degree q in u and r in v, we are interested in its intersection with an algebraic surface of the form

p p - i p - i j

C(x, y, z, w)--- E E E c,jkx'y i - 0 j = 0 k=0

(1)

where p is the degree of the surface and x/w, y/w, and z / w give the Cartesian coordinates of points on the algebraic surface. To obtain the representation of the intersection in the parameter space of the patch, we substitute the coordinates of the parametric patch in the algebraic surface equation

G(x, y, z, w ) = G(R(u, v ) )= F(u, v ) = 0 (2)

Such an equation, in general, represents an algebraic curve of degree pq in u and pr in v where u, v are restricted to the parametric space of patch R(u, v). For the intersection problem at hand, where we are interested only in a finite portion of the algebraic curve F(u, v) within a rectangular domain, it is expedient to represent the algebraic curve in the Bernstein basis

F(u, v)= ~. ~ w,~B,,m(u)Bj, n(,,)= O, i = 0 / = 0

(3)

where

ue[O, 1], ve[O, 1]

In the exceptional case, where wq = 0 for all i -- 0, 1 . . . m, j = 0, 1 . . . n, equation (3) does not define a curve as the intersection of two surfaces. It, rather, points out that the rational polynomial patch coincides with a portion of the algebraic surface. When the coefficients of the algebraic surface are normalized, and floating point arithmetic is employed, the condition I w,jl ~ ~, where 8 is a small positive number, may be used to test for such an exceptional occurrence. When the w~ are either all positive or all negative, there is no intersection since the Bi, m(u) and Bi.n(V) are always non-negative.

Direct computation of intersection curve equation

In the algorithm presented in Prakash 21, the computation of the intersection equation (3) was performed symbolically leading to expressions for w,i in terms of original data. This earlier algorithm was developed to treat intersections of planes and quadrics with up to rational-bicubic patches. The degree restriction stemmed from derivation of the representation of t~he algebraic curve of intersection using symbolic computations. For higher degree intersections this symbolic computation becomes prohibitively expensive in terms of storage and processing requirements.

The present algorithm uses a direct numerical evaluation of the algebraic curve representation using the Bernstein basis throughout the calculation, saving some unnecessary operations and avoiding intermediate use of the monomial basis 24. The only requirement is an ability to multiply Bernstein polynomials numerically 17

• ' \ i+j / ' '

(4)

Using this property, a method was developed to multiply two arbitrary Bernstein polynomials. For example, suppose we are intersecting a rational bicubic patch with the sphere x 2 + y 2 + z 2 _ w 2 = 0 . After substitution of the parametric patch in the algebraic surface equation each of the terms x 2, yZ, z 2 and w 2 can be computed separately using the multiplication property. The results can then be added together, to obtain the representation of the intersection curve in the Bernstein basis. For higher degree cases the multiplication property needs to be applied repeatedly, until the degree of each of the terms of the surface is obtained and addition can be performed. Since all the terms of the algebraic surface have the same total degree in x, y, z and w, this procedure is used to obtain the intersection curve equation without involving a degree elevation process.

Geometric interpretation of algebraic curves in rectangular domain

It is convenient to think of (3) as the intersection of the explicit surface w = F(u, v) with the control plane w = 0. The above explicit surface can be recast as a tensor product B6zier patch

T(u, v)---- ~, ~_, T,~B,.m(u)B~,n(V)where T = [u v w] i=0 j=0

Tq = [u; v~ w,,]

, i , j u~=- - ; vj=--i=O, 1 . . . . m j = O , 1 . . . . n (5)

m n

The coefficients wq introduced in (3) are the w coordinates of the control polyhedron vertices Tq of the parametric surface defined by the above equations while the u and v coordinates of control polyhedron vertices are uniformly spaced in the range of the parametric

646 computer-aided design

variables. The above reformulation was first used in a study of surface intersections 1~. A similar method has been used to represent algebraic curve portions within triangles 2s. Patrikalakis 26'27 introduced an extension of (5) to B-splines as a method of sculptured shape creation in terms of low-order piecewise algebraic curves and surfaces within rectangular boxes. As the control polyhedron provides an approximation of the geometry of the surface (5), we can get an approximation of the intersection curve (3) by intersecting a faceting of the control polyhedron with the plane w = 0. The accuracy of the approximate intersection curve depends on the accuracy to which the control polyhedron approximates the surface. As is well known, the control polyhedron becomes an increasingly better approximation of the surface by the use of subdivision. This geometric interpretation and subdivision is used during the tracing part of the authors' algorithm to compute approximate intersection points which are later refined by more efficient methods.

SIGNIFICANT POINT COMPUTATION

In order to enable detection of all features of the intersection curve, significant points of the intersection curve are determined and the domain is partitioned at these points. The significant points are:

• border points at which at least one parametric variable takes values equal to the borders of the parametric domain, e.g. F(u, 0 )= 0 for the v = 0 border

• turning points at which the normal vector to the curve is parallel to the parametric u or v axes. These may be defined by the following two sets of simultaneous equations

F(u, v)= 0, and Fu(u, v)= 0, v-turning points (6)

and

F(u, v )= 0, and Fv(u, v )= 0, u-turning points (7)

• singular points at which the first partial derivatives vanish,

F(u, v) = Fu(u , v) = Fv(u , v)= 0

Once all solutions of (6) and (7) are found, the singular points can be readily identified. The resulting pieces of the control surface after partitioning (hereafter referred to as subpatches) represent curve portions which can be approximated by intersecting a faceting of the control polyhedron of the subpatch with the control plane. The traced segments can then be connected together to reflect the actual connectivity of the curve.

Border point computation

For the computation of the border points of the algebraic curve of intersection, using the properties of the Bernstein basis we obtain a univariate polynomial

in the u or v direction. For v = 0 border points, for example,

F(u, O)=~ wioB~m(u)=O (8) i = 0

The real roots of the above type of polynomials of degree m or n in the parameter space of the control surface are found using recursive binary subdivision and the variation diminishing property that directly exploit the Bernstein basis 28. For efficiency, this method may be used just for root isolation in an interval, whereas accurate root computation may be performed with efficient direct numerical techniques.

Turning and singular point computation

The computation of turning and singular points can be reduced to the solution of two bivariate polynomials as in (6) or (7). Two such equations can, in theory, be solved using elimination techniques of algebraic geometry. Our experience with this technique showed that the high degree of the resulting polynomials and the characteristics of the elimination process, involving large scale computation, contribute to substantial loss of accuracy making the method unattractive for practical application. 21,29

For these reasons, direct numerical techniques (minimization and Newton methods) were employed. These methods depend only on evaluations of F(u, v) and its derivatives, which are of relatively low degree compared to the polynomials arising from elimination and, hence, suffer less inaccuracy in their computation. The above numerical methods require initial approxi- mations. To obtain such approximations automatically, we use a coarse subdivision of the control polyhedron of the curve of intersection. We then intersect the faceted approximation with the control plane to obtain a coarse approximation to the intersection curve. This coarse approximation does not reflect the true connectivity of the curve, but was found to provide good initial approximations for turning and singular points. More details on the automatic computation of starting points to turning and singular points can be found in Prakash2!

Direct numerical solution methods

Each of the starting points for the turning point computation is used to solve the system of equations (6) and (7) separately. As we are interested in locating singular points as well as turning points, the chosen method must be able to handle the presence of points in the domain where the Jacobian is singular. These situations can be handled by modified Newton algorithms 3°. Alternatively, the same problem can be handled as a minimization problem using a modified Gauss-Newton method by minimizing the sum of the residuals of the two nonlinear equations, ~° i.e. by minimizing P(u, v)= F2(u, v)+ F2(u, v).

In both minimization and Newton methods the required derivatives for the solution are explicitly available at all points in the domain and this contributes

volume 22 number 10 december 1990 647

to the reliability of these schemes. Because of the formulation of the minimization problem, an additional derivative of the algebraic curve is used at each stage of the sequence and this was found to improve the reliability of its convergence to the solution.

In numerical experimentation, with both methods, on a large number of examples of planar algebraic curves selected for their complexity and diversity and with a coarse initial subdivision, it was found that the minimization scheme was stable in that it always produced a solution very close to the correct solution but usually with reduced accuracy. The Newton technique on the other hand provided much better accuracy in the solution compared to the minimization method. Hence, in order to exploit both the stability of the minimization method and the increased accuracy provided by the Newton method, a combination of the two was used and proved successful in all the difficult test cases chosen.

Verification of significant point computation

In the authors' numerical experiments using a very coarse subdivision of the polyhedron, the above procedure was in a position to provide all turning and singular points of a variety of algebraic curves chosen for their complexity and diversity2L However, no guarantee exists that in general at least one starting point exists for every turning point nor that the iterative technique will converge to the appropriate turning point. To enhance reliability, a theoretical verification of the success of the above process to determine all turning and singular points is made using the following additional computation 2z23. The control surface is first partitioned using all available border, turning and singular points. Next, each subpatch is examined for possible intersection with the plane w = O, using the signs of w, i. This test eliminates non-intersecting subpatches. Next, the subpatches with possible intersection are examined for existence of any turning/ singular points away from the corners. This can be performed using the u and v derivative surface control points for each subpatch. Using the convex hull property, such polyhedra can verify the absence of turning/singular points not at corners of the subpatches (all control points except corner points are on one side of the control plane). In case of failure, the starting point/minimization-Newton technique above is invoked within the smaller subdomain and the above process of splitting at new turning/singular points and checking via the derivative patch is repeated until no more turning points can be detected.

The above method for obtaining starting points and computing turning and singular points is very useful because it does not depend on external information to initiate the procedure. In addition, unlike a method based on subdivision only ~, it allows accurate computation of turning/singular points with very little initial subdivision and rapidly convergent Newton-like iteration. The authors' method to identify turning and singular points could, in principle, be combined with marching methods because it provides all the necessary starting points on every segment of the curve and the

singularities of the curve. Marching was not preferred as it may lead to incorrect connectivity in the presence of constrictions (near-singular cases), as explained in the tracing scheme section below.

Treatment of' parametric line' components of curve

Before attempting to find the set of starting points for the turning point computation in the above manner, it is important to exclude situations where all points in an intersection branch are turning points like those on isoparametric lines. The authors' algorithm enables treatment of such situations involving infinite turning points of any multiplicity, by using factorization to remove these lines as indicated in Prakash 21. The first step in this process is to detect all parametric line components in the u and v direction using the computed border points. The parametric line components are then factored (repeatedly if their multiplicity is greater than one). The significant points of the remair:ing intersection curve components are then computed u~ing the direct numerical techniques and the domain is partitioned. The factored subpatches are traced and the parametric lines are added in the end to the list of intersection segments with correct connectivity.

PARTITIONING SCHEME FOR INTERSECTION DOMAIN

In the earlier algorithm 22, the first step of the tracing process was to split (partition) the control patch (intersection domain) along parametric lines passing through all significant points using a subdivision algorithm for B-spline surfaces. In this way, significant points were guaranteed to be on a corner of one of the subpatches and intersection segments in each of the subdomains were monotonic. More than one monotonic intersection segment in each subdomain may, however, arise.

However, there is a way to partition the intersection domain in a smaller number of subdomains compared to those used in the above algorithm and still ensure that intersection segments are monotonic and that significant points are on a corner of one of the subpatches. A tree structure is required to achieve this more economic partitioning of the domain, see Figure 1. The significant points are used in sequence to partition the domain, rather than simultaneously as in the earlier method. For each significant point on the border of a subdomain we partition the domain in two pieces using a line orthogonal to that border, while for each internal significant point we partition the domain in four pieces. Thus, each of the significant points becomes a node in the tree with two or four 'leaves'. When there are no remaining significant points in a subdomain the partitioning stops. At the end of partitioning, the final leaves of the tree correspond to subdomains potentially containing monotonic intersection segments, which require tracing.

The subdivision to extract the subpatches corres- ponding to a given parametric subdomain is performed during the tracing stage using a depth-first-search of the partitioning tree to reach each of the leaves of the

648 computer-aided design

1

D

2

9

10

c

A

pB

Figure "1. New partitioning scheme and tree structure

tree. Once tracing is performed for each of the subdomains, an algorithm for the connection of the monotonic segments is used relying on traversing the partition tree from the leaves to the root. At the top node the result is a list of monotonic connected intersection segments.

Figure 1 illustrates the partitioning for an algebraic curve with two border points, three turning points and one singular point. The resulting tree containing all the partitioning information is shown in the same figure. The new partitioning scheme reduces the number of subpatches that we need to extract and trace by a significant amount in most cases. In the example shown the old partitioning scheme requires extraction of 35 subpatches (20 with no intersection) as compared to 15 subpatches (six with no intersection) for the new scheme. The empty subdomains are discarded immediately in both cases, but the old scheme requires more subdomains to be tested for intersection and to be traced to obtain the intersection curve. Figure 2 is another example of a rather complex degree four algebraic curve with three self-intersections and ten turning points 11. For this example, the old scheme requires extraction of 112 subpatches (72 with no intersection), while the new scheme requires extraction of only 40 subpatches (20 with no intersection). As can

i F

\ J

Figure 2. New partitioning scheme for F(u, v ) = --6u 4 Jr- 21u 3 -- "/gu 2 -- 6U2V 2 -I- "/ ' /UV 2 -'[- 3V 2 -- 4V 4 = 0

be seen in these figures, the new scheme allows partitioning to closely bracket the curve and to efficiently concentrate all computing resources in places where there are intersection segments.

TRACING SCHEME

Approximate tracing of curve segments in a subdomain is based on a faceted approximation of the subpatch control polyhedron and intersection of this faceted approximation with the control plane. This approximation is later refined using an efficient Newton technique. In contrast to subdivision methods, the authors' tracing scheme does not subdivide the subdomain until a planarity condition is satisfied, before intersecting the remaining approximation to the subdomain. The earlier tracing algorithm used a triangulation of the control polyhedron of the subpatch to compute the intersection segments by intersecting triangular facets with the control plane. An important problem with any triangulation algorithm is that for closely spaced intersection features (constriction), the direction of triangulation (of the two possible) affects the connectivity of the approximation. Local subdivision is required to resolve this type of problem as pointed out by Rossignac 4 and Prakash 22. Another efficiency disadvantage of the earlier triangulation algorithm is the fact that each of the triangle edges is intersected twice with the control polyhedron, once for each neighbouring triangle. This, of course, was only done for programming simplicity.

Quadrilateral intersections

The tracing scheme is independent of triangulation, resolves closely spaced features automatically with subdivision and is more efficient. It is based on intersection of the edges of the quadrilaterials of the control polyhedron with the control plane. All the edges of the control polyhedron are intersected once with the control plane and the intersection information for the edges is assigned to each of the quadrilaterals to assist in the connection phase of the intersection segments. The type of intersection in each quadrilateral is determined by the number of edges of the quadrilateral that have an intersection, and the number of vertices that lie on the control plane. The intersection of each

volume 22 number 10 december 1990 649

edge with the plane is a straightforward line/plane intersection.

In the maiority of cases, there is a single intersection segment per quadrilateral and connectivity is easy to determine. The quadrilaterals with intersections in all edges suggest the existence of a closely spaced feature (constriction). Whenever such a situation is detected in the interior of the control polyhedron, knots are added in the interior of the quadrilateral with intersections in all four edges, until all these situations are resolved and correct connection can be achieved. This is always possible because all singular points are found a priori and used to subdivide the intersection domain.

Connection phase The intersection phase above gives a number of disconnected linear segments whose end points are close to the curve. The first step of the present connection method is to determine all possible starting points on the borders of the subpatch. We search for starting points in all the boundary edges of the control polyhedron. Figure 3 illustrates some of the types of starting points expected. Usually starting points are found in the interior of the boundary: see points A and C in Figure 3. The starting quadrilaterals and points $1 and $4 are adequate to determine the starting point information in these cases. Starting points at corners of the subdomain usually indicate significant points at these corners. If the corner is a singular point, a corner quadrilateral may exhibit a closely spaced feature. Point B in Figure 3 is a very common case and results in two starting points.

The case of a corner quadrilateral on the control plane requires special treatment. It usually signifies a higher order singularity, with possibly more than two segments starting from the corner. Figure 4 illustrates the procedure in a case with a number of quadrilaterals on the control plane next to a corner. First a list of edges which surrounds the 'shaded' domain of the patch is created. In the example shown, six quadrilaterals are on the control plane next to corner O and eight edges form the 'envelope' of these pieces. The list of edges on the 'envelope' is checked for possible

sl

$2 $4

s. I - - C

Figure 3. Starting point examples

Sl

~ / $ 2 ~ Envelope

0 ~ $3 Figure 4. Corner resolution scheme [or quadrilaterals on the control plane

intersection points. The number of intersection points on this list of edges signifies the number of segments starting from the corner of the patch. A linear initial approximation to the intersection segments from the intersection points to the corner is assumed and a number of points are added in this approximation depending on the distance of points $1, $2, $3 from the corner. The accuracy of this linear approximation is increased during the Newton iteration used to increase the accuracy of individual intersection points as explained below.

Once all starting points are found and starting quadrilaterals are determined, the connection phase begins at a starting point and proceeds, connecting the intersection segments in neighbouring rectangles until a quadrilateral is reached which corresponds to another starting point. In this way, all the separate pieces of the intersection curve are obtained in each of the subpatches.

Improvement of accuracy of intersection segments The connected list of points determined above in each subpatch are approximate points close to the intersection curve in parameter space. The earlier algorithm 22 uses these points to perform a check of the accuracy of computation of the intersection curve in parametric and three dimensional space. For points which did not satisfy the user specified accuracy tolerance, knots were added and the control polyhedron was subdivided. The connection phase was then repeated until all accuracy tolerances were satisfied. This is a time-consuming process, requiring several computation intensive iterations to achieve high accuracy in the approximation of the intersection curve.

Since the initial list of points is fairly close to the intersection curve in parameter space, applying a direct numerical technique, such as Newton iteration, allows very fast evaluation of accurate points, which normally satisfy all accuracy tolerance constraints after the first subdivision step. Such Newton iteration has been

650 computer-aided design

implemented to efficiently improve the accuracy of the initial piecewise linear segments.

From a point (ui, vi) close to the algebraic curve F(u, v) = 0, we move in the u or the v direction depending on the tangent direction to the algebraic curve calculated using the approximate intersection point. If the tangent to the intersection curve has a slope -Fu/Fv, such that - 1 ~< --Fu/Fv~< 1 ((--45, 45) degree slope), the most appropriate Newton iteration direction is along constant u parametric lines. If the slope is outside this range, the most appropriate Newton iteration direction is along constant v parametric lines.

For ordinary points a second-order Newton iteration is used. For movement along constant u parametric lines, the new v value is given by

V~e ~ = Vprev -- F/F v -- F2Fvv/(2F3v)

The iteration converges if the correction term is below a certain tolerance. If the iteration is slow to converge, as is the case close to singularities, we use a third-order Newton iteration to accelerate convergence. For the third-order Newton scheme, the improved value is given by Dahlquist 31

Vnew = Vpre~ -- F FFv -- F2Fv~/(2F 3)

where the function and its derivatives are evaluated at the value of the previous iteration step.

In the above Newton iteration only a limited number of iterations are allowed. Since the algebraic curve is defined in a bounded domain, the iteration is also not allowed to move beyond the domain. If the iteration does not converge in the allowable number of iterations, the direction of marching is changed and the iteration starts again from the initial starting point. This is usually encountered in cases where the slope of the algebraic curve is close to _ 45 degrees and our initial selection of marching direction is inappropriate. It also occurs very close to singularities. If the iteration does not converge in the other direction also, then the initial starting point is returned to and the iteration results are discarded. Since these points are inaccurate, the remaining accuracy tolerance checks are not satisfied and subdivision is triggered to improve the resolution of the control polyhedron, in a fashion similar to the earlier algorithm by Prakash 22. The final result of the intersection algorithm is a number of piecewise linear intersection segments. Higher order approximating curves can be fitted to the intersection points to reduce the data generated from the intersection algorithm.

The above procedure has been implemented and proved very successful in substantially speeding the tracing (and most time-consuming part of the algorithm), and in ensuring intersection points with a very high degree of accuracy at small incremental computational cost. The method has been tested in a large number of complex and diverse examples either new or drawn from Prakash 22.

NUMERICAL EXPERIMENTS The direct computation of the representation of the intersection curve in the parametric domain of the

patch enabled us to substantially expand the range of applicability of our approach. As implemented, the new algorithm allows computation of the intersection of any order algebraic surface with a rational biquadratic or bicubic patch. The highest order example computed involved the intersection of a torus with a bicubic patch (intersection curve of degree 12 in each parameter variable).

The tolerances for all the examples shown below had the following values. The relative tolerance used to distinguish two points in parameter space was 8so~ = 10 -1°. The relative tolerance used to evaluate if a point can be considered to be on the control plane (it reflects the accuracy of the intersection points in parameter space) was 8pJane= 10 -12. The parameter space of the parametric surface was normalized to [0, 1] x [0, 1], and the largest absolute value weight, I w~jl, in the algebraic curve of intersection was also normalized to 1. The tolerance for the distance accuracy of an approximate intersection point in 3D was 83D = 10 -1°.

Figure 5 illustrates the intersection of two torii of equal radii (larger radius 200 and smaller radius 50) with equatorial planes located at right angles. One of the torii is represented as a rational biquadratic B-spline patch, while the other torus is represented as a degree four algebraic surface. The intersection has four singular points which are identified by our algorithm. To examine the robustness of treating such high order intersection curves, we also modified the smaller radius of one of the torii to 50.01. The result is shown in Figure 6. As can be seen the singular points disappear, and connectivity is different. A similar test was performed with one torus of smaller radius 49.9999. Again the algorithm was able to distinguish the correct change in connectivity.

Figure 7 presents another example of intersection of a torus represented as an algebraic surface with a bicubic B@zier patch. The intersection is composed of two loops.

Beyond the examples of Prakash 22 and Patrikalakis 23, tracing of a number of additional algebraic curves was also performed. These algebraic curves are represented

Figure 5. Torus-torus intersection, equal radii

i volume 22 number 10 december 1990 651

Ill ,'

Figure 6. Torus-toms intersection, smaller radii 50.0 and 50.01, equal larger radii

Figure 7. Torus-bicubic patch intersection, two loops

in the Bernstein form in a rectangular domain. Figure 8 presents the two-sided offset curve of the parabola y = x 2 by a distance of 1.0 in the domain ( - 2 . 5 , 2.5) x ( - 1 . 0 , 2.5). This algebraic curve is of order 5 in the y and order 7 in the x direct ion and exhibits the interesting feature of four closely spaced significant points (three singular and one turn ing point). This curve was obtained from fitt ing an algebraic curve of the above orders to points on the two-sided offset of the parabola using singular value decomposi t ion 27. The singular value decomposi t ion technique in this case leads to an exact fit 32.

Figure 9 presents an algebraic curve which is composed of four isoparametric line components of mult ip l ic i ty one and illustrates the t reatment of such cases by our algorithm. The algebraic curve il lustrated in this figure has the equat ion

f(x, y) = (y -- 0.3)(y -- 0.6)(x -- 0.3)(x -- 0.7) = 0

Figures 10 and 11 il lustrate the result of a perturbat ion in this algebraic curve by adding 10 -9 and 10 2 to the

Figure 8. Two-sided offset of parabola y - x 2 = 0, by a distance of "1

Figure 9. Multi ale parametric lines

Figure 10. Perturbation of multiple parametric lines equation by 70 -9

652 computer-a ided design

Figure 11. Perturbation of multiple parametric lines equation by 70 -2

algebraic curve equation above or equivalently to each Bernstein coefficient. The authors' algorithm is able to automatically resolve the resulting closely spaced features.

Table 1 presents the total and the individual algorithm phases CPU times for the examples presented in the paper. In the table, the cost of computation of the equation of the algebraic curve of intersection, the cost of numerical computation of significant points, the cost of domain partitioning and tracing using faceting and Newton techniques, and the total cost of the algorithm which includes some overhead are provided. The machine used is a Silicon Graphics IRIS-4D 120GTX graphics workstation with one processor operating. For such a machine, the aggregate time required to perform 4M floating point operators (1M each of additions, subtractions, multiplications and divisions) is about 6 CPU seconds. Fifty to sixty per cent of the computation time is spent in recursive evaluation of the B-spline surface and its partial derivatives and applying subdivision in the various parts of the algorithm. The computation times presented in Table I are based on an experimental implementation. It is believed that a more refined implementation would further reduce these times.

CONCLUSIONS

The proposed algorithm provides a reliable method for computing the intersection of algebraic surfaces with rational polynomial parametric patches. The sequential- tree partitioning scheme using the significant points makes the subdivision procedure more efficient by closely bracketing the solution. The Newton-based iterative refinement after an initial generation of approximate intersection points with a subdivision method, substantially improves the efficiency of pure subdivision algorithms in accurately solving intersection problems. Some of the elements of this algorithm, such as the computation of significant points and the tracing scheme have been extended to solve the more general problem of intersecting two rational polynomial parametric patches 33.

A C K N O W L E D G E M E N T S

This work was supported in part by the MIT Sea Grant College Program and the National Science Foundation under grant numbers NA86AA-D-SG0089 and DMC- 8720720 respectively. Mr E C Sherbrooke assisted in the implementation. The authors appreciated the reviewers' comments which improved the quality of the paper.

R E F E R E N C E S

1 Levin, J Z 'Mathematical models for determining the intersections of quadric surfaces Computer Vision Graph. Image Proc. Vol 11 (1979) pp 73-87

2 Sarraga, R F 'Algebraic methods for intersections of quadric surfaces in GMSOLID Comput. Vision, Graph. Image Proc. Vol 22 (1983) pp 222-238

3 Varady, T 'Surface-surface intersections for double- quadratic parametric patches in a solid modeller' Proc. UK-Hungarian Seminar on Computational Geometry for CAD/CAM, Cambridge University UK (1983)

4 Rossignac, J R and Requicha, A A G 'Piecewise- circular curves for geometric modeling' IBM Journal of Research and Development Vol 31 No 3 (1987) pp 296-313

5 Farouki, R T 'The characterization of parametric

Table 1. Computational cost of intersection examples: all times in CPU seconds

Example Computation of Numerical computation curve equation of significant points

Tracing Total time

Figure 2 0 4.5 8.2 Figure 5 8.7 33.8 28.4 Figure 6 8.7 33.9 31.3 Figure 7 2.6 16.3 44.5 Figure 8 0 14.8 21.1 Figure 9 0 0.5 0.1 Figure 10 0 4.0 3.2 Figure 11 0 1.4 2.1

13.7 72.9 75.8 64.1 36.9 1.0 7.7 3.8

volume 22 number 10 december 1990 653

surface sections' Comput. Vision, Graph. and Image Processing Vol 33 (1986) pp 209-236

6 De Montaudouin, Y, Tiller, W and Void, H 'Applications of power series in computational geometry' Comput.-Aided Des. Vo118 No 10 (1986) pp 514-524

7 Bajaj, C L, Hoffmann, C M, Hopcroft, J E and Lynch, R E 'Tracing surface intersections' Comput.-Aided Geom. Des. Vol 5 (1988) pp 285-307

8 Chen, J J and Ozsoy, T M 'Predictor-corrector type of intersection algorithm for C 2 parametric surfaces' Comput.-Aided Des. Vol 20 No 6 (1988) pp 347 352

9 Barnhill, R E, Farin, G, Jordan, M and Piper, B R 'Surface/surface intersection' Comput.-Aided Geom. Des. Vol 4 (1987) pp 3-16

10 Lane, J M and Riesenfeld, R F 'A theoretical development for the computer display and generation of piecewise polynomial surfaces. IEEE Trans. PAMI 2 (1980)

11 Geisow, A 'Surface interrogations' PhD thesis, School of Computing Studies and Accountancy, University of East Anglia, Norwich NR4 7TJ, UK (1983)

12 Peng, Q S 'An algorithm for finding the intersection lines between two B-spline surfaces Comput.-Aided Des. Vol 16 No 4 (1984) pp 191-196

13 Petersen, C S 'Adaptive contouring of three- dimensional surfaces Comput.-Aided Geom. Des. Vol 1 (1984) pp 61-74

14 Thomas, S W Modeling Volumes Bounded by B-Spline Surfaces. PhD thesis, Department of Computer Science, University of Utah, Salt Lake City, Utah, USA (1984)

15 Dokken, T 'Finding intersections of B-spline represented geometries using recursive subdivision techniques Comput.-Aided Geom. Des. Vol 2 (1985) pp 189-195

16 Houghton, E G, Emnett, R F, Factor, J D and Sabharwal, C L 'Implementation of a divide-and- conquer method for intersection of parametric surfaces Comput.-Aided Geom. Des. Vol 2 (1985) pp 173-183

17 Solomon, B J Surface Intersection tor Solid Modelling PhD thesis, Clare College, University of Cambridge, UK (1985)

18 Lasser, D 'Intersection of parametric surfaces in the Bernstein-BEzier representation' Comput.-Aided Des. Vol 18 No 4 (1986) pp 186-192

19 Markot, R P and Magedson, R L 'Solutions of tangential surface and curve intersections' Comput.- Aided Des. Vol 21 No 7 (1989) pp 421--429

20 Cheng, K-P 'Using plane vector fields to obtain all the intersection curves of two general surfaces' in Strasser, W. and Seidel, H.P. (ed.) Theory and Practice of Geometric Modelling Springer, Berlin (1989) (in press)

21 Prakash, P V Computation ot surface-surface intersections tor geometric modeling MIT Sea Grant Massachusetts Institute of Technology, Cambridge, MA, USA (1988)

22 Prakash, P V and Patrikalakis, N M Sudace-to-surtace intersections for geometric mdeling MIT Sea Grant Report No 88-8 (1988)

23 Patrikalakis, N M and Prakash, P V 'Surface inter- sections for geometric modeling' Journal of Mechanical Des. ASME Trans. Vol 112, pp 100-107 (1990)

24 Farouki, R T and Rajan, V T 'On the numerical condition of polynomials in Bernstein form' Comput.-Aided Geom. Des. Vol 4 (1987) pp 191-216

25 Sederberg, T W 'Planar piecewise algebraic curves' Comput.-Aided Geom. Des. Vol I (1984) pp 241-255

26 Patrikalakis, N M 'Piecewise algebraic curves in terms of B-splines' Cambridge, MA: MIT Ocean Engineering Design Laboratory Memorandum 87-5 (1987)

27 Patrikalakis, N M and Kriezis, G A 'Representation of piecewise continuous algebraic surfaces in terms of B-splines' The Visual ComputerVol 5 No 6 (1989) pp 360-374

28 Lane, J M and Riesenfeld, R F 'Bounds on a polynomial' BIT: Nordisk Tidskrift for Informations- Behandling Vol 21 No 1 (1981) pp 112-117

29 Patrikalakis, N M and Prakash, P V Computation of algebraic and polynomial parametric surface inter- sections MIT Sea Grant Report No 87-19 (1987)

30 NAG Fortran Library Manual Mark 13 ed. Numerical Algorithms Group, Oxford, UK (1989)

31 Dahlquist, G and Bjorck, A Numerical Methods Prentice-Hall Inc, USA (1974)

32 Farouki, R T and Neff, C A 'Algebraic properties of plane offset curves' Comput.-Aided Geom. Des. (1990) (in press)

33 Kriezis, G A Algorithms for rational spline surface intersections Ph.d thesis, Massachusetts Institute of Technology, Cambridge, MA, USA (1990)

654 computer-aided design