45
Vera Sacrist´ an Discrete and Algorithmic Geometry Facultat de Matem` atiques i Estad´ ıstica Universitat Polit` ecnica de Catalunya STORING THE VORONOI DIAGRAM

Universitat Polit ecnica de Catalunya Facultat de Matem ...dccg.upc.edu/people/vera/wp-content/uploads/2012/10/Voronoi_2_St… · Discrete and Algorithmic Geometry, Facultat de Matem

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Vera Sacristan

Discrete and Algorithmic Geometry

Facultat de Matematiques i Estadıstica

Universitat Politecnica de Catalunya

STORING THEVORONOI DIAGRAM

Storing the Voronoi diagram

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Possible options, advantages and disadvantages

Storing the Voronoi diagram

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Possible options, advantages and disadvantages

Storing the list of all the edges of the diagram

Storing the Voronoi diagram

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Possible options, advantages and disadvantages

Storing the list of all the edges of the diagram

Advantage: small memory usage.

Disadvantage: it suffices to draw the diagram, but it does not contain the proximityinformation. For example, given a site pi, finding its neighbors or reporting the vertices andedges of its Voronoi region is too expensive.

Storing the Voronoi diagram

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Possible options, advantages and disadvantages

Storing the list of all the edges of the diagram

Advantage: small memory usage.

Disadvantage: it suffices to draw the diagram, but it does not contain the proximityinformation. For example, given a site pi, finding its neighbors or reporting the vertices andedges of its Voronoi region is too expensive.

For each site pi, storing the sorted list of vertices and edges of its Voronoi region, as well asthe sorted list of its neighbors, etc.

Storing the Voronoi diagram

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Possible options, advantages and disadvantages

Storing the list of all the edges of the diagram

Advantage: small memory usage.

Disadvantage: it suffices to draw the diagram, but it does not contain the proximityinformation. For example, given a site pi, finding its neighbors or reporting the vertices andedges of its Voronoi region is too expensive.

For each site pi, storing the sorted list of vertices and edges of its Voronoi region, as well asthe sorted list of its neighbors, etc.

Advantage: allows to quickly recover neighborhood information.

Disadvantage: the stored data is redundant and it uses more space than required.

Storing the Voronoi diagram

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Possible options, advantages and disadvantages

Storing the list of all the edges of the diagram

Advantage: small memory usage.

Disadvantage: it suffices to draw the diagram, but it does not contain the proximityinformation. For example, given a site pi, finding its neighbors or reporting the vertices andedges of its Voronoi region is too expensive.

For each site pi, storing the sorted list of vertices and edges of its Voronoi region, as well asthe sorted list of its neighbors, etc.

Advantage: allows to quickly recover neighborhood information.

Disadvantage: the stored data is redundant and it uses more space than required.

The data structure which is most frequently used to store Voronoi diagrams is the DCEL (doublyconnected edge list).

The DCEL is also used to store plane partitions, polyhedra, meshes, etc.

Storing the Voronoi diagram

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

Storing the Voronoi diagram

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

Storing the Voronoi diagram

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

e

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

e

vE

vB

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

e

vE

vB

fL

fR

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

e

vE

vB

fL

fR

eN

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

e

vE

vB

fL

fR

eN

eP

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

p x y e

1 x1 y1 42 x2 y2 43 x3 y3 14 x4 y4 3∞ — — 9

Table of faces DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

p x y e

1 x1 y1 42 x2 y2 43 x3 y3 14 x4 y4 3∞ — — 9

Table of faces Table of vertices

v x y e original?

1 x1 y1 1 12 x2 y2 1 13 x3 y3 2 04 x4 y4 8 05 x5 y5 4 06 x6 y6 9 0

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

p x y e

1 x1 y1 42 x2 y2 43 x3 y3 14 x4 y4 3∞ — — 9

Table of faces Table of vertices

v x y e original?

1 x1 y1 1 12 x2 y2 1 13 x3 y3 2 04 x4 y4 8 05 x5 y5 4 06 x6 y6 9 0

DCEL

e vB vE fL fR eP eN

1 1 2 2 3 4 22 2 3 4 3 3 63 2 4 2 4 1 74 1 5 1 2 5 85 1 6 3 1 1 96 6 3 3 ∞ 5 77 3 4 4 ∞ 2 88 5 4 ∞ 2 9 39 5 6 1 ∞ 4 6

DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Storing the Voronoi diagram

p x y e

1 x1 y1 42 x2 y2 43 x3 y3 14 x4 y4 3∞ — — 9

Table of faces Table of vertices

v x y e original?

1 x1 y1 1 12 x2 y2 1 13 x3 y3 2 04 x4 y4 8 05 x5 y5 4 06 x6 y6 9 0

DCEL

e vB vE fL fR eP eN

1 1 2 2 3 4 22 2 3 4 3 3 63 2 4 2 4 1 74 1 5 1 2 5 85 1 6 3 1 1 96 6 3 3 ∞ 5 77 3 4 4 ∞ 2 88 5 4 ∞ 2 9 39 5 6 1 ∞ 4 6

DCEL

Storage space

• For each face:

2 coordinates + 1 pointer.

• For each vertex:

2 coordinates + 1 pointer + 1 bit.

• For each edge:

6 pointers.

In total, the storage space is O(n).

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Storing the Voronoi diagram

DCEL

There are other DCEL variants, as for example:

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Storing the Voronoi diagram

DCEL

There are other DCEL variants, as for example:

ee′

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Storing the Voronoi diagram

DCEL

There are other DCEL variants, as for example:

ee′

e −→ vB , fR, eN , e′

e′ −→ vB , fR, eN , e

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Storing the Voronoi diagram

DCEL

There are other DCEL variants, as for example:

ee′

e −→ vB , fR, eN , e′

e′ −→ vB , fR, eN , e

vB(e)

fR(e)

eN (e)

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Storing the Voronoi diagram

DCEL

There are other DCEL variants, as for example:

ee′

e −→ vB , fR, eN , e′

e′ −→ vB , fR, eN , e

vB(e)

fR(e)

eN (e)vB(e

′)

fR(e′)

eN (e′)

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

DCEL

There are other DCEL variants, as for example:

ee′

e −→ vB , fR, eN , e′

e′ −→ vB , fR, eN , e

vB(e)

fR(e)

eN (e)vB(e

′)

fR(e′)

eN (e′)

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

DCELe vB vE fL fR eP eN

1 1 2 2 3 4 22 2 3 4 3 3 63 2 4 2 4 1 74 1 5 1 2 5 85 1 6 3 1 1 96 6 3 3 ∞ 5 77 3 4 4 ∞ 2 88 5 4 ∞ 2 9 39 5 6 1 ∞ 4 6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

1

2

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Storing the Voronoi diagram

DCELe vB fR eN e′

1 1 3 2 1’2 2 3 6 2’3 2 4 7 3’4 1 2 8 4’5 1 1 9 5’6 6 ∞ 7 6’7 3 ∞ 8 7’8 5 2 3 8’9 5 ∞ 6 9’1’ 2 2 4 12’ 3 4 3 23’ 4 2 1 34’ 5 1 5 45’ 6 3 1 56’ 3 3 5 67’ 4 4 2 78’ 4 ∞ 9 89’ 6 1 4 9

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of the edges and faces incident to a given Voronoi vertex

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of the edges and faces incident to a given Voronoi vertex

Input: vi, a Voronoi vertexOutput: listE and listF , sorted in counterclockwise order

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of the edges and faces incident to a given Voronoi vertex

Input: vi, a Voronoi vertexOutput: listE and listF , sorted in counterclockwise order

Procedure:

listE = { }, listF = { }, e = e(vi)

Initialization

Advance

Add e to listEIf i = vB(e), then

add fL(e) to listFe = eP (e)

else

add fR(e) to listFe = eN (e)

Repeat until e coincides again with e(vi)

e

vE

vB

fL

fR

eN

eP

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of the edges and faces incident to a given Voronoi vertex

Input: vi, a Voronoi vertexOutput: listE and listF , sorted in counterclockwise order

Procedure:

listE = { }, listF = { }, e = e(vi)

Initialization

Advance

Add e to listEIf i = vB(e), then

add fL(e) to listFe = eP (e)

else

add fR(e) to listFe = eN (e)

Repeat until e coincides again with e(vi)

The running time of this algo-rithm is linear in the numberof edges (faces) incident to vi

e

vE

vB

fL

fR

eN

eP

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of vertices and edges of a Voronoi region

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of vertices and edges of a Voronoi region

Input: pi, a siteOutput: listE and listV , sorted in clockwise order

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of vertices and edges of a Voronoi region

Input: pi, a siteOutput: listE and listV , sorted in clockwise order

Procedure:

listE = { }, listV = { }, e = e(pi)

Initialization

Advance

Add e to listEIf i = fL(e), then

add vB(e) to listVe = eP (e)

else

addr vE(e) to listVe = eN (e)

Repeat until e coincides again with e(vi)

e

vE

vB

fL

fR

eN

eP

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Sorted list of vertices and edges of a Voronoi region

Input: pi, a siteOutput: listE and listV , sorted in clockwise order

Procedure:

listE = { }, listV = { }, e = e(pi)

Initialization

Advance

Add e to listEIf i = fL(e), then

add vB(e) to listVe = eP (e)

else

addr vE(e) to listVe = eN (e)

Repeat until e coincides again with e(vi)

The running time of this al-gorithm is linear to the num-ber of edges (vertices) of theVoronoi region of pi

e

vE

vB

fL

fR

eN

eP

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Convex hull of P

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Convex hull of P

When pi =∞, the previous algorithm returns, in counterclockwise order, the (fictitious) edgesof the Voronoi region of this (fictitious) point. For each obtained edge, reporting its otheradjacent Voronoi face will produce the sorted list of the convex hull vertices of P , in timeproportional to its size.

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Delaunay diagram

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Delaunay diagram

The DCEL storing the Voronoi diagram information and the DCEL storing the Delaunay trian-gulation information are the same, we just need to do some “dual reading”:

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Delaunay diagram

The DCEL storing the Voronoi diagram information and the DCEL storing the Delaunay trian-gulation information are the same, we just need to do some “dual reading”:

Voronoi:

Delaunay:

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Delaunay diagram

The DCEL storing the Voronoi diagram information and the DCEL storing the Delaunay trian-gulation information are the same, we just need to do some “dual reading”:

Voronoi:

Delaunay:

p x y e

p x y eincident

faces

vertices

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Delaunay diagram

The DCEL storing the Voronoi diagram information and the DCEL storing the Delaunay trian-gulation information are the same, we just need to do some “dual reading”:

Voronoi:

Delaunay:

vertices

triangles

v x y e original?

v x y e original?circumcenter edge

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC

Voronoi diagram storage

How to obtain information from the DCEL

Delaunay diagram

The DCEL storing the Voronoi diagram information and the DCEL storing the Delaunay trian-gulation information are the same, we just need to do some “dual reading”:

Voronoi:

Delaunay:

edges

edges

e vB vE fL fR eP eN

e fL fR vE vB eN ePdual clockwise

12

34

2

3

1

2

4

3 61 5

5

4

7

89

6

Discrete and Algorithmic Geometry, Facultat de Matematiques i Estadıstica, UPC