Post on 17-Feb-2020
Vera Sacristan
Computational Geometry
Facultat d’Informatica de Barcelona
Universitat Politcnica de Catalunya
TRIANGULATING POLYGONS
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
An application example:
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
An application example:
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
An application example:
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
An application example:
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
An application example:
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
A polygon triangulation is the decomposition of a polygon into triangles. This is done byinserting internal diagonals.
An internal diagonal is any segment...
• connecting two vertices of the polygon and
• completely enclosed in the polygon.
An application example:
TRIANGULATING POLYGONS
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Index
1. Every polygon can be triangulated
2. Properties of polygon triangulations
3. Algorithms
(a) Triangulating by inserting diagonals
(b) Triangulating by subtracting ears
(c) Triangulating convex polygons
(d) Triangulating monotone polygons
(e) Monotone partinioning
Every polygon admits a triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
The vertex p with minimum x-coordinate (and, if there are morethan one, the one with minimumy-coordinate) is convex.
p
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
The vertex p with minimum x-coordinate (and, if there are morethan one, the one with minimumy-coordinate) is convex.
p
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
The vertex p with minimum x-coordinate (and, if there are morethan one, the one with minimumy-coordinate) is convex.
So is the vertex q with maximumx-coordinate (which is different ofthe one with minimum one).
p
q
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
The vertex p with minimum x-coordinate (and, if there are morethan one, the one with minimumy-coordinate) is convex.
So is the vertex q with maximumx-coordinate (which is different ofthe one with minimum one).
Finally, there is at least one vertexwhich is extreme in the directionorthogonal to pq and does not co-incide with any of the above. Thisthird vertex r is necessarily convex.
p
q
r
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Lemma 2. Every n-gon with n ≥ 4 has at least one internal diagonal.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Lemma 2. Every n-gon with n ≥ 4 has at least one internal diagonal.
Let vi be a convex vertex.
Then, either vi−1vi+1 is an internal diagonal...
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
vi
vi−1
vi+1
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Lemma 2. Every n-gon with n ≥ 4 has at least one internal diagonal.
or there exists a vertex of the polygon lying inthe triangle vi−1vivi+1.
Let vi be a convex vertex.
Then, either vi−1vi+1 is an internal diagonal...
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
vi
vi−1
vi+1
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Lemma 2. Every n-gon with n ≥ 4 has at least one internal diagonal.
or there exists a vertex of the polygon lying inthe triangle vi−1vivi+1.
Let vi be a convex vertex.
Then, either vi−1vi+1 is an internal diagonal...
In this case, among all the vertices ly-ing in the triangle, let vj be the farthestone from the segment vi−1vi+1. Thenvivj is an internal diagonal (it can notbe intersected by any edge of the poly-gon).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
vi
vi−1
vi+1
vj
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Lemma 2. Every n-gon with n ≥ 4 has at least one internal diagonal.
or there exists a vertex of the polygon lying inthe triangle vi−1vivi+1.
Let vi be a convex vertex.
Then, either vi−1vi+1 is an internal diagonal...
In this case, among all the vertices ly-ing in the triangle, let vj be the farthestone from the segment vi−1vi+1. Thenvivj is an internal diagonal (it can notbe intersected by any edge of the poly-gon).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
vi
vi−1
vi+1
vj
Every polygon admits a triangulation
Lemma 1. Every polygon has at least one convex vertex (actually, at least three).
Lemma 2. Every n-gon with n ≥ 4 has at least one internal diagonal.
Corollary. Every polygon can be triangulated. (By induction.)
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Properties of the triangulations of polygons
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Proof by induction.
Base case: When n = 3, the number of diagonals is d = 0 = n− 3.
Inductive step: Consider a diagonal of a triangulation T of P , decomposing P into twosubpolygons: a (k + 1)-gon P1 and an (n − k + 1)-gon P2. By inductive hypothesis, thenumber of diagonals of the triangulations induced by T in P1 and P2 are:
d1 = k + 1− 3,d2 = n− k + 1− 3,
therefore, d = d1 + d2 + 1 = k + 1− 3 + n− k + 1− 3 + 1 = n− 3.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
P1P2
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Again, the proof is by induction.
Base case: When n = 3, the number of triangles is t = 1 = n− 2.
Inductive step: With the same conditions of the previous proof,
t1 = k + 1− 2,t2 = n− k + 1− 2,
hence,t = t1 + t2 = k + 1− 2 + n− k + 1− 2 = n− 2.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
P1P2
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Property 3. The dual graph of any triangulation of P is a tree.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Property 3. The dual graph of any triangulation of P is a tree.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Given a triangulation of P , its dual graph has one vertex for each trian-gle, and one edge connecting two vertices whenever their correspondingtriangles are adjacent. We want to prove that this graph is connected andacyclic.
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Property 3. The dual graph of any triangulation of P is a tree.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Given a triangulation of P , its dual graph has one vertex for each trian-gle, and one edge connecting two vertices whenever their correspondingtriangles are adjacent. We want to prove that this graph is connected andacyclic.
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Property 3. The dual graph of any triangulation of P is a tree.
Given a triangulation of P , its dual graph has one vertex for each trian-gle, and one edge connecting two vertices whenever their correspondingtriangles are adjacent. We want to prove that this graph is connected andacyclic.
The graph is trivially connected.
About the acyclicity: Notice that each edge of the dual graph “separates”the two endpoints of the internal diagonal of P shared by the two adjacenttriangles. If the graph had a cycle, it would enclose the endpoint(s) of thediagonals intersected by the cycle and, therefore, it would enclose pointsbelonging to the boundary of the polygon, contradicting the hypothesisthat P is simple and without holes.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Properties of the triangulations of polygons
Let P be a simple n-gon.
Property 1. Every triangulation of P has n− 3 diagonals.
Property 2. Every triangulation of P has n− 2 triangles.
Property 3. The dual graph of any triangulation of P is a tree.
Corollary. Every n-gon with n ≥ 4 has at least two non-adjacent ears.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
ALGORITHMS FORPOLYGON TRIANGULATION
Tringulating a polygon by subtracting ears
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Procedure1. Sequentially explore the vertices until you find an ear2. Crop it3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Running time
Procedure1. Sequentially explore the vertices until you find an ear2. Crop it3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Running timeDetecting whether a vertex is convex: O(1).
Procedure1. Sequentially explore the vertices until you find an ear2. Crop it3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Running timeDetecting whether a vertex is convex: O(1).Detecting whether a convex vertex is an ear: O(n).
Procedure1. Sequentially explore the vertices until you find an ear2. Crop it3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Running timeDetecting whether a vertex is convex: O(1).Detecting whether a convex vertex is an ear: O(n).Finding an ear: O(n2).
Procedure1. Sequentially explore the vertices until you find an ear2. Crop it3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Running timeDetecting whether a vertex is convex: O(1).Detecting whether a convex vertex is an ear: O(n).Finding an ear: O(n2).
Overall running time:
T (n) = O(n2) +O((n− 1)2) +O((n− 2)2) + · · ·+O(1) = O(n3).
Procedure1. Sequentially explore the vertices until you find an ear2. Crop it3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Improved procedureInitialization
1. Detect all convex vertices2. Detect all ears
Next step1. Crop an ear2. Update the information of the convex vertices3. Update the information of the ears
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Improved procedureInitialization
1. Detect all convex vertices2. Detect all ears
Next step1. Crop an ear2. Update the information of the convex vertices3. Update the information of the ears
Running time
O(n)O(n2)
O(1)O(1)O(n)
Only once
O(n) times
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by subtracting ears
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Improved procedureInitialization
1. Detect all convex vertices2. Detect all ears
Next step1. Crop an ear2. Update the information of the convex vertices3. Update the information of the ears
Running time
Running time: O(n2)
O(n)O(n2)
O(1)O(1)O(n)
Only once
O(n) times
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Tringulating a polygon by inserting diagonals
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Check vivj against all segments vkvk+1 for intersection.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Is it internal?
Check vivj against all segments vkvk+1 for intersection.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Is it internal?
Check vivj against all segments vkvk+1 for intersection.
If vi is convex, the oriented line −−→vivj should leavevi−1 to its left and vi+1 to its right.
vi
vi−1
vi+1
vj
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Is it internal?
Check vivj against all segments vkvk+1 for intersection.
If vi is convex, the oriented line −−→vivj should leavevi−1 to its left and vi+1 to its right.
If vi is reflex, the oriented line −−→vivj should not leavevi−1 to its right and vi+1 to its left.
vi
vi−1
vi+1
vj
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Is it internal?
Check vivj against all segments vkvk+1 for intersection.
If vi is convex, the oriented line −−→vivj should leavevi−1 to its left and vi+1 to its right.
If vi is reflex, the oriented line −−→vivj should not leavevi−1 to its right and vi+1 to its left.
Running time
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Is it a diagonal?
Is it internal?
Check vivj against all segments vkvk+1 for intersection.
If vi is convex, the oriented line −−→vivj should leavevi−1 to its left and vi+1 to its right.
If vi is reflex, the oriented line −−→vivj should not leavevi−1 to its right and vi+1 to its left.
Running time
O(n)
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Brute-force solution:
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Brute-force solution:
Apply the test to each candidate segment.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Brute-force solution:
Apply the test to each candidate segment.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
O(n3)
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Brute-force solution:
Apply the test to each candidate segment.
Testing each candidate takes O(n) time,and there are
(n2
)of them.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
O(n3)
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Brute-force solution:
Apply the test to each candidate segment.
Applying previous results:
1. Find a convex vertex, vi.2. Detect whether vi−1vi+1 is an internal diagonal.3. If so, report it.
Else, find the farthest vk from the segment vi−1vi+1, lying in the triangle vi−1vivi+1.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
O(n3)
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal?
Brute-force solution:
Apply the test to each candidate segment.
Applying previous results:
1. Find a convex vertex, vi.2. Detect whether vi−1vi+1 is an internal diagonal.3. If so, report it.
Else, find the farthest vk from the segment vi−1vi+1, lying in the triangle vi−1vivi+1.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
O(n3)
O(n)
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal? O(n)
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal? O(n)
Partition. How to partition the polygon into two subpolygons?
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal? O(n)
Partition. How to partition the polygon into two subpolygons?
From the diagonal found, create the sorted list of the vertices of the two subpolygons.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal? O(n)
Partition. How to partition the polygon into two subpolygons?
From the diagonal found, create the sorted list of the vertices of the two subpolygons.
O(n)
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Tringulating a polygon by inserting diagonals
Test. How to decide whether a given segment vivj is an internal diagonal?
Running time
O(n)
Search. How to find an internal diagonal? O(n)
Partition. How to partition the polygon into two subpolygons? O(n)
Total running time of the algorithm: O(n2)
It finds n− 3 diagonals and each one is found in O(n) time.
Procedure:1. Find an internal diagonal2. Decompose the polygon into two subpolygons3. Proceed recursively
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Input: v1, . . . , vn, sorted list of the vertices of a simple polygon P .
Output: List of internal diagonals of P , vivj , determining a triangulation of P .
Is it possible to triangulate a polygon more efficiently?
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Triangulating a star-shaped polygon
Can be done in O(n) time. Posed as problem.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Is it possible to triangulate a polygon more efficiently?
Triangulating a convex polygon
Trivially done in O(n) time.
Triangulating a monotone polygon
It can also be done in O(n) time. In the following we will see how.
Triangulating a star-shaped polygon
Can be done in O(n) time. Posed as problem.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
y
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
y
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
y
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Proof:
If the polygon has a local maximum cusp v, an infinitesimaldownwards translation of the horizontal line through v wouldintersect the polygon in at least two connected components.
v
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Proof:
If the polygon has a local maximum cusp v, an infinitesimaldownwards translation of the horizontal line through v wouldintersect the polygon in at least two connected components.
If the polygon is not y-monotone, let r be a horizontal line intersecting the polygon in two ormore connected components. Consider two consecutive components, with facing endpoints pand q as in the figure. The polygon boundary needs to connect p and q. No matter whether itgoes above or below the horizontal line, it will have a cusp.
p q
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Proof:
If the polygon has a local maximum cusp v, an infinitesimaldownwards translation of the horizontal line through v wouldintersect the polygon in at least two connected components.
If the polygon is not y-monotone, let r be a horizontal line intersecting the polygon in two ormore connected components. Consider two consecutive components, with facing endpoints pand q as in the figure. The polygon boundary needs to connect p and q. No matter whether itgoes above or below the horizontal line, it will have a cusp.
p q
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Proof:
If the polygon has a local maximum cusp v, an infinitesimaldownwards translation of the horizontal line through v wouldintersect the polygon in at least two connected components.
If the polygon is not y-monotone, let r be a horizontal line intersecting the polygon in two ormore connected components. Consider two consecutive components, with facing endpoints pand q as in the figure. The polygon boundary needs to connect p and q. No matter whether itgoes above or below the horizontal line, it will have a cusp.
p q
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone polygon
A polygon P is called monotone with respect to a direction r if, forevery line r′ orthogonal to r, the intersection P ∩ r′ is connected (i.e.,it is a segment, a point or the empty set).
y
Local characterization
A polygon is y-monotone if and only if it does not have any cusp.
A cusp is a reflex vertex v of the polygon such that its twoincident edges both lie to the same side of the horizontal linethrough v.
Corollary
If a polygon is y-monotone, then it can be decomposed into twoy-monotone non intersecting chains sharing their endpoints.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1234
5
76
8 910
1112
1314 15
1617
18 19
P ′
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Processing a vertex vi:
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1234
5
76
8 910
1112
1314 15
1617
18 19
P ′
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Processing a vertex vi:
• If vi belongs to the opposite chain, report the diagonals con-necting vi to every vertex of Q and delete them all from Q,except the last one. Add vi to Q.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Processing a vertex vi:
• If vi belongs to the opposite chain, report the diagonals con-necting vi to every vertex of Q and delete them all from Q,except the last one. Add vi to Q.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Processing a vertex vi:
• If vi belongs to the opposite chain, report the diagonals con-necting vi to every vertex of Q and delete them all from Q,except the last one. Add vi to Q.
• If vi belongs to the same chain and produces a reflex turn,add vi to Q.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Processing a vertex vi:
• If vi belongs to the opposite chain, report the diagonals con-necting vi to every vertex of Q and delete them all from Q,except the last one. Add vi to Q.
• If vi belongs to the same chain and produces a reflex turn,add vi to Q.
• If vi belongs to the same chain and produces a convex turn,report the diagonal connecting vi to the penultimate elementof Q, delete the last element of Q and process vi again.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Triangulating a monotone polygon
The vertices of the polygon P are processed by decreasing order of their y-coordinate.
During the process a queue Q is used to store the vertices that have already been visited butare still needed in order to generate the triangulation. Characteristics of Q:
- The topmost (i.e., largest y-coordinate) vertex in Q, is a convex vertex of the subpolygonP ′ still to be triangulated.
- All the remaining vertices in Q are reflex.- All the vertices in Q belong to the same monotone chain of P ′.
Processing a vertex vi:
• If vi belongs to the opposite chain, report the diagonals con-necting vi to every vertex of Q and delete them all from Q,except the last one. Add vi to Q.
• If vi belongs to the same chain and produces a reflex turn,add vi to Q.
• If vi belongs to the same chain and produces a convex turn,report the diagonal connecting vi to the penultimate elementof Q, delete the last element of Q and process vi again.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18 19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Queue state
1, 2
19
Start
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
3
1, 2, 3
19
Add
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
4
1, 2, 3, 4
19
Add
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
5
1, 2, 3, 4, 5
19
Add
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
6
1, 2, 3, 4, 5, 6
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Add
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
7
6, 7
19
Opposite chain
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
8
6, 8
19
Ear
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
9
6, 9
19
Ear
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
10
6, 9, 10
19
Add
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
11
6, 9, 10, 11
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Add
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
12
6, 9, 10, 11, 12
19
Add
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
13
6, 9, 10, 13
19
Ear
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
14
6, 9, 10, 14
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Ear
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
15
14, 15
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Opposite chain
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
16
15, 16
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Opposite chain
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
17
15, 17
19
Ear
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
18
15, 18
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Ear
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18
Current vertex:
Queue state:
19
18, 19
19
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Opposite chain
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18 19
End
Triangulating a monotone polygon
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
1
2
34
5
7
6
89
10
1112
13
1415
16
17
18 19
Triangulating a monotone polygon
Running time: O(n)
Each vertex is removed fromthe queue Q in O(1) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Running time for triangulating a polygon:
• O(n2) by subtracting ears
• O(n2) by inserting diagonals
If the polygon is convex:
• O(n) trivially
If the polygon is monotone:
• O(n) scanning the monotone chains in order
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Summarizing
Running time for triangulating a polygon:
• O(n2) by subtracting ears
• O(n2) by inserting diagonals
If the polygon is convex:
• O(n) trivially
If the polygon is monotone:
• O(n) scanning the monotone chains in order
Is it possible to be more efficient more general polygons?
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Summarizing
Running time for triangulating a polygon:
• O(n2) by subtracting ears
• O(n2) by inserting diagonals
If the polygon is convex:
• O(n) trivially
If the polygon is monotone:
• O(n) scanning the monotone chains in order
1. Decompose the polygon into monotone subpolygons
2. Triangulate the monotone subpolygons
Is it possible to be more efficient more general polygons? Yes!
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Summarizing
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Connect each cusp with the opposite vertex in itstrapezoid (the upper trapezoid, if the cusp is a localmaximum, the lower one, if it is a local minimum).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Connect each cusp with the opposite vertex in itstrapezoid (the upper trapezoid, if the cusp is a localmaximum, the lower one, if it is a local minimum).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Connect each cusp with the opposite vertex in itstrapezoid (the upper trapezoid, if the cusp is a localmaximum, the lower one, if it is a local minimum).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Connect each cusp with the opposite vertex in itstrapezoid (the upper trapezoid, if the cusp is a localmaximum, the lower one, if it is a local minimum).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Connect each cusp with the opposite vertex in itstrapezoid (the upper trapezoid, if the cusp is a localmaximum, the lower one, if it is a local minimum).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This can be done starting from atrapezoidal decomposition of the polygon.
Connect each cusp with the opposite vertex in itstrapezoid (the upper trapezoid, if the cusp is a localmaximum, the lower one, if it is a local minimum).
Sweep line algorithm
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In order to create a monotone partition of a polygon,all cusps need to be “broken” by internal diagonals.
This gives rise to a correct algorithm:
• The diagonals do not intersect, because theybelong to different trapezoids.
• The polygon ends up decomposed into mono-tone subpolygons.
Sweep line algorithm
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Sweep line algorithm
A straight line (horitzontal, in this case) scans the object (the polygon) and allows detectingand constructing the desired elements (cusps, trapezoids, diagonals), leaving the problem solvedbehind it. The sweeping process is discretized.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Sweep line algorithm
A straight line (horitzontal, in this case) scans the object (the polygon) and allows detectingand constructing the desired elements (cusps, trapezoids, diagonals), leaving the problem solvedbehind it. The sweeping process is discretized.
Essential elements of a sweep line algorithm:
• Events queue
Priority queue keeping the information of the algorithm stops. In our problem, the eventswill be the vertices of the polygon, sorted by their y-coordinate, all known in advance.
• Sweep line
Data structure storing the information of the portion of the object intersected by thesweep line. It gets updated at each event. In our problem, it will contain the informationof the edges of the polygon intersected by the sweep line, sorted by abscissa, as well asthe list of active trapezoids and ther upper vertex.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
ei−1
ei ej
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
ei−1ei
ejek
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em eneiei−1ek ej
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em enei−1ei
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
ei−1 ei
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In addition, eventually updatethe information of the upper ver-tex of the starting trapezoid.
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
ei−1
ei ej
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In addition, eventually updatethe information of the upper ver-tex of the starting trapezoid.
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
ei−1ei
ejek
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In addition, eventually updatethe information of the upper ver-tex of the starting trapezoid.
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em eneiei−1ek ej
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In addition, eventually updatethe information of the upper ver-tex of the starting trapezoid.
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em enei−1ei
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In addition, eventually updatethe information of the upper ver-tex of the starting trapezoid.
Updating the sweep line:
• Passing vertex: replace
• Local minimum cusp: delete
• Local maximum cusp: insert
• Initial vertex: insert
• Final vertex: delete
em en
ei−1 ei
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
In addition, eventually updatethe information of the upper ver-tex of the starting trapezoid.
As for diagonals:
• Passing vertex: nothing
• Local minimum cusp: wait until it can be connect to the final vertex of the startingtrapezoid
• Local maximum cusp: connect it with the initial vertex of the ending trapezoid
• Initial vertex: nothing
• Final vertex: nothing
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
As for diagonals:
• Passing vertex: nothing
• Local minimum cusp: wait until it can be connect to the final vertex of the startingtrapezoid
• Local maximum cusp: connect it with the initial vertex of the ending trapezoid
• Initial vertex: nothing
• Final vertex: nothing
em en
ei−1
ei ej
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
As for diagonals:
• Passing vertex: nothing
• Local minimum cusp: wait until it can be connect to the final vertex of the startingtrapezoid
• Local maximum cusp: connect it with the initial vertex of the ending trapezoid
• Initial vertex: nothing
• Final vertex: nothing
em en
ei−1ei
ejek
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
As for diagonals:
• Passing vertex: nothing
• Local minimum cusp: wait until it can be connect to the final vertex of the startingtrapezoid
• Local maximum cusp: connect it with the initial vertex of the ending trapezoid
• Initial vertex: nothing
• Final vertex: nothing
em eneiei−1ek ej
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
As for diagonals:
• Passing vertex: nothing
• Local minimum cusp: wait until it can be connect to the final vertex of the startingtrapezoid
• Local maximum cusp: connect it with the initial vertex of the ending trapezoid
• Initial vertex: nothing
• Final vertex: nothing
em enei−1ei
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
As for diagonals:
• Passing vertex: nothing
• Local minimum cusp: wait until it can be connect to the final vertex of the startingtrapezoid
• Local maximum cusp: connect it with the initial vertex of the ending trapezoid
• Initial vertex: nothing
• Final vertex: nothing
em en
ei−1 ei
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
1
vertex
sweep line
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e1, e19
v1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
18
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e18, e17
e1, e19
v1
v18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
3
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e2, e3
e1, e19, e18, e17
v1 v18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
3
Diagonal v1− v3
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e2, e3
e1, e19, e18, e17
v1 v18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
19
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e1, e2, e3, e19, e18, e17
v3 v3 v18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
2
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e1, e2, e3, e17
v3 v19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
17
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e3, e17
e16
v19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
17
Diagonal v19− v17
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e3, e17
e16
v19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
15
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e3, e16
e15, e14
v17
v15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
16
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e3, e16, e15, e14
v17 v15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
5
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e3, e14
e5, e4
v16
v5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
6
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e5, e4, e3, e14
e6
v5 v16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
7
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e6, e4, e3, e14
e7
v6 v16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
14
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e4, e3, e14
e13
v7 v16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
14
Diagonal v16− v14
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e4, e3, e14
e13
v7 v16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
4
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e4, e3, e13
v7 v14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
9
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e13
e8, e9
v4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
9
Diagonal v4− v9
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e13
e8, e9
v4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
13
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e8, e9, e13
e12
v9 v9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
8
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e7, e8, e9, e12
v9 v13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
11
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e9, e12
e10, e11
v13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
11
Diagonal v13− v11
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e9, e12
e10, e11
v13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
12
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
e9, e10, e11, e12
v11 v11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
vertex
sweep line
10
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
v11
e9, e10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1516
17
18
19Running time:
• Sorting the vertices in the event queue:O(n log n) time.
• On each event, update sweep line: replace,insert or delete vertices or edges in O(log n)time each.
• There are n events.
The algorithm runs in O(n log n) time.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Monotone partition
Summarizing
Running time of polygon triangulation:
• O(n2) by substracting ears
• O(n2) by inserting diagonals
• O(n log n) by:
1. Decomposing the polygon into monotone subpolygons in O(n log n) time
2. Triangulating each monotone subpolygon in O(n) time
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Summarizing
Running time of polygon triangulation:
• O(n2) by substracting ears
• O(n2) by inserting diagonals
• O(n log n) by:
1. Decomposing the polygon into monotone subpolygons in O(n log n) time
2. Triangulating each monotone subpolygon in O(n) time
Is it possible to triangulate a polygon in o(n log n) time?
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
Summarizing
Running time of polygon triangulation:
• O(n2) by substracting ears
• O(n2) by inserting diagonals
• O(n log n) by:
1. Decomposing the polygon into monotone subpolygons in O(n log n) time
2. Triangulating each monotone subpolygon in O(n) time
Is it possible to triangulate a polygon in o(n log n) time?
Yes.There exists an algorithm to triangulate an n-gon in O(n) time, but it is too complicatedand, in practice, it is not used.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
STORING THEPOLYGON TRIANGULATION
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Possible options, advantages and disadvantages
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Possible options, advantages and disadvantages
Storing the list of all the diagonals of the triangulation
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Possible options, advantages and disadvantages
Storing the list of all the diagonals of the triangulation
Advantage: small memory usage.
Disadvantage: it suffices to draw the triangulation, but it does not contain the proximityinformation. For example, finding the triangles incident to a given diagonal, or finding theneighbors of a given triangle are expensive computations.
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Possible options, advantages and disadvantages
Storing the list of all the diagonals of the triangulation
Advantage: small memory usage.
Disadvantage: it suffices to draw the triangulation, but it does not contain the proximityinformation. For example, finding the triangles incident to a given diagonal, or finding theneighbors of a given triangle are expensive computations.
For each triangle, storing the sorted list of its vertices and edges, as well as the sorted list ofits neighbors.
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Possible options, advantages and disadvantages
Storing the list of all the diagonals of the triangulation
Advantage: small memory usage.
Disadvantage: it suffices to draw the triangulation, but it does not contain the proximityinformation. For example, finding the triangles incident to a given diagonal, or finding theneighbors of a given triangle are expensive computations.
For each triangle, storing the sorted list of its vertices and edges, as well as the sorted list ofits neighbors.
Advantage: allows to quickly recover neighborhood information.
Disadvantage: the stored data is redundant and it uses more space than required.
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Possible options, advantages and disadvantages
Storing the list of all the diagonals of the triangulation
Advantage: small memory usage.
Disadvantage: it suffices to draw the triangulation, but it does not contain the proximityinformation. For example, finding the triangles incident to a given diagonal, or finding theneighbors of a given triangle are expensive computations.
For each triangle, storing the sorted list of its vertices and edges, as well as the sorted list ofits neighbors.
Advantage: allows to quickly recover neighborhood information.
Disadvantage: the stored data is redundant and it uses more space than required.
The data structure which is most frequently used to store a triangulation is the DCEL (doublyconnected edge list).
The DCEL is also used to store plane partitions, polyhedra, meshes, etc.
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6
v7
v8
v9
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
f∞
f5
f4
f1
f3
f6
f2
f7
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6
v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6
f2
f7
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
Table of vertices
v x y e
1 x1 y1 12 x2 y2 13 x3 y3 24 x4 y4 105 x5 y5 46 x6 y6 67 x7 y7 108 x8 y8 89 x9 y9 9
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
f e
1 112 43 104 115 16 67 2∞ 9
Table of faces
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
DCEL
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 22 2 3 7 ∞ 13 33 4 3 ∞ 7 4 24 4 5 2 ∞ 15 55 5 6 2 ∞ 4 66 6 7 6 ∞ 15 77 7 8 4 ∞ 11 88 8 9 4 ∞ 7 99 9 1 5 ∞ 12 1
10 4 7 3 6 13 611 9 7 4 1 8 1412 2 9 5 1 1 1113 2 4 3 7 14 314 2 7 1 3 12 1015 4 6 6 2 10 5
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
e
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
e
vE
vB
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
e
vE
vB
fL
fR
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
e
vE
vB
fL
fR
eN
eP
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 22 2 3 7 ∞ 13 33 4 3 ∞ 7 4 24 4 5 2 ∞ 15 55 5 6 2 ∞ 4 66 6 7 6 ∞ 15 77 7 8 4 ∞ 11 88 8 9 4 ∞ 7 99 9 1 5 ∞ 12 1
10 4 7 3 6 13 611 9 7 4 1 8 1412 2 9 5 1 1 1113 2 4 3 7 14 314 2 7 1 3 12 1015 4 6 6 2 10 5
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
e
vE
vB
fL
fR
eN
eP
Storing the polygon triangulation
DCEL
Storage space
• For each face:
1 pointer
• For each vertex:
2 coordinates + 1 pointer
• For each edge:
6 pointers
In total, the storage space is O(n).
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
DCEL
There are other DCEL variants, as for example:
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
There are other DCEL variants, as for example:
ee′
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
There are other DCEL variants, as for example:
ee′
e −→ vB , fR, eN , e′
e′ −→ vB , fR, eN , e
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
There are other DCEL variants, as for example:
ee′
e −→ vB , fR, eN , e′
e′ −→ vB , fR, eN , e
vB(e)
fR(e)
eN (e)
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
There are other DCEL variants, as for example:
ee′
e −→ vB , fR, eN , e′
e′ −→ vB , fR, eN , e
vB(e)
fR(e)
eN (e)vB(e
′)
fR(e′)
eN (e′)
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 22 2 3 7 ∞ 13 33 4 3 ∞ 7 4 24 4 5 2 ∞ 15 55 5 6 2 ∞ 4 66 6 7 6 ∞ 15 77 7 8 4 ∞ 11 88 8 9 4 ∞ 7 99 9 1 5 ∞ 12 1
10 4 7 3 6 13 611 9 7 4 1 8 1412 2 9 5 1 1 1113 2 4 3 7 14 314 2 7 1 3 12 1015 4 6 6 2 10 5
Storing the polygon triangulation
DCEL
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
e vB fR eN e′
1 1 ∞ 2 1’2 2 ∞ 3 2’3 4 7 2 3’4 4 ∞ 5 4’5 5 ∞ 6 5’6 6 ∞ 7 6’7 7 ∞ 8 7’8 8 ∞ 9 8’9 9 ∞ 1 9’
10 4 6 6 10’11 9 1 14 11’12 2 1 11 12’13 2 7 3 13’14 2 3 10 14’15 4 2 5 15’1’ 2 5 9 12’ 3 7 13 23’ 3 ∞ 4 34’ 5 2 15 4
5’ 6 2 4 56’ 7 6 15 67’ 8 4 11 78’ 9 4 7 89’ 1 5 12 9
10’ 7 3 13 1011’ 7 4 8 1112’ 9 5 1 1213’ 4 3 14 1314’ 7 1 12 1415’ 6 6 10 15
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
Table of vertices
v x y e
1 x1 y1 12 x2 y2 23 x3 y3 34 x4 y4 45 x5 y5 56 x6 y6 67 x7 y7 78 x8 y8 89 x9 y9 9
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
f e
∞ 9
Table of faces
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
DCEL
e vB vE fL fR eP eN
1 1 2 ∞ 22 2 3 ∞ 33 3 4 ∞ 44 4 5 ∞ 55 5 6 ∞ 66 6 7 ∞ 77 7 8 ∞ 88 8 9 ∞ 99 9 1 ∞ 1
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
e vB vE fL fR eP eN
1 1 2 ∞ 22 2 3 ∞ 33 4 3 ∞ 44 4 5 ∞ 55 5 6 ∞ 66 6 7 ∞ 77 7 8 ∞ 88 8 9 ∞ 99 9 1 ∞ 1
DCEL
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
Advance
v1
v2
v9
e1
e9
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
Advance
f5e12
v1
v2
v9
e1
e9
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
Advance
f5e12
v1
v2
v9
e1
e9
f e
5 9
Table of faces
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 1: substracting ears
Advance
f5e12
v1
v2
v9
e1
e9
f e
5 9
Table of faces
DCEL
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 29 9 1 5 ∞ 12 1
12 2 9 5 1
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
Table of vertices
v x y e
1 x1 y1 12 x2 y2 23 x3 y3 34 x4 y4 45 x5 y5 56 x6 y6 67 x7 y7 78 x8 y8 89 x9 y9 9
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
f∞
Initialize
f e
∞ 9
Table of faces
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v7
v6
v4
e6
e10f6
e15
Base step
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v7
v6
v4
e6
e10f6
e15
Base step
f e
6 10
Table of faces
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
v7
v6
v4
e6
e10f6
e15
Base step
f e
6 10
Table of faces
DCEL
e vB vE fL fR eP eN
6 6 7 6 ∞ 15 1010 7 4 6 ∞ 6 1515 4 6 6 ∞ 10 6
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
Merge step
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
Merge step
DCEL 1
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 1414 2 7 1 ∞ 12 7
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
DCEL 2
e vB vE fL fR eP eN
6 6 7 6 ∞ 15 1414 2 7 ∞ 3 2 10
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
Merge step
DCEL 1
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 1414 2 7 1 ∞ 12 7
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
DCEL 2
e vB vE fL fR eP eN
6 6 7 6 ∞ 15 1414 2 7 ∞ 3 2 10
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 2: inserting diagonals
Merge step
DCEL 1
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 1414 2 7 1 ∞ 12 7
v1
v2
v3
v4
v5
v6v7
v8
v9
e1
e2 e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14 e15
f∞
f5
f4
f1
f3
f6f2
f7
DCEL 2
e vB vE fL fR eP eN
6 6 7 6 ∞ 15 1414 2 7 ∞ 3 2 10
Merged DCEL
e vB vE fL fR eP eN
1 1 2 5 ∞ 9 26 6 7 6 ∞ 15 7
14 2 7 1 3 12 10
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 3:
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 3:
1. Decompose into monotone polygons
2. Triangulate monotone pieces
Storing the polygon triangulation
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
How to build the DCEL
Algorithm 3:
1. Decompose into monotone polygons
2. Triangulate monotone pieces
Computing the DCEL is done by combining previous strategies:
• Separating ears for triangulating each monotone subpolygon.
• Merging DCELs for putting together the monotone pieces.
WHAT HAPPENS IN 3D?
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
WHAT HAPPENS IN 3D?
A polyhedron that can be tetrahedralized :
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
WHAT HAPPENS IN 3D?
A cube can be decomposed into 6 tetrahedra...
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
WHAT HAPPENS IN 3D?
A cube can be decomposed into 6 tetrahedra...but also into 5!
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
WHAT HAPPENS IN 3D?
A polyhedron that cannot be tetrahedralized:
Schonhardt polyhedron
Photo from pinshape.com (designed by mathgrrl)
Smallest polyhedron that cannot be tetrahedralized
Figure from the book by Devadoss and O’Rourke
TO LEARN MORE
• J. O’Rourke, Computational Geometry in C (2nd ed.), Cambridge University Press,1998.
• M. de Berg, O. Cheong, M. van Kreveld, M. Overmars, Computational Geometry:Algorithms and Applications (3rd rev. ed.), Springer, 2008.
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS
TO LEARN MORE
• J. O’Rourke, Computational Geometry in C (2nd ed.), Cambridge University Press,1998.
• M. de Berg, O. Cheong, M. van Kreveld, M. Overmars, Computational Geometry:Algorithms and Applications (3rd rev. ed.), Springer, 2008.
A NICE APPLICATION
The art gallery theorem
• J. O’Rourke, Art Gallery Theorems and Algorithms, Oxford University Press, 1987.http://maven.smith.edu/∼orourke/books/ArtGalleryTheorems/art.html
Computational Geometry, Facultat d’Informatica de Barcelona, UPC
TRIANGULATING POLYGONS