Lecture 12: Delaunay Triangulations - Utrecht University · Introduction Triangulations Delaunay...
Embed Size (px)
Transcript of Lecture 12: Delaunay Triangulations - Utrecht University · Introduction Triangulations Delaunay...

IntroductionTriangulations
Delaunay Triangulations
Delaunay Triangulations
Computational Geometry
Lecture 12: Delaunay Triangulations
Computational Geometry Lecture 12: Delaunay Triangulations1

IntroductionTriangulations
Delaunay Triangulations
Motivation: Terrains
a terrain is the graph of afunction f : A⊂ R2→ Rwe know only height values for aset of measurement points
how can we interpolate theheight at other points?
using a triangulation
– but which?
Computational Geometry Lecture 12: Delaunay Triangulations2

IntroductionTriangulations
Delaunay Triangulations
Motivation: Terrains
a terrain is the graph of afunction f : A⊂ R2→ Rwe know only height values for aset of measurement points
how can we interpolate theheight at other points?
using a triangulation
– but which?
Computational Geometry Lecture 12: Delaunay Triangulations3

IntroductionTriangulations
Delaunay Triangulations
Motivation: Terrains
a terrain is the graph of afunction f : A⊂ R2→ Rwe know only height values for aset of measurement points
how can we interpolate theheight at other points?
using a triangulation
– but which?
?
Computational Geometry Lecture 12: Delaunay Triangulations4

IntroductionTriangulations
Delaunay Triangulations
Motivation: Terrains
a terrain is the graph of afunction f : A⊂ R2→ Rwe know only height values for aset of measurement points
how can we interpolate theheight at other points?
using a triangulation
– but which?
?
Computational Geometry Lecture 12: Delaunay Triangulations5

IntroductionTriangulations
Delaunay Triangulations
Motivation: Terrains
a terrain is the graph of afunction f : A⊂ R2→ Rwe know only height values for aset of measurement points
how can we interpolate theheight at other points?
using a triangulation– but which?
0
10
6
20
36
28
1000
980
990
1008
8904 23interpolated height = 985
q
0
10
6
20
36
28
1000
980
990
1008
8904 23
interpolated height = 23
q
Computational Geometry Lecture 12: Delaunay Triangulations6

IntroductionTriangulations
Delaunay Triangulations
Triangulation
Let P = {p1, . . . ,pn} be a point set. A triangulation of P is amaximal planar subdivision with vertex set P.
Complexity:
2n−2− k triangles
3n−3− k edges
where k is the number of points in Pon the convex hull of P.
Computational Geometry Lecture 12: Delaunay Triangulations7

IntroductionTriangulations
Delaunay Triangulations
Triangulation
Let P = {p1, . . . ,pn} be a point set. A triangulation of P is amaximal planar subdivision with vertex set P.
Complexity:
2n−2− k triangles
3n−3− k edges
where k is the number of points in Pon the convex hull of P.
Computational Geometry Lecture 12: Delaunay Triangulations8

IntroductionTriangulations
Delaunay Triangulations
Angle Vector of a Triangulation
Let T be a triangulation of P with m triangles and 3mvertices. Its angle vector is A(T) = (α1, . . . ,α3m) whereα1, . . . ,α3m are the angles of T sorted by increasing value.
Let T′ be another triangulation of P.We define A(T) > A(T′) if A(T) islexicographically larger than A(T′).
T is angle optimal if A(T)≥ A(T′)for all triangulations T′ of P.
α1
α2 α3
α4α5
α6
A(T) = (α1, . . . ,α6)
Computational Geometry Lecture 12: Delaunay Triangulations9

IntroductionTriangulations
Delaunay Triangulations
Angle Vector of a Triangulation
Let T be a triangulation of P with m triangles and 3mvertices. Its angle vector is A(T) = (α1, . . . ,α3m) whereα1, . . . ,α3m are the angles of T sorted by increasing value.
Let T′ be another triangulation of P.We define A(T) > A(T′) if A(T) islexicographically larger than A(T′).
T is angle optimal if A(T)≥ A(T′)for all triangulations T′ of P.
α1
α2 α3
α4α5
α6
A(T) = (α1, . . . ,α6)
Computational Geometry Lecture 12: Delaunay Triangulations10

IntroductionTriangulations
Delaunay Triangulations
Angle Vector of a Triangulation
Let T be a triangulation of P with m triangles and 3mvertices. Its angle vector is A(T) = (α1, . . . ,α3m) whereα1, . . . ,α3m are the angles of T sorted by increasing value.
Let T′ be another triangulation of P.We define A(T) > A(T′) if A(T) islexicographically larger than A(T′).
T is angle optimal if A(T)≥ A(T′)for all triangulations T′ of P.
α1
α2 α3
α4α5
α6
A(T) = (α1, . . . ,α6)
Computational Geometry Lecture 12: Delaunay Triangulations11

IntroductionTriangulations
Delaunay Triangulations
Edge Flipping
α ′1
α ′4
α ′3
α ′5
α ′2
α ′6
pi
p j
pk
pl
piα4
α1
α3
α5
α2
α6
p j
pk
pl
edge flip
Change in angle vector:α1, . . . ,α6 are replaced by α ′1, . . . ,α
′6.
The edge e = pipj is illegal if min1≤i≤6 αi < min1≤i≤6 α ′i .
Flipping an illegal edge increases the angle vector.
Computational Geometry Lecture 12: Delaunay Triangulations12

IntroductionTriangulations
Delaunay Triangulations
Edge Flipping
α ′1
α ′4
α ′3
α ′5
α ′2
α ′6
pi
p j
pk
pl
piα4
α1
α3
α5
α2
α6
p j
pk
pl
edge flip
Change in angle vector:α1, . . . ,α6 are replaced by α ′1, . . . ,α
′6.
The edge e = pipj is illegal if min1≤i≤6 αi < min1≤i≤6 α ′i .
Flipping an illegal edge increases the angle vector.
Computational Geometry Lecture 12: Delaunay Triangulations13

IntroductionTriangulations
Delaunay Triangulations
Edge Flipping
α ′1
α ′4
α ′3
α ′5
α ′2
α ′6
pi
p j
pk
pl
piα4
α1
α3
α5
α2
α6
p j
pk
pl
edge flip
Change in angle vector:α1, . . . ,α6 are replaced by α ′1, . . . ,α
′6.
The edge e = pipj is illegal if min1≤i≤6 αi < min1≤i≤6 α ′i .
Flipping an illegal edge increases the angle vector.
Computational Geometry Lecture 12: Delaunay Triangulations14

IntroductionTriangulations
Delaunay Triangulations
Edge Flipping
α ′1
α ′4
α ′3
α ′5
α ′2
α ′6
pi
p j
pk
pl
piα4
α1
α3
α5
α2
α6
p j
pk
pl
edge flip
Change in angle vector:α1, . . . ,α6 are replaced by α ′1, . . . ,α
′6.
The edge e = pipj is illegal if min1≤i≤6 αi < min1≤i≤6 α ′i .
Flipping an illegal edge increases the angle vector.
Computational Geometry Lecture 12: Delaunay Triangulations15

IntroductionTriangulations
Delaunay Triangulations
Characterisation of Illegal Edges
How do we determine if an edge is illegal?
Lemma: The edge pipj is illegalif and only if pl lies in the interiorof the circle C.
Computational Geometry Lecture 12: Delaunay Triangulations16

IntroductionTriangulations
Delaunay Triangulations
Characterisation of Illegal Edges
How do we determine if an edge is illegal?
Lemma: The edge pipj is illegalif and only if pl lies in the interiorof the circle C. pi
p j
pk
pl
illegal
Computational Geometry Lecture 12: Delaunay Triangulations17

IntroductionTriangulations
Delaunay Triangulations
Thales Theorem
Theorem: Let C be a circle, ` a lineintersecting C in points a and b, andp,q,r,s points lying on the same sideof `. Suppose that p,q lie on C, r liesinside C, and s lies outside C. Then
]arb > ]apb = ]aqb > ]asb,
where ]abc denotes the smallerangle defined by three points a,b,c.
` C
p
q
r
s
a
b
pi
p j
pk
pl
illegal
Computational Geometry Lecture 12: Delaunay Triangulations18

IntroductionTriangulations
Delaunay Triangulations
Thales Theorem
Theorem: Let C be a circle, ` a lineintersecting C in points a and b, andp,q,r,s points lying on the same sideof `. Suppose that p,q lie on C, r liesinside C, and s lies outside C. Then
]arb > ]apb = ]aqb > ]asb,
where ]abc denotes the smallerangle defined by three points a,b,c.
` C
p
q
r
s
a
b
pi
p j
pk
pl
illegal
Computational Geometry Lecture 12: Delaunay Triangulations19

IntroductionTriangulations
Delaunay Triangulations
Thales Theorem
Theorem: Let C be a circle, ` a lineintersecting C in points a and b, andp,q,r,s points lying on the same sideof `. Suppose that p,q lie on C, r liesinside C, and s lies outside C. Then
]arb > ]apb = ]aqb > ]asb,
where ]abc denotes the smallerangle defined by three points a,b,c.
` C
p
q
r
s
a
b
pi
p j
pk
pl
illegal
α
α ′
β
β ′
α ′ < α
β ′ < β
Computational Geometry Lecture 12: Delaunay Triangulations20

IntroductionTriangulations
Delaunay Triangulations
Legal Triangulations
A legal triangulation is a triangulation that does not containany illegal edge.
Algorithm LegalTriangulation(T)Input. A triangulation T of a point set P.Output. A legal triangulation of P.1. while T contains an illegal edge pipj
2. do (∗ Flip pipj ∗)3. Let pipjpk and pipjpl be the two triangles adjacent
to pipj.4. Remove pipj from T, and add pkpl instead.5. return T
Question: Why does this algorithm terminate?
Computational Geometry Lecture 12: Delaunay Triangulations21

IntroductionTriangulations
Delaunay Triangulations
Legal Triangulations
A legal triangulation is a triangulation that does not containany illegal edge.
Algorithm LegalTriangulation(T)Input. A triangulation T of a point set P.Output. A legal triangulation of P.1. while T contains an illegal edge pipj
2. do (∗ Flip pipj ∗)3. Let pipjpk and pipjpl be the two triangles adjacent
to pipj.4. Remove pipj from T, and add pkpl instead.5. return T
Question: Why does this algorithm terminate?
Computational Geometry Lecture 12: Delaunay Triangulations22

IntroductionTriangulations
Delaunay Triangulations
Legal Triangulations
A legal triangulation is a triangulation that does not containany illegal edge.
Algorithm LegalTriangulation(T)Input. A triangulation T of a point set P.Output. A legal triangulation of P.1. while T contains an illegal edge pipj
2. do (∗ Flip pipj ∗)3. Let pipjpk and pipjpl be the two triangles adjacent
to pipj.4. Remove pipj from T, and add pkpl instead.5. return T
Question: Why does this algorithm terminate?
Computational Geometry Lecture 12: Delaunay Triangulations23

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Voronoi Diagram and Delaunay Graph
Let P be a set of n points in theplane.
The Voronoi diagram Vor(P) isthe subdivision of the plane intoVoronoi cells V(p) for all p ∈ P.
Let G be the dual graph ofVor(P).The Delaunay graph DG(P) isthe straight line embedding of G.
Question: How can wecompute the Delaunay graph?
Computational Geometry Lecture 12: Delaunay Triangulations24

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Voronoi Diagram and Delaunay Graph
Let P be a set of n points in theplane.
The Voronoi diagram Vor(P) isthe subdivision of the plane intoVoronoi cells V(p) for all p ∈ P.
Let G be the dual graph ofVor(P).The Delaunay graph DG(P) isthe straight line embedding of G.
Question: How can wecompute the Delaunay graph?
Vor(P)
Computational Geometry Lecture 12: Delaunay Triangulations25

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Voronoi Diagram and Delaunay Graph
Let P be a set of n points in theplane.
The Voronoi diagram Vor(P) isthe subdivision of the plane intoVoronoi cells V(p) for all p ∈ P.
Let G be the dual graph ofVor(P).The Delaunay graph DG(P) isthe straight line embedding of G.
Question: How can wecompute the Delaunay graph?
Vor(P)
G
Computational Geometry Lecture 12: Delaunay Triangulations26

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Voronoi Diagram and Delaunay Graph
Let P be a set of n points in theplane.
The Voronoi diagram Vor(P) isthe subdivision of the plane intoVoronoi cells V(p) for all p ∈ P.
Let G be the dual graph ofVor(P).The Delaunay graph DG(P) isthe straight line embedding of G.
Question: How can wecompute the Delaunay graph?
Vor(P)
DG(P)
Computational Geometry Lecture 12: Delaunay Triangulations27

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Voronoi Diagram and Delaunay Graph
Let P be a set of n points in theplane.
The Voronoi diagram Vor(P) isthe subdivision of the plane intoVoronoi cells V(p) for all p ∈ P.
Let G be the dual graph ofVor(P).The Delaunay graph DG(P) isthe straight line embedding of G.
Question: How can wecompute the Delaunay graph?
Vor(P)
DG(P)
Computational Geometry Lecture 12: Delaunay Triangulations28

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Planarity of the Delaunay Graph
Theorem: The Delaunay graph of a planar point set is a planegraph.
Ci j
pi
p j
contained in V(pi)
contained in V(p j)
Computational Geometry Lecture 12: Delaunay Triangulations29

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Delaunay Triangulation
If the point set P is in general position then the Delaunay graphis a triangulation.
vf
Computational Geometry Lecture 12: Delaunay Triangulations30

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Empty Circle Property
Theorem: Let P be a set of points in the plane, and let T bea triangulation of P. Then T is a Delaunay triangulation of Pif and only if the circumcircle of any triangle of T does notcontain a point of P in its interior.
Computational Geometry Lecture 12: Delaunay Triangulations31

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Delaunay Triangulations and Legal Triangulations
Theorem: Let P be a set of points in the plane. A triangulationT of P is legal if and only if T is a Delaunay triangulation.
pi
p j
pk
pl
C(pi p j pk)
pm C(pi p j pm)
e
Computational Geometry Lecture 12: Delaunay Triangulations32

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Angle Optimality and Delaunay Triangulations
Theorem: Let P be a set of points in the plane. Anyangle-optimal triangulation of P is a Delaunay triangulation ofP. Furthermore, any Delaunay triangulation of P maximizesthe minimum angle over all triangulations of P.
Computational Geometry Lecture 12: Delaunay Triangulations33

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
Algorithm DelaunayTriangulation(P)Input. A set P of n+1 points in the plane.Output. A Delaunay triangulation of P.1. Initialize T as the triangulation consisting of an outer
triangle p0p−1p−2 containing points of P, where p0 is thelexicographically highest point of P.
2. Compute a random permutation p1,p2, . . . ,pn of P\{p0}.3. for r← 1 to n4. do5. Locate(pr,T)6. Insert(pr,T)7. Discard p−1 and p−2 with all their incident edges from T.8. return T
Computational Geometry Lecture 12: Delaunay Triangulations34

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
pr
pi
pk
p j
pr
p j
pi
pkpl
pr lies in the interior of a triangle pr falls on an edge
Computational Geometry Lecture 12: Delaunay Triangulations35

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
Insert(pr,T)1. if pr lies in the interior of the triangle pipjpk2. then Add edges from pr to the three vertices of pipjpk, thereby
splitting pipjpk into three triangles.3. LegalizeEdge(pr,pipj,T)4. LegalizeEdge(pr,pjpk,T)5. LegalizeEdge(pr,pkpi,T)6. else (∗ pr lies on an edge of pipjpk, say the edge pipj ∗)7. Add edges from pr to pk and to the third vertex pl of the
other triangle that is incident to pipj, thereby splitting thetwo triangles incident to pipj into four triangles.
8. LegalizeEdge(pr,pipl,T)9. LegalizeEdge(pr,plpj,T)10. LegalizeEdge(pr,pjpk,T)11. LegalizeEdge(pr,pkpi,T)
Computational Geometry Lecture 12: Delaunay Triangulations36

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
LegalizeEdge(pr,pipj,T)1. (∗ The point being inserted is pr, and
pipj is the edge of T that may need tobe flipped. ∗)
2. if pipj is illegal3. then Let pipjpk be the triangle
adjacent to prpipj along pipj.4. (∗ Flip pipj: ∗) Replace pipj
with prpk.5. LegalizeEdge(pr,pipk,T)6. LegalizeEdge(pr,pkpj,T)
pr pi
p j pk
Computational Geometry Lecture 12: Delaunay Triangulations37

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
=⇒
pr
All edges created are incident to pr.
Correctness: Are new edges legal?
Computational Geometry Lecture 12: Delaunay Triangulations38

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
=⇒
pr
All edges created are incident to pr.
Correctness: Are new edges legal?
Computational Geometry Lecture 12: Delaunay Triangulations39

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
pi
p jpl
pr
CC′
Correctness:For any new edge there is an empty circle through endpoints.New edges are legal.
Computational Geometry Lecture 12: Delaunay Triangulations40

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
Initializing triangulation: treat p−1 and p−2 symbolically.No actual coordinates.Modify tests for point location and illegal edges to work as iffar away.
Point location: search data structure.Point visits triangles of previous triangulations that contain it.
Computational Geometry Lecture 12: Delaunay Triangulations41

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Randomized Incremental Construction
split ∆1
flip pi p j
flip pi pk
pi
pk
∆1∆1
∆2
∆2
∆3
∆3
pr ∆1 ∆2 ∆3
∆2
∆3pi
p j ∆1 ∆2 ∆3
∆4
∆4 ∆5
∆6
∆7
∆7∆6
∆1 ∆2 ∆3
∆4
∆3
∆5
∆4 ∆5
Computational Geometry Lecture 12: Delaunay Triangulations42

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
1 Expected total number of triangles created in O(n)2 Expected total number of triangles visited while search
point location data structure: O(n logn)We will only consider the first (see book for second)
Computational Geometry Lecture 12: Delaunay Triangulations43

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Lemma: Total number of triangles created is at most 9n+1.
How many triangles are created when inserting pr?
Backwards analysis: Any point of p1, . . . ,pr has the sameprobability 1/r to be pr.
Expected degree of pr ≤ 6.
Number of triangles created ≤ 2degree(pr)−3(Why? Count flips.)
2 ·6−3 = 9
+ outer triangle
Computational Geometry Lecture 12: Delaunay Triangulations44

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Lemma: Total number of triangles created is at most 9n+1.
How many triangles are created when inserting pr?
Backwards analysis: Any point of p1, . . . ,pr has the sameprobability 1/r to be pr.
Expected degree of pr ≤ 6.
Number of triangles created ≤ 2degree(pr)−3(Why? Count flips.)
2 ·6−3 = 9
+ outer triangle
Computational Geometry Lecture 12: Delaunay Triangulations45

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Lemma: Total number of triangles created is at most 9n+1.
How many triangles are created when inserting pr?
Backwards analysis: Any point of p1, . . . ,pr has the sameprobability 1/r to be pr.
Expected degree of pr ≤ 6.
Number of triangles created ≤ 2degree(pr)−3(Why? Count flips.)
2 ·6−3 = 9
+ outer triangle
Computational Geometry Lecture 12: Delaunay Triangulations46

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Lemma: Total number of triangles created is at most 9n+1.
How many triangles are created when inserting pr?
Backwards analysis: Any point of p1, . . . ,pr has the sameprobability 1/r to be pr.
Expected degree of pr ≤ 6.
Number of triangles created ≤ 2degree(pr)−3(Why? Count flips.)
2 ·6−3 = 9
+ outer triangle
Computational Geometry Lecture 12: Delaunay Triangulations47

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Lemma: Total number of triangles created is at most 9n+1.
How many triangles are created when inserting pr?
Backwards analysis: Any point of p1, . . . ,pr has the sameprobability 1/r to be pr.
Expected degree of pr ≤ 6.
Number of triangles created ≤ 2degree(pr)−3(Why? Count flips.)
2 ·6−3 = 9
+ outer triangle
Computational Geometry Lecture 12: Delaunay Triangulations48

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Lemma: Total number of triangles created is at most 9n+1.
How many triangles are created when inserting pr?
Backwards analysis: Any point of p1, . . . ,pr has the sameprobability 1/r to be pr.
Expected degree of pr ≤ 6.
Number of triangles created ≤ 2degree(pr)−3(Why? Count flips.)
2 ·6−3 = 9
+ outer triangle
Computational Geometry Lecture 12: Delaunay Triangulations49

IntroductionTriangulations
Delaunay Triangulations
PropertiesRandomized Incremental ConstructionAnalysis
Analysis
Theorem: The Delaunay triangulation of n points can becomputed in O(n logn) expected time.
Computational Geometry Lecture 12: Delaunay Triangulations50