Taubin ssma93-p221


Published on

Published in: Technology, Art & Photos
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Taubin ssma93-p221

  1. 1. AN ACCURATE ALGORITHM FOR RASTERIZING ALGEBRAIC CURVES Gabriel Taubin IBM T.J.Watson Research Center P.O.Box 704 Yorktown Heights, NY 10598Abstract 1 Introduction In this paper we introduce a new algorithm for ras-terizing algebraic curves, and we discuss applications Planar curves can be rvpmsented parametrically orto surface and surface-surface intersection rendering implicitly. A parametric curve is the image set ofand visualization. By rustm”zing an algebraic curve we a two dimensioml vector function of one variablemean to determine which cells, or pixels, from a square {(z(t), y(t)) : t 6 R}, while an implicit curve is themesh of cells in the plane, are cut by a curve represented set of zeros of a function of two variables Z(f) =as the set of zeros of a polynomial in two variables. By {(z, y) : ~(z, y) = 0}. Very efficient methods exist tousing a recursive space subdivision scheme, the prob- render several families of parametric curves, but im-lem is be reduced to testing whether the curve cuts a plicit curves are difficult to render.square or not. Other mwearchers have followed this Since a local parameterization always exists in aapproach, but their tests are either computationally ex- neighborhood of a regular point of an implicit curve, i.e.,pensive, or apply just to special cases. Curves with a point p = (u, v) such that f(p) = O and V~(p) # O,singularities are particularly difficult to deal with, and one approach that several reseamhers follow, calledmost know algorithms fail to nmder these curves cor- tracing, is to approximately parametrize the implicitrectly. Our contribution in this paper is the introduction curve, and then render it using the methods for para-of a computationally effiaent and asymptotically cor- metric curves [1, 2, 3, 4, 13, 19, 20, 27, 28, 30]. Therect test, which applies not only to dimension two, but basic difficulty with this method lies on the fact thatalso to dimension time and above. We prove that the implicit curves can be multiply comected, and oftenrecursive space subdivision algorithm based on this have singular points (where f(p) = O and Vj(p) = O),new test renders a curve of constant width, even in where they intersect themselves, or split into severalneighborhoods of singular points, and with no missing branches. To render the curve correctly, the singularparts. For example, if ~ is a polynomial, it produces points and the comected components must be identi-the same results whether the coefficients of ~ or ~z are fied [8, 9]. The problem with this approach is that thegiven as input to the algorithm. Not many algorithms algorithms are intrinsically complex, computatiomllysatisfy this property. Finally, the same methodology expensive, and can only deal with curves with isolatedcan be applied to compute a set of voxels containing singularities. In order to find all the singular points,an algebraic surface, and by representing it as a sin- all the solutions of a system of polynomial equationsgular surface, space algebraic curves (surface-surface have to be found. Tracing algorithms follow a bottom-intemections) can be approximated as well. We show up approach, while recursive subdivision algorithmsexamples of these applications. This sets of voxels can follow a top-down approach. Somewhere in betweenbe used for tolerance analysis and to compute polyhe- is a family of algorithms that compute piecewise lin-dral or piecewise linear approximations of the curves ear approximations [5, 7, 11, 14]. They am based on aor surfaces for interactive nmdering purposes as well. single teselation of the initial box into a regular mesh of cells, triangles or squares in the plane, and cubes or tetrahedra in space, and a marching cubes [22, 10, 21] type of algorithm to move from a;occupied cell to a neighboring one. Inside an occupied cell the curve is approximated by a straight line segment, or a polyhe- dron in the spatial case. There am two basic problems with this kind of approach. The first problem is how toPermission (o copy without fee all or pan of this material is granted choose the resolution of the mesh. The second problemprovided {hal the copies are not made or distributed for direct is how to find an occupied cell to start the marchingcommercial advantage, the ACM copyright notice and the title of thepublication and its date appar, and notice is given that copying is bypermission of the Association for Computing Machinery. To copyotherwise. or to republish, requires a fee arrd/or specific permission.2nd ACM Solid Mcdeling ‘93-5/93/Montreal. Canada@ 1993 ACM 0-89791 -584 -4/93/0005r022 1...$1.50 221
  2. 2. process. In principle, all the cells must be visited inorder not to miss discomected components, but somerecent results show how to deal with this problem [6].Recursive space subdivision algorithms am generallybased on subdividing boxes, the subject of this paper,and on subdividing triangles or tetrahedra [18, 24]. Itis our understandti~ thatso far no altzorithm has dealt degree 3 degree 4with arbitraxy sin~”lar curves and s“urfaces correctly.The algorithm described in this paper does. For a m- Elrecent ttempt to deal with singular surfaces in a similar amanner see [25]. By using a space subdivision scheme, i.e. by lookingat the original square as a low resolution pixel, discard- (xling pixels which are not cut by the curve, and subdivid-ing those which might be cut, the problem of rendering degree 4 , de 10 de 8an algebraic curve in a raster device, such as a CRT vdisplay or a laser printer, can be mciuced to determini-ng whether the curve cuts a given square or not. In apnwious work [29] we introduced a correct algorithmfor rasterizing algebraic curves based on this scheme.Instead of using a test that provides a yes-or-no answer mto the question of whether the curve cuts the square or Dnot, i.e. evaluating a necessary and sufficient condi- degnx 6 degree 6 degree 8tion for zeros of the associated ‘polynomial in the box, Figure 1: Examples of algebraic curves rasterized with the algo-a difficult problem [26, 23], we introduced a much less rithm described in [29], on a grid of 512 x 512 pixels. Note thatcomputationally expensive test based on a simple poly- isolated zeros and singularities of low order a~ correctly rsmdered,nomial inequality. This test provides a no-or-may-be but neighborhoods of singularities are thicker. The curve on theanswer to the same question, i.e. it constitutes a suffi- lower right comer is the union of thee circumferences, but all the points in one of them are singular.cient condition for a polynomial not to have roots insidea circle, but an empty circle could pass the test. Squarescan be tested by testing the circumscribed tides. Thus,squares that do not pass the test can be safely discarded, function, a ratio of two polynomials, continuous ev-but theiv is no guarantee that the curve cuts the squares erywhere, with the exactly the same zeros as the ori-that pass the test. However, the test is proven to be ginalpolynomial, but with constant multiplicity. Thisasymptotically cornxt near regular points of algebraic ratioml function behaves locally as a second degreecurves, and the results are rendered curves of constant polynomial. The previous test is applied to this secondwidth in the neighborhood of regular points. Figure detpe approximation to the rational function to deter-1 shows some examples of algebraic curves rendered mine whether or not a box should be discatied or not.with this algorithm. With this new test we how have a practical algorithm Although practical and simple, producing correct which renders a curve of constant width everywhere,rasterizations of regular curves, and almost correct even in neighborhoods of singularities. Figure 2 showsrasterizations of curves with low order isolated sin- the same curves of figure 1 rendered with this new al-gularities, this nmdering algorithm does not behave gorithm. Note that neighborhoods of singular points,correctly near singular points. In this paper we in- even when they are not isolated, are rendered correctly.troduce an improved version of the intersection test We end the paper with a section on applications ofwhich solves the problem. First of all, by switching the algorithm to three dimensioml problems : surfacefmm the 2-norm [l(z, y)[lz = (Z2 + #)1/2 to the oo- and surface-surface intersection nmdering and visual-norm 11(z,~)11~ = max{lzl, IYI}, and modifying the ization.corresponding inequality, we obtain a new test that is Many readem might be skeptical about the robust-a sufficient conditions for an algebraic curve not to cut ness and numerical stability of the algorithm, particu-a square, instead of a circle. Fewer arithmetic opera- larly near singular points. We originally had the same tions are need to evaluate this test, and the results are concerns, mainly after the work of Farouki and Ra- equivalent to those obtained with the old test. In the jan [16, 171, but the experimental results have clearly second place, the pnwious algorithm is too conserva- shown us that these concerns am not sound in prac- tive near singularities, empty squares near a singularity tice in the case of this algorithm. Due to lack of space, am not discarded, resulting in thickerlines in the neigh- we only show a few examples hem, but we have doneborhood of a singular point. We solve this problem by extensive experimentation with these algorithms, anddesingukizing the polynomial. We construct a rational their performance is very good. In [29] we show curves 222
  3. 3. how to reduce the computatioml complexity by recur- sive subdivision. The second issue, to be discussed in the next section, is how to test whether or not the curve Z(f) cuts a square. promh.m IdealPaintCurve(f, B((u, u), n/2))F forz+u– for~tv– n/2+1 /2tou+n/2- n/2+1 /2tou+n/2– if Intersect l/2stepldo l/2stepldo (z(~), B((z, v), 1/2))) # NO1 (xl PaintPixel (z, y) Figure 3: Ideal algorithm for rendering the curve Z(f)= {(z,v) : degree 10 f(z, y) = O} on a square of side n centered at the point (u, v) B((u, v),6) denotes the square box {(zjy) : max{lz - tilt [y – wI} < 6}. The number of test evaluations can be easily rvduced using a recursive space subdivision scheme described in figwe 4, where n is assumed to be a power of 2. The rationale behind this algorithm is very simple. It degree 6 degree 8 starts by considering the initial square region as a single degm 6 pixel. Then, every square region which had pnwiouslyFigure 2: Same algebraic curves of figure 1 rasterized with the satisfied the test for its resolution is divided into fouralg;rithm described h this paper. Note-the curves have constant equal size square regions, which are then tested. Thewidth, even in the neighborhoods of singular points. squares which pass the distance test are kept into a stack. The size of the squares is divided by two at each iteration, and when the square regions become singleof degree 50 with many singdar points correctly nm- pixels, the iteration stops, and the pixels are painted.dered with the previous version of the algorithm, andthe impmved version described in this paper produces 3 Tests for zeros of an algebraic curve in aeven better pictures. box The issue of speed might also be a source of concern In this section we are concerned with the problem ofto some readers. Again, due to lack of space, we do not testing whether or not the algebraic curve Z(f) definedpresent timing information here, but the running times by a polynomial of two variables ~(z, y) intersects theare acceptable. For low degree curves, the running box B((u, v),6) = {(z, y) : max{lz – uI, Iv– vi} < 6}.times for the pictures shown ranges from a fraction of Tests that give a yes or no answer, i.e., tests for neces-a second to a few seconds. Tiiing information for the sary and sutlicient conditions for the curve to intersectold algorithm is given in [29]. We nxognize, however, the box, exist [26, 23], but they am computationallythat this is an area that needs further exploration, and very expensive, involving elimination techniques, andwe are curnmtly studying ways to speed up the process. probably not numerically well behaved, for to the same mason. Approximate tests can be used instead, but2 Recursive subdivision algorithms the main problem with approximate tests is to prove Figure 3 describes an ideal algorithm for xvndering the correctness of the algorithm. An approximate testan algebraic curve should satisfy three main properties. First of all, it should never discard a box that intersects the curve, z(j) = {(z, y) : /(z, y) = 0; otherwise parts of the curve could be missing. That is, the test should be a sufficient condition for a curvein the square box of side n centered at the point not to intersect the box. Second, it should be asymp-p = (u, o). The square is scanned, and only those totically correct, i.e. if a box does not intersect thepixels cut by the curve are painted. We call this al- curve, and it is not rejected by the test, after a numbergorithm ideal because every correct algorithm should of subdivision steps all the resulting sub-boxes shouJdpaint exactly the same pixels, but it is impractical. It be rejected. Third, and very much dated to the previ-requires n2 test evaluations, one for each pixel in the ous property, it should render curves of approximatelysquare. But since in general it will be rendering a curve constant width. The last two properties are difficult toon a planar region, the number of pixels it is expected achieve, in particular close to singular points. Thereto paint is only O(n). We need a more efficient algo- is also the issue of how well the test performs in prac-rithm. Them are two issues to look at. The first one is tice, because even if it is asymptotically correct, it could 223
  4. 4. equivalent to evaluating the polynomial and all its par- procedure RecursivePaintCurve (~, B((u, v), n/2) tial derivatives at (u, v). Homer’s algorithm requires input-stack + 0 0(m2) operations, where m is the number of coeffi- output-stack + 0 cients of the polynomial. The same order of operations Push ((u, U), input-stack) required to evaluate a polynomial in Bernstein form. while n >1 do So, from now on we will concentrate on finding a suf- n + n/2 fiaent condition for the polynomial (1) not to have zeros while input-stack # 0 do in the box B((0,0),6) = {(z, Y) : ll(z,v)llrn S ~}~ and (u, u) + Pop(input-stack) we can assume that f (O, O) = fm # O, because other- (a3, V3) ~ r (Wl 7J4) wise the curve clearly intersects the box. The approach is as follows. We construct a polynomial of one variable F(6), whose coefficients am functions of the coefficients fij of j, and Su& that F(O)= 1~(0, 0)1> O, and VE > Ov(z, y) E B((O, O),E) : If(%y)l 2 F(c) . (?q, tn) J ~ (U2, V2) fori=lto4stepldo Clearly, if 6 is smaller than the fimt positive root of if Intersect (Z(~), B((ui, vi), ~/2)) # NO F (if any), the polynomial f will not have zeros in Push((u;, vi), output-stack) B((o, o),4) . input-stack +- output-stack In [29] we constructed the bounding polynomial output-stack + 0 F(e) to provide a sufficient condition for the poly- while input-stack # 0 do nomial (1) not to have zeros in a circle C((O, O),6) = (Z, y) + pop (input-stack) {(z, y) : /~ < 6}. The following construction PaintPiiel (z, y) provides a test for boxes, and it requires less arithmetic operations to evaluate. We first rewrite the polynomial (1) as a sum of homogeneous terms, or@rrns Figure 4: hnpmved ideal rendering algorithm. f(’, Y) = ~{ ~ fij Zi??} = ~fh(~,Y) , (3) h=O i+j=h hdlconverge very slowly. Now we will bmafh describe a slkhtly modified ver- and apply the triangular inequality to the last sumsion of a test that we have recently ir%oduced [29]. Thistest satisfies the fimt property, and the second and thid lf(~~v)l 2 IfOl–~lf%,v)l . (4)ones only in the neighborhoods of the regular points of h=lthe curve. The test fails to discaxd enough pixels closeto singular points, resulting in thicker regions, i.e. the We now consider each one of the forms tl,..., ~d in-width of the rendered curve increases in the neigh- dividually, and we use the following inequalityborhood of singular points. We have already seen infigure 1 examples of algebraic curves rendered with therecursive subdivision algorithm of figure 4 using thistest. We will then modify the test to correct its behaviornear singular points. This is the main contribution ofthis paper. Note that by first translating the origin to (u, v), i.e.by expanding the polynomial in Taylor series around where(u, v), the problem isn?duced to the case (u, v) = (O,O).An effiaent algorithm for transforming the polynomial E = M% Y)IlOo = m={lzl, IYI} Fh = ll(fh& ...,foh)lll = ~ Ifajl ~+j=h because it is trivial to verify thatwhere d is the degree of f, to the form O<i,j,i+j~d If we defie F(c) = FO – ~~=1 Fh q frOrn eqUaliOnS h, (2) (4) and (5) we obtainis Homer’s algorithm [12], and even parallel algo-rithms exist to do so [15]. Going from (1) to (2) is 1~(~, Y)I a F(c). 224
  5. 5. Note that, since F(c) is positive at the origin ( F(O) = In [29] we analyzed the case of the 2-norm test. WeF. = 1~(0, O)I > O), and it is monotonically decreasing p :mred that the 2-norm approximate distance 6d(P),for E >0, because the coefficients ~1,..., Fd a~ non- define as above by first translating the origin to thenegative and 1’~ is positive, it has a unique positive point P = (u, v), then evaluating the coefficients of themotdd. Since ~(~) >0 foro<~<bd, we havea bounding polynomial, and finally finding its uniquesufficient condition for the polynomial f not to have nonnegative root, has the following property, whichzeros inside a box: if O < c < 6d then F does not explains the behavior of the algorithm near regularhave zeros inside the box B((O, O), ~) . In fact, although points.the number 6d can be computed very quickly with acouple of Newton iteration steps, it does not need to Lemma 1 If f is a polynomial qf degree d > 1, ~ is abe computed. Since the polynomial F(c) is positive at regular point @ Z{ f ), w is a unit length normal vector tothe ori@, and it is strictly decreasing for c ~ O, to test Z(f) at~, and~=~+ tw,fmt EZR, thenwhether the curve intersects the box B((O, O),4) or notwe just evaluate F(J). If the value is positive, the curve Cf@) =1,does not cut the box. ~ ciist (~, Z(f)) In the old test [29], the coefficients F1, ,.., Fd weredefined as follows where dist (p, Z(f)) is the Euclidean distance@m the point p = (u, v) to the cuwe Z(f). Fh = { ~ (~)-1[fij12}1’2 . The behavior of the algorithm near singular points is i+j=h more difficult to analyze. Near a singular point the ap- proximate distance 6~(p) always undenxtirnates theIn this case F(6) > 0 implies that ~ does not have Euclidean distance, and in general the width of thezeros in the circle C((O, O),E) instead. The difference curve increases proportiomlly to the multiplicity ofbetween the old and the new tests is related to the the singularity. We will be mom specific in the nextswitching fmm the 2-norm 11(z,U)112= /~ to section, but for example, if 2(f) is a regular curve,the co-norm 11(z,y)ll~ = max{lzl, Iyl}. We will refer i.e. Vf(z, ~) + O for every point (z, y) E Z(f), andto the old test as the 2-norm test, and to the new one as we set g(z, y) = f(~, y)2, the algorithm based on thethe co-norm test. In fact, these am just two particular test described above will still render the curve Z(g)instances of a more general construction. For every correctly, i.e., without erroneously discarding occupiedmal number r such that O< r <00 we can construct a boxes, but at almost twice the width. It is important tor-norm test in a similar way by defining the coefficients note that most rendering algorithms, in particular trac-Fl,..., Fd &5 fO~OWS ing algorithms, camot deal with this kind of situation. Fi@m- 5 show some examples of these curves. ., x+j=hIn this case F(c) >0 is a sufficient condition for thepolynomial ~ not to have zeros in the r-ball‘r((o, ),~) = o {(Z, Y) : ll(z,y)llr = (121’ + l$/lr)l/’ <However, since we will not use these tests, and it is c . T z(f) +more expensive to evaluate them, we will not describe Hl_?zthem in detail hem. The only reason we have to men-tion this family of testis the fact that the only positiveroot bd of the bounding polynomial F(c) associatedwith the r-norm is a lower bound estimate for the r-distance from the origin to the curve, and since all the Enorms am equivalent to each other, in the sense that Z(fz) Z(fz) Z(fz)when one goes to zem all of them go to zero at thesame rate, using any one of these tests as the basis Figure 5: Exarnplesof algebraic curve pairs (Z(f), Z(~2)). Z(f’)for the rendering algorithm should produce almost the is rendered at ahnoat twice the width of Z(f)same results. Due to lack of space we will not givea formal proof for this fact, but we have confirmed itexperimentally. Although the results are not identical, 4 Desingularizationthem is no pemeptual difference. So, to understand the Our goal in this section is to modify the test describedlocal behavior of a rendering algorithm based on these above, to coned its behavior near singular points. Wetests, it is sufficient to analyze any one of them. need to start with a definition. 225
  6. 6. 4.1 Multiple points K ET The multiplicity of a point p = (u, u) as a zem ofthe polynomial f is the minimum index h such thatat least one partial derivative of f of order h is notidentically zero at p m(p;f) = min{h : f; # O} , m(p; f) = 1 m(p; f) = 2 m(p; f) = 4where the form f; is the form f h of equation(3), after Figure 6: 6ehaviorof Jd nearregr,dar singularpoints. me andtranslating the origin top, as in equation (2). The mt.d- thickcurveis thegraphof f and thethincurveis thegraph of thetiplicity of a point as a zem of an analytic function can boundingpolynoxkd F at the origin. The closest zeru ~o &e originbe defined in a similar way. In this case we will have to is p, marked with a vertical segment on the left hand side of the pictures.expand the function in Taylor series around p to obtainthe forms f: . The multiplicity of a point with respectto a rational function, a ratio of two polynomials, is multiplicity of the same point as a zem of f. Now wedefined as the multiplicity of the point with respect to show how to construct a polynomial #(z, y) with thethe numerator minus the multiplicity of the same point following propertieswith respect to the denominator. Points with positive 1. Thedegmeof@is2d-2.multiplicity are called zeros, and points with negative 2. The set of zeros of @ is a subset of the set of zeros ofmultiplicity are called poles. We will make use of this #. In fact, Z(+) will be the set of singular pointsconcept later. off. Since $ = f(p) is a constant, the set Z(f) is exactly 3. If p is a zero of +, and thus of #, the multiplicity ofthe set of points with positive multipliaty p as a zero of @ is exactly equal to the multiplicity of p as a zero of ~ minus 2. Z(f) = {p E IR2 : m(p;f) > O} . Under this conditions, the ratioml function g(z, y) =A point p of multiplicity one is called a simple, or regu- 4(z, y)/@(z, y) is well defined and continuous every-lar, point of Z(f). If m(p; f ) >1, p is called a multiple, where ( g does not have poles), it has exactly the sameor singular, point of Z(f). The setof singular points of zeros as f, and the multiplicity of every point p inthe curve Z(f) is exactly the set of points with muhi- Z(g) = Z(f) as a zem of g is exactly 2.plicity at least two SO,let us construct @. First of all, let us denote with f= and fv the two partial derivatives of f. A point p Z’(f) = {p E IR2 : m(p;f) > 1} ~ Z(f) . is singular if and only if it is a common zero of f, f=, and fy . Since the degrees of f= and fY are at most4.2 Reducing multiplicities d– 1 while thede~ of f is d, let us definea new The main reason for the approximate distance fid to polynomialunderestimate the Euclidean distance near a singularpoint is illustrated in figure 6. The graphs of the poly- fm(%y) = ~f(%Y) - (~f.(%Y) + Yf,(% Y)) onomial f (s, y) and of its bounding polynomial F(c) at The degree of f~ is at most d – 1 because of Euler’sthe origin am ~presented along a line that cuts a zem formula [31], i.e., the leudingjorm f d of f satisfies thepoint p (marked with a vertical line segment on the following identityright side of the figures). When approaching a regularpoint, the value of If (~, y) I goes to zem linearly while d fd(z, y) = zf~(z, y) + yf~(z, y) ,when the multiplicity increases, If I goes to zero muchfaster. Note that the graph of If I is concave near a zero and the common zeros of f, f= and fy am exactly theof f, while the graph of F(e), which is always below same as the common zeros of f~, f= and fg, becausethe graph of If 1, is convex. For a good approximation the construction is ~versibleof the former by the later we need almost linearity ofboth graphs. If the concavity of the graph of If I is too f(&Y) = ;(fm(z, u) + ~f.(~,Y) + Yfy(% Y)) .pmnourtced, it is just not possible to obtain an accurateapproximation with a convex function. Another way to construct fm is to first homogenize Our approach is to linearize the behavior of f nearZ(f), or todesingulariz.e it. By this we mean to construct f(~, Y) with a new variable wa new function g(z, y), it will not be a polynomial but da rational function, with exactly the same set of zeros f(W%Y) = ~wd-hfh(%Y) ,Z(g) = Z(i), but such that all the points in Z(g) have h=Oexactly the same multiplicity with ~spect to g. Wefirst set #(z, y) = f(2, y) 2. Thedegree of#is2d and obtaining an homogeneous polynomial of degree d inthe multiplicity of a point as a zero of # is twice the threevariables, then differentiate with respect to the 226
  7. 7. new variable clearly cuts the box. Since rational functions am an- alytic, in a certain neighborhood of the origin we can d–1 expand g as an convergent series ~w(%%y) = ~(~– ~)~d-’’-’fh(%y) , h=O m 9(%Y) = ~9h(%Y) ,and finally dehomogeneize and divide by d hnO where gh is a form of degree h or identically zero. The fcm(~,v) = ;L(l, Z,Y) =; +#h(z, Y) . forms g’J,gl, . . . can be computed from the following recursive equations #o = +090Let 4(z, Y) = f~(z,v)2 f.(z, y)z + fy(z, y)z. The + #l = *ogldegree of @ is exactly 2d – 2, because at least one of + *’g’Jj. or jy should have degree d – 1, and neither one ofthe three has degree larger that d – 1. By construction, ;Zd-z = #@-2 + ... + @+-jJ (6)the set of zeros of @ is exactly equal to the set of singular ~2d-1 = ~Og2d- _ 1points of ~, and so, a subset of Z(f) = Z(d). The only ~2d _ #og2d : _ ::: : $::::;:property that remains to be proved is the following o $Og2d+k + . . . ++9 2d–2 2+kLemma2 I,f#(p) = O,then tn(p; @) = rn(p; ~) –2. with the last equation valid for k = 1,2,3, . . . . Then the inequality I}(z, y) I ? FO– ~h = 1‘~h Chis generalizedPR~F : If m(p; ~) = k >0, after translating the origin to an infinite sumto p, we can write the polynomial ~ as follows where the coefficient Gh is computed from the coeffi- cients of the form gh(z, y) as befonswith the form ~~ not identically zero. The two partialderivatives are then i+jzh i+j=h (7) fz(z, y) = ~ f:(z, y) The analytic function of one variable G(E) behaves as h=k d F(E). That is, it is positive at the origin, and decreases f,(zlv) = ~f/(%Y) , monotonically for e > 0. So, it has a unique positive h=k root. We don’t need to compute this root either. To test whether g has no zeros in a box B((O, O),6), wewhere f~ and ~~ are forms of degree k – 1, and at just need to evaluate G(6). If G(6) >0, then g hasleast one of them is nonzero, again because of Euler’s no zeros in the box. And here we have a problem. Ifformula [31]. It follows that either m(p; ~z ) = k – 1, a partial sum ~~=o Gh /ih is negative, we can stop theor m(p; fv) = k – I, i.e., evaluation, and accept the box for further subdivision, but to be sure that G(6) >0, we need to perform an min{m(p; f=), m(p; fY)} = m(p; f) – 1, infinite number of operations, and we cannot do that. The solution is to truncate the series, and redefine G(c)and this is also true for functions of mom than two as a polynomial plus an extra termvariables. Finally, by construction, m(p; ~~ ) ~ k – 1 2das well. We conclude that m(p; @) = 2k – 2. •l G(E) = Go – ~ Gh Eh – G2~+1(c) , (8) Note that the construction of f~ , as well as the con- h=lstruction of @, depends on the location of the originof the coordinates system. Once a point p = (u, v) is where Go, . . . . Gzd are defined in equation (7), butchosen, we first translate the origin of the polynomial &+l (c) will be chosen to bound the tail of the seriesto p, and then construct #1 and +. Different rational expansion of gfunctions are used in different locations. Now we need to extend our intersection test for poly- 1nomials to the rational function g = @J/@, nd as be- afore, after translating the origin we can just assume thatp = (O,O). The second assumption is that +(p) # O, for Il(z, y)ll ~ E. To construct Gzd+l we need theand so d(p) # O, because in such a case the curve following result 227
  8. 8. Lemma 3 M <1,..., i,vl,v,vn, hfvn, hf bereal numbers. should not be rejected, and subdivided even further. ItLet us de@ vJ+n = ~lv~+n-l + ..0 + (nvj, and Kj = is clear that the condition M(c) <1 will eventually bemax{l~l,..., lv~+’’-ll}, jbr j 21. ~ M, satis&s the satisfied after a number of subdivisions. With respectinequality 1<1 + ““”+ l(nl<lw<l,then I to K1 = max{lgll, . . . . lg2d-21}, we can always replace it with an upper bound function of c. Since &&1 = 15 # < nKIMr/(l– &d = O, we take M), ‘ j=rn+l ‘ K1 (e) = max {Glq... , Gzd-&d-2} . This isalso a monotone function of c, and K1(0) = O. Observe that K1 (c) is independent of Go, which isPRmF : First of all, note that for every j 21 we have assumed to be diffem-tt from zero. Finally,lvj+~l = l(lti+-1 +... +~~v~l Gzi+](f) = u K1(E) WE)/(1 – Jf(E)) . s {1<11+..+ lf~l} . max{l#l,...,lvjJ’ll}l} Note that at least Gzd+l(~) = O(&). < Kjl Figure 2 shows examples of curves rasterized with the algorithm of figure 4 based on this test.with the last inequality because M < 1. This clearlyimplies that 5 Visualizing surfaces and surface-surface intersections Kj+~ = max{lti’+ll,..., Iti+’’-ll, lti+nl} < Kj . The algorithms described above can be trivially ex- tended to dimension three and above. In dimensionNow, from the previous two inequalities we obtain thee we start with a cubical box 13((u, v, w), 4) Kj += = max{l~”+nl, . . . . l@”+2n–11} {(z, y,z) : max{lz - Ml,Iv- vI, Iz - wI} < 6} ~ max{MKj,... , MKj+._l} z .MKj , and a polynomial of three variables ~(z, y, z) of de-and by induction, Ifj+hn ~ MhKj , for h ~ 1. Finally, gree d. The recursive subdivision algorithm can befor r ~ 1 we have extended to three dimensions by subdividing the cube into eight subcubes. We introduced the tests in dimen- w lx j=rn+l d sion two just not overload the reader with notation, but here is how it can be extended to dimension three. Ex- m tensions to higher dimensions zue left to the reader, but this kind of approach is not practical in very high di- mensioml space because each box must be subdivided into 2“ subboxes, where n is the dimension of the nKIM’ ~Mh = nKIM’/(l– M). space, and one could very easily encounter a storage h=O problem.u Homer’s algorithm can also be used in dimension the and above, so for testing whether the polyno- Now we compute G2~+1(t) as follows. We first com- mial ~ has zeros in a box lil((u, v, w), 6), we first trans-pute the coefficients of the forms go,..., g2~ with the late the origin to (u, v, w), and then we test the boxrecursive equations (6), and then evaluate the coeffi- B((O, O,O),6). After translating the origin we write thecients Go, ..., GM of the bounding polynomial. Now polynomial !(z, y, z) as a sum of forms of increasingwe apply the lemma for n = 2d, r = 1, (j = –@j /+0 degreeforj= l,..., 2d–2, ~2d-1 =~2d=0, and @ =~, for dj= l,..., 2d. Note that the recursive equation of thelemma is nothing but the last equation of (6), and ev- h=Oerything hem is function of the point p = (z, y), eventhe bounds M and K1 . But there is some freedom wherein choosing M, which we will make a function of c. fh(x, Y,z) = ~ fajk~i~zkAs we have done for other forms, the form (h(z, y) i+j+k=hsatisfies the inequality <h(z, y) S ~hll(z, Y)I12, Where For the first test, we define the coefficients of the bound-‘h = ~i+jnh !’& I ~ ‘d th = ~a+jch %z$d - ‘e ‘ake ing polynomial F(f) = Fo – ~;=l Fh q as follows hNote that M(c) is a monotone function, and M(0) = O.So, for small E the hypothesis M(E) <1 is satisfied. and we obtain the corresponding test for dimensionIf it is not satisfied for the curmmt value of E, the cube three: if F(6) >0 the polynomial f does not have 228
  9. 9. zeros m the box B((O, O, O), 6) Fype 7 shows the m- In the case of the Cartan’s umbrella, the z am ]s theresult applying the algorithm based on tlus test to the of set of singular points of the Polynomial In the case ofsimple case of a sphere The results at the end of each the heart all the singular points belong to the boundarysubcimson level have been rendered with a standard of the set of regular points, but not here The algorithmray-tracing algorithm The new test mtmduced m the correctly keeps track of a ne@borhood of all the pointspnwlous sechon cart be extended to the three dm-ten- of the surface, mcludmg the singular pointsslonal case m a smular way We leave the detads to the sreader The set of regular zeros of a polynomial define a sur-face (If not empty), but the set of singular points can bea uruon of Isolated points, curves, and even surfacesFor example, m the case of the heart of figure 8, thesurface has two ~olated singular points, the two cusps, mmone at the top, and the other at the bottom, and also acurve of singular points The 2ntersect20n of the surfacewith the plane z = O 1s an elhpse, an all the points ontlus elhpse are sutgular Since we have used the sunplertest for tius pictures, that w why we observe a fatterurtgaround that curvesss mmm level 5 level 6 level 7 Flgu~ 9 Cartans umbrella ‘(Z2 + l?) - 23 = O BOX center (0,0,0) Box s]de 4 In fact, the mtersectlon of two regular surfaces canmmms be rendered with d-us algorithm by representing It as a completely .wngular surface For example, figure 10 shows an example of tlus process The mtersetion of two cylinders 1s rende~d by applying the subdnwon algorithm to the sum of squares of the two polynomials defmmg the mdnudual surfaces level 6 level 7 RaytracedFlgu~ 7 Sphere .2 + ~ + .2 -225 = O Box center (0,0,0)Box s]de 4 umummm mm mmm level 5 level 6 level 7 Flgu~ 10 hte~on of two cyhnders .2 + (z - I )2 2 = O ~ + (z + 1)2 – 2 = O asmgular surface (Z2 + (z 1)2 – 2)2 + (d+ (z+ 1)2 - 2)2 = O Box center (O 0,0) Box side 4 As a parhcular case, we can use the algorithm to wsuahze and explore surfaces with smgulantws The level 6 level 7 Raytraced singular space, defined as the set of zeros of the poly nomlal #(z, y, z)Figure 8 Heart (2.2 + & + .2 1)3 (1/IO)Z2Z3 – tj-z3 %xcenter (O O O) Box side 25 fuJ(%Y, z)2 + fz(~, Y!z)2 + fy(~, Y,z)2 + fz(z!Y, z)2 229
  10. 10. used in the desingularization test, can be mndemcl si- [14] D.P. Dobkin, S.V.F. Levy, and Thurston W.P, Contourmultaneously, and the user can choose regions to ex- tracing by piecewise hnear approximation. ACM Trans-plore in more detail based on this. actions on Graphics, 9(4)389-423, October 1990. As we have seen, in dimension three this algorithm [15] M.L. Dowting. A fast parallel homer algorithm. SIAMprovides a primitive tool to visualize algebraic surfaces )ourmd on Computing, 19(1):13>142, February 1990. [16] R.T. Farouki, and V.T. Rajan. On the numerical conditionand space curves, and to seamh for singularities. As it of Berstein polynomials. IBM Research Diviswn Technicalis, the result of the algorithm is a set of cubes containing Report RC-12626, March 1987.the curve or surface. For regular surfaces, a marching [17] R.T. Famuki, and V.T. Rajan. On the numerical conditioncubes [22, 10, 21] type of algorithm can be used to com- of algebraic curves and surfaces. IBM Research Diviswnpute an approximate triangulation of the surface. The Technical Report RC-13263, November 1987.problem is how to deal with singular cases, and we are [18] M. Hall and J. Warren. Adaptive polygonalization ofcurrently investigating how to deal with the problem. implicitly defined surfaces. IEEE Computer Graphics and Apphcations, pages 3342, November 1990.References [19] J.D. Hobby. Rasterization of nonparametric curves. ACM Transactions on Graphics, 9(3):162-277, July 1990. [1] S.S. Abhyankar and C. Bajaj. Automatic parametri- [20] B.W. Jordan Jr., W.J. Lennon, and B.D. Hohn. An im- zation of rational curves and surfaces I: conies and proved algorithm for the generation of nonparametric conicoids. Computer Aided Design, 19(1):11-14, Jan- curves. IEEE Transactions on Computers, C-22(12) :1052– uary/February 1987. 1060, December 1973. [2] S.S. Abhyankar and C. Bajaj. Automatic parametrizat- [21] A.D. Kalvin. Segmentatwn and Su@ce-Based Modeling ion of rational curves and surfaces II: cubics and cubi- of Objects in Three-Dirnenswnal Bwmedicd Images. PhD coids. Computer Aided Design, 19(9):499-502, November thesis, New York University, New York, March 1991. 1987. [22] W. Lcmmson and H. Cline. MaAing cubes: A high [3] S.S. Abhyankar and C. Bajaj. Automatic parametrizat- resolution 3d surface construction algorithm. Computer ion of rational curves and surfaces ILI:algebraic plane Graphics (Prvc. SKGRAPEO, 21(4):163-169,July 1987. curves. Technical Report CSD-TR-619, Purdue Univer- [23] P.H. Milne. SymtKIlicand Numerical Computatwn fir Ar- sity, Computer Sciences Department, W=t Lafayette, tificial Intelligence, chapter On the Solution of a Set of Indiana, February 1987. Polynomial Equations, pages 89-101. Academic Press [4] S.S. Abhyankar and C. Bajaj. Automatic parametrizat- Ltd., London, UK, 1992. ion of rational curves and surfaces N algebraic space [24] D. Moore and J. Warren. Adaptive mesh generation curves. Technical Report CSD-TR-703, Purdue Univer- ii: Packing solids. Technical Report Rice COMP TR90- sity, Computer Sciences Department, West Lafayette, 139, Department of Computer Science, Rice University, Indiana, February 1988. Houston, TX, March 1991. [5] E. Allgower and K. Georg. Simplicial and continuation [25] R. Morns. A new method for drawing algebraic sur- methods for approximating fixed points and solutions faces. In R. Fisher, editor, The Mathematics of Su@ces to systems of equations. SIAM Review, 22(1):28-85, Jan- V, Edinburgh, Scotland, September 1992. IMA, Oxford uary 1980. University Press. (to appear). [6] E.L. Allgower and S. Gnutzmanrt. Sirnplicial pivoting [26] P. Pedersen. Counting Real Zeros. PhD thesis, New York for mesh generation of implicitly defined surfaces. Comp- University, 1991. uter Aided Geometric Design, 8:305-325,1991. [27] T.W. Sederberg, D.C. Anderson, and R.N. Goldman. Im- [n E.L. Allgower and P.H. Schmidt. An algorithm for plicit representation of parametric curves and surfaces. piecewise-linear approximation of an implicitly defined Computer Vision, Graphics, and Image Processing, 28:72- manifold. SIAM Journal of Numerical Analysis, 22(2)322- 84,1984. 346, April 1985. [28] T.W. sederb~ D.C. Anderson, and R.N. Goldman. Im- [8] D.S. Amen. Topcdogically reliable display of algebraic plicitization, inversion, and intersection of planar ratio- curves. Computer Graphics,17(3)219-227, July 1983. nal cubic curves. Computer Wwn, Graphics, and hnage [9] C.L. Bajaj, C.M. Hoffmann, J.E. Hopcmft, and R.E. Processing, 31(1):89-102, July 1985. Lynch. Tracing surface intersections. Twhnical Report [29] G. Taubin. Rasterizing implicit curves by space subdi- CSD-TR-728, Department of Computer Science, Purdue vision. IBM Research Diviswn Technical Report RC17913, University, West Lafayette, Indiana, December 1987. April 1992.[10] H. Baker. Building surfaces of evolution: The weaving [30] J. Van Aken and M. Novak. Curvedrawing algo- wall. International journal of Computer Viswn, 3:51-71, rithms for raster displays. ACM Transactions on Graphks, 1989. 4(2):147-169, A@ 1985.[11] J. Bloomenthal. Polygonization of implicit surfaces. [31] R. Walker. Algebraic Curves. Princeton University Press, Computer Aided Geometric Design, 5:341-355,1988. 1950.[12] A. Borodin and I. Munm. TheComputational Complexity of Algebraic and Numeric Problems. American Elsevier, New York, 1975.[13] Y. De Mountaudouin. Resolution of P(Z, y) = O. Com- puter Aided Design, 23(9):653454, November 1991. 230
  11. 11. SESSION 4: Constraints231