A sweepline algorithm for Voronoi Diagrams

24
A sweepline algorithm for Voronoi Diagrams Steven Fortune Algorithmica, 1987 By : Himanshi Sinha (SR - 122 Sweta Sharma (SR - 12392

Transcript of A sweepline algorithm for Voronoi Diagrams

Page 1: A sweepline algorithm for Voronoi Diagrams

A sweepline algorithm for Voronoi DiagramsSteven FortuneAlgorithmica, 1987

By :Himanshi Sinha (SR - 12202)Sweta Sharma (SR - 12392)

Page 2: A sweepline algorithm for Voronoi Diagrams

Problem StatementA transformation is presented

that can be used to compute Voronoi diagrams of point sites, of line segment sites and of weighted point sites using sweepline technique efficiently.

Page 3: A sweepline algorithm for Voronoi Diagrams

MotivationComputing the Voronoi diagram

directly with the sweepline technique is difficult, because the Voronoi region of a site may be intersected by the sweepline long before the site itself is intersected by the sweepline.

Transformed Voronoi diagram has the property that the lowest point of the transformed Voronoi region of a site appears at the site itself.

Page 4: A sweepline algorithm for Voronoi Diagrams

Prior WorkPaper Type of

algorithmTime Complexity

J. Green, et. al Computing DirichletTesselations in the Plane

Incremental O(n^2)

L. Bentley et. al Optimal Expected-Time Algorithms forClosest Point Problems

Incremental O(n^2)

T. Ohya et.alImprovements of the Incremental Method for the Voronoi Diagram with Computational Comparison of Various Algorithms

Incremental O(n^2)

M.I.Shamos et.alClosest-Point Problems

Divide and Conquer

O(nlogn)

C.K. Yap et.alAn O(nlogn) Algorithm for theVoronoi Diagram of a Set of Simple CurveSegments.

Divide and Conquer

O(nlogn)

Page 5: A sweepline algorithm for Voronoi Diagrams

Key contributionsCompetitive in simplicity with the

incremental algorithms with O(nlogn) time complexity.

Avoid the merge step compared to divide-and-conquer algorithms and therefore are much simpler to implement.

An algorithm to compute the Voronoi diagram of weighted point sites with time complexity O(nlogn) has been proposed.

Page 6: A sweepline algorithm for Voronoi Diagrams

Sweepline algorithm for set of sitesThe sites can be • Point sites• Line segment sites• Weighted point sites having

additive weights

Page 7: A sweepline algorithm for Voronoi Diagrams

Sweepline algorithm for set of point sitesBasic Terminologies :Lexicographically ordered points : points p,q R2 lexicographically ordered, p

<q, if py <qy or py=qy and px <qx.d: R2 –> RFor p S, dp : R2 –> R is the Euclidean distance

from a point in R2 to p, and d: R2 –> R is min dp(for all p S)

Voronoi circle at z R2 : Is the circle centered at z of radius d(z).

Page 8: A sweepline algorithm for Voronoi Diagrams

Bisector Bpq

For p,q S is {z R2 : dp (z) = dq (z)}

Rpq is {z R2 : dp (z) <= dq (z)}

Voronoi region of p , Rp is Rpq

Page 9: A sweepline algorithm for Voronoi Diagrams

The Transformation * :The mapping * : R2 –> R2 defined by *(x,y) = (x, y+d(x,y))

* maps the point z to the topmost point of the Voronoi circle at z.

Page 10: A sweepline algorithm for Voronoi Diagrams

Effect of transformation on a bisector*p (Bpq ) = *q (Bpq )

= {(x, y+dp(x,y)) : (x,y) Bpq }If py > qy , then *p (Bpq ) is a

hyperbola open upwards with minimum point p

Else if py = qy , then Bpq is a vertical line through r=(px+qx)/2, and *p (Bpq ) = {(r, y+dp(r,y)) }, which is the vertical half line above (r,py).

Page 11: A sweepline algorithm for Voronoi Diagrams

Effect of transformation on a region RpMaps all the points not vertically

below p to points above pMaps all the points that are

vertically below p to p itself p must be the lowest point of Rp

*

Page 12: A sweepline algorithm for Voronoi Diagrams

Mapping between V* and VNo vertical segment incident to a

site is contained in V and * fails to be one-one only on such segments

* must be one-one on V

Page 13: A sweepline algorithm for Voronoi Diagrams

Algorithm for V*

Moves a horizontal line upwards across the plane maintaining the regions of V* intersected by the horizontal line.

A region appears for the first time at a site and a region disappears at the intersection of two edges.

Voronoi diagram is generated as a list of bisectors which are marked with their corresponding end vertices.

Page 14: A sweepline algorithm for Voronoi Diagrams

If py > qy then *p (Bpq ) is a hyperbola that opens upwards, and a horizontal line can intersect it at exactly two points

*p (Bpq ) is thus split into two pieces, Cpq+ and Cpq

-

Cpq+ is the monotonically increasing part of the

hyperbola

Cpq- is the monotonically decreasing part of the

hyperbola

If py = qy then Cpq- = and Cpq

+ = *p (Bpq )

Page 15: A sweepline algorithm for Voronoi Diagrams

Input : S a set of n>=1 points with unique bottommost point

Output : The bisectors and vertices of V*

Data structures :o Q : a priority queue of points in the

plane ordered lexicographically. Each point is labelled as a site or labelled with a pair of boundaries

o L : a sequence of (r1,c1,r2,....,rk) of regions and boundaries in the order in which they appear on the horizontal line from left to right

Page 16: A sweepline algorithm for Voronoi Diagrams

initialize Q with all sites p <- extract_min(Q) L <- the list containing Rp

while Q is not empty begin p <- extract_min(Q) case p is a site: Find an occurrence of a region Rq

* on L containing p Create bisector Bpq

*

Update list L so that it contains .... Rq*, Cpq

-, Rp*, Cpq

+, Rq

* . . . . in place of Rq*

Insert intersections between Cpq- and Cpq

+ with neighbouring boundaries into Q

Page 17: A sweepline algorithm for Voronoi Diagrams

p is an intersection:Let p be the intersection of boundaries Cqr and Crs.Create the bisector Bqs

* Update list L so it contains Cqs = Cqs

- or Cqs+, as

appropriate, instead of Cqr , Rr*, Crs.

Delete from Q any intersections between Cqs and their neighbours.

Insert any intersections between Cqs and its neighbours into Q.

Mark p as a vertex and as an endpoint of Bqr*, Brs

* and Bqs

*.end

Page 18: A sweepline algorithm for Voronoi Diagrams

Intersection

q

r s

Bisector Cqs

Page 19: A sweepline algorithm for Voronoi Diagrams

Time complexityNumber of sites is nNumber of vertices in Voronoi diagram is O(n)Therefore, the number of times while loop

executes is O(n)The number of bisectors also is thus O(n) Q needs operations insert and extract-min and

thus can be implemented as a heap at time cost O(logn)

L needs operations insert, delete and search and thus a balanced tree scheme can implement this at a cost of O(logn)

The total time complexity of the algorithm is thus O(nlogn)

Page 20: A sweepline algorithm for Voronoi Diagrams

Computing V using the same algorithmThe given algorithm first creates a bisector

containing the Voronoi edge and then marks it’s end-points in subsequent iterations.

Queue Q can contain untransformed sites and boundaries. The transformed intersections of two boundaries can be computed from untransformed bisectors and then adding to the y co-ordinate of the intersection the distance to any of the sites determining the bisectors.

Similarly L can contain untransformed regions and boundaries. The transformation can be done on-the-fly during the update step of the case when a site is processed.

Page 21: A sweepline algorithm for Voronoi Diagrams

Extensions of the algorithmThe given sweepline algorithm

can be extended to compute the Voronoi diagram of :

Set of line segment sites Set of weighted point sites

Page 22: A sweepline algorithm for Voronoi Diagrams

Summary and commentsAlgorithm presented is simple

and asymptotically efficient.The transformation * can

introduce numeric instability since even if it is mathematically one-one, it can map distant points very close.

Page 23: A sweepline algorithm for Voronoi Diagrams

References Bentley, B. W. Wgide, A.C. Yao, Optimal Expected-Time Algorithms

for Closest Point Problems, ACM Transactions on Mathematical Software, 6(4), 1980.

J. Green, R. Sibson, Computing Dirichlet Tesselations in the Plane, Computer Journal, 21(22), 1977.

T. Ohya, M. lri, and K. Murota, Improvements of the incremental method for the Voronoi diagram with computational comparison of various algorithms, J. Oper. Res. Soc. Japan, 27 (1984).

M.I. Shamos and D. Hoey, Closest-point problems, Proceedings of the 16th Annual Symposium on Foundations of Computer Science, 1975.

C.K. Yap, An O(n log n) algorithm for the Voronoi diagram of a set of simple curve segments, NYU-Courant Robotics Report No. 43 (submitted to SIAM J. Comput.)(1984).

S. Fortune, Sweepline algorithms for Voronoi diagrams, Algorithmica 1987.

Page 24: A sweepline algorithm for Voronoi Diagrams

THANK YOU