Polygon Triangulation. Shmuel Wimer Bar Ilan Univ., School of Engineering. Definitions. Simple polygon. Nonsimple polygons. There are no holes in a simple polygon. The Art Gallery Problem. How many stationary guards are needed to guard a room?.
Bar Ilan Univ., School of Engineering
There are no holes in a simple polygon.
How many stationary guards are needed to guard a room?
Guards are located at fixed points and have 2π range of visibility. A guard cannot see through walls.
A set of guards covers a polygon if every point of the polygon is visible to some guard.
Problem: Find the max over all n-vertex polygons of the min number of guards needed to cover the polygons.
This 12-vertex polygon needs 3 guards to cover it.
This 12-vertex polygon needs 4 guards to cover it
Necessity follows from the prong’s example.
First Proof of sufficiency is due to Chvátal in 1975 (very complex). We’ll present a simple, four-step proof by Fisk from 1978.
A diagonal of a polygon is a line segment connecting two visible vertices.
Triangulation: the partition of a polygon by maximal non crossing diagonals into triangles (not unique!).
Interesting, both triangulations have same number of diagonals!
Notice that number of diagonals equals n-3.
G(V,E) is a graph defined on a triangulated polygon P.
E consists of P’s edges and the triangulation diagonals, while V consists of P’s vertices.
k-coloring is an assignment of k colors to the vertices of V such that no adjacent vertices have same color.
We’ll show later that a triangulation graph is 3-colorable.
Assigning color to first vertex enforces the rest color assignments.
The coloring of a triangulation graph is unique!
It is sufficient to place guards at one color only (say red).
This follows since every triangle must have 3 distinct colors at its corners, hence one must be red. Therefore every triangle is covered.
But the triangles cover the entire polygon P.
Pigeon-hole principle: There must be one color whose number of assigned vertices doesn’t exceed └n/3┘.
Proof: Let the vertices be counterclockwise ordered. Traversing the boundary, a convex vertex corresponds to a left turn.
Need to prove that every polygon can be triangulated.
Though intuitive, proof is not trivial.
Lemma:Every polygon must have at least one strictly convex vertex.
Pick the lowest vertex (pick the rightmost If there are few).
L is a line passing through v.
The edge following v must lie above L. ■
Lemma:Every polygon of n≥4 vertices has a diagonal.
Proof: There exists a strictly convex vertex v. Let a and b be vertices adjacent to v.
If [a,b] is a diagonal we are done. So assume it is either exterior or intersecting with the boundary of P.
Theorem:Every n-vertex polygon P can be triangulated.
Proof: By induction on n.
If n=3P is a triangle.
Let n≥4. By lemma, P has a diagonal d which divides P into two polygons P1 and P2, having n1<n and n2<n vertices, resp.
P1 and P2can be triangulated by induction hypothesis. ■
Question: Are all triangulations have the same number of diagonals and triangles?
Lemma:Every triangulation of an n-vertex polygon P has n-3 diagonals and n-2 triangles.
Proof: By induction on n.
For n=3 the claims are trivially true.
For n≥4, divide P by a diagonal d into P1 and P2, having n1<n and n2<n vertices, resp.
n1+n2 = n+2 since the end vertices of d are duplicated.
It follows from the induction hypothesis that the claims hold for n1-vertex and n2-vertex polygons.
The total number of diagonals (n1-3)+(n2-3)+1=n-3, where +1 stands for counting d.
The number of resulting triangles is (n1-2)+(n2-2)=n-2.■
Corollary:The sum of internal angles in an n-vertex polygon is (n-2)π.
Proof: Polygon is covered by n-2 triangles, whose corners are placed at polygon’s vertices.
A vertex is placed in every triangle.
An arc exists between two vertices iff the corresponding triangles are adjacent.
Lemma:The dual T of a triangulation of a simple polygon P is a tree whose vertex degree is 3 at most.
Proof: Degree claim follows immediately from the fact that a triangle has three sides at most to share.
Assume in contrary that T is not a tree. It then must have a closed cycle C, completely contained in P.
C must enclose a vertex of P, which is the end point of a diagonal crossing C.
Completely in P
P must therefore have a hole, thus contradicting its simplicity. ■
Vertices of degree 1 are leaves of T. Vertices of degree 2 lie on T’s paths. Vertices of degree 3 are branches.
When rooted at a vertex of degree 1 or 2, T is a binary.
Definition: Three successive vertices a, b, c of a polygon form an ear if ac is a diagonal, while ab and bc are not.
Theorem:A polygon with n≥4 has two nonoverlapping ears at least.
Proof: A leaf of the dual tree T implies an ear. T has n-2 ≥2 vertices, at least 2 of which are leaves. ■
Theorem:The triangulation graph of a simple n-vertex polygon P is 3-colorable.
Proof: By induction on n.
P has an ear. Ear removal obtains an (n-1)-vertex polygon, which by induction hypothesis is 3-colorable.
The end vertices of the ear’s base (diagonal) are adjacent vertices of P and thus have two distinct colors. The tip of the ear is then colored with the third color. ■
We are done!
Area of polygons can be found by triangulation and calculation of triangles areas.
We’d like to obtain a closed-form formula, independent of triangulation.
A(P)’s expression depends on triangulation.
We’ll consider first quadrilaterals and show its area is independent of triangulation.
Diagonal related terms are canceled out!
What happens for non-convex quadrilateral ?
We’d like to obtain the area of a general simple polygon in terms of its vertices only.
P is a polygon and p an arbitrary point (internal or external). p’s vertices are cyclically ordered counterclockwise.
We can traverse the edges along the border and consider the triangles viewed from p.
The areas of rectangles counterclockwise oriented are added while the clockwise ones are subtracted. This is integration along the border (Green’s Theorem).
Run time is reduced to O(n2) (Lennes, 1911) as follows.
Pick the leftmost vertex v of P and connect its two neighbors u and w. Checking whether uw is a diagonal takes O(n). If it is, the rest is (n-1)-vertex polygon.
If uw is not a diagonal, get x, the farthest vertex from uw inside Δuvw. This takes O(n) time. vx is a diagonal dividing P into P1and P2, having n total number of vertices.
Recursive application of the above procedure consumes total O(n2) time.
Can we do better?
There is a type of polygons whose triangulation takes linear time, called monotone.
Definition: P is monotone w.r.t to a line l if P intersects with any line l’ perpendicular to l in a single segment, a point or it doesn’t intersect.
We’ll partition P into y-monotone pieces.
On horizontal edge the left vertex is considered above the right one.
Lemma:A polygon is y-monotone if it has neither split vertices nor merge vertices.
Proof: If P is not monotone, there must exist a line l intersecting P in more than a single segment. Let [p,q] be its leftmost sub segment.
Follow the boundary of P starting at q, where P is on the left. At some point r we must cross l.
If r ≠ p then the highest vertex must be a split one.
If r = p we follow the boundary from q in opposite direction.
At some point r’ we must cross l. r’ ≠ p as otherwise it contradicts that P is not monotone.
This implies that the lowest encountered vertex must be a merge one. ■
Sort P’s vertices from top to bottom. It takes O(nlogn) time.
Apply scan line from top to bottom to encounter vertices.
Diagonals are introduced at split and merge vertices.
Scan line intersection with P’s boundary is stored in a left to right ordered balanced binary tree.
Insertion into and deletion from a tree takes O(logn) time. Neighbor query takes O(1) time.
Total time consumed by scanning is O(nlogn) time.
At a split point we get the nearest left and right edges in O(1) time.
The last upper vertex is also stored (can be the top end of right or left edge).
This data suffices to decide on diagonal in O(1) time.
Merge vertices are handled similarly.
It takes O(nlogn) time to split P into monotone polygons.
Theorem: An n-vertex simple polygon can be partitioned into y-monotone polygons in O(nlogn) time and O(n) storage.
Theorem: Strictly y-monotone n-vertex polygon can be triangulated in linear time.
Theorem: (Gary et. al. 1978) A simple n-vertex polygon can be triangulated in O(nlogn) time and O(n) storage.
The problem has been studied extensively between 1978 and 1991, when in 1991 Chazelle presented an O(n) time complexity algorithm.