A Sweepline Algorithm for Higher Order Voronoi Diagrams

49
Maksym Zavershynskyi joint work with Evanthia Papadopoulou Università della Svizzera Italiana Lugano, Switzerland Supported in part by the Swiss National Science Foundation (SNF) grant 200021-127137. Also by SNF grant 20GG21-134355 within the collaborative research project EuroGIGA/VORONOI of the European Science Foundation. A Sweepline Algorithm for Higher Order Voronoi Diagrams Tuesday, July 16, 2013

description

We present an algorithm to construct order-k Voronoi diagrams with a sweepline technique. The sites can be points or line segments. The algorithm has O(k^2n log n) time complexity and O(nk) space complexity. Demo: http://zavermax.github.io/

Transcript of A Sweepline Algorithm for Higher Order Voronoi Diagrams

Page 1: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Maksym Zavershynskyijoint work with

Evanthia Papadopoulou

Università della Svizzera ItalianaLugano, Switzerland

Supported in part by the Swiss National Science Foundation (SNF) grant 200021-127137. Also by SNF grant 20GG21-134355 within the collaborative research project EuroGIGA/VORONOI of the European Science Foundation.

A Sweepline Algorithm forHigher Order Voronoi Diagrams

Tuesday, July 16, 2013

Page 2: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Nearest Neighbor Voronoi Diagram

The nearest neighbor Voronoi diagram is the partitioning of the plane into regions, such that all points within a region have the same closest site.

Tuesday, July 16, 2013

Page 3: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Higher Order Voronoi Diagram

The order-k Voronoi diagram is the partitioning of the plane into regions, such that all points within an order-k region have the same k nearest sites.

V2({s1, s2}, S)

s1 s2

Tuesday, July 16, 2013

Page 4: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Related Work

• Structural complexity of the order-k Voronoi diagram:

• for points [Lee’82]

• line segments [Papadopoulou&Zavershynskyi’12]

O(k(n− k))

O(k(n− k))

Tuesday, July 16, 2013

Page 5: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Related Work

• Iterative construction algorithm:

• Time

• Space

• Can be used to construct all order-i Voronoi diagrams, for

O�k2n log n

O�k2(n− k)

i = 1, . . . , k

Tuesday, July 16, 2013

Page 6: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Construction Algorithms

Construction Time Reference

Chazelle&Edelsbrunner’87

Clarkson’87

Aurenhammer’90

Mulmuley’91

Boissonnat et al.’93

Agarwal et al.’98

Chan’98

Ramos’99

O�n2 + b log2 n

O�n1+�

k�

O�nk

2 + n log n�

O�nk

3 + n log n�

O�n log3 n+ nk log n

O (n log n+ nk log n)

O

�n log n+ nk2c log

∗ k�

O�nk

2 log n�

Tuesday, July 16, 2013

Page 7: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Construction Algorithms

Construction Time Reference

Chazelle&Edelsbrunner’87

Clarkson’87

Aurenhammer’90

Mulmuley’91

Boissonnat et al.’93

Agarwal et al.’98

Chan’98

Ramos’99

O�n2 + b log2 n

O�n1+�

k�

O�nk

2 + n log n�

O�nk

3 + n log n�

O�n log3 n+ nk log n

O (n log n+ nk log n)

O

�n log n+ nk2c log

∗ k�

O�nk

2 log n�

Expected

For Points!

Tuesday, July 16, 2013

Page 8: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Construction Algorithms

• Based on Fortune’s algorithm

• For points and line segments

• Deterministic

• Simple

• Easy to implement

Sweepline approach?

Tuesday, July 16, 2013

Page 9: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Algorithm

Tuesday, July 16, 2013

Page 10: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Idea

• Consider horizontal line l

• Wave-curve w(s) is the locus of points equidistant from l to s

Tuesday, July 16, 2013

Page 11: A Sweepline Algorithm for Higher Order Voronoi Diagrams

• Let be the set of line segments that intersect the upper halfplane.

• Consider an arrangement of wave-curves

The Idea

S�

w(s), s ∈ S�

Tuesday, July 16, 2013

Page 12: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Idea

• Consider k-level Ak

• Lower envelope is 1-level

Ak

Tuesday, July 16, 2013

Page 13: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Idea

• Consider k-level Ak

• Lower envelope is 1-level

Breakpoint

Wave

Tuesday, July 16, 2013

Page 14: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Idea

• While the horizontal line moves down, the breakpoints of Ak and Ak+1 levels move along the edges of the order-k Voronoi diagram.

Tuesday, July 16, 2013

Page 15: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Events

• Simulate the discrete event points that change the topological structure of k-level while line l moves down.

• We store the adjacency relations!

Site Events Circle Events

Tuesday, July 16, 2013

Page 16: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Site Events

• Occur when the line hits a new line segment.

• We insert the corresponding wave-curve and update all levels.

Tuesday, July 16, 2013

Page 17: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Site Events

a1, am1. . . ,

b1, bm2. . . ,

c1, cm3

. . . ,

. . . ,

d1, dm4

A1 :

A2 :

A3 :

A4 :

A1

A2

A3

A4

. . . ,

. . . ,

. . . ,

. . . ,

ai,

bj ,

cr,

ds,

Adjacency relations:

x

Tuesday, July 16, 2013

Page 18: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Site Events

a1, am1. . . ,

b1, bm2. . . ,

c1, cm3

. . . ,

. . . ,

d1, dm4

A1 :

A2 :

A3 :

A4 :

A1

A2

A3

. . . ,

. . . ,

. . . ,

. . . ,

ai,

bj ,

cr,

ai, , ai,

bj , bj ,

cr, cr,

ds, ds,

Adjacency relations:

x, x,

x, x,

x, x,

x

A4

A5 : x, xds,

Tuesday, July 16, 2013

Page 19: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Circle Events

• Occur when 3 wave-curves intersect at a common point

a

bc

Tuesday, July 16, 2013

Page 20: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Circle Events

• Occur when 3 wave-curves intersect at a common point

a

bc

Tuesday, July 16, 2013

Page 21: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Circle Events

• Occur when 3 wave-curves intersect at a common point

a

b

c

Tuesday, July 16, 2013

Page 22: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Circle Events

a

bc Ai :

Ai+1 :

Ai+2 :

a, b,

c,

c

b, a, b

c, a

Adjacency relations:

Tuesday, July 16, 2013

Page 23: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Circle Events

a

b

c

Ai :

Ai+1 :

Ai+2 :

a,

b,

c,

c

b, a, b

c, a

Adjacency relations:

Tuesday, July 16, 2013

Page 24: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Circle Events

• Precompute the circle events of all triples of the consecutive waves.

• A new triple appears - create the circle event

• An old triple disappears - remove the circle event

Tuesday, July 16, 2013

Page 25: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Maintaining the ≤k-level

• The breakpoints of k-level and (k+1)-level move along the edges of the order-k Voronoi diagram

• We need to keep track of k-level!

• A new wave may be introduced to k-level:

• By Site Events

• From (k-1)-level and (k-2)-level by Circle Events

• We need to maintain ≤k-level!

Tuesday, July 16, 2013

Page 26: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Data Structures

• Event queue:

• Queue: Site Events, sorted by y-coordinate.

• Balanced Binary Tree: Circle Events, sorted by y-coordinate of the bottom-most point of the circle.

• Levels 1,...,k:

• Balanced Binary Tree for each level:Sequence of waves that constitute the level.

Tuesday, July 16, 2013

Page 27: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Time and Space Analysis

Tuesday, July 16, 2013

Page 28: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Maximum Size of the ≤k-level?

• The complexity of the ≤k-level in arrangement of Jordan curves [Sharir&Agarwal’95, Clarkson’87]

• Complexity of the lower envelope [Fortune’87]

• Therefore the complexity of the ≤k-level is:

g≤k(n) = O�k2g1(n/k)

g1(n) = O(n)

g≤k(n) = O(kn)

Tuesday, July 16, 2013

Page 29: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Maximum Size of the Event Queue?

• Event Queue:

• Site Events

• Circle EventsEach Circle Event corresponds to a triple of consecutive waves in ≤k-level

O(n)

O(kn)

Tuesday, July 16, 2013

Page 30: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Time Complexity?

• Site Event

• For each i-level, i = 1,...,k

• Find insertion point

• Update adjacency relations at the point

• For all Site Events:

O(log |Ai|) ≤ O(log (i(n− i))) ≤ O(log n)

O(nk)O(log n) = O(nk log n)

Tuesday, July 16, 2013

Page 31: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Number of Circle Events

• Every processed Circle Event corresponds to some order-i Voronoi vertex, i = 1,...,k

• Therefore total number of processed Circle Events is the total complexity of order-i Voronoi diagrams, i = 1,...,k

k�

i=1

i(n− i) = O�k2n�

Tuesday, July 16, 2013

Page 32: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Time Complexity

• Circle Event

• Remove Circle Event from the queue

• Update adjacency relations relations on 3 levels:

• For all Circle Events:

O�logO

�k2n��

= O(log n)

3O(log n) = O(log n)

O(k2n)O(log n) = O(k2n log n)

Tuesday, July 16, 2013

Page 33: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Results

• Time complexity

• Space complexity

O(k2n log n)

O(kn)

Tuesday, July 16, 2013

Page 34: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Line Segments Forming a Planar Straight-Line Graph

Tuesday, July 16, 2013

Page 35: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Planar Straight-Line Graph

• Weak general position assumption:“No more than 3 elementary sites touch the same circle”

Tuesday, July 16, 2013

Page 36: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Planar Straight-Line Graph

Bisectors containing 2-dimensional portion

IV. COMPLEXITY ANALYSIS

Lemma 5: The maximum size of queue Q and the maxi-mum total size of lists L1, . . . , Lk are O(nk).

Proof: Lists L1, . . . , Lk correspond to levels A1, . . . , Ak.Since the wave-curves are Jordan curves the following boundholds [5], [18]:

g≤k(n) = O�k2g1 (�n/k�)

�(2)

where g≤k(n) is the maximum complexity of levelsA1, . . . , Ak and g1(m) is the maximum complexity of thelower envelope of m wave-curves. The lower envelope ofwaves corresponds to wavefront of the order-1 Voronoi di-agram [8], therefore g1(m) = O(m). Thus the maximumcomplexity of A1, . . . , Ak, g≤k(n) is equal to O(nk).

The number of site-events is O(n). Every circle-event inevent queue Q corresponds to a triple of adjacent waves atsome level Ai, 1 ≤ i ≤ k. Therefore the number of circle-events is proportional to the total size of levels A1, . . . , Ak,which is O(nk). Thus Q is of size O(nk).

Theorem 1: The algorithm can be implemented to run intime O(k2n log n) and O(nk) space.

Proof: The site-events correspond to the insertion of thenew wave-curves in levels A1, . . . , Ak. The number of site-events is bounded by the number of sites, O(n). When anew line segment intersects a halfplane l+ we insert it inlists L1, . . . , Lk. This requires a binary search on every listand therefore it takes O(log |Li|) per list, where |Li| denotesthe size of the list. Since the maximum complexity of Li isbounded by the structural complexity of the order-i Voronoidiagram, we need O (log (i(n− i))) = O(log n) per level Li,or O(k log n) for all levels. Therefore it takes O(nk log n) timeto process all the site-events.

The circle-events correspond to the Voronoi vertices ofthe order-i Voronoi diagrams, i = 1, . . . , k. Every such eventrequires constant time. Since the number of order-i Voronoivertices is bounded by O(i(n−i)) thus it implies that the totalnumber of circle-events is bounded by

�ki=1 O(i(n − i)) =

O(k2n). Every site-event and circle-event requires an updateof the triples that involve the line segments that are adjacentto the places where the changes occurred. Insertions anddeletions into the event queue Q require log |Q| time per eachinserted/removed circle-event, where |Q| - is the size of thequeue. Lemma 5 implies that the size of the queue is O(nk).Therefore it takes O(log (nk)) = O(log n) time per event. Andthe total running time is O

�k2n log n

�.

During the execution of the algorithm we store the eventqueue Q, lists L1, . . . , Lk and we output the order-k Voronoidiagram Vk(S). Then Lemma 5 implies the total space com-plexity.

V. LINE SEGMENTS FORMING A PLANAR STRAIGHT-LINEGRAPH

In this section we consider line segments that may touchat endpoints, such as line segments forming a simple polygon,more generally line segments forming a planar straight-linegraph. This is important for applications involving polygonalobjects such as in [15].

s1 s2

b(s1, s2)

b(s1, s2)

Fig. 3: Bisector containing 2-dimensional portion

s1

s2s3

s4

b(s1, s4)b(s2, s4)b(s3, s4)b(s1, s4)

b(s2, s4), b(s3, s4)

Fig. 4: Bisectors intersecting non-transversely

Abutting line segments do not satisfy the standard generalposition assumption that no more than 3 sites can touch thesame circle. We make weak general position assumption thatno more than 3 elementary sites can touch the same circle2,where each segment consists of three elementary sites: twoendpoints and an open line segment.

Under the weak general position assumption we have twosources of degeneracy: 1) bisectors may contain 2-dimensionalportions; 2) bisectors intersect non-transversely. For the order-1 Voronoi diagram this is typically addressed efficiently byconsidering the endpoints and open portion of a line segmentsas different entities [9]. For higher order Voronoi diagramswe cannot simply consider elementary sites as distinct whendefining an order-k Voronoi region as this will lead to adifferent type of order-k Voronoi diagram for disjoint segmentsthat is not very interesting. For instance, in case of farthestVoronoi diagram the result is the farthest Voronoi diagram ofendpoints which is different from the farthest Voronoi diagramof line segments [3].

We want to keep the information on the shared endpointswithout altering the structure of the order-k Voronoi diagramof disjoint line segments.

A disk centered at point x that intersects (or touches) atleast k line segments and has minimal radius is called an order-k disk and is denoted as Dk(x). If Dk(x) touches exactlyone elementary site p then it is called a proper order-k disk

2In case when line segment s touches disk D at endpoint p and the linepassing through s is tangent to disk D it is possible to slightly move diskD to make it intersecting the open partition of s. Therefore in this case weconsider both endpoint p and the open partition of s to be touching disk D.

Tuesday, July 16, 2013

Page 37: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Planar Straight-Line Graph

Bisectors intersecting non-transversely

IV. COMPLEXITY ANALYSIS

Lemma 5: The maximum size of queue Q and the maxi-mum total size of lists L1, . . . , Lk are O(nk).

Proof: Lists L1, . . . , Lk correspond to levels A1, . . . , Ak.Since the wave-curves are Jordan curves the following boundholds [5], [18]:

g≤k(n) = O�k2g1 (�n/k�)

�(2)

where g≤k(n) is the maximum complexity of levelsA1, . . . , Ak and g1(m) is the maximum complexity of thelower envelope of m wave-curves. The lower envelope ofwaves corresponds to wavefront of the order-1 Voronoi di-agram [8], therefore g1(m) = O(m). Thus the maximumcomplexity of A1, . . . , Ak, g≤k(n) is equal to O(nk).

The number of site-events is O(n). Every circle-event inevent queue Q corresponds to a triple of adjacent waves atsome level Ai, 1 ≤ i ≤ k. Therefore the number of circle-events is proportional to the total size of levels A1, . . . , Ak,which is O(nk). Thus Q is of size O(nk).

Theorem 1: The algorithm can be implemented to run intime O(k2n log n) and O(nk) space.

Proof: The site-events correspond to the insertion of thenew wave-curves in levels A1, . . . , Ak. The number of site-events is bounded by the number of sites, O(n). When anew line segment intersects a halfplane l+ we insert it inlists L1, . . . , Lk. This requires a binary search on every listand therefore it takes O(log |Li|) per list, where |Li| denotesthe size of the list. Since the maximum complexity of Li isbounded by the structural complexity of the order-i Voronoidiagram, we need O (log (i(n− i))) = O(log n) per level Li,or O(k log n) for all levels. Therefore it takes O(nk log n) timeto process all the site-events.

The circle-events correspond to the Voronoi vertices ofthe order-i Voronoi diagrams, i = 1, . . . , k. Every such eventrequires constant time. Since the number of order-i Voronoivertices is bounded by O(i(n−i)) thus it implies that the totalnumber of circle-events is bounded by

�ki=1 O(i(n − i)) =

O(k2n). Every site-event and circle-event requires an updateof the triples that involve the line segments that are adjacentto the places where the changes occurred. Insertions anddeletions into the event queue Q require log |Q| time per eachinserted/removed circle-event, where |Q| - is the size of thequeue. Lemma 5 implies that the size of the queue is O(nk).Therefore it takes O(log (nk)) = O(log n) time per event. Andthe total running time is O

�k2n log n

�.

During the execution of the algorithm we store the eventqueue Q, lists L1, . . . , Lk and we output the order-k Voronoidiagram Vk(S). Then Lemma 5 implies the total space com-plexity.

V. LINE SEGMENTS FORMING A PLANAR STRAIGHT-LINEGRAPH

In this section we consider line segments that may touchat endpoints, such as line segments forming a simple polygon,more generally line segments forming a planar straight-linegraph. This is important for applications involving polygonalobjects such as in [15].

s1 s2

b(s1, s2)

b(s1, s2)

Fig. 3: Bisector containing 2-dimensional portion

s1

s2s3

s4

b(s1, s4)b(s2, s4)b(s3, s4)b(s1, s4)

b(s2, s4), b(s3, s4)

Fig. 4: Bisectors intersecting non-transversely

Abutting line segments do not satisfy the standard generalposition assumption that no more than 3 sites can touch thesame circle. We make weak general position assumption thatno more than 3 elementary sites can touch the same circle2,where each segment consists of three elementary sites: twoendpoints and an open line segment.

Under the weak general position assumption we have twosources of degeneracy: 1) bisectors may contain 2-dimensionalportions; 2) bisectors intersect non-transversely. For the order-1 Voronoi diagram this is typically addressed efficiently byconsidering the endpoints and open portion of a line segmentsas different entities [9]. For higher order Voronoi diagramswe cannot simply consider elementary sites as distinct whendefining an order-k Voronoi region as this will lead to adifferent type of order-k Voronoi diagram for disjoint segmentsthat is not very interesting. For instance, in case of farthestVoronoi diagram the result is the farthest Voronoi diagram ofendpoints which is different from the farthest Voronoi diagramof line segments [3].

We want to keep the information on the shared endpointswithout altering the structure of the order-k Voronoi diagramof disjoint line segments.

A disk centered at point x that intersects (or touches) atleast k line segments and has minimal radius is called an order-k disk and is denoted as Dk(x). If Dk(x) touches exactlyone elementary site p then it is called a proper order-k disk

2In case when line segment s touches disk D at endpoint p and the linepassing through s is tangent to disk D it is possible to slightly move diskD to make it intersecting the open partition of s. Therefore in this case weconsider both endpoint p and the open partition of s to be touching disk D.

Tuesday, July 16, 2013

Page 38: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Planar Straight-Line Graph

We want to keep the information on the shared endpoints without altering the structure of the order-k

Voronoi diagram of disjoint line segments.

Tuesday, July 16, 2013

Page 39: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Planar Straight-Line Graph

• - a minimal disk centered at point x that intersects at least k line segments, where p is an elementary site that touches the disk.

Dpk(x)

x

Tuesday, July 16, 2013

Page 40: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Planar Straight-Line Graph

• - a minimal disk centered at point x that intersects at least k line segments, where p is an elementary site that touches the disk.

Dpk(x)

x

pDp

3(x)

Sk(x)

Tuesday, July 16, 2013

Page 41: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Generalized Definition

Definition: A set is called an order-k subset if

type-1:

type-2: and there exists a proper order-k disk , where p is an endpoint common at least two segments, that intersects exactly all line segments in .

p - the representative of

H,H ⊆ S

|H| = k

|H| > k

Dpk(x)

Hp

H

Tuesday, July 16, 2013

Page 42: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Generalized Definition

The order-k Voronoi region defined:

type-1 - in the ordinary way.

type-2 :

Vk(Hp, S) = {x | ∃Dpk(x) ∩ Sk(x) = Hp}

Tuesday, July 16, 2013

Page 43: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Generalized Definition

Order-1

1

2

3

456

7

8

V (a)

V (d)

V (f) V (g)

V (b)V (5) V (4)

V (3)

V (2)

V (1)

V (6)

V (7)

V (8)

V (c)V (e)

a b

c

de

f g

Tuesday, July 16, 2013

Page 44: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Generalized Definition

Order-2

1

2

3

456

7

8

V (1, 2)

V (6, 5) V (3, 4)

V (3, 8)

V (2, 8)

V (4, 5)

V (7, 5)

V (7, 8)

V (c, 3)

V (c, 8)

V (e, 5)

V (2, 7)

V (d)

V (g)

V (1, 7)

V (6, 7)

a b

c

de

f g

Tuesday, July 16, 2013

Page 45: A Sweepline Algorithm for Higher Order Voronoi Diagrams

Generalized Definition

Order-3

1

2

3

456

7

8

V (2, 3, 8)

V (3, 4, 8)

V (3, 4, 5)

V (4, 5, 6)V (d, 5)

V (5, 6, 7)

V (1, 6, 7)

V (d, 2)

V (g, 1)

V (1, 2, 8)V (1, 2, 7)

V (2, 7, 8)

V (1, 7, 8)V (3, 7, 8)

V (4, 5, 8)

V (4, 5, 7)

V (5, 7, 8)

V (6, 7, 8)

V (c, 7, 8)

V (c, 3, 8)

a b

c

de

f g

V (e, 4, 5)

Tuesday, July 16, 2013

Page 46: A Sweepline Algorithm for Higher Order Voronoi Diagrams

How we define the k-level?

x

a, b

c

d

e

π(x) = �π−(x),π0(x),π+(x)�

π(x) = �{a}, {b, c, d}, {e}�

Tuesday, July 16, 2013

Page 47: A Sweepline Algorithm for Higher Order Voronoi Diagrams

How we define the k-level?

x

a, b

c

d

e

π(x) = �π−(x),π0(x),π+(x)�Definition: k-level is a set of points x such that and|π−(x)| < k |π−(x) ∪ π0(x)| ≥ k

A3

Tuesday, July 16, 2013

Page 48: A Sweepline Algorithm for Higher Order Voronoi Diagrams

The Idea

1

2

3

456

7

8

ab

c

de

f g

A1

A2

A3

l

x

Fig. 8: Constructing order-3 Voronoi diagram via sweeplinetechnique. Point x belongs to the order-k Voronoi regionV (d, 2). The dotted lines depict internal edges.

on the plane, where two points x and y are equivalent iffπ(x) = π(y). Equivalence classes partition Ak. The connectedcomponents of Ak that consist of more than a single point arecalled waves (similarly to the definition of a wave in case ofdisjoint line segments). Each wave corresponds to equivalenceclass α = �α−,α0,α+� where for any point x on the waveπ(x) = α. We call a point separating two waves of k-level abreakpoint.

Lemma 8: For every point x on level Ak disk Dk(x)touches line l and Sk(x) = π−(x) ∪ π0(x). If x is not abreakpoint then Dk(x) is a proper order-k disk. If x is abreakpoint then Dk(x) touches 2 or 3 elementary sites.

The lemma implies that while line l moves down thebreakpoints of level Ak move along the bisectors of elementarysites. These bisectors correspond to the edges of the order-iVoronoi diagram, where 1 ≤ i ≤ k. We have two types ofVoronoi edges: external and internal. External Voronoi edgesbound order-k Voronoi regions. Internal Voronoi edges belongto the interior of the order-k Voronoi regions and they representthe farthest subdivision inside the order-k Voronoi regions.Type-2 Voronoi regions do not contain internal edges.

Lemma 9: Let x be a breakpoint on level Ak that separatestwo waves with equivalence classes π1 and π2. If |π0

1 ∪π−1 | >

k, |π02 ∪ π−

2 | > k, π01 ∪ π−

1 = π02 ∪ π−

2 , π01 ⊆ I(p) and

π02 ⊆ I(p) then x is not on the edge of the order-k Voronoi

diagram, where p is some endpoint. If |π01 ∪ π−

1 | = k and|π0

2 ∪ π−2 | = k and π0

1 ∪ π−1 = π0

2 ∪ π−2 then x is on the

internal edge of the order-k Voronoi diagram. Otherwise x ison the external edge of the order-k Voronoi diagram (see Fig.8).

The algorithm sweeps the plane with the horizontal linewhile maintaining levels A1, . . . , Ak. For each wave on everyi-level we store the set of wave-curves π0 and the number ofwave-curves b = |π−|, for i = 1, . . . , k. A wave may appearon several levels and therefore we store each level Ai as listLi of links to waves and breakpoints to avoid duplication.Each breakpoint is linked to its incident waves and levels. Thedefinition of k-level implies that for a given wave using π0

and b we can determine in constant time the range j, . . . , j� ofthe levels Aj , . . . , Aj� to which it belongs.

When the two breakpoints meet an event occurs during

s1s2

s3

s4

w2 w1 w3 w2 w4 w3

s1s2

s3

s4

w2 {w2, w3, w4}{w1, w2, w3, w4}

{w1, w2, w3}w3

Fig. 9: 2-level (a) before and (b) after the site-event occurs. Thewaves of 2-level are labeled with wave-curves that correspondto π0. The red waves disappear from the 2-level and the bluewaves appear. The dashed lines depict levels 1,3 and 4.

which arrangement A changes locally at the meeting point.This causes waves to appear or disappear from levels Ai,i = 1, . . . , k. If two breakpoints that move along the internalor external edges of the order-k Voronoi diagram meet atpoint x then x is the order-k Voronoi vertex. If event involvesonly internal Voronoi edges then the corresponding Voronoivertex is internal, i.e. belongs to the interior of the order-kVoronoi region. We need to handle the events that involvelevels A1, . . . , Ak. There are two types of events:Site-event: Horizontal line hits an endpoint.Circle-event: Two breakpoints meet at a common point.

Let p be an endpoint that corresponds to a site-event. LetI−(p) be the set of line segments incident to point p that arebelow horizontal line l. Let I+(p) be the set of line segmentsincident to point p that are above horizontal line l. Thenbefore line l hits endpoint p the line segments in I−(p) donot contribute the wave-curves to the arrangement. After line lhits endpoint p the line segments in I−(p) contribute the wave-curves to the arrangement that intersect transversely betweeneach other. Therefore we can insert the wave-curves of the linesegments in I−(p) one by one using the method described fordisjoint line segments.

Consider line segments in I+(p) and suppose theyare ordered from left to right as s1, s2, . . . , sm. Denotethe corresponding wave-curves as w1, w2, . . . , wm. Con-sider the moment before the site-event occurs, and con-sider i-level of wave-curves above point p, where 1 ≤i ≤ m. The i-level contains the sequence of wavesthat have the following π0 of their equivalence classes:

Maintain the ≤k-level!

Tuesday, July 16, 2013

Page 49: A Sweepline Algorithm for Higher Order Voronoi Diagrams

SUMMARY

We have developed an algorithm that constructsthe order-k Voronoi diagram of line segments in time and space.

• Simple

• Easy to implement

• Sweepline

• Can output all order-i Voronoi diagrams for i = 1,...,k

• Generalized to the case of line segments forming a planar straight-line graph.

O(k2n log n) O(kn)

Tuesday, July 16, 2013