<<

Polygon Partitioning

O’Rourke, Chapter 2 Outline • Partitions • Convex Partitions Monotonicity A polygonal 푃 is monotone w.r.t. a 퐿 if its boundary can be split into two chains, 퐴 and 퐵, such that each chain is monotonic w.r.t. 퐿. 퐿 퐴 퐵 푃

퐿′ Monotonicity A polygonal 푃 is monotone w.r.t. a line 퐿 if its boundary can be split into two polygon chains, 퐴 and 퐵, such that each chain is monotonic w.r.t. 퐿. 퐿

A polygon 푃 is a monotone 푃 mountain w.r.t. 퐿 if it is 퐿′ monotone w.r.t. 퐿 and one of the two chains (the base) is a single segment.

Note: Both endpoints of the base have to be convex Claim Every strictly convex of a monotone mountain that is not on the base is an ear tip.

WLOG, we will assume that 퐿 퐿 is vertical and that the base is to the left. 푃 퐿′ We will first show that the has to be interior and then that it cannot intersect the polygon. Proofs Assume ∃ 푣−, 푣, 푣+ ⊂ 푃, with 푣 strictly convex, s.t. 푣−푣+ is not an interior diagonal.

+ − 푣 푣 cannot be locally 퐿 exterior because:  If 푣+ is not on the base, then 푣+푣++ must be below 푣+. 푣− Since 푣 is strictly convex, 푣 푣+푣− is to the left of 푣+푣.

푣+

푣++ Proofs Assume ∃ 푣−, 푣, 푣+ ⊂ 푃, with 푣 strictly convex, s.t. 푣−푣+ is not an interior diagonal.

+ − 푣 푣 cannot be locally 퐿 exterior because:  If 푣+ is on the base, then 푣+푣− is to the left of 푣+푣. But it must also be to the right 푣− of the base since 푣− is to the right of the base. 푣

푣+ Proofs Assume ∃ 푣−, 푣, 푣+ ⊂ 푃, with 푣 strictly convex, s.t. 푣−푣+ is not an interior diagonal.

− + ⇒ If 푣 푣 is not an interior 퐿 diagonal then ∃푥 ∈ 푃, reflex, with 푥 interior to Δ푣+푣푣−.  Interior ⇒ it cannot lie on the − chain 푣+푣푣−. 푣 푥 푣  Reflex ⇒ it is not on the base. + ⇒ The horizontal through 푥 푣 intersects 푃 in three points. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1.

Note: We can induct because when we remove an ear, we do not violate the monotonicity of the chain. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. Monotone Mountain Triangulation Approach: 1. Find a convex vertex not on the base. 2. Remove it. 3. Go to step 1. To do this, we need to be able to quickly identify the next convex vertex. Recall: Strictly convex ⇔ interior < 휋. Monotone Mountain Triangulation

 MonotoneMountainTriangulation( 푃 ): – 퐵 ←FindBase( 푃 ) – 퐶 ← LinkConvexVertices( 푃 − 퐵 ) – while 퐶 ≠ ∅: • 푣 ← First( 퐶 ) • output( Δ푣−푣푣+ ) • 푃 ← 푃 − {푣} • if(푣+ ∉ 퐶 AND 푣+ ∉ 퐵 ) • if( ∠푣+ < 휋 ) 푣.addAfter( 푣+ ) • if( 푣− ∉ 퐶 AND 푣− ∉ 퐵 ) • if( ∠푣− < 휋 ) 푣.addBefore( 푣− ) • 퐶 ← 퐶 − {푣} Generating Monotone Mountains Approach: • Compute a trapezoidalization of 푃. • Connect supporting vertices that don’t come from the same side. Generating Monotone Mountains Claim: Such a partition generates pieces that are monotone mountains. Generating Monotone Mountains Proof: This algorithm removes all interior cusps, so the partition pieces are monotone. Generating Monotone Mountains Proof: Given a piece, we can find its topmost 푣 vertex 푣, with neighbors 푣− and 푣+. 푣− Assume 푣+ is lower than 푣−.

푣+ Generating Monotone Mountains Proof: Following the chain down 푣−, we get to the 푣 last vertex, 푤 ∈ 푃, above 푣+. 푣− There is a supported by 푤 and 푣+. Since 푤 and 푣+ are on different sides of the trapezoid, the diagonal to 푣+ must be added. 푤 ⇒ 푣+ is a partition endpoint 푣+ Triangulation

 Triangulate( 푃 ): – Construct a trapezoidalization Triangulation

 Triangulate( 푃 ): – Construct a trapezoidalization – Connect supporting vertices from different sides. Triangulation

 Triangulate( 푃 ): – Construct a trapezoidalization – Connect supporting vertices from different sides. – Triangulate the mountains Triangulation Note: The algorithms for triangulating via monotone and monotone mountains works for polygons with disconnected boundaries. Outline • Triangle Partitions • Convex Partitions Convex Partitions Definition: A convex partition by segments of a polygon 푃 is a decomposition of 푃 into convex polygons obtained by introducing arbitrary segments. Convex Partitions Definition: A convex partition by segments of a polygon 푃 is a decomposition of 푃 into convex polygons obtained by introducing arbitrary segments.

A convex partition by of a polygon 푃 is a decomposition of 푃 into convex polygons obtained by only introducing diagonals. Convex Partitions Definition: A convex partition by segments of a polygon 푃 is a decompositionChallenge :of 푃 into convex polygons obtainedCompute by introducing a convex arbitrary partition segments. with the smallest number of pieces. 2 A convex partitionChallenge by diagonals: of a polygonCompute 푃 is a decomposition it efficiently of 푃 into convex polygons obtained by only introducing diagonals. Convex Partitions (by Segments) Claim (Chazelle): Assume the polygon 푃 has 푟 reflex vertices. If Φ is the fewest number of polygons required for a convex partition by segments of 푃 then: 푟/2 + 1 ≤ Φ ≤ 푟 + 1 Convex Partitions (by Segments) Proof (Φ ≤ 푟 + 1): For each reflex vertex, add the bisector. Because the segment bisects, the reflex angle splits into two convex . (Angles at the new vertices have to be < 휋.) Doing this for each reflex vertices, gives a convex partition with 푟 + 1 pieces. Convex Partitions (by Segments) Proof ( 푟/2 ≤ Φ): Each reflex vertex needs to be split and each introduced segment can split at most two reflex vertices. Convex Partitions (by Diagonals) Definition: A diagonal in a convex partition is essential for vertex 푣 ∈ 푃 if removing the diagonal creates a piece that is not convex at 푣. Convex Partitions (by Diagonals) Claim: If 푣 is a reflex vertex, it can have at most two essential diagonals. Convex Partitions (by Diagonals) Proof: Given a reflex vertex 푣, let 푣− and 푣+ be the vertices immediately before and after 푣 in 푃. There can be at most one essential segment in the half-space to the right of 푣푣+. (If there were two, we could 푣+ remove the one closer to 푣푣+.) 푣

푣− Convex Partitions (by Diagonals) Proof: Given a reflex vertex 푣, let 푣− and 푣+ be the vertices immediately before and after 푣 in 푃. Similarly, there can be at most one essential segment in the half-space to the right of 푣푣−.

푣+

푣− Convex Partitions (by Diagonals) Proof: Given a reflex vertex 푣, let 푣− and 푣+ be the vertices immediately before and after 푣 in 푃. Similarly, there can be at most one essential segment in the half-space to the right of 푣푣−.

Since the two half-spaces 푣+ cover the interior of the vertex there are at most two essential vertices at 푣.

푣− Convex Partitions (by Diagonals) Algorithm (Hertl & Mehlhorn): Start with a triangulation and remove inessential diagonals. Claim: This algorithm is never worse than 4 × optimal in the number of convex pieces. Convex Partitions (by Diagonals) Proof: When the algorithm terminates, every remaining diagonal is essential for some (reflex) vertex. Each reflex vertex can have at most two essential diagonals. ⇒ There can be at most 2푟 + 1 pieces in the partition. Since at least 푟/2 + 1 are required, the result is within 4 × optimal. Convex Partitions Why do we care? Convex polygons are easier to intersect against. For a polygon with 푛 vertices: • Testing if a point is inside is 푂(log 푛). • Testing if a line intersects is 푂(log 푛). • Testing if two polygons intersect is 푂(log 푛). Point/Convex-Polygon Intersection Algorithm: Recursively split the polygon in half and test the

half the point could be in.푣7 푣6

푣8 푣5

푣1 푣4 푞

푣 2 푣3 Point/Convex-Polygon Intersection Algorithm: Recursively split the polygon in half and test the half the point could be in.

푣1 푣4 푞

푣 2 푣3 Point/Convex-Polygon Intersection Algorithm: Recursively split the polygon in half and test the half the point could be in.

푣1 푣4 푞

푣3 Point/Convex-Polygon Intersection

InConvexPolygon( 푞 , {푣1, … , 푣푛} )  if( 푛 == 3 ) »return InTriangle( 푞 , {푣1, 푣2, 푣3} );  if( Left( 푣1, 푣푛 2 , 푝 ) ) »return InConvexPolygon( 푞 , {푣푛 2, … , 푣1} );  else »return InConvexPolygon( 푞 , {푣1, … , 푣푛 2} ); Line/Convex-Polygon Intersection Note: Given a convex polygon 푃, a 퐿, and * vertices 푣푖, 푣푗 ∈ 푃 on the same side of 퐿.

푣 If the vector 푣푖푣푖+1 points 푗 푣푖+1 away from 퐿, then 퐿 can only intersect 푃 along the 푣푖 chain {푣 , 푣 , … , 푣 }. 푗 푗+1 푖 퐿 Otherwise, 퐿 can only intersect 푃 along the chain {푣푖, 푣푖+1, … , 푣푗}.

* Assume, WLOG that 푣푖 is closer to 퐿 than 푣푗. Line/Convex-Polygon Intersection Algorithm: Recursively split the polygon in half. If the split points are on the same side, test the 푣7 half of the polygon that 푣6 could intersect. 푣8 푣5 Otherwise there is an intersection. 푣1 푣4

푣 2 푣3 Line/Convex-Polygon Intersection Algorithm: Recursively split the polygon in half. If the split points are on the same side, test the half of the polygon that could intersect. Otherwise there is an intersection. 푣1 푣4

푣 2 푣3 Line/Convex-Polygon Intersection

IsectConvexPolygon( {푙1, 푙2} , {푣1, … , 푣푛} )  if( 푛 == 3 ) »return IsectTriangle( {푙1, 푙2} , {푣1, 푣2, 푣3 );  if( Left( 푙1 , 푙2 , 푣1 )!=Left( 푙1 , 푙2 , 푣푛 2 ) ) »return true;  else »if( Dist( {푙1, 푙2} , 푣1 )

• return IsectConvexPolygon( {푙1, 푙2} , {푣1, … , 푣푛 2} ); »else...