surface self-intersection computation via algebraic decomposition

7
Computer-Aided Design 41 (2009) 1060–1066 Contents lists available at ScienceDirect Computer-Aided Design journal homepage: www.elsevier.com/locate/cad Surface self-intersection computation via algebraic decomposition Gershon Elber a,* , Tom Grandine b , Myung-Soo Kim c a Department of Computer Science, Technion – IIT, Haifa 32000, Israel b The Boeing Company, Seattle, WA, United States c School of Comp. Science and Eng., Seoul National University, Seoul, Republic of Korea article info Article history: Received 26 June 2008 Accepted 16 July 2009 Keywords: Surface self-intersection Multivariate polynomial constraints Redundant components Algebraic decomposition abstract This work draws upon a recent result (Pekerman et al., 2008) [3] on self-intersection detection and elimination for planar curves, which attempted to eliminate redundant algebraic components. We extend this result to surfaces and bivariate functions. An algebraic decomposition is presented that reformulates the surface self-intersection problem using an alternative set of constraints, while removing the redundant components. Extensions to higher dimensions are also briefly discussed. © 2009 Elsevier Ltd. All rights reserved. 1. Introduction The detection of self-intersections in freeform curves and sur- faces and more so, the exact computation of the self-intersection locations, are difficult problems that have been addressed by the geometric modeling community, for several decades [1]. Only a few results are currently available on the problem of self- intersections of freeform curves, and even fewer results in the case of freeform surfaces. Self-intersection detection and elimination is a crucial problem, for example, in the computation of offsets for NC machining and robot navigation [2]. Once the shape’s offset extends beyond the local radius-of-curvature, a self-intersection is bound to occur in the offset. While the non-degenerate self-intersection of univariates is a single point or a finite set of such points, the non-degenerate self- intersection of bivariate surfaces can comprise several univariate components. Thus, it is considerably more difficult to deal with the self-intersection of freeform surfaces. In this paper, we consider this more general problem by extending the algebraic method of Pekerman et al. [3], where redundant components were removed from the characterizing algebraic equation of a curve self- intersection. In Pekerman et al. [3], it was shown that, given a polynomial parametric curve C and the algebraic self-intersection expression C (u) - C (v) = 0, the linear term (u - v) could be eliminated algebraically, without resorting to solving a set of linear equations numerically as in [4]. Because this elimination scheme serves as the basis of our current work, we briefly discuss the basic idea here. * Corresponding author. Tel.: +972 4 829 4338; fax: +972 4 829 5538. E-mail address: [email protected] (G. Elber). Let I(u,v) = C (u) - C (v), for some polynomial curve C . Using a monomial basis, we can see that I contains the factor (u - v), once: C (u) - C (v) = n X i=0 a i u i - n X i=0 a i v i = n X i=1 a i (u i - v i ). An equivalent basis for the polynomials that is common in geometric design is the Bézier basis functions. A Bézier curve is defined as: C (t ) = n X i=0 P i θ n i (t ), (1) where P i is the i’th Bézier control point and θ n i (t ) is the i’th Bézier basis function of degree n, θ n i (t ) = ( n i ) t i (1 - t ) n-i . To remove all redundant solutions along the diagonal line u = v, we seek to eliminate (u - v) from I(u,v). Now consider a bivariate Bézier function representing I(u,v), known to hold the factor of (u - v); we seek to find the Bézier bivariate function b I(u,v) (that exists under our assumption) such that (u - v) b I(u,v) = I(u, v). In the Bézier basis function terms, this reduces to (u - v) n-1 X i=0 n-1 X j=0 p ij θ n-1 i (un-1 j (v) = n X k=0 n X l=0 q kl θ n k (un l (v). (2) More explicitly, in [3] we can find the following result: Theorem 1.1. Let I(u,v) = m k=0 n l=0 q kl θ m k (un l (v) be a biva- riate polynomial in the Bézier basis known to contain a factor of 0010-4485/$ – see front matter © 2009 Elsevier Ltd. All rights reserved. doi:10.1016/j.cad.2009.07.008

Upload: gershon-elber

Post on 26-Jun-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Computer-Aided Design 41 (2009) 1060–1066

Contents lists available at ScienceDirect

Computer-Aided Design

journal homepage: www.elsevier.com/locate/cad

Surface self-intersection computation via algebraic decompositionGershon Elber a,∗, Tom Grandine b, Myung-Soo Kim ca Department of Computer Science, Technion – IIT, Haifa 32000, Israelb The Boeing Company, Seattle, WA, United Statesc School of Comp. Science and Eng., Seoul National University, Seoul, Republic of Korea

a r t i c l e i n f o

Article history:Received 26 June 2008Accepted 16 July 2009

Keywords:Surface self-intersectionMultivariate polynomial constraintsRedundant componentsAlgebraic decomposition

a b s t r a c t

This work draws upon a recent result (Pekerman et al., 2008) [3] on self-intersection detection andelimination for planar curves, which attempted to eliminate redundant algebraic components. Weextend this result to surfaces and bivariate functions. An algebraic decomposition is presented thatreformulates the surface self-intersection problem using an alternative set of constraints, while removingthe redundant components. Extensions to higher dimensions are also briefly discussed.

© 2009 Elsevier Ltd. All rights reserved.

1. Introduction

The detection of self-intersections in freeform curves and sur-faces and more so, the exact computation of the self-intersectionlocations, are difficult problems that have been addressed by thegeometric modeling community, for several decades [1].Only a few results are currently available on the problemof self-

intersections of freeform curves, and even fewer results in the caseof freeform surfaces. Self-intersection detection and elimination isa crucial problem, for example, in the computation of offsets forNC machining and robot navigation [2]. Once the shape’s offsetextends beyond the local radius-of-curvature, a self-intersection isbound to occur in the offset.While the non-degenerate self-intersection of univariates is a

single point or a finite set of such points, the non-degenerate self-intersection of bivariate surfaces can comprise several univariatecomponents. Thus, it is considerably more difficult to deal withthe self-intersection of freeform surfaces. In this paper, weconsider this more general problem by extending the algebraicmethod of Pekerman et al. [3], where redundant components wereremoved from the characterizing algebraic equation of a curve self-intersection.In Pekerman et al. [3], it was shown that, given a polynomial

parametric curve C and the algebraic self-intersection expressionC(u) − C(v) = 0, the linear term (u − v) could be eliminatedalgebraically, without resorting to solving a set of linear equationsnumerically as in [4]. Because this elimination scheme serves as thebasis of our current work, we briefly discuss the basic idea here.

∗ Corresponding author. Tel.: +972 4 829 4338; fax: +972 4 829 5538.E-mail address: [email protected] (G. Elber).

0010-4485/$ – see front matter© 2009 Elsevier Ltd. All rights reserved.doi:10.1016/j.cad.2009.07.008

Let I(u, v) = C(u)− C(v), for some polynomial curve C . Usinga monomial basis, we can see that I contains the factor (u − v),once:

C(u)− C(v) =n∑i=0

aiui −n∑i=0

aivi =n∑i=1

ai(ui − vi).

An equivalent basis for the polynomials that is common ingeometric design is the Bézier basis functions. A Bézier curve isdefined as:

C(t) =n∑i=0

Piθni (t), (1)

where Pi is the i’th Bézier control point and θni (t) is the i’th Bézierbasis function of degree n, θni (t) =

( ni

)t i(1− t)n−i.

To remove all redundant solutions along the diagonal line u =v, we seek to eliminate (u − v) from I(u, v). Now consider abivariate Bézier function representing I(u, v), known to hold thefactor of (u − v); we seek to find the Bézier bivariate functionI(u, v) (that exists under our assumption) such that

(u− v)I(u, v) = I(u, v).

In the Bézier basis function terms, this reduces to

(u− v)n−1∑i=0

n−1∑j=0

pijθn−1i (u)θn−1j (v) =

n∑k=0

n∑l=0

qklθnk (u)θnl (v). (2)

More explicitly, in [3] we can find the following result:

Theorem 1.1. Let I(u, v) =∑mk=0

∑nl=0 qklθ

mk (u)θ

nl (v) be a biva-

riate polynomial in the Bézier basis known to contain a factor of

G. Elber et al. / Computer-Aided Design 41 (2009) 1060–1066 1061

(u − v). Then, I could be represented as (u − v)I(u, v), whereI(u, v) =

∑m−1i=0

∑n−1j=0 pijθ

m−1i (u)θn−1j (v) and

p0,j−1 = −njq0j,

pi,j−1 =ijn− jm− i

pi−1,j −njmm− i

qij, i > 0.

Proof. See [3]. �

Now we consider a polynomial parametric surface S(u, v)and its potential self-intersections. A direct attempt to solve forJ(u, v, r, t) = S(u, v) − S(r, t) = 0 yields three equations(in x, y and z components) in four unknowns (u, v, r and t),seeking the univariate sub-space solution of the self-intersections.Unfortunately, those equations all vanish when (u = r) and (v =t) and therefore a direct attempt to solve these equations is boundto fail, detecting the entire 2-dimensional parametric domain ofthe original surface as a valid solution. Extending Theorem 1.1 tohigher dimensions (i.e. surfaces) is non-trivial. It is quite simpleto verify that the obvious attempt at extending the univariatecase, using the factor (u − r)(v − t), fails as this factor is simplynot included in J. In this work, we present an extension of thecurve case to bivariate functions and propose a proper algebraicdecomposition and factor elimination for surfaces as well.The rest of this paper is organized as follows. In Section 2, we

briefly review related previous results. In Section 3, the bivariateextension is presented with an algorithm for algebraic decompo-sition. In Section 4, the problem of surface self-intersection de-tection and computation is presented and examples are shown.Section 5 considers the extension of the presented results to ar-bitrary dimensions. Finally, we conclude in Section 6 with someadditional considerations.

2. Related work

Ho and Cohen [5] developed a divide-and-conquer algorithmfor computing the self-intersection curves of a surface, which isbased on a necessary condition for self-intersection that can betested using the normal and tangent bounding cones of the surface.Galligo and Pavone [6] presented two algebraic methods for

computing a self-intersection locus for a Bézier bicubic surface.Using a specific sparse resultant, the first method produces animplicit equation of a plane projection of this locus. The second oneaccurately computes the coordinates of critical points on this locus,by solving a system of four polynomial equations in four variables,derived from a previously computed plane projection of the self-intersection locus.Attempts were similarly made to divide a potentially self-

intersecting surface into injective maps [7]. Because the self-intersecting regions are not necessarily iso-parametric, thistypically amounts to a large number of subdivisions. Skytt [8] alsorecently reported an approach that delineates the topology of theself-intersections; however, in many cases, the topology can bequite complex.It is a non-trivial task to detect and trim all local and global self-

intersections in offset curves and surfaces [9,10]. Lee et al. [10]applied a plane sweep algorithm to detect all self-intersectionsof planar offset curves. The plane sweep approach is, however,difficult to implement. Elber and Cohen [9] detected local self-intersections of offset curves by checking whether the tangentfield of the curve, C(t), and that of its offset, Co(t), have oppositedirections. The tangent field approach [9] is limited to detectinglocal self-intersections only. A similar approach was used in [11]to detect and eliminate self-intersections in sweep surfaces.Recently, Elber [12] and Seong et al. [13] presented schemes to

trim both local and global self-intersections of offset curves and

surfaces. An analytic distance map is derived between the originalcurve/surface and its offset. The problem is then posed as a setof polynomial constraints over an offset curve/surface, resolvingall the local and global self-intersection regions. The trimming ofthese regions is completed by projecting the zero-set of polynomialequation(s) into the desired parametric domain. The proposedmethod is efficient and robust.Wang [14] proposed an algorithm to compute the intersection

curve between two offset surfaces. The method is based on theconcept of normal projection. The intersection is represented inthe parameter spaces of the base surfaces and no offset surfaceapproximation is needed. This algorithm can also deal with globalself-intersections, but not local self-intersections. Aomura andUehara [15] presented a similar approach based on numericalintegration starting from random initial points. Nevertheless, thismethod does not guarantee the detection of all the components ofself-intersections.Maekawa and Patrikalakis [16] presented a method for tracing

self-intersection loops in the parameter domain. In their method,starting points are computed by solving a system of fivenonlinear polynomial equations in five variables; nonetheless,their algorithm requires special treatment for trivial solutions.Wallner et al. [17] considered the problem of computing themaximum offset distance that guarantees no local or global self-intersections.Maekawa et al. [4] made the observation that the term (u− v)

always exists in the self-intersection expression of C(u)− C(v) =0. A numeric elimination procedure is presented that removesthe term (u − v). The procedure poses the problem as a set oflinear constraints in the coefficients of the reduced expression oflower order. Given that this observation is crucial to efficientlyfinding self-intersection locations, Pekerman et al. [3] presentedan efficient algorithm that directly eliminates the linear term(u − v) algebraically, without resorting to solving a set of linearequations numerically. Thiswork takes a similar approach towardsthe computation of surface self-intersections.

3. Algorithm

In order to extend Theorem 1.1 to the bivariate case, we needthe following well-known algorithm of de Casteljau [18]. Let θmi (t)be the i’th Bézier basis function of degreem, and consider theBéziercurve c(t).

Lemma 3.1 (de Casteljau Algorithm for Curves).

c(t) =m∑i=0

piθmi (t)

= (1− t)m−1∑i=0

piθm−1i (t)+ tm∑i=1

piθm−1i−1 (t)

= (1− t)c1(t)+ tc2(t), (3)

where c1(t) is a Bézier curve consisting of all control points of c(t) butthe last one and c2(t) is a Bézier curve consisting of all control pointsof c(t) but the first one.

Now consider a Bézier surface s(u, v),

Lemma 3.2 (de Casteljau Algorithm for Surfaces).

s(u, v) =m∑i=0

n∑j=0

pijθmi (u)θnj (v)

= (1− u)(1− v)m−1∑i=0

n−1∑j=0

pijθm−1i (u)θn−1j (v)

1062 G. Elber et al. / Computer-Aided Design 41 (2009) 1060–1066

+ u(1− v)m∑i=1

n−1∑j=0

pijθm−1i−1 (u)θn−1j (v)

+ (1− u)vm−1∑i=0

n∑j=1

pijθm−1i (u)θn−1j−1 (v)

+ uvm∑i=1

n∑j=1

pijθm−1i−1 (u)θn−1j−1 (v)

= (1− u)(1− v)s11(u, v)+ u(1− v)s21(u, v)+ (1− u)vs12(u, v)+ uvs22(u, v) (4)

where s11(u, v) is a Bézier surface consisting of all control points ofs(u, v) but the last row and column, etc.

We are now ready to state the main result of this paper. Con-sider a surface s(u, v), having independent parameterizations asboth s(u, v) and s(r, t). Then, we have

Theorem 3.3. The algebraic expression

J(u, v, r, t) = s(u, v)− s(r, t)

could always be decomposed and represented as

J(u, v, r, t) = (u− r)J1(u, v, r, t)+ (v − t)J2(u, v, r, t), (5)

for some vector of functions, Ji, i = 1, 2, of lower degree.

Proof. By induction, but we first modify the representation ofs(u, v) a bit, using Lemma 3.2,

s(u, v) = (1− u)(1− v)s11(u, v)+ u(1− v)s21(u, v)+ (1− u)vs12(u, v)+ uvs22(u, v)

= s11(u, v)+ u(s21(u, v)− s11(u, v))+ v(s12(u, v)− s11(u, v))+ uv(s11(u, v)− s21(u, v)− s12(u, v)+ s22(u, v))

= s1(u, v)+ us2(u, v)+ vs3(u, v)+ uvs4(u, v), (6)

to yield

s(u, v)− s(r, t) = (s1(u, v)− s1(r, t))+ (us2(u, v)− rs2(r, t))+ (vs3(u, v)− ts3(r, t))+ (uvs4(u, v)− rts4(r, t)). (7)

We start by proving that Theorem3.3 holds for a bilinear surfaces, with si, i = 1, 2, 3, 4, which are all constants, denoted ai,

J(u, v, r, t) = s(u, v)− s(r, t)= (a1 + ua2 + va3 + uva4)− (a1 + ra2 + ta3 + rta4)= (u− r)a2 + (v − t)a3 + (uv − rt)a4= (u− r)a2 + (v − t)a3 + (uv + ut − ut − rt)a4= (u− r)a2 + (v − t)a3 + (u(v − t)+ t(u− r))a4= (u− r)(a2 + ta4)+ (v − t)(a3 + ua4).

Now assume Theorem 3.3 holds for one degree less in bothdirections and reconsider Eq. (7), for the general, higher degreecase. Being one degree less, the first term on the right side of Eq.(7) holds by the induction hypothesis. Examine the second termof Eq. (7),

us2(u, v)− rs2(r, t)= us2(u, v)− us2(r, t)+ us2(r, t)− rs2(r, t)= u(s2(u, v)− s2(r, t))+ (u− r)s2(r, t),

with the first term holding by the induction hypothesis, and thesecond containing (u− r). Same for the third term of Eq. (7). Now

examine the last term of Eq. (7),

uvs4(u, v)− rts4(r, t) = uvs4(u, v)− uts4(u, v)+ uts4(u, v)− uts4(r, t)+ uts4(r, t)− rts4(r, t)= u(v − t)s4(u, v)+ ut(s4(u, v)− s4(r, t))+t(u− r)s4(r, t), (8)

of which the first term contains (v − t), the last (u − r), and themiddle holds by the induction hypothesis. �

We would like to gain some more insight and show theconnection of this decomposition to the univariate case, presentedin Eq. (2). Consider the following simpler, yet non-constructive,decomposition of Eq. (5):

s(u, v)− s(r, t) =(s(u, v)− s(r, v))

u− r(u− r)

+(s(r, v)− s(r, t))

v − t(v − t)

= M1(u, v, r)(u− r)+M2(r, v, t)(v − t), (9)

where M1(u, v, r) is clearly a polynomial (as (s(u, v) − s(r, v))contains (u − r)) and so is M2(r, v, t). Moreover, the two termsin (s(u, v)− s(r, v)) (in (s(r, v)− s(r, t))) share the variable v (r).Hence, (s(u,v)−s(r,v))u−r and (s(r,v)−s(r,t))

v−t aremerely two instances of theunivariate case. In otherwords,M1(u, v, r)has no (u−r) term (andobviously no (v − t) term) and the same forM2(r, v, t).Clearly, the full proof of Theorem3.3 could bedirectly converted

into a recursive algorithm to compute Decomposition (5). Beingable to now decompose expressionJ as suggested by Theorem 3.3,we can reduce difficult self-intersection problems into muchsimpler problems, as we demonstrate in the coming section.

4. Self-intersections in polynomial (Bézier) surfaces

Consider the computation of self-intersections of freeformsurfaces. The problem is to find all locations in S(u, v) =(sx(u, v), sy(u, v), sz(u, v)) that equate, in the Euclidean space,with some parametrically different, S(r, t), locations,

sx(u, v)− sx(r, t) = 0,sy(u, v)− sy(r, t) = 0,

sz(u, v)− sz(r, t) = 0. (10)

As we already pointed out, an attempt to solve Eq. (10) directlyis bound to fail, detecting the entire domain as a solution, as foru = r and v = t all constraints are satisfied, a case we denotethe trivial diagonal solution. However, we can now rewrite Eq. (10)using Theorem 3.3 as,

(u− r)Jx1(u, v, r, t)+ (v − t)Jx2(u, v, r, t) = 0,

(u− r)Jy1(u, v, r, t)+ (v − t)Jy2(u, v, r, t) = 0,

(u− r)Jz1(u, v, r, t)+ (v − t)Jz2(u, v, r, t) = 0, (11)

where Jx1 is the x function of J1, etc.Clearly, Eqs. (11) are identical to Eqs. (10). Then again, Eqs. (11)

provide much insight into the problem in hand. Eqs. (11) (and ob-viously Eqs. (10)) clearly vanish when u = r and v = t , the trivialdiagonal solution case we wish to eliminate from those equations.Moreover, we know that Jak(u, v, r, t), a = x, y, z, k = 1, 2, con-tain neither (u− r) nor (v − t) terms.Recall we are interested in all other cases for which Eqs. (11)

vanish. Differently viewed, Eqs. (11) vanish for the case when thetwo vectors inR2 of (u−r, v−t) and (Ja1(u, v, r, t),J

a2(u, v, r, t)),

a = x, y, z, are orthogonal. Two vectors are orthogonal if either oneis zero or their inner product vanish. In otherwords and as all threeequations must vanish simultaneously, if vector (u − r, v − t) is

G. Elber et al. / Computer-Aided Design 41 (2009) 1060–1066 1063

not a zero vector (the solution we seek!) vectors (Jx1,Jx2), (J

y1,J

y2),

(Jz1,Jz2) should all be collinear inR2. That said, we could formulate

the following collinearity constraints using neither (u − r) nor(v − t):

Jx1(u, v, r, t)Jy2(u, v, r, t)− J

y1(u, v, r, t)J

x2(u, v, r, t) = 0,

Jx1(u, v, r, t)Jz2(u, v, r, t)− Jz1(u, v, r, t)J

x2(u, v, r, t) = 0,

Jy1(u, v, r, t)J

z2(u, v, r, t)− Jz1(u, v, r, t)J

y2(u, v, r, t) = 0. (12)

Since Eqs. (12) are dependent, one can impose any two of thesethree constraints with one original constraint. The following is onealternative set of constraints to Eqs. (10) that potentially could beused, a set that eliminated the trivial diagonal solution set:

(u− r)Jx1(u, v, r, t)+ (v − t)Jx2(u, v, r, t) = 0,

Jx1(u, v, r, t)Jy2(u, v, r, t)− J

y1(u, v, r, t)J

x2(u, v, r, t) = 0,

Jx1(u, v, r, t)Jz2(u, v, r, t)− Jz1(u, v, r, t)J

x2(u, v, r, t) = 0. (13)

Eqs. (13) are perfectly valid for as long as Jxk 6= 0, k = 1, 2.If Jx1 = Jx2 = 0, all three constraints are satisfied in Eqs. (13). Inregions of the examined surface where Jx1 = Jx2 = 0, a differentset of equations (using J

yk or Jzk , k = 1, 2) should be selected.

In practice, when using our subdivision based solver [19,20] tofind surface self-intersections, we found that the best results wereachieved when using the complete redundant set of the followingsix equations,

sx(u, v)− sx(r, t)= (u− r)Jx1(u, v, r, t)+ (v − t)J

x2(u, v, r, t) = 0,

sy(u, v)− sy(r, t)= (u− r)Jy1(u, v, r, t)+ (v − t)J

y2(u, v, r, t) = 0,

sz(u, v)− sz(r, t)= (u− r)Jz1(u, v, r, t)+ (v − t)J

z2(u, v, r, t) = 0,

Jx1(u, v, r, t)Jy2(u, v, r, t)− J

y1(u, v, r, t)J

x2(u, v, r, t) = 0,

Jx1(u, v, r, t)Jz2(u, v, r, t)− Jz1(u, v, r, t)J

x2(u, v, r, t) = 0,

Jy1(u, v, r, t)J

z2(u, v, r, t)− Jz1(u, v, r, t)J

y2(u, v, r, t) = 0. (14)

where the first three are identical to Eqs. (11) and the last three areidentical to Eqs. (12).So far, we dealt with a single polynomial patch. However, when

examining a B-spline surface for self-intersections the tests are abit more involved as is explained in the next section, Section 4.1.

4.1. Self-intersections in piecewise polynomial (B-spline) surfaces

To gain some insight into the B-spline surface case, we startby examining the curve case first. When a B-spline curve isexamined for self-intersections, it can be first decomposed into allits polynomial Bézier segments, by subdividing the B-spline curveat all interior knots. Then, all segments should be tested against allother segments, for self-intersections, including themselves. Onespecial case that should be handled is the case of two adjacentsegments that share an end point. Consider two Bézier curvesegments C1(u) and C2(v) that share an end point C1(1) = C2(0).Then, we have

Lemma 4.1. Let C1(u), u ∈ [0, 1] and C2(v), v ∈ [0, 1] be twoadjacent planar Bézier segments, sharing an end point C1(1) = C2(0).The self-intersection vector constraint of

K(u, v) = C1(u)− C2(v),

can be rewritten as

K(u, v) = (u− 1)K1(u)− vK2(v), (15)

for some vector of functionsK1 andK2 of lower degrees.

Proof. Let P = C1(1) = C2(0) be the shared point between C1 andC2. We may rewrite C1 as

C1(u) =m∑i=0

piθmi (u)

=

m−1∑i=0

piθmi (u)+ Pθmm (u)

=

m−1∑i=0

pi(mi

)ui(1− u)m−i + umP

= (1− u)m−1∑i=0

pi(mi

)ui(1− u)m−i−1 + umP

= (1− u)K1(u)+ umP.

Similarly, we can rewrite C2 as

C2(v) = vK2(v)+ (1− v)mP.

But now, and assuming both adjacent segments came from thesame B-spline curve and hence share the same degree,

C1(u)− C2(v) = (1− u)K1(u)− vK2(v)+ umP − (1− v)mP.

Examining just the last line, we have

P(um − (1− v)m)

= P

(um −

(1− v

m∑i=1

(mi

)(−v)i−1

))

= P

((u− 1)

m−1∑i=0

ui + vm∑i=1

(mi

)(−v)i−1

), (16)

carrying terms with (u− 1) and v as well. �

The proof of Lemma 4.1 can now be immediately used to derivethe functions K1(u) and K2(v). All the terms in C1(u) − C2(v)multiplied by (u− 1) yields:

K1(u) = −K1(u)+ Pm−1∑i=0

ui, (17)

where K1(u) =∑m−1i=0 pi

(mi

)ui(1 − u)m−i−1 and

∑ni=0 u

i=∑n

i=0n+1n+1−iθ

ni (u) (this can be shown using induction on n), and

similarly forK2(v).With Lemma 4.1 and Decomposition (15), we can reduce the

self-intersection solution of C1(u) − C2(v) for the case of C1(1) =C2(0) to an alternative set of constraints that ignores the sharedlocation P . K1(u) and K2(v) must again be collinear in R2 fora solution for which vector (u − 1, v) does not vanish. Thiscollinearity constraint could be simply written asKx

1(u)Ky2(v) −

Ky1(u)K

x2(v) = 0, where (K

xi ,K

yi ) are the x and y coefficients of

Ki.Returning back to the bivariate surface case, when a B-spline

surface is examined for self-intersections, it can be similarly de-composed into all its polynomial Bézier patches, by subdividingthe B-spline surface at all interior knots. Then, all patches shouldbe tested against all other patches, for self-intersections, includingthemselves. The self-intersection computation for a Bézier patchwas already discussed in the previous section. A test for an in-tersection between two different patches that share no commonboundary is reduced to a simple surface-surface-intersection prob-lem. However, if the two patches share a common boundary curve,computational effort will be wasted by re-detecting this bound-ary. A naive attempt to extend Lemma 4.1 for two surfaces sharinga boundary curve S1(1, v) = S2(0, t), and to seek a decomposition

1064 G. Elber et al. / Computer-Aided Design 41 (2009) 1060–1066

of the form S1(u, v) − S2(r, t) = (u − 1)K1(u, v) − rK2(r, t),is bound to fail. The function should vanish only when v = t , anadditional constraint that must be reflected in the decomposition.Hence, we have

Lemma 4.2. Let S1(u, v), u, v ∈ [0, 1], and S2(r, t), r, t ∈ [0, 1],be two adjacent Bézier patches, sharing a boundary curve S1(1, v) =S2(0, t). The self-intersection vector constraint

K(u, v, r, t) = S1(u, v)− S2(r, t),

can be rewritten as,

K(u, v, r, t) = (1− u)K1(u, v)+ rK2(r, t)+ (v − t)K3(u, v, r, t). (18)

for some vector of functionsKi, i = 1, 2, 3, of lower degrees.

Proof. Let C(v) = S1(1, v) = S2(0, t) = C(t) be the sharedboundary between S1 and S2. We may rewrite S1 as

S1(u, v) =m∑i=0

n∑j=0

pijθmi (u)θnj (v)

=

m−1∑i=0

n∑j=0

pijθmi (u)θnj (v)+

n∑j=0

pmjθmm (u)θnj (v)

=

m−1∑i=0

n∑j=0

pij(mi

)ui(1− u)m−iθnj (v)+ u

mn∑j=0

pmjθnj (v)

= (1− u)m−1∑i=0

n∑j=0

pij(mi

)ui(1− u)m−i−1θnj (v)

+ umn∑j=0

pmjθnj (v)

= (1− u)K1(u, v)+ umn∑j=0

pmjθnj (v).

Similarly, we can rewrite S2 as

S2(r, t) = rK2(r, t)+ (1− r)mn∑j=0

q0jθnj (t),

qij being the control points of S2.But now, and assuming both adjacent patches came from the

same B-spline surface and hence share the same degree,

S1(u, v)− S2(r, t) = (1− u)K1(u, v)− rK2(r, t)

+ umn∑j=0

pmjθnj (v)− (1− r)m

n∑j=0

q0jθnj (t).

Examining just the last line, while noting that pmj = q0j, ∀j, thecontrol points on the shared boundary, we have

umn∑j=0

pmjθnj (v)− (1− r)m

n∑j=0

q0jθnj (t)

=

n∑j=0

pmj(umθnj (v)− (1− r)

mθnj (t))

=

n∑j=0

pmj(umθnj (v)− umθnj (t)+ u

mθnj (t)− (1− r)mθnj (t))

=

n∑j=0

pmj(um(θnj (v)− θnj (t))+ (u

m− (1− r)m)θnj (t))

= (v − t)K3(u, v, t)+n∑j=0

pmj(um − (1− r)m)θnj (t)

= (v − t)K3(u, v, t)+ (1− u)K1(u)+ rK2(r),

following the same decomposition of (um−(1−r)m) as in Eq. (16),and also

K1 = K1 +K1,

K2 = −K2 +K2. �

Once again, this time using Eq. (18), the self difference expres-sion ofK(u, v, r, t) = S1(u, v)−S2(r, t) could vanishwhen u = 1,r = 0 and v = t or when the vector in R3 of (1 − u, r, v − t) isorthogonal to the vectors (Ka

1,Ka2,K

a3) for a = x, y, z. As before,

this means that the vectors of (Kx1,K

x2,K

x3), (K

y1,K

y2,K

y3), and

(Kz1,K

z2,K

z3)must all be linearly dependent, if (1− u, r, v− t) is

not the zero vector.Before we present some examples in the next section, some

final comments are in order. Two different Bézier patches in a B-spline surface could also share a common boundary corner point,in which case, if untreated, would be incorrectly detected as a self-intersection location. The computational cost invested in detectingcorner points is negligible and eliminating such points is trivial;so we found no real need, in practice, to handle this special case.Another case that one is required to handle is the case of closed orperiodic surfaces. If the surface’s u (v) minimum boundary curveidentifies with the u (v) maximum boundary curve, one shouldrefrain from re-detecting that boundary as a self-intersection,employing the elimination procedure presented in this section forthis periodic case as well.

4.2. Examples of self-intersection computation

We now present a few examples of self-intersection compu-tation for Bézier and B-spline surfaces. Fig. 1 shows two exam-ples of simple bicubic Bézier surfaces with self-intersections. Fig. 2shows two examples of higher order Bézier surfaces with self-intersections. All these Bézier cases were solved in a fraction of asecond to a few seconds on a modern PC workstation.Fig. 3 shows two examples of large B-spline surfaces with self-

intersections. The self-intersections in these B-spline surfaceswerecomputed in several minutes on a modern PC workstation.Finally, Fig. 4 shows an example from SINTEF (see http://shapes.

aimatshape.net/). These self-intersections were computed in a fewseconds, on a modern PC workstation.Throughout this work, we solve sets of polynomial equations.

While there are several schemes to attempt at solving such sets,in this specific work, we employed the solver that is part of theIRIT [21] modeling scheme, a solver that is discussed in [19,20].

5. Self-intersections in higher dimensions

The decomposition of self-difference expression presentedin Theorem 3.3 could also be extended to higher dimensions.Consider the self-difference expression of a k-variate polynomialfunctionm:

Theorem 5.1. The algebraic expression

M(u1, u2, . . . , uk, w1, w2, . . . , wk)= m(u1, u2, . . . , uk)−m(w1, w2, . . . , wk)

G. Elber et al. / Computer-Aided Design 41 (2009) 1060–1066 1065

a b

Fig. 1. (a) A bicubic self-intersecting Bézier surfacewith a single intersection component. (b) A bicubic self-intersecting Bézier surfacewith a pair of intersection components.

a b

Fig. 2. (a) A bi-quintic self-intersecting Bézier surface with a single interior intersection component. (b) A bi-quartic self-intersecting Bézier surface which is the result ofan offset operation. Note the four, very small, self-intersections at the four tips.

a b c

Fig. 3. (a) A bi-quadratic B-spline surface with a mesh size (33× 45). Local (left) and global (right) self intersections are detected. (b) and (c) show two views of a quadraticby cubic B-spline surface with a mesh size (33× 385). Both surfaces are the result of an offset approximation of a circular sweep surface.

could always be decomposed and represented as

M(u1, u2, . . . , uk, w1, w2, . . . , wk)= (u1 − w1)M1(u1, u2, . . . , uk, w1, w2, . . . , wk)+ (u2 − w2)M2(u1, u2, . . . , uk, w1, w2, . . . , wk)+

...

(uk − wk)Mk(u1, u2, . . . , uk, w1, w2, . . . , wk).

for some vector of functionsMi, i = 1, . . . , k, of lower degree.

Proof. To prove Theorem 5.1, recall the decomposition of Eq. (5),shown in Eq. (9). This can be extended into a higher dimension,

permuting over all parameters ofm, as follows:

m(u1, u2, . . . , uk)−m(w1, w2, . . . , wk)

=m(u1, u2, . . . , uk)−m(w1, u2, . . . , uk)

u1 − w1(u1 − w1)

+m(w1, u2, . . . , uk)−m(w1, w2, . . . , wk)

=m(u1, u2, . . . , uk)−m(w1, u2, . . . , uk)

u1 − w1(u1 − w1)

+m(w1, u2, u3, . . . , uk)−m(w1, w2, u3, . . . , uk)

u2 − w2(u2 − w2)

+m(w1, w2, u3, . . . , uk)−m(w1, w2, . . . , wk)

1066 G. Elber et al. / Computer-Aided Design 41 (2009) 1060–1066

Fig. 4. A self-intersecting bi-cubic B-spline surface with a mesh size (10 × 12).Contributed by SINTEF (see http://shapes.aimatshape.net/).

=m(u1, u2, . . . , uk)−m(w1, u2, . . . , uk)

u1 − w1(u1 − w1)

+m(w1, u2, u3, . . . , uk)−m(w1, w2, u3, . . . , uk)

u2 − w2(u2 − w2)

...

+m(w1, w2, . . . , wk−1, uk)−m(w1, w2, . . . , wk−1, wk)

uk − wk× (uk − wk)+m(w1, w2, . . . , wk)−m(w1, w2, . . . , wk)= (u1 − w1)M1 + (u2 − w2)M2

...

+ (uk − wk)Mk. �

6. Conclusions

This work presented an approach to decompose the commonexpression of s(u, v) − s(r, t) into an alternative representationthat allows the elimination of the trivial diagonal solution.In the proof of Theorem 3.3, the assumption was made that the

u degree of s is equal to the v degree. While this need not be thecase, one can always raise the lower degree (between u and v) tothe higher one. Only changing a representation, this degree raisingability shows that the original low degree shape also contains the(u − r) and the (v − t) terms and so a similar algorithm could beprobably derived to different u and v degrees as well, making theproof a bit more complicated.As an alternative to the recursive algorithm presented in

Section 3, one can employ Eq. (9) and perform the divisions as inthe univariate case, once for (S(u, v)− S(r, v)) by (u− r) and oncefor (S(r, v)−S(r, t)) by (v− t). These divisions are known to yieldpolynomials.In some instances, it is desired to find a single point on

each component of the solution space. Specifically, seeking (self-)intersections of a surface, one might seek a single (starting) point

on each internal loop. One can also add an additional constraintthat prescribes some slope in the parametric domain, fully con-straining the problem while guaranteeing the detection of at leastone point on each internal loop. Then, numerical marching tech-niques could be used to trace the entire set of self-intersectioncurves.

Acknowledgments

The authors would like to thank Bernard Mourrain and theanonymous reviwers for their invaluable comments on this work.This research was partly supported by the Software TechnologyCenter of Excellence, Technion, in part by the Israel ScienceFoundation (grant No. 346/07), in part by the Israeli Ministryof Science Grant No. 3-4642, and in part by KICOS throughthe Korean-Israeli Binational Research Grant (K20717000006)provided by MEST in 2007.

References

[1] Hoffmann CM. Geometric and solid modeling. San Mateo (CA): MorganKaufmann; 1989.

[2] Hoschek J, Lasser D. Fundamentals of computer aided geometric design.Wellesley (MA): AK Peters; 1993.

[3] Pekerman D, Elber G, Kim MS. Self-intersection detection and elimination infreeform curves. Computer-Aided Design 2008;40(2):150–9.

[4] Maekawa T, Patrikalakis NM. Computation of singularities and intersectionsof offsets of planar curves. Computer Aided Geometric Design 1993;10(5):407–29.

[5] Ho C-C, Cohen E. Surface self-intersection. In: Mathematical methods forcurves and surfaces: Oslo 2000. 2001. p. 183–194.

[6] Galligo A, Pavone JP. Self intersections of a Bézier bicubic surface. In: Proc. ofthe international symposium on symbolic and algebraic computation. 2005.

[7] Galligo A, Pavone JP. A sampling algorithm computing self-intersections ofparametric surfaces. In: Elkadi M, Mourrain B, Piene R, editors. Algebraicgeometry and geometric modeling. Springer; 2006. p. 185–204.

[8] Skytt V. Algorithms for finding the topology of complex surface self-intersections. In: The tenth SIAM conference on Geometric Design andComputing. 2007.

[9] Elber G, Cohen E. Error bounded variable distance offset operator for freeformcurves and surfaces. International Journal of Computational Geometry &Applications 1991;1(1):67–78.

[10] Lee IK, Kim MS, Elber G. Planar curve offset based on circle approximation.Computer-Aided Design 1996;28(8):617–30.

[11] Elber G. Global error bounds and amelioration of sweep surfaces. Computer-Aided Design 1997;29(6):441–9.

[12] Elber G. Trimming local and global self-intersections in offset curves usingdistance maps. In: Proc. of the 10th IMA conference on the mathematics ofsurfaces. 2003. p. 213–222.

[13] Seong J-K, Elber G, Kim M-S. Trimming local and global self-intersectionsin offset curves/surfaces using distance maps. Computer-Aided Design 2006;38(3):183–93.

[14] Wang Y. Intersection of offsets of parametric surfaces. Computer AidedGeometric Design 1996;13(5):453–65.

[15] Aomura S, Uehara T. Self-intersection of an offset surface. Computer-AidedDesign 1990;22(7):417–21.

[16] Maekawa T, Cho W, Patrikalakis NM. Computation of self-intersectionsof offsets of Bezier surface patches. Journal of Mechanical Design: ASMETransactions 1997;119(2):275–83.

[17] Wallner J, Sakkalis T,Maekawa T, PottmannH, YuG. Self-intersections of offsetcurves and surfaces. International Journal of Shape Modeling 2001;7(1):1–21.

[18] Cohen E, Riesenfeld RF, Elber G. Geometric modeling with splines: Anintroduction. Natick Massachusetts: A.K. Peters; 2001.

[19] ElberG, KimMS. Geometric constraint solver usingmultivariate rational splinefunctions. In: Proc. of the sixth ACM/IEEE symposium on solid modeling andapplications. 2001. p. 1–10.

[20] Hanniel I, Elber G. Subdivision termination criteria in subdivisionmultivariatesolvers. Computer-Aided Design 2007;39:369–78. Also GMP’06. 2006. p.115–128.

[21] IRIT 9.5 User’s Manual. 2005, Technion. http://www.cs.technion.ac.il/∼irit.