p313 fortune (1)

Upload: hirak-sarkar

Post on 04-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 p313 Fortune (1)

    1/10

    A S w eep l i n e A l g o r i th m fo r V o ro n o i D i a g ra msSteven FortuneA T& T Bell LaboratoriesMurray Hill, New Jersey 07974

    AbstractWe present a transformation that can be used tocompute Voronoi diagrams with a sweepline technique.The transformation is used to obtain simple algorithmsfor computing the Voronoi diagram of point sites, of l inesegm ent sites, and of weighte d point sites. All algo-ri thms have O (n log n) worst case running t ime and useO (n) space.

    1. IntroductionWe present simple algorithms for the constructionof Voronoi diagram s of a set of si tes in the plane. The

    sites can be points or line segmen ts. The algorith ms arebased on the sweepline technique [$83]. The sweeplinetechnique conceptually sweeps a horizontal l ine upwardsacross the plane, noting the regions intersected by theline as the line moves. Comp uting the Voronoi diagramdirectly with a sweepline technique is difficult, becausethe Voronoi region of a si te may be intersected by thesweepline long before the site itself is intersected by thesweepline. Rathe r than compute the Voronoi diagram ,we compute a geometric transformation of i t. Thetransformed Voronoi diagram has the property that thelowest point of the transformed Voronoi region of a siteappea rs at the site itself. Thu s the sweepline algor ithmneed consider the Voronoi region of a site only when thesite has been intersected by the sweepline. It turns outto be easy to reconstruct the real Voronoi diagram fromits transformation; in fact in practice the real Voronoidiagram would be constructed, and the transformationcomputed only as necessary. The sweepline algorithmsall have asymptotic running t ime O(n log n) and spaceusage O (n).

    Previous algorithms for Voronoi diagrams fall intotwo categories. First are incremental algorithms, whichconstruct the Voronoi diagram by adding a si te at at ime. These algorithms are relatively simple, but haveworst case t ime complexity O(n2). However, the algo-ri thms may have good expected t ime behavior [BWYS0][GS77] [OIM84] .The second category of algorithms are divide-and-conquer algorithms. The set of si tes is spli t into twoparts, the Voronoi diagra m of each part c omputed rec ur-sively, and then the two Voronoi diagrams mergedtogether. If the sites are points, then they can be splitsimply by drawing a l ine that separates the si tes into two

    Permission to copy without fee all or part of this material is grantedprovided that the copies are not made or distributed for directcommercial advantage, the ACM copyright notice and the title of thepublication and its date appear, and notice is given that copying is bypermission of the Association for Computing Machinery. To copyotherwise, or to republish, requires a fee and/or specific permission.(c) 1 9 86 AC M 0 -8 9 7 9 1 -1 9 4 -6 / 8 6 / 0 6 0 0 / 0 3 1 3 $ 0 0 .7 5

    halves[SH75]. If the si tes are l ine segments, then morecomplex parti tioning is necessary [Y84]. With care, thedivide-and-conquer algorithms can be implemented inworst case t ime O(n logn ). The difficulty of the divide-and-conquer algorithms is generally with the merge stepthat combines two Voronoi diagram s together. Whilethe time required for this step is only linear in thenumb er o f si tes, the details of the merge a re complexand hard to implement.

    The sweepline algorithms presented in this paperare competit ive in simplicity with the incremental algo-ri thms. Since they avoid the merge step, they are muchsimpler to implement than the divide-and-conquer algo-ri thms. But they have the same worst-case t ime com-plexity as the divide-and-conquer algorithms.We also present an algorithm to compute theVoronoi diagram of weighted point sites, in which eachsite has an additive weight associated with i t. The algo-

    ri thm uses exactly the same sweepline technique, andhas t ime c omplexity O (n log n). No algorithm w ith thist ime c omplexity was previously known for this problem.All algorithms presented in this paper are assumedto be implemented in exact real ari thmetic. We hope to

    investigate stability issues of the algorithms in more rea-sonable models of floating point ari thmetic.2. Point Sites

    We first consider the case that all si tes are pointsin the plane. This simple case has been discussed exten-sively in the literature. For more details, see for example[SH7 5] or [LD81]. For a more general si tuation thanpoint sites, see [LS85a].I f pE R 2, then Px and py are the x and y coordi-nates o f p, respec tively. Points p,q ER 2 are lexicographi-cally ordered, p

  • 8/14/2019 p313 Fortune (1)

    2/10

    V consists of the union of segments and hairl ines.A vertex of V is a point of V with at least three incidentsegments or halflines; equivalently a vertex is a pointequidistant from at least three si tes. An edge of V is amaxim al straightl ine subset of V containing at least asegment and not containing any vertices in i ts interior.An edge either has two vertices as endpoints or is a half-l ine with one vertex as endpoint. B~ 0 V is always con-nected; if i t properly contains a point, then i t is an edge,label led e~. e~ fo rms par t o f the boundary of Rp andRq. There a re at most O (# S) edges and vertices of V,since V forms a plana r graph.2.1. The transformation *

    Consider the mapping *:R2--*R 2 defined by (x ,y)-(x ,y+ d((x ,y))). * maps the point z E R 2 tO thetopmost point of the Voronoi circle at z. Not e tha t * iscontinuous, fixes all si tes, and maps each vertical l ineinto itself. In general we refer to * (B) as B' , for B asubset of the plane.Wh at is the effect of * on a bisector7 We claim~hat the image under * of the Voronoi edge between

    sites at different heights is a section of a hyperbola, andbetween sites at the same height is a section of a verticalline. To see this, let *p(x,y),-Oqy+dp((x,y))). Then p (B p q ) - - *q(Bpq) - { ( x , y + d p ( 0 q y ) ) ) : (x,y)EBp]. I fp~>qy, then *p(Bpq) is a hyperbola open upwards, withminim um point p. Not e that *p( R~) l ies above *p(Bpq),and *p(R~p) lies below *p(Bpq). Othe rwise we havepy-qy, so B~ is the ver t ical l ine th rough r - (px+qx) /2 ,and *p(Bpq) is {(r,y+dp((r,y)))}, which is the verticalhairl ine above (r,py) not contai ning (r, py). No w if epq isan edge of V, then d-dp-dq on epq, so e~-*p(epq ) , ande~ is a section of a hyperb ola or a vertical line. SeeFigure 2.3.

    What i s the ef fect o f * on a reg ion Rp? Note th at - * p o n Rp. Consider a vertical l ine not passingthrough p. It is easy to see tha t * is monotonicallyincreasing on the section of the vertical l ine through Rp,and m aps every point to another above p. On the verti-cal l ine through p, * maps every point in Rp below p top, and is monotonically increasing in Rp above p . Not icethat p must be the lowest point of R~.

    No w * must b e 1-1 on IF, since no vertical seg-ment incident to a si te can be contained in V, and * failsto be 1-1 only on such segments. Hen ce we can decom -pose V" into edges and vertices, the images of edges andvertices of V, and V* has the same incidence structure asV.Lemma 2.1: If v is a vertex of V and v* is not a si te,then exact ly one edge of V" ex tends upwards f rom v ' ,and the rest extend downwards. If v* is a si te, then~actly two edges extend upwards from v* and the rest=t~nd downwards.Proof: Staightforwa rd. D

    Using the preceding discussion and Lemma 2.1,we can analyze every point x in the range of *. The fol-.~wi~ c~s~s are mutually exclusive and exhaustive: x is

    in the interior of some region Rp; x l ies on some edge e~but is neither a site nor a vertex; x is a site, is not a ver-tex, and is the minim um point of both R* and e~p, somep; x is a vertex, not a site, with at least two edgesincident downwards and exactly one incident upwards;and x is a vertex and a site, with exactly two edgesincident upwards and at least one incident downwards,and is the minimum point of R~.2.2. The algorithm for V and for V

    A sweepline algorithm suffices to compute V' .The algorithm conceptually moves a horizontal l ineupward across the plane, maintaining the regions of V"intersected by the horizontal line. A region is encoun-tered for the first t ime at a si te, and a region disappearsat the intersection of two edges. The coordinates ofthese two events are easily computed, since all si tes areknown init ial ly, and since intersections of edges can becomputed as the regions bounded by the edges areencountered.

    The algorithm is given formally as Algorithm 1.Algorithm 1 produces the Voronoi diagram V" as a l istof bisectors. Eac h bisector is marked with the verticesthat are the endpoints of the corresponding Voronoiedge. If a bisector is mark ed with only a single vertex,then the c orresponding edge is a hairl ine.

    Algorith m 1 is writ ten as if degeneracies could nothappen, w here a d egenerac y is a si te lying on a bisectoror four or more cocircular points. As Theore m 2.2shows, this simplification is st i l l adequate to compute theVoronoi diag ram in the presence of degeneracies. How-ever, one consequence of this approach is that Algorithm1 can produce zero length edges, specifically bisectorswith the same point as the two endpoints. These edgesmust be removed from the l ist if their presence causesproblems. Alternatively, Algorithm 1 can be writ ten totest explicit ly for degeneracies, though it then becomesmore complex. Also, Algorithm 1 assumes that the set Sof si tes contains a unique bottommos t si te. This assump-tion is not essential; lines 2 and 3 need to be modified toinitialize the list L correctly if S contains several siteswith identical minimal y coordinate.

    I f py>qy, then *p(Bpq) is a hyperbola openupwards, and a horizontal l ine can intersect i t at twopoints. To simplify the presentation of Algorithm 1, wesplit *p(Bp) into two pieces, ~ to the left of and con-taining p, and ~ to the right of and containing p.Then ~ is monotonically decreasing, ~ is monotoni-cally increasing, and a horizontal l ine can intersect eitherof them at most once. I f py-qy t h en we se t ~ - ~ an d~ - * p ( B p ) . W e c al l ~ a n d ~ boundaries. W e useCpq to denote one of ~ and ~ when the choice isun importan t o r can be determined f rom contex t. Forexample, in l ine 15 of Algorithm 1, C, is ~ either if pis to the right of the.higher of q and s or if q and s arecohorizontal; otherwise Cq: is ~.

    Line 8 of Algorithm 1 is a search to find theregion containing a newly encountered si te. The search

    3 1 4

  • 8/14/2019 p313 Fortune (1)

    3/10

    can be implemented as a b inary search on l is t L , s ince Lcon tains the reg ions and boundaries in o rder on the hor-izon tal line. I f the s i te actual ly fa l ls on a boundary , thesearch can retu rn the reg ion on ei ther s ide o f the boun-dary . Note tha t the actual x coord inate where a boun-dary in tersects the hor izon tal l ine is determined by the ycoord inate o f the l ine.Theorem 2 .2 : Let S be a set o f po in t s i tes , wi th un iquebo t tommost s i te . Then A lgori thm 1 computes V* (S) .Proof : Omit ted due to lack o f space. 13Theorem 2 .3: Algori thm 1 can be implem ented to run int ime O (n log n ) and space O (n ) .P ro o f : We f i r s t c l a im th a t t h e n u m b er o f i t e r a t io n s o fthe whi le loop is a t most O(n) ; i t then fo l lows that thenumber o f b isecto rs ever create d is O (n ) . The numbe rof i terat ions o f the loop fo r a po in t p no t a s i te i s oneless than the number o f boundar ies in tersect ing at p , andfor p a s i te i s one more than the n umber o f boundar ies pl ies on . S ince the num ber o f in tersect ing boundaries a t pis bounded a bove by the degree o f p as a ver tex o f V, thenumber o f i terat ions summed over a l l ver t ices and s i tesis O (n).

    Now Q con tains a t most two en tr ies per boundaryand one per s i te , hence at most O (n ) en tr ies . Q needsoperat ions inser t and ex tract -min ; Q can be implementedas a heap at t ime cost O(logn) p er o p e ra t io n an dsto rage cost O (n ) . S imila r ly , L can con tain at mostO (n ) en tr ies , s ince a hor izon tal l ine can in tersect eachb isecto r a t most twice. L needs operat ions inser t , delete ,and search ( fo r L ine 10) ; a balanced t ree scheme canimplement these at t ime cost O (log n) per operat ion andsto rage cost O (n ) . Thus each i terat ion o f the whi le looptakes t ime O (log n) for a tota l t im e of O (n log n). 13Theorem 2 .4 : Algor i thm can be modif ied to compute Vin t ime O(n i o g n ) an d sp ace O (n ) .P ro o f : We c l a im th a t A lg o r i th m l can b e m o d i f i ed touse on ly un transfo rme d b isecto rs and ver t ices . Algo-r i thm l creates a Vorono i edge by f i rs t creat ing theb isecto r con tain ing the edge and then la ter mark ing theb isecto r wi th the endpo in ts o f the edge; these operat ionscan be perfo rm ed d irect ly . Even t queue (2 con tains s i tesand the in tersect ions o f boundar ies . The in tersect ion o ftwo boundaries can be ob tained by comput ing the in ter-sect ion o f two un transfo rmed b isecto rs and then add ingto the y -coord inate o f the in tersect ion the d is tance toany o f the s i tes determ in ing the b isecto rs . S imila r ly , thel is t L can con tain un transfo rmed reg ions and b isecto rs ;t h e t r an s fo rm at io n can b e co m p u ted ex p l i c it l y d u r in g th esear ch o f line 10. 13

    Algor i thm l can be easi ly modif ied to computethe Delaun ay t r iangu lat ion . In the case o f the in tersec-t ion o f boundar ies , s tar t ing at l ine 12 , the Delaunay t r i -ang le correspond ing to ver t ices q, r, and s shou ld be ou t-pu t . Th is wi l l actual l y p roduce a fu l l t r iangu lat ion , wi thd iag o n a ls ad d ed a rb i t r a r i l y t o D e lau n ay r eg io n s w i thmore than th ree s ides .

    3 . L ine segment s i tesAlgori t hm 1 can be ex tended to compute the

    Vorono i d iagr am of a set o f l ine segments . The gene ralidea o f the algor i thm is the same; we t ransfo rm theVorono i d iagram so that the lowest po in t o f a Vorono ireg ion appears a t the Vorono i s i te , and then use a sweep-l ine techn ique. However , the detai ls are more complex ,because the Vorono i d iag ram i tself ' i s more complex , andbecause the t ransfo rmat ion * is no t as wel l behaved .

    The Vorono i d iagram is constructed using theb isecto rs between pairs o f s i tes , where the "b isecto r" isthe locus o f po in ts equ id is tan t f rom the two s i tes. Theb isecto r o f two po in ts is a l ine. Whil e the b isecto r o ftwo d is jo in t segments is s t i l l a s imple curve, i t can haveup to seven sect ions, each a sect ion o f a l ine o r a para-bo la . Worse, the b isecto r o f two segments shar ing acommon endpo in t need no t even be one-d imensional ,s ince there is a two-d imensional reg ion fo r which thecommon endpo in t i s the closest po in t to bo th s i tes .

    We can s im pl i fy the s i tuat ion somew hat by g iv inga s l igh t ly modif ied def in i t ion o f the Vorono i d iagram.We requ ire that every segment be sp l i t in to th ree s i tes ,two fo r the endpo in ts and one fo r the segment i t sel f .Then we d is t ingu ish between the endpo in ts o f the seg-ment o r the seg ment i t sel f being closest . As wi l l be seen ,th is has the consequence that the b isecto r between twosi tes is a lways a sect ion o f a l ine o r a parabo la . Also ,the two-d imensional reg ion that used to be the b isecto ro f two co inciden t segments becomes the Vorono i reg ionof the common endpo in t o f the segments . A s imilar ideahas been used in p rev ious papers on the Vorono i d iagramof l ine segments [K79] [Y84] .

    3~he t ransfo rm at ion * in the l ine segment case isno t a lways one-one, as i t was in the po in t s i te case. Th isdoes no t a l ter the asympto t ic t ime o r space complex i ty o fthe algor i thm, bu t more care is needed in hand l ing spe-cial eases .3 .1 . The Vorono i d iagram of l ine segments

    L e t S , t h e se t o f sites, be a set o f po in ts and l inesegments in the p lane, wi th the p roper t ies that l ine seg-ments in tersect on ly at endpo in ts and that every end-po in t o f a l ine segment is a po in t s i te . For pES ,dp:R2--*R is the distance to p and is def ined by dp(z) -g lb e (x , z ) , w h ere e (x , z ) i s t h e E u c l id ean d is t an ce f romxEpx to z. The tangent contact region o f p, tp, is R 2 for p apo in t , and fo r p a segm ent i t i s the band co n tain ing pbounded by the two l ines th rough the endpo in ts o f p per-p en d icu la r t o p . (A c i r c le cen te red a t z E p o f r ad iu sdp(z) i s tangen t to p.) d:R2--*R i s def ined byd ( z ) - m i n dp (z). T h e bisector B~ isp::~tp{zEtpNtq:dp :)-d, z)}. R~ is {zEtp:dp z)d, z)}and the Voronoi region Rp is q~pRM The Voronoidiagram V-V S) is {zEB~:p,qES and d z)-dp z)}.

    The b isecto r a M fal ls in to one o f four categories ,depend ing on whether p and q are two po in ts , a segment

    315

  • 8/14/2019 p313 Fortune (1)

    4/10

    and its endpoint, a segment and a disjoint point, or twosegments. If p and q are distinct point sites, then B~ isthe line bisecting p and q, as before. If p is an endpointof segment q, then B~ is the line perpendicular to qthrough p. If p is a point not collinea r with segment q,then Bpq is a section of a parabola. (Note t hat i f p is apoint collinear with segment q, not an endpoint, then Bpqis empty.) Finally , if p an d q are segment sites, thenBpq is a point, a segment, possibly empty if tp O tq con-tains no points equidistant from p and q, or if p and qare c ollinear sharing a common endpoint, then Bt,q is theline perpendicular to p and q through the common end-point. See Figure 3.1.

    The Voronoi region Rp need not be convex, how-ever it is starshaped from p: for each xERp, there isy Ep so that the line segment xy is entirely contained inRp (in fact, y can be chosen to be the po int of p closestto x).

    It is possible that the Voronoi region of a pointsite p is degenerate. If p is the common endpoint of twocollinear segments, then Rp is contained in the linethrough p perpend icular to the two segments. If p is thecommon endpoint of three or more segments and everyangle formed by two consecutive segments is less than ~r,then Rp is p itself.

    A vertex of V is a point of V incident to threecurves contained in V. A vertex is always a pointequidistant from three sites and in all three tangent con-tact regions. (Note that the converse statement fails onthe degenerate case mentioned first in the last para-graph.) An edge of V is a maximal one-dimensionalcurve connecting two distinct vertices, or with one vertexas endpoint and extending to infinity. An edge is alwayscontained in a single bisector B~. B~ O V may not beconnected, however it can have at most #S connectedcomponents, each an edge. There are at most O( S)edges and vertices of V, since V forms a planar graph.Figure 3.2 is a simple example of the Voronoi diagram.3.2. The transformation *

    As before, we define * :R 2...,R 2 by (x,y)u(x,y+ d(x,y)), and *p:R2-*R2 by *(x,y) -(x,y+dp x,y) ).What is the effect of * on a bisector Beq? Note

    that *p is 1-1 everywhere except on a vertical segmentbelow the lowest point of p, or below all of p if p is ahorizontal segment. The first case is that p and q aredistinct point sites; then as before *p(Bpq) is a hyperbolaif py;~qy, and is an open vertical hairline if py-qy.Second, if point site p is an endpoint of segment q, thenif q is not horizontal, then *p(Br~) is two hairlines withendpoint p, one directed up and to the left, the otherdirected up and to the right; if q is horizontal, then thevertical hairlin e below p conta ined in Br~ collapses to p,and *p (Bpq) is the vertical hairline with bottom endpointp. The third case is that p is a point site not collinearwith seg ment q. The n *p (Boq) is a parabol a, except if qis horizontal and qy>py, in which case *p(B ~ is q.

    Final ly, if p and q are both seg ment sites, and Bpq is asegment, then in general *p(Br~) is also a segment. How-ever, if p and q are both horizontal segments sharing acommon endpoint, then again the vertical hairline belowthe common endpoint contained in Br~ collapses to thecommon endpoint, and B ~ is the vertical hairline abovethe common endpoi nt. See Figure 3.4.

    As before, d-dp-dq along B~N V, so *p-*q-*along B~ N V. Hence the edges of V* are sections oflines, parabola s, and hyperbolas. Also, we again split*p(B~) into two boundarie s. If u and v are the lexico-graphically minimal points of p and q, respectively, andu~>vy, then C~ - {(x,y)E*p(Bm):x~ux}. If py-qy, then C~q-*p(B~)and ~- o. Thus C~ if nonempty is monotonicallydecreasing, and C~q is monotonically increasing.

    Now *, like *p, can fail to be one-one; this hap-pens only on a vertical segment below a point z on whichthe value of d is identically the distance from z. Such apoint z arises in three ways: if z is an isolated point site;if z is the lowest endpoint of a line segment site, and z isnot the upper endpoint of any other nonhorizontal seg-ment site; or if z is an interior point of a horizontal seg-ment site.

    Unfortu nat ely, * can fail to be 1-1 on V. Asalready noted, * can collapse a bisector contained in thevertical halfiine below the endpoint of a horizontal seg-ment site into the endpoint of the segment. * can alsofail to be one-one in a different way: if point site z is thelower endpoint of a segment site, if no segment has z asits upper end point, and if the re is some site p with ycoordinate strictly below the y coordinate of z, then thevertical halfiine below p intersects some point of V at theboundar y of Rz. This point and z itself are both mappedto zb y* . Note that zm us t be in V, since z lies on thebisector between z and the segment incident to z. Fig-ure 3.2 exhibits both kinds of collapsing.3.3. The Algorithm for V* and for V

    A sweepline algorithm, similar to Algorithm 1,suffices to compute V'. Since * is not always one-one, Vis not identica l topologically to V '. However, it is easyto deter mine how V differs fro m V* as V* is being con-structed, and hence to construct V at the same time asV'. Actually, in an implementation it is probablypreferable to only construct V, and compute the mapping* as necessary.

    The algorithm uses a list L containing the regionsand boundaries intersected by the horizontal line and apriority queue Q of events, each event associated with apoint in the plane. Unlik e Algor ithm 1, we process allthe events associated with a point in the plane all ato n ce .

    What are the possible events? An event may be anintersection of boundaries, a new set of sites, or both. Ifthe event is a site, there are two cases depending onwhether the site occurs in the interior of the Voronoiregion of some other site, or on a boundary. Also, we

    316

  • 8/14/2019 p313 Fortune (1)

    5/10

    process a segment s i te when i ts lex icograph ical ly leastendpo in t i s encoun tered . Hence we d iv ide the segmentsinciden t to a po in t s i te in to those fo r which the po in t s i teis the lower endpo in t and those fo r which the po in t s i teis the upper endpo in t .

    We g ive a case analysis to i l lust rate the act ionsnecessary fo r each possib le even t . I f the even t a t po in t pis s imply the in tersect ion o f boundar ies , o r i s a po in t s i tewith no inciden t segments , then the necessary act ion iss t ra igh tfo rwa rd , s imilar to Algori t hm 1 . Anoth er s implecase is i f p is a po in t s i te that i s the upper endpo in t o f as ing le segment . Then p l ies in the in ter io r o f the Voro-no i reg ion o f the segm ent , and the b isecto r between po in ts i te p and the segment s i te must be created . See F igure3.5a.

    Now suppose p is bo th a po in t s i te and th e lowerendpoin t o f a s ing le segment and l ies in the in ter io r o fsome Vorono i reg ion o f a s i te q. See F igur e 3 .5b . Thentwo b isecto rs need to be created : between p and q , andbetween p and the segme nt s i te inciden t to p . Not icethat * maps two po in ts o f V to p . A degener ate case o fth is i s i f the segment is hor izon tal . See F ig ure 3 .5c.Then the b isecto r between p and the se gment is ver t ical ,and the por t ion o f i t below p is co l lapsed in to p . Threeb isecto rs need to be created : betweeen p and q , betweenp and the segment s i te , and between q and the segmentsite. In V , point p is the endpoin t of all three bisectors ;in V the endpo in t o f the ver t ical segment below p is theendpoin t o f a l l th ree b isecto rs .

    I f p is the lower endpo in t o f several segments , s t i l lin the in ter io r o f the reg ion fo r s i te q , the s i tuat ion iss imilar . The b isecto rs necessary are between s i te p andq , between s i te p and the m ost coun terclockwise seg-ment , between s i te p a nd the most c lockwise segment ,and between ad jac en t pai rs o f segments . Again , i f themost c lockwise segment is hor izon tal , there is a degen-eracy and an add i t ional b isecto r must be created . Notethat in th is ease two ver t ices o f V and a ver t ical edge o fV are a l l m apped by * to p .

    I f p is the upper endpo in t o f a s ing le segment qand lower endpo in t o f a t least one segment , then oneadd i t ional complicat ion can ar ise . I f the ang le betweenq and ei ther i t s c lockwise o r coun terclockwise neighbor isexac tly ~r, then th e Voronoi re gion for p dege nera tes to asection of a line. If the a ngle is less than ~r the V oronoireg ion fo r p d isappears en t i re ly . See F igure 3 .5d . Theb isecto rs created must be ad justed accord ing ly .

    In the re main ing cases po in t s i te p l ies on a boun-dary . The f i rs t way th is can happen is i f p is the upperendpo in t o f a t least two segments . Then p l ies on theboundary separat ing every ad jacen t pai r o f segments .Note that these boundaries were created before p wasencoun tered . I f in fact p is the upper endpo in t o f th reeor more segments , there is a lso an in tersect ion o f boun-dar ies a t p . See F igure 3.5e. The b isecto rs necessaryare s imilar to p rev ious cases .

    The f inal possib i l i ty is that po in t s i te p l ies on theboundary between two s i tes q and r , a t least one o f

    which is no t a segment inciden t to p . Again , the b isec-to rs necessary are s imilar to p rev ious cases . In th is casei t possib le that two ver t ices o f V no t connected by anedge o f V map to the same po in t o f V ' : the cen ter c o fthe ci rcle wi th p , q and r on i t s boundary is a lways aver tex o f V and p may be a ver tex o f V. See F igure3.5f.Th eor em 3.1: Let S be a set of point and line segmentsites, an d V-V S). Then V or V can be computed intime O n Iogn) a nd space O (n).Proof: Similar to the proofs of Th eo re ms 2.2, 2.3, and2.4, using the case analysis discussed above.4 Weighted Point Sites

    As a f inal , easy , app l icat ion o f the sw eep l ine tech-n ique we consider weigh ted po in t s i tes . Now e very s iteis a po in t and has a nonnegat ive weigh t associated wi thi t . We wish to par t i t ion the p lane in to reg ions so thateach reg ion consis ts o f po in ts c losest to a par t icu lar s i te ,where the metr ic is the sum of the weigh t o f the s i te andthe d is tance to the s i te . The Vorono i d iag ram tha tresu l ts has a s imilar appearance to the unweigh ted po in ts i te case, excep t that b isecto rs are sect ions o f hyperbo las .Also , the reg ion o f a s i te may be empty i f i t s weigh t i sb igger than the weigh ted d is tance f rom some o ther s i te .

    The algor i thm fo r th is case is a lmost iden t ical toAlgo ri thm 1 , wi th two minor d i f ferences. F i rs t , themapping * no longer f ixes s i tes , bu t maps them upwardby a d is tance equal to thei r weigh t . Exp l ic i t ly , * i sdef ined by * (x,y) - ( x , y + m i n {dp(x,y)+wp)}, where wppSi s the w eigh t o f s i te p . Second , the reg ion o f a s i te pmay b empty . Th is happens i f * (p )y is less thanpy+wp; th is can be tes ted when p is encoun tered by thesweep l ine. The rem ain ing detai ls are s imilar to Algo-r i t h m 1 an d a re o m i t t ed .

    An al ternat ive def in i t ion o f weigh ted Vorono id i ag ram h as b een s tu d ied b y A u ren h am m er an dEdelsbrunner [A E84] . In this model each s i te has amult ip l icat ive weight : the me tr ic is the Eucl idean d is-tance to a s i te mul t ip led by i ts weigh t . The d iag ramthat ar ises f rom th is metr ic is qu i te d i f feren t f rom theusual Vorono i d iagram; fo r example, one Vorono i reg ionmay completely encircle ano ther Vorono i reg ion .5 , A Geometr ic In terp reta t ion o f *

    T h e m ap p in g * m ay ap p ea r t o b e so m ew h a t m y s-ter ious. A th ree -d imensional vers ion o f the Vorono id i ag ram m ay e lu c id a t e t h e ro l e o f * . T h i s i n t e rp re t a t io nwas f i rs t suggested by Edelsbrunner[E85] .

    F ix a set o f po in t s i tes S . We v iew the s i tes asly ing in the z- 0 p lane o f R3 . For p a s i te , le t the coneof p , cp, be {(x,y,z) ER3:dp(x,y) -z]. Let the su rface Cbe {(x,y,z):(x,y,z)Ecp, some p , and fo r a l l q , i f(x,y,z')Ecq then z

  • 8/14/2019 p313 Fortune (1)

    6/10

    "oblique" projection of R 3 onto the plane z -0 in thedirection parallel to the line {x -0, y + z- 0} . V* is justthe oblique projection of D, and R~ just the oblique pro-jection of cp O C.This interpretation of V in three dimensions givesa different geometric explanation of the sweepline algo-rithm. Suppo se the sweepline is the line y - c (in thez -0 plane). Let Pc be the plane y + z- c. Notice that

    the portion of the Voronoi diag ram V" intersected by thesweepline is just the oblique pro jection of Pc f3 D. Hen cerather than translating a line in the z-0 plane, we canimagine translating a plane parallel to Pc. The intersec-tion of the plane with D gives exactly the sequence ofedges of V" intersected b y the sweepline. It is clear thatthe first time that the translating plane intersects a coneCp, the plane is tangent to the cone, and the oblique pro-jection of the intersection is the site p.The extension to additively weighted point sites isimmediate from this interpretation. The cone for eachsite is simply pushed in the positive z direction by a dis-tance equ al to the weight of the site.

    6. ConclusionsThe algorithms presented in this paper are simpleand asy mptotically efficient. Several issues need to beaddressed before they can be considered practical.The first issue is numerical stability and the han-dling of degeneracies. Very little formal attention hasbeen paid this issue for any Voronoi diagram algorithm,indeed for almost any geometric algorithm. The sweep-line algorithm needs geometric primitives to create bisec-tors and to determine intersections of lines, the same asany Voronoi diagra m algorithm. In addition, the sweep-line algorithm must manipulate the transformation *Now * can introduce numeric instability since even if it

    is mathematically one-one, it can map distant points veryclose. Most of the instabilities introduced by * can beaddressed by performing geometric operations onuntransformed objects, which is the natural way to per-form the operations anyway. We hope to addressnumeric issues in a future paper.A second issue is whether, in practice, other algo-rithms perform better than the sweepline algorithm. Atleast two other algorithms for Voronoi diagrams havebeen proposed that have expected linear running time onuniformly distr ibuted data [BWY80] [OIM8 5]. Thesealgorithms rely on bucketing techniques to obtain thelinear time bound. The sweepline algorithm perform squite favorably, at least compared to the second of these

    algorithms, if similar bucketing techniques are used toimplement the sweepline data structures. Ifcomparsion-based data structures are used instead, thesweepline algorithm is not as efficient[T85].Voronoi diagrams are often used for nearestneighbor searching. This use requires an algorithm tosearch the planar polygonal regions defined by the Voro-noi diagram. A data structure for such searches hasrecently been proposed by Sarnak and Tarjan [ST85].

    The data structure uses linear space and gives O(logn)search time , and app ears relatively simple. A sweeplineapproach is used to produce the data structure from thepolygonal regions. Thus a direct use of the data struc-ture for nearest neighbor searching requires two sweeps:one to produce the Voronoi diagram, and the second toproduce the data structure itself . An interesting ques-tion is whether the two sweeps can be combinedtogether.The combination of transformation and sweeplineis a powerful technique, and the question arises of whatother problems can be solved with it. In a companionpaper we will consider the case of Voronoi diagrams ofline segments under polygonal convex distance functions[CD85]. Convex polygonal distance functions generalizethe metrics L t and L . and hav e applications to versionsof the piano mover 's problem. (A preliminary version ofthe companion paper appeared in [F85], and Leven andSharir [LS85b] obtain a similar result, though with amore complex algorithm.) Perhaps the sweepline algo-rithm is adequate for even more general metrics.

    Referenees[AE84] F. Aurenh amme r, H. Edelsbrunner, AnOptimal Algorithm for Constructing theWeighted Voronoi Diagram in the Plane,Pattern Recognition 17(2), 1984, pp. 251-257.[BWY80] J.L. Bentley, B. W. Wgide, A.C. Yao,Optimal Expected-Time Algorithms forClosest Point Problems, ACM Transactionson Mathematical Software, 6(4), 1980, pp.563-580.[CD85] L.P. Chew, R.L. Drysdale, Voronoi Diagramsbased on Convex Distance Functions,

    Proceedings of the Symposium on Computa-tional Geometry, June 1985, pp. 235-244.[E85] H. Edelsbrunner, private commun ication,1985.[F85] S.J. Fortune, Fast Algorithms for PolygonContainment, Automata, Languages, andProgramming, 12th Colloquium, in LectureNotes in Computer Science 194, Springer-Verlag, New York, pp. 189-198.[GS77] P.J. Green, R. Sibson, Comp uting DirichletTesselations in the Plane, Computer Journal,21(22), 1977, pp. 168-173.[K79] D. Kirkpatrick, Efficient Com putation of

    Continuous Skeletons, Proceedings of the20th Annual Symposium on Foundations ofComputer Science, 1979, pp. 18-27.[LD81] D.T. Lee, R.L. Drysdale, Generalizations ofVoronoi Diagrams in the Plane, Siam J.Computing 10 1), 1981, pp. 73-87.[LSg0] D.T. Lee, B.J. Schacter, Two Algorithms forConstructing a Delauney Triangulation,

    318

  • 8/14/2019 p313 Fortune (1)

    7/10

    [LS85a]

    [LS85b]

    [L82]

    [OIM84]

    [P771

    [SH75]

    [S83][ST85]

    [T851

    [Y84]

    International Journal of Computer andInformation Sciences, 9(3), 1980, pp. 219-227+.D. Leven,M. Sharir, Intersection Problemsand Applications o f Voronoi Diagrams, inAdvances in Robotics, Vol I: Algorithmicand Geometric Aspects of Robotics, J.Schwartz, C.K. Yap, ed. Lawrence ErlbaumAssociates, Inc, to appear.D. Leven, M. Sharir, Planning a PurelyTranslational Motion for a Convex Object inTwo-dimensional Space using GeneralizedVoronoi Diagrams, Technical Report 34/85,June 1985, Tel Aviv UniversityD.T. Lee, Medial Axis Transformation of aPlanar Shape, IEEE Trans. Pattern Analysisand Machine Intelligence, VOL PAMI-4,1982, pp. 363-369.T. Ohya, M.Iri, K. Murota, Improvements ofthe Incremental Method for the VoronoiDiagram with Computational Comparison ofVarious Algorithms, Journal of the Opera-tions Research Society of Japan, Vol 27(4),Dec 1984, pp. 306-336.F.P. Preparata, The Medial Axis of a SimplePolygon, Proc. 6th Symp. Math Foundationsof Comp. Science, Lecture Notes in Com-puter Science, Vol 53, Springer-Verlag, NewYork, pp. 443-450, 1977.M.I. Shamos, D. Hcey , Closest-Point P rob -lems, Proceedings of the 16th Annual Sym-posium on Foundations of Computer Sci-ence, 1975, pp. 151-162.R. Sedgewick, Algorithms, Addison Wesley,1983.N. Sarnak, R.E. Tarjan, Planar Point Loca-tion using Persistent Search Tr ee s,manuscript, 1985.R. Tuminaro, Computation of the TwoDimensional Voronoi Diagram in ExpectedLinear Time, manuscript, 1985.C.K. Yap, An O nlogn) Algorithm for theVoronoi Diagram of a Set of Simple CurveSegments, manuscript, October 1984.

    319

  • 8/14/2019 p313 Fortune (1)

    8/10

    A lg o r i th m I :Inpu t :Outpu t :Data s t ructu res :

    C o m p u ta t io n o f v(s) .s is a set o f n - I po in ts wi th un ique bo t tommost po in t .The b isecto rs and ver t ices o f V* .Q: a p r io r i ty queue o f po in ts in the p lane, o rdere d lex icograph ica l ly . Each po in t i s label led as a s i te ,o r label led wi th a pai r o f boundar ies . Q may con tain dup l icate instances o f the same po in t wi th d is t inctlabels ; the o rder ing o f dup l icates is i r re levan t .L : a sequ en ce ( r I , c l , r 2 , , r t ) o f r eg io ns an d b o u n d ar i e s. N o te t h a t a r eg ion can ap p ea r m o re th anonce on L .

    1. initialize Q with al l s i tes2 . p ex tract_ min(Q )3. L - th e list cont ainin g Rp.4 . whi le Q is no t empty beg in5 . p - ex tract_ ra in (Q)6 . case7. p is a site:8 . F ind an occurrence o f a reg ion R~ on L con tain ing p .9 . Crea te b isecto r B~q.I0. U pda te list L so that it cont ains . . . . Rq, C~, R~, C~, R~ . . . . in plac e of R~.i 1 . Inser t in tersect ions between C~ an d C~ with neighboring boundarie s in to Q.12. p is an interse ction:13. Let p be the in tersect ion o f bounda r ies Cqr and Crs.14. Cr eat e the bisec tor B~s.15. U pdate l i s t L so i t con tains Cqs = C~ or C~z, as ap propria te , instead o f Cq , , R* , Crs.16. Delete f rom Q any in tersect ions between Cqs and their neighbors .17. Inser t any in tersect ions between Cqs and i ts neighbors in to Q.18. Mar k p as a ver tex and as an endpo in t o f B~, , B 's , and B~,.19. end

    i . : " " g r a~ V

    w r

    F i g u r e 2 . 2 . V * f o r p o i n t s i n F i g u r e 2 . 1

    3 2 0

  • 8/14/2019 p313 Fortune (1)

    9/10

    Figure 2.3. Bisectors and t ransformed bisectors

    Figure 3.1: Bisectors. ~fDashe d lines outline tang ent contact re gion. ~f

    igure 3.2: Voronoi diagram of l ine segments Figure 3.3: Transformed Voronoi diagram

    321

  • 8/14/2019 p313 Fortune (1)

    10/10

    I i i I ~ ~ t l

    Figure 3.4: Transformed bisectors

    t

    sqs S

    " Pq e q e

    Case a Case b

    P~ p ' .~- . . Iq e " ' t ~ q e

    Case c ~ Case d

    .

    Case e Case f

    Figure 3.5: Dashed l i n e s i n d i c a t e b i s e c t o r s n e w a t p

    322