Title: AMS 345/CSE 355 Computational Geometry
1AMS 345/CSE 355 Computational Geometry
Joe Mitchell
Some figures ORourke Computational Geometry
in C Chap 2
2Triangulation
- Input Set S of n points
- Input Other shapes
- 3D Surfaces and solids (tetrahedralization)
Simple polygon
Planar Straight-Line Graph (PSLG)
Polygon with holes
Triangulation applet for simple polygons
3Triangulation Theory in 2D
Also with holes
- Thm A simple polygon has a triangulation.
- Lem An n-gon with n?4 has a diagonal.
- Thm Any triangulation of a simple n-gon has n-3
diagonals, n-2 triangles. - Thm The dual graph is a tree.
- Thm An n-gon with n?4 has ?2 ears.
- Thm The triangulation graph can be 3-colored.
But, NOT true in 3D!
Proofs Induction on n.
4Triangulating a Simple Polygon
- Simple ear-clipping methods O(n2 )
- Cases with simple O(n) algorithms
- Convex polygons (trivial!)
- Monotone polygons, monotone mountains
- General case (even with holes!)
- Sweep algorithm to decompose into
- monotone mountains
- O(n log n)
- Best theoretical results
- Simple polygons O(n) Chazelle90
- Polygons with h holes O(nh log1? h), ?(nh
log h) BC - Good practical method FIST Held, based on
clever methods of ear clipping (worst-case O(n2 )
)
fan
Not practical!
5Lower Bound ?(nh log h)
- ?(n) Have to read the data
- ?(h log h) from SORTING
6FIST Fast Industrial-Strength Triangulation
Based on ear clipping
Constrained Delaunay
Simple polygon
FIST
Works nicely also for highly degenerate and
crazy polygons
3D cycles
http//www.cosy.sbg.ac.at/held/projects/triang/tr
iang.html
7Ear-Clipping Triangulation
Input Simple polygon P
vi1
vi-1
vi
pq is a diagonal, cutting off a single triangle
(the ear)
Naive O(n3) Smarter Keep track of ear
tip status of each vi (initialize O(n2)
) Each ear clip requires O(1) ear tip tests ( _at_
O(n) per test ) Thus, O(n2) total, worst-case
8Triangulate
9Ear-Clipping
- Lemma When clipping ear wth tip vi the only ear
tip statuses that can change are at vi-1 and
vi1
10(No Transcript)
11(No Transcript)
12Example Triangulate
13Example Output
14W(n2 ) Examples Exist
15Faster Algorithm O(n log n)
- Input PSLG of size n can enclose by a big box B
- Step 1 Use sweep to decompose B into y-monotone
mountains y-monotone polygons having one side
(left/right) a single segment (the base) O(n
log n) - Step 2 Triangulate each y-monotone polygon (size
ni ) in time O(ni), for total O(n) - Overall O(n log n) to triangulate PSLG
16Monotone Polygons
- P is monotone in direction d
d
17Monotone Polygons
- P is monotone in direction d
18y-Monotone Polygon
d
19y-Monotone Polygon
d
20Monotone Mountains
d
21Triangulating a Monotone Mountain in O(n)
- Ear clipping is easy!
- Testing if vi-1 vi1 is a diagonal takes only
O(1) time
t
vi-1
vi
vi1
vi is ear tip iff Left(vi1 , vi , vi-1 )
Just traverse vertices from top to bottom.
Test/clip ears. If an ear is clipped, re-test
the earity of the upper endpoint (vi-1 ) of the
diagonal just clipped.
monotone
b
22Triangulating a Monotone Mountain in O(n)
23Example
24Triangulation in O(n log n)
- (1) Plane sweep to get horizontal
trapezoidalization
L
Fire bullets left/right from each vertex
SLS left-to-right ordering of segments crossed
by L (balanced binary tree) Events L hits a
vertex
Time O(n log n)
25Trapezoidalization
26Trapezoidalization
27Trapezoidalization
In each case We do O(1) updates to the SLS, each
taking time O(log n), since the SLS is stored in
a balanced binary search tree.
28Trapezoidalization
29Triangulation in O(n log n)
- (2) Join top vertex to bottom vertex in each
trapezoid
Lemma Resulting pieces are monotone mountains
30Triangulation in O(n log n)
- (3) Triangulate each monotone mountain
Triangulate each, in time O(ni ), for total time
O(n)
Summary O(n log n) to triangulate n points or a
planar straight-line graph (PSLG)
31Minimum-Weight Triangulation
- MWT of a simple polygon O(n3), using dynamic
programming - MWT of a polygon with holes (or of a set of
points in the plane) is NP-hard - Min-Weight Steiner Triangulation allow extra
Steiner points to be added - Not known to exist
- 316-approximation known
32Convex Decomposition
- Partition simple polygon P into a small number of
convex pieces
One way to do it Triangulate P
33Convex Decomposition
- Partition simple polygon P into a small number of
convex pieces
Another way to do it Use diagonals to partition
P into convex polygons
34Convex Decomposition
- Partition simple polygon P into a small number of
convex pieces
Another way to do it Allow Steiner points
(non-vertices) inside P. May get fewer pieces!
35Convex Decomposition
- Goal Partition P into a small number of convex
pieces (convex polygons) - A triangulation is one possible decomposition
into convex pieces, but it may have many more
pieces than necessary! - Dynamic Programming algorithms yield optimal
solutions for simple polygons (for both Steiner
and non-Steiner versions), in roughly O(n3) - Hertel-Mehlhorn algorithm 4-approximation in
time O(n)
O(r2n log n) without Steiner Keil85 O(nr3)
allowing Steiner Chazelle80
36Convex Decomposition
37Convex Decomposition
38Optimal Convex Decomposition
39Convex Decomposition
r6
40Convex Decomposition
One diagonal resolves the local nonconvexities
at 2 reflex vertices at once
r6
We need at least r/2 segments to resolve all r
reflex vertices
Results in at least ceil(r/2)1 pieces
41Hertel-Mehlhorn Algorithm
- Start with any triangulation of simple polygon P
(time O(n), Chazelle) - Remove inessential diagonals, in any order (time
O(n), since we can test a diagonal locally in
time O(1) to see if it is essential if we remove
a diagonal, we only have to update the
inessential flag of O(1) other diagonals)
42Hertel-Mehlhorn Algorithm
- Lemma 2.5.2 At the end of the algorithm, for
each reflex vertex v, there can be at most 2
diagonals essential for v
43Hertel-Mehlhorn Algorithm
- Theorem 2.5.3 The H-M algorithm yields a
decomposition into at most 4OPT pieces, where
OPT is the minimum possible number of convex
pieces in a (Steiner) convex decomposition.
We say that the H-M Algorithm is a
4-approximation algorithm
OPEN Find a better factor than 4, which still
runs very efficiently (say, in O(n log n) or O(n)
time).
44Hertel-Mehlhorn Algorithm
- Proof At end, each diagonal is essential for
some (reflex) vertex. - By Lemma 2.5.2, there are at most 2r diagonals
left (since each reflex vertex is responsible
for at most 2 diagonals) - Thus, the number, M, of pieces is 2r1 lt 2r4
4OPT - (Since, by Theorem 2.5.1, OPT ceil(r/2)1, so
4OPT 4ceil(r/2)42r4)
45H-M Algorithm Example