Anda di halaman 1dari 45

STORING THE

VORONOI DIAGRAM

Vera Sacrist
an

Computational Geometry
Facultat dInform`atica de Barcelona
Universitat Polit`ecnica de Catalunya
Storing the Voronoi diagram
Possible options, advantages and disadvantages

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
Possible options, advantages and disadvantages

Storing the list of all the edges of the diagram

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
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 proximity
information. For example, given a site pi , finding its neighbors or reporting the vertices and
edges of its Voronoi region is too expensive.

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
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 proximity
information. For example, given a site pi , finding its neighbors or reporting the vertices and
edges 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 as
the sorted list of its neighbors, etc.

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
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 proximity
information. For example, given a site pi , finding its neighbors or reporting the vertices and
edges 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 as
the 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.

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
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 proximity
information. For example, given a site pi , finding its neighbors or reporting the vertices and
edges 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 as
the 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 (doubly
connected edge list).
The DCEL is also used to store plane partitions, polyhedra, meshes, etc.

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

4 3

2
1

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

2
4 3
2
3 1 6
1 5
4
2
4
1
5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

3
6
7
2
4 3
2
3 1 6
1 5
4
2
4
1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

3
6
7
2
4 3
2
3 1 6
e 1 5
4
2
4
1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

3
6
vE 7
2
4 3
2
3 1 6
e 1 5
4
2
4
vB 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

3
6
vE 7
2
4 3
fL 2
3 1 6
e 1 5
fR 4
2
4
vB 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

3
6
vE 7
eN 2
4 3
fL 2
3 1 6
e 1 5
fR 4
2
4
vB 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

3
6
vE 7
eN 2
4 3
fL 2
3 1 6
e 1 5
fR 4
2
4
eP vB 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
Table of faces DCEL
p x y e
1 x1 y1 4
2 x2 y2 4 3
3 x3 y3 1 6
7
4 x4 y4 3 2
9 4 3
2
3 1 6
1 5
4
2
4
1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
Table of faces Table of vertices DCEL
p x y e v x y e original?
1 x1 y1 4 1 x1 y1 1 1
2 x2 y2 4 2 x2 y2 1 1 3
3 x3 y3 1 3 x3 y3 2 0 6
7
4 x4 y4 3 4 x4 y4 8 0 2
9 5 x5 y5 4 0 4 3
6 x6 y6 9 0 2
3 1 6
1 5
4
2
4
1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
Table of faces Table of vertices DCEL
p x y e v x y e original?
1 x1 y1 4 1 x1 y1 1 1
2 x2 y2 4 2 x2 y2 1 1 3
3 x3 y3 1 3 x3 y3 2 0 6
7
4 x4 y4 3 4 x4 y4 8 0 2
9 5 x5 y5 4 0 4 3
6 x6 y6 9 0 2
DCEL 3 1 6
1 5
e vB vE fL fR eP eN 4
2
1 1 2 2 3 4 2 4
2 2 3 4 3 3 6 1
9
3 2 4 2 4 1 7 8 5
4 1 5 1 2 5 8
5 1 6 3 1 1 9
6 6 3 3 5 7
7 3 4 4 2 8
8 5 4 2 9 3
9 5 6 1 4 6
Computational Geometry, Facultat dInform`
atica de Barcelona, UPC
Storing the Voronoi diagram
Table of faces Table of vertices DCEL
p x y e v x y e original?
1 x1 y1 4 1 x1 y1 1 1
2 x2 y2 4 2 x2 y2 1 1
3 x3 y3 1 3 x3 y3 2 0
4 x4 y4 3 4 x4 y4 8 0
9 5 x5 y5 4 0
6 x6 y6 9 0 Storage space
DCEL
For each face:
e vB vE fL fR eP eN
1 1 2 2 3 4 2 2 coordinates + 1 pointer/index.
2 2 3 4 3 3 6 For each vertex:
3 2 4 2 4 1 7
2 coordinates + 1 pointer/index + 1 bit.
4 1 5 1 2 5 8
5 1 6 3 1 1 9 For each edge:
6 6 3 3 5 7
6 pointers/indices.
7 3 4 4 2 8
8 5 4 2 9 3 In total, the storage space is O(n).
9 5 6 1 4 6
Computational Geometry, Facultat dInform`
atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

There are other DCEL variants, as for example:

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

There are other DCEL variants, as for example:

e0
e

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

There are other DCEL variants, as for example:

e vB , fR , eN , e0
e0 vB , fR , eN , e

e0
e

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

There are other DCEL variants, as for example:

e vB , fR , eN , e0
e0 vB , fR , eN , e

eN (e)

e0
e
fR (e)

vB (e)

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

There are other DCEL variants, as for example:

e vB , fR , eN , e0
e0 vB , fR , eN , e

vB (e0 )
0
eN (e)
fR (e )
e0
e
fR (e)

eN (e0 ) vB (e)

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL

There are other DCEL variants, as for example:

e vB , fR , eN , e0 3
6
e0 vB , fR , eN , e 7
2
4 3
vB (e0 ) 2
eN (e) 3 1 6
0
fR (e ) 1 5
4
e0 2
4
e 1
fR (e) 9
8 5

eN (e0 ) vB (e)

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL
e vB vE fL fR eP eN
1 1 2 2 3 4 2
2 2 3 4 3 3 6
3 2 4 2 4 1 7 3
6
4 1 5 1 2 5 8 7
5 1 6 3 1 1 9 2
6 6 3 3 5 7 4 3
7 3 4 4 2 8 2
1
3 6
8 5 4 2 9 3
9 5 6 1 4 6 1 5
4
2
4
1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Storing the Voronoi diagram
DCEL
0
e vB fR eN e
1 1 3 2 1
2 2 3 6 2
3 2 4 7 3 3
6
4 1 2 8 4 7
5 1 1 9 5 2
6 6 7 6 4 3
7 3 8 7 2
1
3 6
8 5 2 3 8
9 5 6 9 1 5
4
1 2 2 4 1 2
4
2 3 4 3 2 1
9
3 4 2 1 3
8 5
4 5 1 5 4
5 6 3 1 5
6 3 3 5 6
7 4 4 2 7
8 4 9 8
9 6 1 4 9

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Sorted list of the edges and faces incident to a given Voronoi vertex

Computational Geometry, Facultat dInform`


atica de Barcelona, 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 vertex
Output: listE and listF , sorted in counterclockwise order

Computational Geometry, Facultat dInform`


atica de Barcelona, 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 vertex
Output: listE and listF , sorted in counterclockwise order

Procedure:
vE
Initialization eN
listE = { }, listF = { }, e = e(vi ) fL
Advance
e
Add e to listE fR
If i = vB (e), then
add fL (e) to listF eP vB
e = eP (e)
else
add fR (e) to listF
e = eN (e)
Repeat until e coincides again with e(vi )

Computational Geometry, Facultat dInform`


atica de Barcelona, 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 vertex
Output: listE and listF , sorted in counterclockwise order

Procedure:
vE
Initialization eN
listE = { }, listF = { }, e = e(vi ) fL
Advance
e
Add e to listE fR
If i = vB (e), then
add fL (e) to listF eP vB
e = eP (e)
else
add fR (e) to listF The running time of this algo-
e = eN (e) rithm is linear in the number
Repeat until e coincides again with e(vi ) of edges (faces) incident to vi

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Sorted list of vertices and edges of a Voronoi region

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Sorted list of vertices and edges of a Voronoi region
Input: pi , a site
Output: listE and listV , sorted in clockwise order

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Sorted list of vertices and edges of a Voronoi region
Input: pi , a site
Output: listE and listV , sorted in clockwise order

Procedure:
vE
Initialization eN
listE = { }, listV = { }, e = e(pi ) fL
Advance
e
Add e to listE fR
If i = fL (e), then
add vB (e) to listV eP vB
e = eP (e)
else
addr vE (e) to listV
e = eN (e)
Repeat until e coincides again with e(vi )

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Sorted list of vertices and edges of a Voronoi region
Input: pi , a site
Output: listE and listV , sorted in clockwise order

Procedure:
vE
Initialization eN
listE = { }, listV = { }, e = e(pi ) fL
Advance
e
Add e to listE fR
If i = fL (e), then
add vB (e) to listV eP vB
e = eP (e)
else
The running time of this algo-
addr vE (e) to listV
rithm is linear in the number
e = eN (e)
of edges (vertices) of the Vo-
Repeat until e coincides again with e(vi ) ronoi region of pi
Computational Geometry, Facultat dInform`
atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Convex hull of P

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, 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) edges
of the Voronoi region of this (fictitious) point. For each obtained edge, reporting its other
adjacent Voronoi face will produce the sorted list of the convex hull vertices of P , in time
proportional to its size.

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC
Voronoi diagram storage
How to obtain information from the DCEL
Delaunay diagram

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, 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:

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, 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:

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, 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: faces p x y e
Delaunay: vertices p x y e
incident

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, 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: vertices v x y e original?


Delaunay: triangles v x y e original?
circumcenter edge

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, 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: edges e vB vE fL fR eP eN
Delaunay: edges e fL fR vE vB eN eP
dual clockwise

3
6
7
4 2 3

2 1
3 6
1 5
4
2
4 1
9
8 5

Computational Geometry, Facultat dInform`


atica de Barcelona, UPC

Anda mungkin juga menyukai