Post on 28-Jun-2018
transcript
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 1
Computational Geometry
EDU - Tutorial on
Computational Geometry (9201)
Oswin Aichholzer / Thomas Hackl
20th / 21st June 2006, TU Graz
Martin Peternell / Tibor Steiner
22nd June 2006, TU Wien
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 2
Triangulation: Examples
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 3
Overview
Triangulations in general
– Definition
– Size (Complexity)
– Construction
Special triangulations
– Minimum weight triangulation
– Greedy triangulation
– Delaunay triangulation
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 4
Definition
Triangulation of a point set S
– Maximal plane straight-line graph
with vertex set S
– (Disjoint but complete)
decomposition of the convex hull of
S into triangles with vertex set S
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 5
Size of a triangulation
Let n = |S| and h = |CH(S)|:
– Each triangulation has m = 3n – h – 3 edges
– Each triangulation has f = 2n – h – 2 faces (triangles)
– Minimal number of edges / faces
⇒ convex set
– Maximal number of edges / faces
⇒ triangular convex hull
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 6
The convex hull spans a total angle of (h – 2)⋅π
Every internal vertex spans an angle of 2⋅π
Each triangle spans a total angle of π
Each triangle has 3 edges; this counts every edge twice
except convex hull edges
Proof (Sum of angles)
( ) ( )332
322−−=
+⋅−−hn
hhn
( ) ( ) ( ) πππ ⋅−−=⋅−+⋅−⇒ 2222 hnhhnnumber of triangles
number of edges
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 7
Proof (Euler)
Euler: n – m + f = 2 (! ∞-face !)
mh … number of edges on the convex hull
mi … number of interiour edges (not on the convex hull)
( ) 13
21
3
2=
+⋅++−⇒+
+⋅= hi
hihi mm
mmnmm
f
323 −⋅−⋅=⇒ hi mnmhi mmm += hmh =
33 −−⋅=⇒ hnm 223
6461 −−⋅=
+−⋅−⋅=−⇒ hn
hhnf
number of trianglesnumber of edges
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 8
Triangulation of Polygons
Convex polygon:
⇒ simple: (every diagonal is valid)
Star shaped: Zigzag:
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 9
Triangulation of Polygons
Triangulating simple polygons is not so simple
– 1978: O(n⋅logn) Garey et al. [GJPT]
– 1988: O(n⋅loglogn) Tarjan and van Wijk [TW]
– 1989: O(n⋅log*n) Clarkson et al. [CTW]
– 1990: O(n) Chazelle [Chaz]
– 1991: O(n⋅log*n) Seidel [Seid]
• Simple, fast, implementation exist
e.g.: Fast Polygon Triangulation based on Seidel's Algorithm
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 10
A simple O(n⋅logn) algorithm
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 11
A simple O(n⋅logn) algorithm Scan line algorithm
X-sort point set:
O(n⋅logn)
Insert each vertex ontoscan line:
n × O(logn) = O(n⋅logn)
Non-inserting edge-tests:
n × O(1) = O(n)
All edge insertions:
O(n)
O(n⋅logn)
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 12
Triangulating a point set
By insertion:
– Build convex hull
– Triangulate CH
– Insert remaining
vertices into the
triangles
– Problem: for each
new vertex find the
triangle
⇒ point location
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 13
Triangulating a point set
Presorted:
– sort point set by x
– build first triangle
– add points x-sorted and
their edges while
looking for the CH-
tangents
– O(n⋅logn)
– compare with Graham-
scan for convex hull
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 14
Special triangulations
Minimum weight (optimal) triangulation (MWT)
– sum of edge-length is minimum
Greedy triangulation (GT)
– insert edges sorted by length
Delaunay triangulation (DT)
– vertex empty circumcircles for each triangle
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 15
Minimum weight triangulation
Minimize the sum of edge length
Complexity status unknown until two weeks ago
⇒ NP-hard
“Minimum Weight Triangulation is NP-hard”
[W. Mulzer, G. Rote, SoCG June 2006]
What about MWT of polygons?
– Convex polygons?
– Simple polygons?
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 16
How many
triangulations?
MWT – convex polygon
Test all triangulations?
⇒ exponential
k n-k
( )nn
knTkTnT 4)()()( *1
1
Ω=−⋅=∑− Catalan numbers:
# binary trees with fixed
root and (n – 1) leaves?
5.1
1
0
1
4
nCCC
nn
k
knkn ≈=∑−
=
−−
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 17
MWT – convex polygon
Test all triangulations?
⇒ exponential
Subproblems?
– Recursion
⇒ exponential
P1P2
MWT(P)=MWT(P1) ∪∆∪MWT(P2)
∆ = ? … (n – 2) triangles
( ) ( ) ( )nn
i
nTinTiTOnT 212)1()()1()(1
2
Ω=−⋅≥+−++=∑−
=
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 18
MWT – convex polygon
Test all triangulations?
⇒ exponential
Subproblems?
– Recursion
⇒ exponential
– Dynamic
programming
⇒ Matrix in O(n3)
⇒ MWT in O(n)
1
654321 7
2
3
4
5
6
7
786743170 95
6244210 79
40210 57
160 34
0 17
0
1 7
2
3 4
5
6
396260
234567
6
5
4
3
2
1 23444
3443
444
56
6
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 19
MWT - summary
Convex polygon: O(n3)
– Dynamic programming
Simple polygon: O(n3)
– Test intersection for each subpolygon
General point set: NP-hard [MR]
http://fmysql.tu-graz.ac.at/~igi/animierte/MWT.html
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 20
Insert compatible edges in ascending order (weight)
– O(n2⋅logn) det., resp. O(n⋅logn) expected [DDMW]
– O(n) expected for uniformly distributed points [DRA]
Light edge:
– each crossing edge is longer
Light triangulation (LT)
– each edge is light
∃ light triangulation LT(S) for point set S:
LT(S) ⇔ GT(S) ⇔ MWT(S)
Greedy triangulation
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 21
Delaunay triangulation
Definition
Properties
Construction
Dual structure: (Nearest point) Voronoi diagram
Interesting subgraphs
Links to software
Links to applets and further links
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 22
Definition of DT
Delaunay triangle:
it‘s unique circumcirle is empty
Delaunay triangulation: every
triangle is a Delaunay triangle
locally Delaunay is globally
Delaunay
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 23
Properties of DT
maximizes the smallest angel
maximizes the sum of inradii (average inradius)
minimizes the biggest circumcircle
minimizes the biggest minidisk
minimizes roughness (integral of the gradient squared)
NOT: minimizing the sum of edge length
NOT: minimizing the longest edge
NOT: minimizing the biggest angle
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 24
Construction of DT
Lifting into 3D: [pic]
Lift the point set to the
paraboloid (h = x2 + y2)
O(n)
Construct the convex hull in 3D
O(n⋅logn)
Project the edges of the (lower)
convex hull back to 2D
O(n)
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 25
Construction of DT
Insertion:
Start with a triangle (first 3 points)
Insert next point p into DT(S\p)
– Find triangle in DT(S\p) that
contains p
– All triangles whose circumcircle
contains p get destroyed
– All new triangles have p as a vertex
works both in O(δ(p)), δ(p) is degree of p
! As δ(p) can be O(n) -> algorithm is O(n2) !
?
2
n
2n
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 26
Construction of DT
Randomized insertion:
Start with 3 random points
Insert other points in random sequence
– Find triangle in DT(S\p) that contains p
• simple “point location” structure with
O(logn) expected query time
– Delete invalid triangles and retriangulate “hole” in O(δ(p))
Expected number of edges ever created: E(#edges) = O(n)
Algorithm: O(n⋅logn) expected time (O(n) expected storage)
[ ]∑∈
=Sp
iDTpEedgesE in )()(# δ ( ))1(6
632)( O
i
ip =<
−⋅⋅≤δ
point random a is as ,in )( pDTp iδ
?
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 27
Construction of DT
Divide & Conquer:
Basecase: 1, 2 or 3 points ← O(1)
More than 3 points?
Divide point set in equal parts ← O(n)
and recurse on them ← 2⋅T(n/2)
Merge the subparts to a
Delaunay triangulation ← O(n)
( ) ( ) )log(2
2 nnOnOn
TnT =+
⋅=
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 28
Dual Structure
Voronoi Diagram:
Lots of applications: Nearest site, settlement selection (interactive map), tumor cell diagnoses, 3D shape and surface matching, …
Different types: Nearest point, furthest point, segment, weighted (power diagram), airlift, city, aspect ratio, …
Dualism:
– 2D: vertex ⇔ face, edge ⇔ edge
– 3D: vertex ⇔ tetrahedron, edge ⇔ face
– dD: sum of dimensions of dual objects = d
e.g.: 2D, vertex ⇔ face: 0 + 2 = 2; 3D, edge ⇔ face: 1 + 2 = 3
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 29
Dual Structure
Construction: Θ(n⋅logn)
– Via Delaunay triangulation:
(lower numerical errors)
• Delaunay in Θ(n⋅logn)
• Dualize in Θ(n)– Direct:
• e.g.: divide & conquer
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 30
Interesting Subgraphs
Delaunay triangulation α-shapes
Convex hull (α = ∞)Gabriel graph
Nearest Neighborhood graph
Minimum spanning tree
Nearest neighbor pairs
Minpair
β-skeleton (β≥1)
Minimum weight
triangulation
2≥β
αααα
l⋅β
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 31
DT - Software
CGAL – Computational Geometry Algorithms Library
Qhull: software for conves hulls, Delaunay triangulations, Voronoi diagrams, halfspace intersection about a point … www.qhull.org
The Gnu Triangulated Surface library (GTS)
– providing robust primitives for mesh representation, constractive solid geometry operations and Delaunay triangulation
Convex hull, Voronoi diagram, and Delaunay triangulation software
– list of software from Nina Amenta …
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 32
DT – Applets / Links
Voronoi / Delaunay Applet
VoroGlide
Delaunay Triangulation Algorithms (2D/3D)
Fortune’s sweep-line Delaunay Triangulation Algorithm
CG-Page of J.R.Shewchuk: links to applets
Geometry in Action – Delaunay triangulation:
– more links about Delaunay triangulation
Geometry in Action: David Eppstein’s links to geometry
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 33
Thanks …
Thank you for your attention
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 34
23rd European Workshop on
Computational Geometry
EWCGRAZ
EWCG 07 March 19 – 21 2007,Graz, Austria
http://ewcg07.tugraz.at
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 35
Literature
[GJPT] M.R.Garey, D.S.Johnson, F.P.Preparata, R.E.Tarjan: Triangulating simple polygon, Information Processing Letters 7 (1978), 175-180
[TW] R.E.Tarjan, C.J. van Wijk: An O(n log log n)-time algorithm for triangulating a simple polygon. SIAM Journal on Computing 17 (1988), 143-178
[CTW] K.Clarkson, R.E.Tarjan, C.J. van Wijk: A fast Las Vegas algorithm for triangulating a simple polygon. Discrete and Computational Geometry 4 (1989), 423-432
[Chaz] B.Chazelle: Triangulating a simple polygon in linear time. Discrete and Computational Geometry 6 (1991), 485-524
[Seid] R.Seidel: A simple and fast incremental randomized algorithm for computing trapezoidal decompositions and for triangulating polygons. Computational Geometry: Theory and Applications, 1 (1991) 51-64
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 36
Literature
[MR] W.Mulzer, G.Rote: Minimum Weight Triangulation is NP-hard,
Proc. Symposium on Computational Geometry (2006), ???-???
22nd European Workshop on Computational Geometry
Institute for Software Technology
Thomas Hackl: FSP Seminar Strobl, Edu: Tutorial on Computational Geometry (9201), June 19th- 22nd 2006 37
Literature
[DDMW] M.T.Dickerson, R.L.S.Drysdale, S.A.McElfresh, E.Welzl:
Fast Greedy Triangulation Algorithms, Proc. Symposium on
Computational Geometry (1994), 211-220
[DRA] R.L.S.Drysdale, G.Rote, P.Aichholzer: A Simple Linear Time
Greedy Triangulation Algorithm for Uniformly Distributed Points,
IIG-Report-Series 408 (1995)