Guarding Fat Polygons and Triangulating Guarded Polygons
Total Page:16
File Type:pdf, Size:1020Kb
Guarding Fat Polygons and Triangulating Guarded Polygons G. Aloupis ∗ P. Bose † V. Dujmovic ‡ C. Gray § S. Langerman ¶ B. Speckmann § Abstract In this paper we study three related problems: (i) Given a fat polygon P , we show how to find a set G of points in P such that every point on the boundary of P sees at least one point of G. The set G is said to guard the boundary of P and its cardinality depends on the shape parameters of P . Fat polygons are often used to model more realistic inputs. (ii) Given k points that guard the boundary of P , we show how to compute O(k2) points that guard the interior of P . (iii) Given k points that guard P , we provide two simple O(kn) time algorithms to triangulate P : one that triangulates the polygon when the guards are given as input and the other slightly more complicated algorithm that triangulates the polygon when the guards are not given. 1 Introduction Many algorithms and data structures developed in Computational Geometry often display their worst-case performance on intricate configurations that seem artificial. Indeed, in practical situ- ations, these algorithms tend to perform much better than predicted by the theoretical bounds. An attempt to understand this disparity has led to the study of geometric problems with so-called realistic input models [5]. Here one places certain restrictions on the shape and/or distribution of the input objects, so that hypothetical worst-case examples are excluded. One of the most widely studied realistic input models assumes that the input objects are fat, that is, they are not arbitrar- ily long and skinny. There are several different ways to characterize fat objects—see Section 3 for formal definitions. Combinatorial properties of sets or unions of fat objects are well-studied in the literature, while properties of a single fat object has only been addressed recently. The first problem we study in this paper is how to find a guard set for the boundary of a polygon whose cardinality depends on the fatness parameter of the polygon. Valtr showed [21] that ε-good polygons (a class of fat polygons) can be guarded with a constant number of guards where the constant depends on the fatness parameter. We show in Section 3 that the boundary of a different class of fat polygons, namely (α,β)-covered polygons, can also be guarded by a constant—again depending on the fatness— number of guards. Guarding problems have a rich history in Computational Geometry (see [9], [20], [15] for books and surveys on this topic). We continue our investigation by showing in Section 4 that a polygon whose boundary can be guarded with k guards can be completely guarded with O(k2) guards. We say that a polygon is completely guarded provided that every point in the polygon is visible to at least one guard. ∗Carleton University & Universit´eLibre de Bruxelles, [email protected]. †Carleton University, [email protected]. ‡McGill University, [email protected]. §TU Eindhoven, {cgray,speckman}@win.tue.nl. C.G. is supported by the Netherlands’ Organisation for Scientific Research (NWO) under project no. 639.023.301. ¶Chercheur Qualifi´edu FNRS, Universit´eLibre de Bruxelles, Belgique, [email protected]. 1 We complete our investigation in Section 5 by showing a relationship between the number of guards required to guard the boundary of a polygon and the time required to triangulate that polygon. Such relationships between shape complexity and time to triangulate polygons have been investigated before. For example, it has been shown that monotone polygons [19], star-shaped polygons [16], edge-visible polygons [18] and palm-shaped polygons [8] can all be triangulated in linear time by fairly simple algorithms. Other measures of shape complexity studied include the number of reflex vertices [11] or the sinuosity [4] of the polygon. In 1991, Chazelle [3] presented a linear time algorithm to triangulate a simple polygon. However, the algorithm is quite complex. In this paper, we give simple algorithms to triangulate a polygon for which a set of guards collectively sees its boundary. Given a simple n vertex polygon P and k guards that guard the boundary of P , we present a simple O(kn) time algorithm to triangulate P . By simple, we mean that the algorithm uses the following: computing the convex hull of a polygonal chain [14], computing the visibility polygon from a point [7], and triangulating an edge-visible polygon [18]. These problems have linear-time algorithms that are generally considered to be simple. If we are simply told that the boundary of P can be guarded with k guards but are not given k guards as input, then we provide another O(kn) time triangulation algorithm that is slightly more complicated. The additional operation we need is a linear-time algorithm to compute the visibility polygon from an edge. There exist classes of polygons that can be guarded by a constant number of guards, such as ε-good polygons and (α,β)-covered polygons. Therefore, our algorithms for such classes use linear running time. 2 Tools and definitions Throughout this paper let P be a simple polygon with n vertices. We denote the interior of P with int(P ), the boundary of P with ∂P , and the diameter of P by diam(P ). The boundary is considered part of the polygon, that is, P = int(P ) ∪ ∂P . We say that a point p is in P if p ∈ int(P ) ∪ ∂P . The segment or edge between two points p and q is denoted by pq. The same notation implies the direction from p to q if necessary. Two points p and q in P see each other if pq ∩ P = pq. If p and q see each other, then we also say that p is visible from q and vice versa. A star-shaped polygon contains a set of points—the kernel—each of which can see the entire polygon. If there ex- ists an edge pq ⊂ ∂P such that each point in P sees some point on pq, then P is weakly edge-visible. The visibility polygon of a point p ∈ P with respect to P , denoted by v(p, P ) is the set w P Pw of points in P that are visible from p. Visibility polygons are p star-shaped and have complexity O(n). Let Q be a subpolygon of P , where all vertices of Q are on ∂P . If all vertices of Q coincide with vertices of P , then we call Q a pure subpolygon. If ∂P intersects an edge w of ∂Q only at Figure 1: The visibility polygon w’s endpoints, then w is called a window of Q. Any window v(p, P ) is shaded. Pw is the pocket w separates P into two subpolygons. The one not containing of w with respect to v(p, P ). Q is the pocket of w with respect to Q (see Fig. 1). Lemma 1 (El Gindy and Avis [7]) v(p, P ) can be computed in O(n) time. 2 This algorithm, while not trivial, is fairly simple. It involves a single scan of the polygon and a stack. See O’Rourke’s book [15] for a good summary. The geodesic between two points in P is the shortest polygonal path connecting them that is contained in P . The vertices of a geodesic belong to ∂P . Lemma 2 Let x be a vertex of polygon P and let y be a point on edge vw ∈ P . If y sees x, then the geodesic between x and v: (a) is convex and entirely visible from y, and (b) can be computed in O(n) time. Proof. Property (a) holds trivially if x sees v. Consider the case v w where x does not see v. Then, the triangle (x,y,v), denoted by T , y must contain at least one vertex of P in its interior. Let I be all the vertices of P inside T and let CH(I) be the convex hull of I. The path S = CH(I) \ xv is the geodesic from x to v. Any other path from x to v inside T can be shortened. Thus, Property (a) holds. x To prove property (b), note that since the geodesic we seek is z entirely visible from y by part (a) it is fully contained in v(y, P ). We compute v(y, P ) in linear time. Let z be the first intersection of ∂P and the ray emanating from x in the direction yx. Consider Figure 2: The geodesic from the polygonal chain from x to v along ∂v(y, P ) that avoids y. By x to v. construction of v(y, P ), the shortest path from x to v is part of the convex hull of this path. By Melkman’s algorithm [14], the convex hull of a simple polygonal chain can be computed in linear time. 3 Guarding fat polygons As mentioned in the introduction there are several ways to characterize fat polygons. Valtr [21] studied ε-good polygons. A polygon P is ε-good if every point p ∈ P can see at least an ε-fraction of the total area of P . Valtr showed that an ε-good polygon can be guarded by (1 + o(1)) · 23 · (1/ε) log(1/ε) guards. Kirkpatrick [12] considered polygons where every point on the boundary sees a fraction ε of the boundary. He showed how to guard the boundary of such polygons with 64(1/ε) log log(1/ε) guards.