1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
-
Upload
sherman-houston -
Category
Documents
-
view
217 -
download
0
Transcript of 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
![Page 1: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/1.jpg)
1
Triangulation Supplemental
From O’Rourke (Chs. 1&2)
Fall 2005
![Page 2: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/2.jpg)
2
Contents
• Ear clipping algorithm
• Triangulating monotonic polygons
• Monotonic decomposition via trapezoidalization
![Page 3: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/3.jpg)
3
Ear Clipping
• Go around the polygon to check whether a diagonal can be drawn from (i-1) to (i+1)
• Diagonal check:– No edge crossing AND inside P
What is the time
complexity in the worst case?
![Page 4: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/4.jpg)
4
0
1
2
3
4
5
6
7
![Page 5: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/5.jpg)
5
Think…
• Can every simple polygon be triangulated?
• Does every simple polygon have at two ears (so that ear clipping algorithm can work)?
![Page 6: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/6.jpg)
6
Validity of Diagonal
• No edge crossing– Each potential diagonal
(i-1, i+1) need to check with ? edges
• “In-Cone” check:– local geometry
![Page 7: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/7.jpg)
7
Triangulating Monotonic Polygons
• Linear time algorithm: O(n)• Fact on monotonic polygons
– Def: a vertex is called reflex if its internal angle is strictly greater than
– Def: cusp• A reflex vertex whose adjacent vertices v- and v+ are
either both above or below v.
– Lemma: • If a polygon P has no cusps, then it is monotone.
Why?
![Page 8: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/8.jpg)
8
Algorithm Ideas:
• Cut off triangles from the top in a greedy fashion– At each step, the first available triangle removed
• For each vertex v, connect v to all the vertices above it and visible via a diagonal, and remove the top portion of the polygon thereby triangulated
• Continue with the next vertex below v
![Page 9: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/9.jpg)
9
![Page 10: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/10.jpg)
10
Case 1:
Case 2a, 2b:
![Page 11: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/11.jpg)
11
Sort by y-coordinate reflex chain: {1,2} v = 3
1
2
5
3
4
7
8
6
Triangulate Monotone Polygon
![Page 12: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/12.jpg)
12
Case 2b: chain {1,2,3} v = 4
v = 3 chain: {1,2}
[same side, non-convex]1
2
5
3
4
7
8
6
![Page 13: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/13.jpg)
13
Case 2b: chain {1,2,3,4} v = 5
v = 4 chain: {1,2,3}
[same side, non-convex]1
2
5
3
4
7
8
6
![Page 14: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/14.jpg)
14
1
2
5
3
4
7
8
6
Case 1: diagonal (5,2) reflex chain {1,2,3,4}
v = 5 chain: {1,2,3,4}
[opposite side]
![Page 15: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/15.jpg)
15
1
2
5
3
4
7
8
6
Case 1: diagonal (5,3) reflex chain {2,3,4}
v = 5 chain: {2,3,4}
[opposite side]
![Page 16: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/16.jpg)
16
1
2
5
3
4
7
8
6
Case 1: diagonal (5,4) reflex chain {3,4} reflex chain {4,5} v = 6
v = 5 chain: {3,4}
[opposite side]
![Page 17: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/17.jpg)
17
1
2
5
3
4
7
8
6
Case 2b: reflex chain {4,5,6} v = 7
v = 6 chain: {4,5}
[same side, non-convex]
![Page 18: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/18.jpg)
18
1
2
5
3
4
7
8
6
Case 2a: diagonal (7,5) reflex chain {4,5,6}
v = 7 chain: {4,5,6}
[same side, convex]
![Page 19: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/19.jpg)
19
1
2
5
3
4
7
8
6
Case 2a: diagonal (7,4) reflex chain {4,5} reflex chain {4,7} v = 8
v = 7 chain: {4,5}
[same side, convex]
![Page 20: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/20.jpg)
20
1
2
5
3
4
7
8
6
v = 8 chain: {4,7}
[lowest vertex; stop]
![Page 21: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/21.jpg)
21
0
1
2
3
4
5
67
8
9
1011
12
13
{0,1,2}
{0,1,2,3}
{0,1,2,3,4}
{0,1,2,3,4}
{4,5}{4,6}
{6,7}
{7,8}
{7,9}
{4,5}
{6,7}
{7,8}
{9,10}
{7,9}
{4,6}
![Page 22: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/22.jpg)
22
Trapezoidalization
• Accomplish monotonic subdivision via horizontal trapezoidalization
• Supporting vertices: the vertices through which the horizontal lines are drawn
• Assume P be a polygon with no two vertices on a horizontal line– Each trapezoid has exactly two supporting vertices: one on t
op, one on bottom– Remove cusps by connecting the supporting vertex to the op
posite vertexAssume no two points h
ave same y coord.
![Page 23: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/23.jpg)
23
The support line stops at the boundary
![Page 24: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/24.jpg)
24
Trapezoidalization via Plane Sweep
• Time complexity: O(n log n)
• Maintain a balanced tree of edges
![Page 25: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/25.jpg)
25
Sweep Line Events
(…, a, c, b, …)
(…, a, d, b, …)
(…, a, c, d, b, …)
(…, a, b, …)
(…, a, b, …)
(…, a, c, d, b, …)
![Page 26: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/26.jpg)
26
Summary
![Page 27: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/27.jpg)
27
Review Questions
1. Analyze the worst case complexity of ear clipping algorithm
2. Analyze the time complexity of the algorithm for triangulating monotone polygon
3. Triangulate (and keep track of the reflex chain) of the polygon on the next page
4. Decompose the polygon on page 24 into monotonic pieces using trapezoidalization
![Page 28: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/28.jpg)
28
![Page 29: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/29.jpg)
29
Monotone-ization
• If the polygon has no cusp, it is monotone and can be triangulated immediately.
• [seek an orientation where the polygon is monotone]
• Decompose into monotone pieces via horizontal trapezoidalization
![Page 30: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/30.jpg)
30
Three Types of Event Points
(…, a, c, b, …)
(…, a, d, b, …)
(…, a, c, d, b, …)
(…, a, b, …)
(…, a, b, …)
(…, a, c, d, b, …)
Regular
Upward cusp
Downward cusp
replace
remove
insert
![Page 31: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/31.jpg)
31
Making Trapezoids
• Regular point: Extend toward material side until a boundary is reached
• Cusps: extend both sides until boundaries are reached
![Page 32: 1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.](https://reader035.fdocuments.in/reader035/viewer/2022062423/56649f045503460f94c18bd0/html5/thumbnails/32.jpg)
32
a
b c
de f g
hi
j
{bc}
{aj}
{ajih}
{ajicdh}u.cusp
{ajicdg}{acdg}d.cusp{acdefg}u.cusp{bcdefg}{bcde}
{}
Upward cusp: connect to support vertex aboveDownward cusp: connect to support vertex below[implementation]