EWCG 2006, Delphi, March 27–29, 2006
Pseudo-Convex Decomposition of Simple Polygons∗
Stefan Gerdjikov† Alexander Wolff‡
Abstract e.g. for point location or ray shooting. For decom- positions of simple polygons the same terms as for We extend a dynamic-programming algorithm of Keil decompositions of point sets apply. A decomposition and Snoeyink for finding a minimum convex decompo- is called minimum if it consists of the minimum num- sition of a simple polygon to the case when both con- ber of regions. vex polygons and pseudo-triangles are allowed. Our In this paper we give an algorithm for comput- algorithm determines a minimum pseudo-convex de- ing minimum pseudo-convex decompositions of simple composition of a simple polygon in O(n3) time where polygons. Given a simple polygon we use the same ap- n is the number of the vertices of the polygon. In this proach as Gudmundsson and Levcopoulos [4] to deter- way we obtain a well-structured decomposition with mine all geodesics in the polygon which can be sides fewer polygons, especially if the original polygon has of a pseudo-triangle and present a simple way to check long chains of concave vertices. whether three such geodesics form a pseudo-triangle. We use dynamic programming to solve proper sub- problems which then can be combined to obtain a 1 Introduction global solution. The resulting algorithm runs in O(n3) 2 Pseudo-triangles are simple polygons with exactly time and uses O(n ) space. three convex angles, i.e. interior angles of less than Our algorithm is based on a general technique for 180◦. Recently they have emerged to have geometri- decomposing a simple polygon into polygons of a cer- cal properties of interest for rigidity theory and ray- tain type proposed by Keil [5]. The technique is based shooting problems [2]. This is why pseudo-triangles on optimally decomposing subpolygons each of which is obtained from the original by drawing a single di- have been considered in relation with the decomposi- 3 tion problem of a set of points. It is defined as follows. agonal. This idea yields an O(n log n)-time algo- rithm for the convex decomposition problem [5]. Keil Given a set S of n points in the plane, decompose and Snoeyink [6] improve Keil’s result by giving an the convex hull of S into polygons of a given type O(min(nr2, r4))-time algorithm, where r is the num- such that the vertices of the polygons are in S and ber of reflex vertices of the polygon. each point in S is a vertex of at least one of the polygons. The decomposition is called convex if only convex polygons are allowed, pseudo-triangulation if 2 Characterization of Pseudo-Triangles only pseudo-triangles are allowed, and pseudo-convex + − if both pseudo-triangles and convex polygons can be We use P (Ai, Aj ) and P (Ai, Aj ) to denote the used. Convex decompositions have been considered paths on the boundary ∂P from a vertex Ai to a ver- by Fevens et al. [3]. Streinu [7] shows that the min- tex Aj of P in clockwise and anticlockwise direction, imum number of edges needed to obtain a pseudo- respectively. With vis(Ai) we denote the list of all triangulation is 2n−3 and thus, by Euler, the number vertices of P which are visible from Ai in clockwise of pseudo-triangles is n−2, which does not depend on order starting with Ai+1. Unless stated otherwise, the the structure of the point set but only on its size. This vertices of a polygon will be given in clockwise order. motivates research on the problem of enumerating all minimum pseudo-triangulations [2]. Aichholzer et al. Definition 1 Let P = A0A1 ...An−1 be a simple [1] study pseudo-convex decompositions. They show polygon. A path p = B1B2 ...Bm from Ai to Aj that each minimum pseudo-convex decomposition of is a concave geodesic with respect to the polygon P if a set of n points consists of less than 7n/10 polygons. it satisfies the following three conditions, see Fig. 1: A related problem is the decomposition of simple (G1) B1 = A and B = A . polygons into convex polygons or pseudo-triangles, i m j
∗ (G2) For each k 13 22nd European Workshop on Computational Geometry, 2006 A P k Bm−1 B2 π 2 π3 Aj = Bm Ai = B1 π1 Aj Ai Figure 1: The geodesic B1B2 ...Bm from Ai to Aj is concave with respect to the simple polygon P . Figure 3: Testing whether three concave geodesics π1, π2, and π3 define a pseudo-triangle Remark 1 If B1B2 ...Bm is a concave geodesic from B1 to Bm with respect to a simple polygon P then + be such that Ai ∈ T (Aj , Ak) violates the construc- B2 ...Bm is a concave geodesic from B2 to Bm with tion proposed in property (G2). Let As be the vertex respect to P . + on T (Aj , Ak) after Ai and let k ≥ t>s be such For our further considerations we will need the fol- that At is visible from Ai. It is clear that s>i. lowing fact [6]: Due to Fact 1 we obtain that the edges AiAi+1, AiAs and AiAt appear in clockwise order around Ai. In + Fact 1 Let Ai be a vertex of P = A0A1 ...An−1. particular, because of the convexity of T (Ai, Ak)Ai, + Then the cyclic order of the line segments AiAj with AiAt intersects T (Ai, Ak) only in Ai and AiAs is + AiAj ⊆ P around Ai is the same as the order of their contained in the polygon P (Ai, At)Ai. However, Ak + other endpoints along ∂P . lies outside this polygon and thus T (Ai, Ak) leaves + P (Ai, At)Ai in some point x which does not belong + The following lemma states the relationship be- to AiAt, see Fig 2. Therefore T (Ai, Ak) leaves P . tween the concave geodesics in a simple polygon and Contradiction. the pseudo-triangles that can participate in a decom- position of the polygon. Next we establish the converse relation. Namely three concave geodesics determine a pseudo-triangle. Lemma 1 If a pseudo-triangle T is contained in a simple polygon P = A0A1 ...An−1 with convex ver- Lemma 2 Let P = A0A1 ...An−1 be a simple poly- tices at Aj , Ak and Al, j A t 3 Algorithm A s Ai x We use the same approach for finding a minimum pseudo-convex decomposition of a simple polygon as Keil and Snoeyink [6] for finding the minimum con- Ak Aj vex decomposition of a polygon. Namely we consider smaller simple polygons which are obtained from the Figure 2: Each pseudo-triangle consists of three con- original polygon by drawing a single diagonal. For cave geodesics that connect its convex vertices. The each such polygon we make assumptions in what sort + arcs denote the boundary of P (Aj , At) and the solid of polygon the diagonal can be included. In case the + lines denote the edges of T (Aj , Ak). diagonal is a part of a convex polygon we use the 14 EWCG 2006, Delphi, March 27–29, 2006 algorithm of Keil and Snoeyink [6]. In case the di- convex polygon C = Aj ...Ak ∪ T , where Aj ...Ak is agonal is part of a pseudo-triangle we proceed as fol- a smaller convex polygon. In the former case, an op- lows. Assume we have a precomputed list L of all timal decomposition of Pij consists of wik + wkj +1 concave geodesics w.r.t. P . Then we can filter L to polygons. In the latter case the decomposition of Pij find all pseudo-triangles that contain the diagonal as is the union of two pseudo-convex decompositions: an edge. For each such pseudo-triangle T we compute (i) that of Pik and (ii) that of Pkj under the con- 0 the size of an optimal decomposition that contains T . dition that AkAj is an edge of a convex polygon C The optimal solution is the minimum of the solutions with C0 ∪ T convex. In (i) an optimal decomposition obtained in the two cases. Finally we apply dynamic of Pik consists of wik polygons. To determine an opti- programming, just as Keil and Snoeyink [6]. mal decomposition of Pkj in (ii) we use the approach Now we describe our ideas in detail. Let P = of Keil and Snoeyink [6], which relies on the following A0A1 ...An−1 be a simple polygon. We use defini- observation. tions similar to those in [6]. If i < j and Aj is visible We call a diagonal-convex decomposition of Pij a from Ai in P then we denote the line segment AiAj decomposition where dij is the diagonal of a convex by dij and call it a diagonal of P . In particular each polygon. For each polygon Pij we store not only the edge of P is a diagonal. For each such diagonal a value cwij but also a list CLij of representatives of simple polygon Pij = AiAi+1 ...Aj is defined. diagonal-convex decompositions of Pij which attain cwij . Given an optimal diagonal-convex decomposi- Definition 2 Let D denote the set of all pseudo- tion ∆ of Pij the representative (s,t) of ∆ is uniquely convex decompositions of a polygon Pij . Then we defined by a pair of vertices {As, At}∩{Ai, Aj } = ∅. introduce the following parameters: More precisely, As and At are those vertices of Pij wij = min{|D| : D ∈ D} that are adjacent to Ai and Aj , respectively, in the cwij = min{|D| : D ∈ D, the edge dij is con- only polygon Π ∈ ∆ with dij being an edge of Π. We tained in a convex polygon} store only representatives (s,t) satisfying the property 0 0 pwij = min{|D| : D ∈ D, the edge dij is con- that for each other representative (s ,t ) 6= (s,t) of Pij 0 0 tained in a pseudo-triangle } either s>s or t 15 22nd European Workshop on Computational Geometry, 2006 + 3 Ai on P (Ai, Aj )—this is either Aj or the last vertex polygon P with n vertices can be computed in O(n ) + visible from Ai on P (Ai, Aj−1). Fact 1 allows us time. to handle vis(Ai) in O(1) time to obtain the desired information. Once we have found the last vertex Al Acknowledgments + visible from Ai on P (Ai, Aj ) we check whether there is a concave geodesic π from Al to Aj . If this is the We thank the anonymous referee whose comments case we use the second and the second last vertex on helped us to improve the readability of this paper. π to check whether Ai can be added to π without vi- olating property (G2). According to Remark 1 this is References the only way for obtaining a concave geodesic from Ai to Aj . Finally the second and the second last vertex [1] O. Aichholzer, C. Huemer, S. Renkl, B. Speck- on this path can also be computed in O(1) time. Thus mann, and C. D. T´oth. On pseudo-convex decom- we need only O(1) time per pair (i, j) in order to check positions, partitions, and coverings. In Proc. 21st whether there exists a concave geodesic from Ai to Aj European Workshop on Computational Geometry and—in case it does—to find the second and the sec- (EWCG’05), pages 89–92, Eindhoven, 2005. ond last vertex on this path. Because the number of all pairs (i, j) is O(n2), this results in an O(n2)-time [2] O. Aichholzer, G. Rote, B. Speckmann, and algorithm with the desired properties. I. Streinu. The zigzag path of a pseudo- triangulation. In Proc. Workshop on Algorithms Notice that in the proof of Proposition 3 we can and Data Structures (WADS’03), pages 377–388, compute also the vertices with the greatest and small- 2003. est indices that lie on a given concave geodesic π with- out increasing the complexity of the algorithm. More- [3] T. Fevens, H. Meijer, and D. Rappaport. Mini- over, we can check in constant time whether these two mum convex partition of a constrained point set. vertices are adjacent on π. We use this observation Discrete Applied Mathematics, 109(1–2):95–107, to compute a list PLij for each diagonal dij . In this 2001. list we store all pairs (k,l) such that there is a con- [4] J. Gudmundsson and C. Levcopoulos. Mini- cave geodesic from A to A which contains d but k l ij mum weight pseudo-triangulations. In K. Lodaya no vertex with index smaller than i or greater than j. and M. Mahajan, editors, Proc. 24th Int. Conf. Foundations Software Tech. Theoretical Comput. Theorem 4 The number of polygons in a minimum Sci. (FSTTCS’04), volume 3328 of Lecture Notes pseudo-convex decomposition of a simple polygon 3 in Computer Science, pages 299–310. Springer- P = A0A1 ...A 1 can be computed in O(n ) time. n− Verlag, 2004. Proof. We first set up the data structure of Proposi- [5] J. M. Keil. Decomposing a polygon into simpler tion 3 and compute the lists PL . This takes O(n2) ij components. SIAM J. Comput., 14:799–817, 1985. total time. Then we implement the algorithm of Sec- tion 3. Using the technique of Keil and Snoeyink [6] [6] J. M. Keil and J. Snoeyink. On the time bound the computation of all cwij can be carried out in total for convex decomposition of simple polygons. Int. 3 O(n ) time. To bound the time needed for the com- J. Comput. Geometry Appl., 12(3):181–192, 2002. putation of pwij first note that each concave geodesic π = B1 ...Aj Ai ...Bm is contained in at most one [7] I. Streinu. A combinatorial approach to pla- list PLij and thus it is considered once only. We walk nar non-colliding robot arm planning. In Proc. along π to determine the sum of the values wkl over 41st Annu. IEEE Sympos. Found. Comp. Sci. all (k,l) 6= (i, j) with AkAl ⊆ π. This takes O(n) time (FOCS’00), pages 443–453, 2000. according to Proposition 3. Then for each point Al + on P (Bm,B1) we check whether there is a concave geodesic π1 from Al to B1 and a concave geodesic π2 from Bm to Al. If this is the case, we use Lemma 2 to check whether ππ1π2 is a pseudo-triangle. This takes O(1) time. Finally we need the values w(π1) and w(π2) which can be computed in O(n) time the first time we need them. Thus we walk along each geodesic only once and perform only O(n) operations for each geodesic. The total number of concave geodesics is O(n2) which results in O(n3) time for determining all values pwij . Thus the number of polygons in a minimum pseudo-convex decomposition of a simple 16