CS6100: Topics in Design and Analysis of Algorithms Voronoi Diagram - - PDF document

cs6100 topics in design and analysis of algorithms
SMART_READER_LITE
LIVE PREVIEW

CS6100: Topics in Design and Analysis of Algorithms Voronoi Diagram - - PDF document

CS6100: Topics in Design and Analysis of Algorithms Voronoi Diagram John Augustine CS6100 (Even 2012): Voronoi Diagram Definition & Properties Let P = ( p 1 , p 2 , . . . , p n ) be a set of points (or sites) in the plane. The Voronoi


slide-1
SLIDE 1

CS6100: Topics in Design and Analysis of Algorithms

Voronoi Diagram John Augustine

CS6100 (Even 2012): Voronoi Diagram

slide-2
SLIDE 2

Definition & Properties

Let P = (p1, p2, . . . , pn) be a set of points (or sites) in the plane. The Voronoi diagram of P, denoted Vor(P), is a subdivision of the plane into n cells, one for each point in P, such that for any point q in the cell corresponding to a point pi ∈ P, ∀pj ∈ P \ {pi}, dist(q, pi) ≤ dist(q, pj). The cell corresponding to pi ∈ P is denoted V(pi).

CS6100 (Even 2012): Voronoi Diagram 1

slide-3
SLIDE 3

Observation: Consider two points pi and pj. Let h(pi, pj) be the half space induced by the perpendicular bisector of pipj in which pi is contained. V(pi) =

  • pj∈P \{pi}

h(pi, pj). Theorem

  • 1. If all points are collinear, Vor(P)

consists of n−1 parallel lines. Otherwise, Vor(P) is connected and its edges are either segments or half lines. Proof Sketch. First part follows from previous

  • bservation.

So for rest of proof assume ∃ three non-collinear points.

CS6100 (Even 2012): Voronoi Diagram 2

slide-4
SLIDE 4

pi p j pk e

To show that edges of Vor(P) are either line segments

  • r half lines, we consider ( for the sake of contradiction)

a Voronoi edge e that is a line. It must be the perpendicular bisector of two points, say, p1 and p2. From our assumption that not all points are collinear, there must be a third point that is not collinear to p1 and p2. Show, in this context, that e cannot be a line, a contradiction that will prove our lemma.

CS6100 (Even 2012): Voronoi Diagram 3

slide-5
SLIDE 5

Complexity of Voronoi Diagrams

How complex can Voronoi diagrams be? More precisely, how many vertices, edges and faces can a Voronoi diagram have? Notice that a single cell can have O(n) vertices. Does that mean that the total number of vertices is Ω(n2)? Theorem 2. For a points set P with cardinality n ≥ 3, Number of vertices nv of Vor(P) ≤ 2n − 5 Number of edges ne of Vor(P) ≤ 3n − 6.

CS6100 (Even 2012): Voronoi Diagram 4

slide-6
SLIDE 6

Proof Sketch. If all points are collinear, the theorem holds trivially. Therefore, assume that they are not all collinear. Euler’s Formula: If a connected plane graph (i.e., a planar graph that is embedded on a plane) has mv nodes, me edges and mf faces, then, mv − me + mf = 2. To apply Euler’s formula, we add an artificial vertex to Vor(P) as shown below.

v∞

CS6100 (Even 2012): Voronoi Diagram 5

slide-7
SLIDE 7

Note that the number of faces is equal to the number

  • f sites. Applying Euler’s formula, we get

(nv + 1) − ne + n = 2. (1) Twice the total number of edges is the total degree. Notice that each vertex has degree at least 3. Therefore, total degree is at least 3(nv + 1). Stated using notations, we get 2ne ≥ 3(nv + 1). (2) The required inequalities follow. We define the largest empty circle of q with respect to P (denoted CP(q)) as the largest circle centered at q that does not enclose any point in P. Theorem 3. For the Voronoi diagram Vor(P) of a set P of points,

  • 1. A point q is a vertex in Vor(P) iff CP(q) has three
  • r more sites on its boundary.

CS6100 (Even 2012): Voronoi Diagram 6

slide-8
SLIDE 8
  • 2. The perpendicular bisector of pipj defines an edge

in Vor(P) iff there is a point q on the bisector such that CP(q) contains pi and pj, but no other point in P. Proof Sketch.

  • 1. Note that a vertex q in Vor(P) is equidistant to at

least three points in P, and, no other point in P is closer to q.

q CP(q)

  • 2. Use the definition of Voronoi diagram.

CS6100 (Even 2012): Voronoi Diagram 7

slide-9
SLIDE 9

Plane Sweep Algorithm to Compute the Voronoi Diagram

Given: A set P of points in the 2D plane. We sweep a horizontal line ℓ from top to bottom. As an invariant, we construct the Voronoi diagram above up to ℓ. We need to be careful here. We only maintain parts of vor(P) that cannot be changed by points below ℓ. What are those points? These are the points above ℓ that are closer to a site above ℓ than to ℓ itself. For a single site above ℓ, the locus of points equidistant from both ℓ and the site is a parabola.

CS6100 (Even 2012): Voronoi Diagram 8

slide-10
SLIDE 10

For multiple sites, the locus of points locus of points closer to some site above ℓ is bounded by multiple parabolic arcs.

The sequence of parabolic arcs is called the beach line. In other words, each site above ℓ induces a parabola. Consider any vertical line. The lowest point at which the line touches some parabola is on the beach line. Clearly, the beach line is x-monotone.

CS6100 (Even 2012): Voronoi Diagram 9

slide-11
SLIDE 11

Notice that a parabola might appear several times in the beach line.

When does a new parabolic arc appear?

ℓ ℓ ℓ

When ℓ reaches a site, a new parabolic arc appears. Can a parabolic arc appear some other way? Lemma 1. The only way a new parabolic arc appears

  • n the beach line is when ℓ reaches a new site.

CS6100 (Even 2012): Voronoi Diagram 10

slide-12
SLIDE 12

Proof Idea. There are two other ways a parabola βj can possibly enter the beachline (that we need to show it can’t).

ℓ β j ℓ β j

βj breaks through middle of an arc. This implies that βj was tangential to the other arc at some

  • point. This is not possible.

Why? When two points share either x or y coordinates, then easy to see they intersect twice. Assume therefore that p1 is above but not directly above p2 and β1 and β2 are the two parabolas about them Think of the parabola about a point p1 w.r.t. ℓ as locus of the center of circle that goes through p1 and touches ℓ tangentially.

CS6100 (Even 2012): Voronoi Diagram 11

slide-13
SLIDE 13

When such a circle encloses p2, it is centred at a part where β1 and β2 overlap.

p1 p2 CS6100 (Even 2012): Voronoi Diagram 12

slide-14
SLIDE 14

When such a circle does not enclose p2, it is centred at a part where β1 and β2 do not overlap. Notice that there are two extremities of β1 at which this occurs. This implies that β1 and β2 must meet at 2 points.

CS6100 (Even 2012): Voronoi Diagram 13

slide-15
SLIDE 15

βj breaks through between two arcs.

ℓ β j

p j pi pk q βk βi βj ℓ C p j pi pk q C ℓ

Notice in the left figure that the circle C through the three points pi, pj, and pk meet at q and its lowest point is on ℓ. What happens when ℓ is pulled down infinitesimally, but C touches pj and is maintained tangentially to ℓ? Answer: Either pi or pk penetrate the circle.

CS6100 (Even 2012): Voronoi Diagram 14

slide-16
SLIDE 16

Corollary 1. The beach line consists of at most 2n−1 arcs.

  • Proof. Each new site creates one new parabolic arc

and splits another into two.

CS6100 (Even 2012): Voronoi Diagram 15

slide-17
SLIDE 17

Circle Event

ℓ q pi p j pk ℓ α′ α α′′ p j pk pi ℓ p j pk pi q

Notice that the 3 arcs α, α′, and α′′ correspond to distinct sites. α, α′, and α′′ intersect at q, which is equidistant from corresponding sites and ℓ. Therefore, there is a circle C centered at q touching pi, pj, and pk and ℓ. The point at which C touches ℓ is called a circle event. At a circle event, a parabolic arc disappears. Vertices in Vor(P) are captured by circle events.

CS6100 (Even 2012): Voronoi Diagram 16

slide-18
SLIDE 18

How do we find circle events? Answer: Check each time three parabolas become adjacent. But this might not always lead to circle events.

  • 1. The breakpoint loci might be moving away from

each other.

  • 2. The circle event that is induced by a triple might be

removed by the entry of a new site/parabola. We call these defnfalse alarms.

CS6100 (Even 2012): Voronoi Diagram 17

slide-19
SLIDE 19

Required Datastructures

Voronoi diagram is stored as a DCEL. We use a large bounding box. Beach line is stored in a dynamic balanced binary search tree T . Recall that beachline is x-monotone and has complexity ≤ 2n − 1. Internal nodes of T store two arcs (pi, pj). This can be used to detect the place where a new arc has to be inserted in O(log n) time. Each leaf of T stores a pointer to the circle event that will make the leaf disappear. Each internal node has a pointer to a half edge in the DCEL. The event queue Q is a dynamic priority queue based on y-coordinates. Site events are static and known a priori. Circle events are dynamic. Also, need to watch for false alarms in circle events.

CS6100 (Even 2012): Voronoi Diagram 18

slide-20
SLIDE 20

Algorithm VORONOIDIAGRAM(P)

  • Input. A set P := {p1,..., pn} of point sites in the plane.
  • Output. The Voronoi diagram Vor(P) given inside a bounding box in a doubly-connected edge

list D. 1. Initialize the event queue Q with all site events, initialize an empty status structure T and an empty doubly-connected edge list D. 2. while Q is not empty 3. do Remove the event with largest y-coordinate from Q. 4. if the event is a site event, occurring at site pi 5. then HANDLESITEEVENT(pi) 6. else HANDLECIRCLEEVENT(γ), where γ is the leaf of T representing the arc that will disappear 7. The internal nodes still present in T correspond to the half-infinite edges of the Voronoi

  • diagram. Compute a bounding box that contains all vertices of the Voronoi diagram

in its interior, and attach the half-infinite edges to the bounding box by updating the doubly-connected edge list appropriately. 8. Traverse the half-edges of the doubly-connected edge list to add the cell records and the pointers to and from them.

CS6100 (Even 2012): Voronoi Diagram 19

slide-21
SLIDE 21

HANDLESITEEVENT(pi) 1. If T is empty, insert pi into it (so that T consists of a single leaf storing pi) and return. Otherwise, continue with steps 2– 5. 2. Search in T for the arc α vertically above pi. If the leaf representing α has a pointer to a circle event in Q, then this circle event is a false alarm and it must be deleted from Q. 3. Replace the leaf of T that represents α with a subtree having three leaves. The middle leaf stores the new site pi and the other two leaves store the site p j that was originally stored with α. Store the tuples p j, pi and pi, pj representing the new breakpoints at the two new internal nodes. Perform rebalancing operations on T if necessary. 4. Create new half-edge records in the Voronoi diagram structure for the edge separating V(pi) and V(p j), which will be traced out by the two new breakpoints. 5. Check the triple of consecutive arcs where the new arc for pi is the left arc to see if the breakpoints converge. If so, insert the circle event into Q and add pointers between the node in T and the node in Q. Do the same for the triple where the new arc is the right arc.

CS6100 (Even 2012): Voronoi Diagram 20

slide-22
SLIDE 22

HANDLECIRCLEEVENT(γ) 1. Delete the leaf γ that represents the disappearing arc α from T. Update the tuples represent- ing the breakpoints at the internal nodes. Perform rebalancing operations on T if necessary. Delete all circle events involving α from Q; these can be found using the pointers from the predecessor and the successor of γ in T. (The circle event where α is the middle arc is currently being handled, and has already been deleted from Q.) 2. Add the center of the circle causing the event as a vertex record to the doubly-connected edge list D storing the Voronoi diagram under construction. Create two half-edge records corresponding to the new breakpoint of the beach line. Set the pointers between them

  • appropriately. Attach the three new records to the half-edge records that end at the vertex.

3. Check the new triple of consecutive arcs that has the former left neighbor of α as its middle arc to see if the two breakpoints of the triple converge. If so, insert the corresponding circle event into Q. and set pointers between the new circle event in Q and the corresponding leaf

  • f T. Do the same for the triple where the former right neighbor is the middle arc.

Theorem 4. The Voronoi diagram of a set of n point in 2D can be computed using plane sweep technique in O(n log n) time and O(n) storage. Proof Sketch. Mostly straightforward. Note that false alarms are removed before processing and their removal is part of the time needed to process a new site/parabola.

CS6100 (Even 2012): Voronoi Diagram 21