Prof.Vigneron's Slides on Voronoi Diagram/Delaunay ... · 1 Introduction 2 Voronoi Diagrams 3 Dual...

38
CS 372: Computational Geometry Lecture 11 Voronoi Diagrams and Delaunay Triangulations Antoine Vigneron King Abdullah University of Science and Technology November 12, 2012 Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 1 / 39

Transcript of Prof.Vigneron's Slides on Voronoi Diagram/Delaunay ... · 1 Introduction 2 Voronoi Diagrams 3 Dual...

CS 372: Computational GeometryLecture 11

Voronoi Diagrams and Delaunay Triangulations

Antoine Vigneron

King Abdullah University of Science and Technology

November 12, 2012

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 1 / 39

1 Introduction

2 Voronoi Diagrams

3 Dual of a planar graph

4 The Delaunay Triangulation

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 2 / 39

Course Information

Today: Lecture 11.

Wednesday 14/11: Lecture 12.

Sunday 18/11: Tutorial.

Wednesday 21/11: Midterm.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 3 / 39

Outline

Today: Geometry, no algorithm.

Two problems:I Nearest neighbor search, mesh generation.I Surprisingly, they are closely related.

Geometric concepts:I Voronoi diagram, Delaunay triangulation.I Planar graph duality.

Reference:

Textbook Chapter 7 and 9.

Dave Mount’s lecture notes, lectures 16–17.

Demo by Jack Snoeyink.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 4 / 39

Nearest Neighbor Search (NNS)

Definition (Nearest neighbor search in R2)

Preprocess a set S of n points in R2 so as to be able to answer thefollowing queries efficiently.

Query: point q ∈ R2.

Output: point s ∈ S that is closest to q.

S

q

Input

closestsite

S

q

Output

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 6 / 39

Nearest Neighbor Search (NNS)

Approach:

Draw a diagram.

Example with |S | = 2:

Closer to s2

s2

Closer to s1

Bisector of s1s2

s1

This is the Voronoi diagram of S = s1, s2.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 7 / 39

Example with |S | = 3

s3

v

s2

V(s1)

s1

V(s3)

V(s2)

The Voronoi diagram of S = s1, s2, s3 consists of:

The Voronoi vertex v , which is the center of the circumcircle oftriangle s1s2s3.

The Voronoi cells V(s1), V(s2), V(s3).

3 Voronoi edges.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 8 / 39

Example

si

V(si)

V(si ) = x ∈ R2 | ∀j 6= i , |six | < |sjx |

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 9 / 39

Half-Plane h(si , sj)

Notation:h(si , sj) =

x ∈ R2

∣∣∣|six | < |sjx |

sjsi

h(si , sj)

(Closer to si )

Bisector of sisj

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 10 / 39

Voronoi Cell

It follows thatV(si ) =

⋂j 6=i

h(si , sj).

si

V(si)

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 11 / 39

Properties

The Voronoi diagram of S is not a planar straight line graph.I Reason: It has infinite edges.I To fix this problem, we can restrict our attention to the portion of the

Voronoi diagram that is within a large bounding box.

All the cells are convex, hence connected.

So the Voronoi diagram has n faces, one for each site.

It has O(n) edges and vertices.I Non trivial. Follows from:

F Vertices have degree at least 3,F Double counting,F and Euler’s relation.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 12 / 39

Algorithmic Consequences

V(si ) is an intersection of n half-planes.

So it can be computed in O(n log n) time.

We can compute the Voronoi diagram of S in O(n2 log n) time.

We associate it with a point location data structure.

So we can do nearest neighbor searching in:I O(n2 log n) preprocessing time.I Expected O(n) space usage.I Expected O(log n) query time.

Next lecture: preprocessing time down to expected Θ(n log n)

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 13 / 39

Voronoi Cell

∀x ∈ V(si ), the disk through si centered at x contains no other site thansi .

si

V(si)

x

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 14 / 39

Voronoi Edges

A Voronoi edge is an edge of the Voronoi diagram.

A point x on a Voronoi edge is equidistant to two nearest sites si andsj .

Hence the circle centered at x through si and sj contains no site in itsinterior.

x

a Voronoi edge

sjsi

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 15 / 39

General Position Assumption

General position assumption: No four sites are cocircular.

A degenerate case: 4 sites lie on the same circle

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 16 / 39

Voronoi Vertices

A Voronoi vertex v is equidistant to three nearest sites si , sj and sk .

Hence the circle centered at v through si , sj and sk contains no site inits interior.

sjsi

sk

v

By our general position assumption, each Voronoi vertex has degree 3.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 17 / 39

Voronoi Cells

If V(si ) is bounded, then it is a convex polygon.

V(si ) is unbounded iff si is a vertex of CH(S).

CH(S)

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 18 / 39

Consequence

Knowing the Voronoi diagram, we can compute the convex hull inO(n) time.

So computing a Voronoi diagram takes Ω(n log n) time.

Next lecture: An optimal O(n log n) time randomized algorithm.

There is also a deterministic O(n log n) time algorithm.I Plane-sweep algorithm.I Lecture 16 of D. Mount or Lecture 7 in textbook.I Not covered in CS 372.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 19 / 39

Further Remarks

Sites need not be points: one can define in the same way the Voronoidiagram of a set of line segments, or any shape.

We can also use different distance functions.

The Voronoi diagram can also be defined in Rd for any d .I But it has size Θ

(ndd/2e).

I So it is only useful when d is small (say, at most 4).

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 20 / 39

Dual of a Planar Graph

G

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 21 / 39

Dual of a Planar Graph

G

G∗

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 22 / 39

Dual of a Planar Graph

Definition

Let G be a planar graph, embedded in the plane. The dual graph G∗ issuch that:

Each vertex f ∗ of G∗ corresponds to a face f of G(f ∗, g∗) is an edge of G∗ iff f and g are adjacent in G.

Property

The dual of a planar graph is planar.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 23 / 39

Triangulation of a point-set

Definition (Point-set triangulation)

Given a set S of n points in R2, a triangulation of S is a planar graph withvertex set S , such that all the bounded faces are triangles, and these facesform a partition of the convex hull CH(S) of S .

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 24 / 39

The Delaunay Triangulation

DT (S)

The Delaunay triangulation of the same set.

It has many interesting properties.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 25 / 39

The Delaunay Triangulation

DT (S)

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 26 / 39

The Delaunay Triangulation

Definition (Delaunay triangulation)

Let S be a set of n points in R2. We assume general position in the sensethat no 4 points in S are cocircular. The Delaunay triangulation DT (S) ofS is the dual graph of the Voronoi diagram of S such that:

Each vertex V(si )∗ is located at the corresponding site si .

The edges of DT (S) are straight line segments.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 27 / 39

Remarks

Is DT (S) well defined?We need to prove that:

Edges do not intersect (= it is a PSLG).I Left as an exercise.

Faces are triangles.I The number of edges in a face of DT (S) is the degree of the

corresponding Voronoi vertex.I General position assumption implies that Voronoi vertices have degree

3.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 28 / 39

Convex Hull

The convex hull of S is the complement of the unbounded face ofDT (S).

CH(S)

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 29 / 39

Circumcircle Property

DT (S)

v

s1

s3

s2

Property (Circumcircle)

The circumcircle of any triangle in DT (S) is empty. (It contains no site siin its interior.)

Proof: Let s1s2s3 be a triangle in DT (S), let v be the correspondingVoronoi vertex. Property of Voronoi vertices: the circle centered at vthrough s1s2s3 is empty.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 30 / 39

Empty Circle Property

DT (S)

si

sj

Property (Empty circle)

si sj is an edge of DT (S) iff there is an empty circle through si and sj .

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 31 / 39

Proof (Empty Circle Property)

DT (S)

si

sj

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 32 / 39

Closest Pair Property

DT (S)

si

sj

Property (Closest pair)

The closest two sites si sj are connected by an edge of DT (S).

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 33 / 39

Proof (Closest Pair Property)

si sj

empty

empty

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 34 / 39

Euclidean Minimum Spanning Tree

Euclidean graph:I Set of vertices = SI For any i 6= j , there is an edge between si and sj with weight |si sj |.

Euclidean Minimum Spanning Tree (EMST): Minimum spanning treeof the Euclidean graph.

Property: The EMST is a subgraph of DT (S).

Corollary: It can be computed in O(n log n) time.

See D. Mount’s notes pages 75–76.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 35 / 39

Angle Sequence

Let T be a triangulation of S .

Angle sequence Θ(T ): Sequence of all the angles of the triangles ofT in non-decreasing order.

Example:

π/4

π/4π/2 π/3

π/3

π/3

Θ(T ) = (π/4, π/4, π/3, π/3, π/3, π/2)

Comparison: Let T and T ′ be two triangulations of S . We compareΘ(T ) and Θ(T ′) using lexicographic order.

Example: (1, 1, 3, 4, 5) < (1, 2, 4, 4, 4).

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 36 / 39

Optimality of the Delaunay Triangulation DT (S)

Theorem

Let S be a set of points in general position. Then the angle sequence ofDT (S) is maximal among all triangulations of S.

So the Delaunay triangulation maximizes the minimum angle.

Intuition: Avoids skinny triangles.

DT (P)

skinny triangle

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 37 / 39

Proof

Idea:

Flip edges to ensure the circumcircle property.

It increases the angle sequence.

edge flip

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 38 / 39

Degenerate Cases

Several possible Delaunay triangulations.

Example:

Two possibilities.

Any Delaunay triangulation maximizes the minimum angle. But the anglesequences of two Delaunay triangulations may differ.

Antoine Vigneron (KAUST) CS 372 Lecture 11 November 12, 2012 39 / 39