CS133 Computational Geometry Voronoi Diagram Delaunay - - PowerPoint PPT Presentation

β–Ά
cs133
SMART_READER_LITE
LIVE PREVIEW

CS133 Computational Geometry Voronoi Diagram Delaunay - - PowerPoint PPT Presentation

CS133 Computational Geometry Voronoi Diagram Delaunay Triangulation 5/17/2018 1 Nearest Neighbor Problem Given a set of points and a query point , find the closest point to , ,


slide-1
SLIDE 1

CS133

Computational Geometry

Voronoi Diagram Delaunay Triangulation

5/17/2018 1

slide-2
SLIDE 2

Nearest Neighbor Problem

Given a set of points 𝑄 and a query point π‘Ÿ, find the closest point π‘ž ∈ 𝑄 to π‘Ÿ βˆ€π‘ž, 𝑠 ∈ 𝑄, 𝑒𝑗𝑑𝑒 π‘ž, π‘Ÿ ≀ 𝑒𝑗𝑑𝑒(𝑠, π‘Ÿ) Simple algorithm: Scan and find the minimum An efficient algorithm: Use a spatial index structure such as Kd tree What if we need to repeat this for every point in the space, i.e., an infinite number of points?

5/17/2018 2

slide-3
SLIDE 3

Application: Cell Coverage

5/17/2018 3

Voronoi Diagram

slide-4
SLIDE 4

Other Applications

Service coverage for hospitals, post offices, schools, … etc. Marketing: Find candidate locations for a new restaurant Routing: How an electric vehicle should travel while staying close to charging stations

5/17/2018 4

slide-5
SLIDE 5

Voronoi Region

Given a set 𝑄 of points (also called sites), a Voronoi region of a site π‘žπ‘— ∈ 𝑄, π‘Š π‘žπ‘— is the set of points in the Euclidean space where π‘žπ‘— is (one of) the closest sites π‘Š π‘žπ‘— = 𝑦: π‘žπ‘— βˆ’ 𝑦 ≀ π‘žπ‘˜ βˆ’ 𝑦 βˆ€π‘žπ‘˜ ∈ 𝑄

5/17/2018 5

slide-6
SLIDE 6

Voronoi Diagram

The Voronoi diagram is the set of points that belong to two or more Voronoi regions Voronoi diagram is a tessellation of the space into regions where each region contains all the points that are closest to one site

5/17/2018 6

slide-7
SLIDE 7

VD of Two Points

5/17/2018 7

π‘ž1 π‘ž2 π‘Š π‘ž1 π‘Š π‘ž2

slide-8
SLIDE 8

VD of Three Points

5/17/2018 8

π‘ž1 π‘ž2 π‘Š π‘ž1 π‘Š π‘ž2 π‘ž3 π‘Š π‘ž3

slide-9
SLIDE 9

VD of Three Points

5/17/2018 9

π‘ž1 π‘ž2 π‘Š π‘ž1 π‘Š π‘ž2 π‘ž3 π‘Š π‘ž3

slide-10
SLIDE 10

Voronoi Region

A Voronoi region of a set π‘žπ‘— is the intersection

  • f all half spaces defined by the

perpendicular bisectors π‘Š π‘žπ‘— =Ϊπ‘˜β‰ π‘— 𝐼 π‘žπ‘—, π‘žπ‘˜

5/17/2018 10

slide-11
SLIDE 11

VD of a Set of Points

5/17/2018 11

𝑄 π‘ŠπΈ 𝑄

slide-12
SLIDE 12

Mother Nature Loves VD

5/17/2018 12

http://forum.woodenboat.com/showthread.php?112363-Voronoi-Diagrams-in-Nature

slide-13
SLIDE 13

Mother Nature Loves VD

5/17/2018 13

slide-14
SLIDE 14

Mother Nature Loves VD

5/17/2018 14

http://forum.woodenboat.com/showthread.php?112363-Voronoi-Diagrams-in-Nature

slide-15
SLIDE 15

Mother Nature Loves VD

5/17/2018 15

Onion cells under the microscope

slide-16
SLIDE 16

Mother Nature Loves VD

5/17/2018 16

http://forum.woodenboat.com/showthread.php?112363-Voronoi-Diagrams-in-Nature

A thin slice of carrot under the scope

slide-17
SLIDE 17

Mother Nature Loves VD

5/17/2018 17

http://forum.woodenboat.com/showthread.php?112363-Voronoi-Diagrams-in-Nature

A dead maple leaf at 160X

slide-18
SLIDE 18

Mother Nature Loves VD

5/17/2018 18

http://forum.woodenboat.com/showthread.php?112363-Voronoi-Diagrams-in-Nature

An oak leaf

slide-19
SLIDE 19

VD Properties

5/17/2018 19

Voronoi regions are convex Each Voronoi region contains a single site Voronoi regions (faces) can be unbounded Most intersection points connect three segments

slide-20
SLIDE 20

VD Properties

π‘Š π‘žπ‘— is unbounded iff π‘žπ‘— ∈ π’Ÿβ„‹ 𝑄 If a point 𝑦 is at the intersection of three or more Voronoi regions, say π‘Š π‘ž1 , π‘Š π‘ž2 , … , π‘Š π‘žπ‘™ , then 𝑦 is the center of a circle 𝐷 that have π‘ž1, … , π‘žπ‘™ at its boundary 𝐷 contains no other sites VD is unique

5/17/2018 20

slide-21
SLIDE 21

Delaunay Triangulation (DT)

Delaunay triangulation is the straight-line dual

  • f the Voronoi diagram

Each site is a corner of at least one triangle Each two Voronoi regions that share an edge are connect with an edge in DT

5/17/2018 21

slide-22
SLIDE 22

DT Properties

The edges of 𝐸 𝑄 do not intersect Is 𝐸 𝑄 unique?

Yes, if no four sites are co-circular

If π‘žπ‘— and π‘žπ‘˜ are the closest pair

  • f sites, they are connected with an edge in DT

If π‘žπ‘— and π‘žπ‘˜ are nearest neighbors, they are connected with an edge in DT The circumcircle of π‘žπ‘—, π‘žπ‘˜, and π‘žπ‘™ is empty ⟺ π‘žπ‘—, π‘žπ‘˜, π‘žπ‘™ is a triangle in DT

5/17/2018 22

slide-23
SLIDE 23

DT is a Planar Graph

Since the edges in DT do not intersect, they form a planar graph

The number of edges/faces in a Delaunay Triangulation is linear in the number of vertices. The number of edges/vertices in a Voronoi Diagram is linear in the number of faces. The number of vertices/edges/faces in a Voronoi Diagram is linear in the number of sites.

5/17/2018 23

slide-24
SLIDE 24

DT Properties

The boundary of 𝐸 𝑄 is the convex hull of 𝑄

5/17/2018 24

π‘žπ‘— π‘žπ‘˜ π‘Š π‘žπ‘— π‘Š π‘žπ‘˜

slide-25
SLIDE 25

DT Properties

If π‘žπ‘˜ is the nearest neighbor of π‘žπ‘— then π‘žπ‘—π‘žπ‘˜ is a Delaunay edge π‘žπ‘˜ is the nearest neighbor of π‘žπ‘— iff. the circle around π‘žπ‘— with radius π‘žπ‘— βˆ’ π‘žπ‘˜ is empty of

  • ther points.

β‡’The circle through π‘žπ‘— + π‘žπ‘˜ /2 with radius |π‘žπ‘— βˆ’ π‘žπ‘˜|/2is empty of other points. β‡’ π‘žπ‘— + π‘žπ‘˜ /2 is on the Voronoi diagram. β‡’ π‘žπ‘— + π‘žπ‘˜ /2 is on a Voronoi edge.

5/17/2018 25

slide-26
SLIDE 26

VD Plane Sweep

Scan the plane from top to bottom Compute the VD of the points above the sweep line Is it that simple?

5/17/2018 26

slide-27
SLIDE 27

VD of a Line and a Point

5/17/2018 27

slide-28
SLIDE 28

VD of a Line and a n Points

5/17/2018 28

slide-29
SLIDE 29

VD of a Line and a n Points

5/17/2018 29

slide-30
SLIDE 30

Fortune’s Algorithm

As the line sweeps the plane, the algorithm maintains the VD of the set of points and the sweep line Since the sweep line is closer than any future point, it acts as a barrier that isolates the VD from all future points

5/17/2018 30

slide-31
SLIDE 31

Fortune’s Algorithm in Action

5/17/2018 31

slide-32
SLIDE 32

VD Properties

The VD part above the beach line (blue) is

  • final. Why?

This area is closer to some site than the beach line … closer to some site than any future site We already know the nearest site to those areas

5/17/2018 32

slide-33
SLIDE 33

VD Properties

The beach line is x-monotone. Why?

Each parabola is x-monotone At each x-coordinate, the beach line takes one value which is the minimum of all the parabolas Therefore, it is x-monotone

5/17/2018 33

Credits: http://www.cs.sfu.ca/~binay/813.2011/Fortune.pdf

slide-34
SLIDE 34

VD Properties

The breakpoints of the beach line lie on Voronoi edges of the final diagram

Each breakpoint is equidistant from two sites A breakpoint is as close to some site as to the sweep line The sweep line is (closer) to the blue sites than future sites

5/17/2018 34

slide-35
SLIDE 35

Fortune’s Algorithm

Move the sweep line downwards and update the VD as the line moves When the line reaches βˆ’βˆž, we will have our final VD. (Because any point in the space is closer to some site than y = βˆ’βˆž) Note: We never create the beach line

  • explicitly. We only maintain enough

information that allows us to reconstruct parts

  • f it when we need them

5/17/2018 35

slide-36
SLIDE 36

Beach Line Changes

How can the beach line change (topologically)

A new arc appears An existing arc is removed

5/17/2018 36

slide-37
SLIDE 37

Site Event

When the sweep line hits a new site Where are the points that are equi-distant from the new site and the sweep line?

5/17/2018 37

slide-38
SLIDE 38

Site Event

5/17/2018 38

Lemma: The only way in which a new arc can appear on the beach line is through a site event Proof by contradiction The arc 𝛽𝑗 of site π‘žπ‘— = π‘žπ‘—π‘¦, π‘žπ‘—π‘§ has the function 𝑧 = 1 2 𝑦 βˆ’ π‘žπ‘—π‘¦ 2 π‘žπ‘—π‘§ βˆ’ ℓ𝑧 + ℓ𝑧 + π‘žπ‘—π‘§

slide-39
SLIDE 39

Site Event

𝑧 =

1 2 π‘¦βˆ’π‘žπ‘—π‘¦ 2 π‘žπ‘—π‘§βˆ’β„“π‘§ + ℓ𝑧 + π‘žπ‘—π‘§

5/17/2018 39

π‘žπ‘—π‘¦, π‘žπ‘—π‘§ Δ𝑧 Δ𝑧 2 > Δ𝑧 2

Consequence: The beach line can have at most 2π‘œ βˆ’ 1 arcs

slide-40
SLIDE 40

Circle (Vertex) Event

An existing arc shrinks into a point and disappears This happens when three (or more) sites become closer to a point than the sweep line shielding the point from the sweep line

5/17/2018 40

slide-41
SLIDE 41

Circle (Vertex) Event

The sweep line will only go further while the points stay This results in a vertex on the Voronoi Diagram Lemma: The only way in which an existing arc can disappear from the beach line is through a circle event

5/17/2018 41

slide-42
SLIDE 42

Circle (Vertex) Event

A circle event is added at the lowest point of the circle

5/17/2018 42

Circle event

slide-43
SLIDE 43

Plane Sweep Constructs

Sweep line status: The VD of the sites and the sweep line. In other words, the final part

  • f the VD + the beach line

Event points:

Site event: A new site that adds a new arc to the

  • VD. 1-to-1 mapping to an input site

Circle event: The disappearance of an arc resulting in a vertex in VD. Can only be discovered along the way

5/17/2018 43

slide-44
SLIDE 44

Sweep Line Status

The final part of VD is stored in the Doubly- Connected Edge List (DCEL) data structure The beach line is stored as a BST (𝜐) of arcs sorted by 𝑦

Leaves store arcs Internal nodes store the breakpoints as a pair of sites π‘žπ‘—, π‘žπ‘˜

5/17/2018 44

slide-45
SLIDE 45

Event Points

Stored in a priority queue 𝑅 as a max-heap

  • rdered by 𝑧

𝑅 is initialized with all sites

5/17/2018 45

slide-46
SLIDE 46

Handle Site Event (𝒒𝒋)

If 𝜐 is empty, add the site to it and return Search in 𝜐 for the arc 𝛽 vertically above π‘žπ‘— If exists, delete a circle event linked with 𝛽 Split 𝛽 into two arcs and insert a new arc 𝛽𝑗 corresponding to π‘žπ‘— The new intersections are 𝛽, 𝛽𝑗 and 𝛽𝑗, 𝛽 Check the new triples of arcs and add their corresponding circle event to 𝑅

5/17/2018 46

slide-47
SLIDE 47

Handle Circle Event (𝜹)

Delete the leaf 𝛿 that corresponds to the disappearing arc 𝛽 from 𝜐 Add the center of the circle event as a vertex in VD. This center is one side of two half- edges Check for any new circle events caused by the now adjacent triples of arcs Running time:

𝑃 π‘œ log π‘œ

5/17/2018 47

slide-48
SLIDE 48

Delaunay Triangulation

5/17/2018 48

slide-49
SLIDE 49

Delaunay Triangulation

A Delaunay triangulation can be defined as the (unique) triangulation in which the circumcircle of each triangle has no other sites NaΓ―ve algorithm:

Consider all possible triangles 𝑃 π‘œ3

Check if the circumcircle of the triangle is empty 𝑃 π‘œ

Running time 𝑃 π‘œ4

5/17/2018 49

slide-50
SLIDE 50

Guibas and Stolfi’s Algorithm

A divide and conquer algorithm

5/17/2018 50

slide-51
SLIDE 51

Algorithm Outline

DelaunayTriangulation(P)

If (|P| <= 3)

return TrivialDT(P)

Split P into P1 and P2 DT1 = DelaunayTriangulation(P1) DT2 = DelaunayTriangulation(P1) Merge(DT1, DT2)

5/17/2018 51

slide-52
SLIDE 52

Split

5/17/2018 52

Pre-sort by x

slide-53
SLIDE 53

TrivialDT(P)

5/17/2018 53

P TrivialDT(P)

slide-54
SLIDE 54

Merge(P1, P2)

5/17/2018 54

slide-55
SLIDE 55

Merge(P1, P2)

5/17/2018 55

slide-56
SLIDE 56

Merge(P1, P2)

5/17/2018 56

slide-57
SLIDE 57

Merge(P1, P2)

5/17/2018 57

slide-58
SLIDE 58

Find the First LR edge

5/17/2018 58

Upper tangent of π’Ÿβ„‹ 𝑄

1 , π’Ÿβ„‹ 𝑄2 Base LR edge

slide-59
SLIDE 59

Rising Bubble

5/17/2018 59

slide-60
SLIDE 60

Rising Bubble

5/17/2018 60

slide-61
SLIDE 61

Rising Bubble

5/17/2018 61

slide-62
SLIDE 62

Rising Bubble

5/17/2018 62

New Base LR edge

slide-63
SLIDE 63

Rising Bubble

5/17/2018 63

slide-64
SLIDE 64

Rising Bubble

5/17/2018 64

slide-65
SLIDE 65

Rising Bubble

5/17/2018 65

slide-66
SLIDE 66

Rising Bubble

5/17/2018 66

slide-67
SLIDE 67

Rising Bubble

5/17/2018 67

slide-68
SLIDE 68

Rising Bubble

5/17/2018 68

slide-69
SLIDE 69

Rising Bubble

5/17/2018 69

slide-70
SLIDE 70

Rising Bubble

5/17/2018 70

slide-71
SLIDE 71

Rising Bubble

5/17/2018 71

slide-72
SLIDE 72

Rising Bubble

5/17/2018 72

slide-73
SLIDE 73

Rising Bubble

5/17/2018 73

slide-74
SLIDE 74

Rising Bubble

5/17/2018 74

slide-75
SLIDE 75

Rising Bubble

5/17/2018 75

slide-76
SLIDE 76

Rising Bubble

5/17/2018 76

slide-77
SLIDE 77

Rising Bubble

5/17/2018 77

slide-78
SLIDE 78

Rising Bubble

5/17/2018 78

slide-79
SLIDE 79

Rising Bubble

5/17/2018 79

slide-80
SLIDE 80

Rising Bubble

5/17/2018 80

slide-81
SLIDE 81

Rising Bubble

5/17/2018 81

slide-82
SLIDE 82

Rising Bubble

5/17/2018 82

slide-83
SLIDE 83

Rising Bubble

5/17/2018 83

slide-84
SLIDE 84

Rising Bubble

5/17/2018 84

slide-85
SLIDE 85

Rising Bubble

5/17/2018 85

slide-86
SLIDE 86

Rising Bubble

5/17/2018 86

slide-87
SLIDE 87

Rising Bubble

5/17/2018 87

slide-88
SLIDE 88

Rising Bubble

5/17/2018 88

slide-89
SLIDE 89

Rising Bubble

5/17/2018 89

slide-90
SLIDE 90

Rising Bubble

5/17/2018 90

slide-91
SLIDE 91

Rising Bubble

5/17/2018 91

slide-92
SLIDE 92

Rising Bubble

5/17/2018 92

slide-93
SLIDE 93

Rising Bubble

5/17/2018 93

slide-94
SLIDE 94

Rising Bubble

5/17/2018 94

slide-95
SLIDE 95

Rising Bubble

5/17/2018 95

slide-96
SLIDE 96

Rising Bubble

5/17/2018 96

slide-97
SLIDE 97

Rising Bubble

5/17/2018 97

slide-98
SLIDE 98

Rising Bubble

5/17/2018 98

slide-99
SLIDE 99

Rising Bubble

5/17/2018 99

slide-100
SLIDE 100

Rising Bubble

5/17/2018 100

slide-101
SLIDE 101

Terminate

5/17/2018 101

slide-102
SLIDE 102

Rising Bubble Implementation

5/17/2018 102

πœ„π‘† πœ„π‘€

slide-103
SLIDE 103

Rising Bubble Implementation

5/17/2018 103

πœ„π‘† πœ„π‘€

slide-104
SLIDE 104

Rising Bubble Implementation

5/17/2018 104

πœ„π‘† πœ„π‘€

slide-105
SLIDE 105

Rising Bubble Implementation

5/17/2018 105

πœ„π‘† πœ„π‘€

slide-106
SLIDE 106

Rising Bubble Implementation

5/17/2018 106

πœ„π‘† πœ„π‘€

slide-107
SLIDE 107

Rising Bubble Implementation

5/17/2018 107

slide-108
SLIDE 108

Terrain Problem

5/17/2018 108

slide-109
SLIDE 109

Terrain Problem

We would like to build a model for the Earth terrain We can measure the altitude at some points How to approximate the altitude for non- measured points?

5/17/2018 109

slide-110
SLIDE 110

Nearest Neighbor

One possibility, approximate it to the nearest measured point Does not look natural

5/17/2018 110

slide-111
SLIDE 111

Triangulation

Determine a triangulation Raise each point to its altitude Question: Which triangulation?

5/17/2018 111

slide-112
SLIDE 112

Angle-optimal Triangulation

For a triangulation 𝒰 𝐡(𝒰): is the angle vector which consists of the angles 𝛽’s in sorted order 𝛽1 ≀ 𝛽2 ≀ β‹― ≀ π›½π‘œ We say that 𝐡 𝒰 > 𝐡(𝒰′) if 𝐡(𝒰) is lexicographically larger than 𝐡(𝒰′) 𝒰 is angle optimal if 𝐡 𝒰 β‰₯ 𝐡(𝒰′) for all triangulations 𝒰′

5/17/2018 112

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

slide-113
SLIDE 113

Edge Flip

The edge π‘žπ‘—π‘žπ‘˜ is illegal if min

1≀𝑗≀6 𝛽𝑗 < min 1≀𝑗≀6 𝛽𝑗 β€²

Flipping an edge increases the angle vector

5/17/2018 113

𝛽1 𝛽2 𝛽3 𝛽4 𝛽5 𝛽6 π‘žπ‘— π‘žπ‘˜ π‘žπ‘™ π‘žπ‘š 𝛽1

β€²

𝛽2

β€²

𝛽3

β€²

𝛽4

β€²

𝛽5

β€²

𝛽6

β€²

π‘žπ‘— π‘žπ‘˜ π‘žπ‘™ π‘žπ‘š Edge Flip

slide-114
SLIDE 114

Detect Illegal Edges

Thale’s Theorem 𝑏𝑐 is a chord in 𝐷 βˆ‘π‘π‘ π‘ > βˆ‘π‘π‘žπ‘ βˆ‘π‘π‘žπ‘ = βˆ‘π‘π‘Ÿπ‘ βˆ‘π‘π‘Ÿπ‘ > βˆ‘π‘π‘‘π‘

5/17/2018 114

𝑏 𝑐 𝑠 π‘ž π‘Ÿ 𝑑 𝐷

slide-115
SLIDE 115

Detect Illegal Edges

By Thale’s Theorem βˆ‘π‘žπ‘—π‘žπ‘˜π‘žπ‘™ < βˆ‘π‘žπ‘—π‘žπ‘šπ‘žπ‘™ βˆ‘π‘žπ‘˜π‘žπ‘—π‘žπ‘™ < βˆ‘π‘žπ‘˜π‘žπ‘šπ‘žπ‘™ An angle-optimal triangulation is equivalent to Delauany Triangulation

5/17/2018 115

π‘žπ‘— π‘žπ‘˜ π‘žπ‘™ π‘žπ‘š Illegal Edge

slide-116
SLIDE 116

Delaunay Triangulation

  • 1. Start with any valid triangulation
  • 2. If no illegal edges found, terminate
  • 3. Pick an illegal edge and flip it
  • 4. Go to 2
  • Does this algorithm terminate?
  • Running time: 𝑃 π‘œ2

5/17/2018 116

slide-117
SLIDE 117

Incremental Algorithm

Given an existing Delaunay triangulation πΈπ‘ˆ(𝑄) We need to add a point π‘žπ‘— to πΈπ‘ˆ

5/17/2018 117

slide-118
SLIDE 118

Incremental Algorithm

5/17/2018 118

slide-119
SLIDE 119

Incremental Algorithm

5/17/2018 119

slide-120
SLIDE 120

Incremental Algorithm

5/17/2018 120

slide-121
SLIDE 121

Incremental Algorithm

5/17/2018 121

slide-122
SLIDE 122

Incremental Algorithm

5/17/2018 122

π‘žβˆ’1 π‘žβˆ’2

slide-123
SLIDE 123

Incremental Algorithm

5/17/2018 123

slide-124
SLIDE 124

Incremental Algorithm

5/17/2018 124

slide-125
SLIDE 125

Insert

5/17/2018 125

slide-126
SLIDE 126

Legalize Edge

5/17/2018 126

slide-127
SLIDE 127

Correctness

5/17/2018 127

slide-128
SLIDE 128

Correctness

5/17/2018 128

slide-129
SLIDE 129

Incremental Algorithm

5/17/2018 129

slide-130
SLIDE 130

Search Data Structure

5/17/2018 130