Visibility: Finding the Staircase Kernel in Orthogonal Polygons

Similar documents
Visibilty: Finding the Staircase Kernel in Orthogonal Polygons

Lecture 3: Art Gallery Problems and Polygon Triangulation

Computational Geometry

CS6100: Topics in Design and Analysis of Algorithms

Connected Components of Underlying Graphs of Halving Lines

The Geometry of Carpentry and Joinery

The Art Gallery Problem: An Overview and Extension to Chromatic Coloring and Mobile Guards

2 A Plane Sweep Algorithm for Line Segment Intersection

Polygon decomposition. Motivation: Art gallery problem

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls

CS 532: 3D Computer Vision 11 th Set of Notes

Partitioning Orthogonal Polygons by Extension of All Edges Incident to Reflex Vertices: lower and upper bounds on the number of pieces

arxiv: v2 [cs.cg] 15 Aug 2016

CMSC 425: Lecture 9 Geometric Data Structures for Games: Geometric Graphs Thursday, Feb 21, 2013

MISCELLANEOUS SHAPES

AMS 345/CSE 355 Computational Geometry

Approximation Algorithms for Geometric Intersection Graphs

CS 532: 3D Computer Vision 14 th Set of Notes

Restricted-Orientation Convexity in Higher-Dimensional Spaces

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

Edge Guards for Polyhedra in Three-Space

On Guarding Orthogonal Polygons with Bounded Treewidth

Line Arrangement. Chapter 6

Generalized kernels of polygons under rotation

Computational Geometry

January 10-12, NIT Surathkal Introduction to Graph and Geometric Algorithms

Finding sets of points without empty convex 6-gons. Mark H. Overmars

Coloring Variations of the Art Gallery Problem

GEOMETRIC SEARCHING PART 1: POINT LOCATION

Polygon Partitioning. Lecture03

The Visibility Graph of Congruent Discs is Hamiltonian

Geometric Streaming Algorithms with a Sorting Primitive (TR CS )

INTRODUCTION TO THE HOMOLOGY GROUPS OF COMPLEXES

A technique for adding range restrictions to. August 30, Abstract. In a generalized searching problem, a set S of n colored geometric objects

On Merging Straight Skeletons

CMSC 754 Computational Geometry 1

Crossing Families. Abstract

How Do Computers Solve Geometric Problems? Sorelle Friedler, University of Maryland - College Park

1. Meshes. D7013E Lecture 14

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Chapter 6. Planar Orientations. 6.1 Numberings of Digraphs

Triangle Graphs and Simple Trapezoid Graphs

CMSC 754 Computational Geometry 1

Smallest Intersecting Circle for a Set of Polygons

Coverage and Search Algorithms. Chapter 10

Geometric Unique Set Cover on Unit Disks and Unit Squares

Bicriteria approach to the optimal location of surveillance cameras *

Complexity Results on Graphs with Few Cliques

Polygon Triangulation. (slides partially by Daniel Vlasic )

On the null space of a Colin de Verdière matrix

Line segment intersection. Family of intersection problems

Polygon Triangulation. (slides partially by Daniel Vlasic )

Planar union of rectangles with sides parallel to the coordinate axis

Computational Geometry

Computational Geometry

Reconstructing Orthogonal Polyhedra from Putative Vertex Sets

Projects & Polygon Triangulation

Orthogonal art galleries with holes: a coloring proof of Aggarwal s Theorem

Geometric Data Structures

Convex Hull of the Union of Convex Objects in the Plane: an Adaptive Analysis

As a consequence of the operation, there are new incidences between edges and triangles that did not exist in K; see Figure II.9.

Mesh Generation. Quadtrees. Geometric Algorithms. Lecture 9: Quadtrees

EULER S FORMULA AND THE FIVE COLOR THEOREM

Drawing Planar Graphs

CS S Lecture February 13, 2017

T. Biedl and B. Genc. 1 Introduction

Computational Geometry: Lecture 5

Range Tree Applications in Computational Geometry

Eulerian disjoint paths problem in grid graphs is NP-complete

Computational Geometry Algorithmische Geometrie

The Helly Number of the Prime-coordinate Point Set

4. Conclusion. 5. Acknowledgment. 6. References

[Me] Meisters, G. H., Polygons have ears, American Mathematical Monthly, June/July 1975, pp

A Constant-Factor Approximation Algorithm for Optimal Terrain Guarding

Lecture 3 February 9, 2010

Approximation Algorithms for the Unit Disk Cover Problem in 2D and 3D

Geometry. Geometric Graphs with Few Disjoint Edges. G. Tóth 1,2 and P. Valtr 2,3. 1. Introduction

arxiv: v1 [math.co] 7 Dec 2018

However, this is not always true! For example, this fails if both A and B are closed and unbounded (find an example).

Embedded Subgraph Isomorphism and Related Problems

Theoretical Computer Science

Derrick Stolee. April 12,

Gardener s spline curve

Fundamental Properties of Graphs

An Eternal Domination Problem in Grids

On Graphs Supported by Line Sets

APPROXIMATING THE MAXMIN AND MINMAX AREA TRIANGULATIONS USING ANGULAR CONSTRAINTS. J. Mark Keil, Tzvetalin S. Vassilev

CS 372: Computational Geometry Lecture 3 Line Segment Intersection

The Unified Segment Tree and its Application to the Rectangle Intersection Problem

Reachability on a region bounded by two attached squares

Planar Point Location

arxiv: v5 [cs.dm] 9 May 2016

ON THE EMPTY CONVEX PARTITION OF A FINITE SET IN THE PLANE**

Straight-Line Drawings of 2-Outerplanar Graphs on Two Curves

Motivation: Art gallery problem. Polygon decomposition. Art gallery problem: upper bound. Art gallery problem: lower bound

Pebble Sets in Convex Polygons

VORONOI DIAGRAM PETR FELKEL. FEL CTU PRAGUE Based on [Berg] and [Mount]

Minimum-Link Watchman Tours

This blog addresses the question: how do we determine the intersection of two circles in the Cartesian plane?

Ma/CS 6b Class 11: Kuratowski and Coloring

Transcription:

Visibility: Finding the Staircase Kernel in Orthogonal Polygons 8 Visibility: Finding the Staircase Kernel in Orthogonal Polygons Tzvetalin S. Vassilev, Nipissing University, Canada Stefan Pape, Nipissing University, Canada We consider the problem of finding the staircase kernel in orthogonal polygons, with or without holes, in the plane. Orthogonal polygon is a simple polygon in the plane whose sides are either horizontal or vertical. We generalize the notion of visibility in the following way: We say that two points a and b in an orthogonal polygon P are visible to each other via staircase paths if and only if there exist an orthogonal chain connecting a and b and lying entirely in the interior of P. Furthermore, the orthogonal chain should have the property that the angles between the consecutive segments in the chain are either +90 or 90, and these should alternate along the chain. There are two principal types of staircases, NW-SE and NE-SW. The notion of staircase visibility has been studied in the literature for the last three decades. Based on this notion we can generalize the notion of starshapedness. A polygon P is called star-shaped under staircase visibility, or simply s-star if and only if there is nonempty set of points S in the interior of P, such that any point of S sees any point of P via staircase path. The largest such set of points is called the staircase kernel of P and denoted ker P. Our work is motivated by the work of Breen [1]. She proves that the staircase kernel of an orthogonal polygon without holes is the intersection of all maximal orthogonally convex polygons contained in it. We extend Breen's results for the case when the orthogonal polygon has holes. We prove the necessary geometric properties, and use them to derive a quadratic time, O(n2) algorithm for computing the staircase kernel of an orthogonal polygon with holes, having n vertices in total, including the holes' vertices. The algorithm is based on the plane sweep technique, widely used in Computational Geometry [2]. Our result is optimal in the case of orthogonal polygon with holes, since the kernel (as proven) can consist of quadratic number of disjoint regions. In the case of polygon without holes, there is a linear time algorithm by Gewali [3] that is specific to the case of a polygon without holes. We present examples of our algorithm's results. Keywords: computational geometry, polygons with holes, s-stars 79

Essays on Mathematics and Statistics Introduction and Basic Definitions The problem of visibility in polygons is well researched in computational geometry. The well known Art Gallery Problem and its variations [2] is the base problem. To begin, consider a simply connected polygon P in the plane, P is convex if for every point q in P, q is visible from each other point in P. P is nonconvex if there exist points p and q in P such that p is not visible from q via a line segment that lies entirely in the interior of P. Thus not all pairs of points in P have direct visibility. The notion of non-convexity also provides the possibility that P is star-shaped. A polygon P is star-shaped, if there exists a point p such that for each point q in P the line segment pq lies entirely within P. Since there exists such a point p we want to find the core set of p, the set of all such points that see all other points in P. The core set of all points p will be referred to as the kernel of P. The kernel of a polygon is the intersection of all its interior half-planes, an algorithm to find the kernel was constructed to run in O(n) time. However, not all polygons are star-shaped. We can define similar notions of visibility for the restricted class of orthogonal polygons. A polygon P in the plane is orthogonal if its edges are parallel to the coordinate axes, thus its edges meet at right-angles, and the interior angle at each vertex is either 90 or 270. The orthogonal polygons, also called rectilinear polygons have received a lot of attention in the Computational Geometry literature due to their applicability to planar layouts and many problems in automated motion planning. We introduce visibility via orthogonal paths as follows. A polygonal path in R 2 from point p to point q is referred to as a orthogonal path if its edges are parallel to the coordinate axes and alternate in direction, and thus p "sees" q. Trivially, from the definition, every simply connected orthogonal polygon is convex under this notion of visibility. Now, consider the restriction that the can only travel North West/South East or North East/South West. Such a path is called staircase path. This restriction does not guarantee that every orthogonal polygon is convex, refer to the polygon in Figure 1, there is a pair of points that are not visible to each other via staircase path. However a question now arises, is the orthogonal polygon star-shaped? Is there a point p that sees all other points via restricted staircases, which will now be referred to as staircase paths? An orthogonal polygon P is star-shaped via staircase paths, or s-star if there is a point p in P that sees every other point of P via staircase paths. This gives rise to the question of this research, how to find the core sets of all such points p, which will be referred to as the staircase kernel of P. The polygon in Figure 1 is not star-shaped under the normal definition, but is star-shaped under the definition of staircase visibility. Figure 1. A Polygon that is s-star 80

Visibility: Finding the Staircase Kernel in Orthogonal Polygons Previous Work There have been several papers on the subject of staircase visibility, and orthogonal polygons. The question was studied from the point of view of deciding whether a polygon is s-star, and if not whether it can be decomposed into s-stars. The latter question gives rise to the approach of finding the visibility graph of the decomposition and finding the staircase kernel using the visibility graph. This approach is used by Motwani et al. [4] to obtain quadratic, O(n2) algorithm for the problem in case of simply connected orthogonal polygon with holes. Interesting geometric properties were proved by Breen in her 1992 paper [1]. She characterizes the staircase kernel through maximal orthogonally convex (sub)polygons. Here we mention few of her most important results: Lemma 1. If P is an orthogonal polygon, then P contains finitely many maximal orthogonal convex polygons. Moreover, every orthogonally convex polygon in P lies in a maximal orthogonally convex polygon in P. Lemma 2. Let x, y, z be points in P, and let 1, 2, 3 be staircase paths joining x to y, y to z, and x to z, respectively. Then the bounded region T determined by = 1 2 3 is an orthogonally convex polygon. Theorem 1. Let P be a simply connected orthogonal polygon which is starshaped via staircase paths. Then (1) the staircase kernel of P is the intersection of all maximal orthogonal convex polygons in P and (2) is again an orthogonally convex polygon. We draw upon Breen's work, since her results are of highly algorithmic nature, although she was not concerned with the algorithmic aspects or applications. Further, there is one more relevant result on the subject. In [3], Gewali gives linear time algorithm, O(n), for the staircase kernel of an orthogonal polygon without holes. Although this result appeared three years later than Breen's work, it does not seem to refer to it or use any ideas. The author uses ad-hoc approach to derive the algorithmic result. Our Approach We extend the result of Breen to simply connected orthogonal polygons with holes. Then, we devise an algorithm for finding the kernel of an s-star based on the line sweep technique. The algorithm is robust in the sense that it recognizes the situations when the polygon is not s-star, i.e. the kernel is empty. It also recognizes the situation when a polygon with holes has connected kernel. Normally, the kernel contains quadratic number, O(n2), of disjoint components as shown in Figure 2. The kernel is shown in green. Thus, any quadratic time algorithm that computes it is worst-case optimal. 81

Essays on Mathematics and Statistics Figure 2. Kernel Consisting of Quadratic Number of Disjoint Components Key to our approach, besides the use of line sweep, is the fact that we decompose the input polygon into rectangles. The main motivation for this is that decomposing the polygon into maximal orthogonally convex subpolygons might not be algorithmically nice. Further, the maximally orthogonal subpolygons will be in general complex (as complex as linear in the size of the input) and their intersection, therefore much more complex than intersecting two rectangles, which is constant time operation, O(1). The correctness of our approach lies upon the following two geometric properties. Lemma 3 (Parallel Corridor Lemma). If a horizontal (or vertical) line intersects an orthogonal polygon P, and the intersection consists of two or more disjoint line segments, then none of the regions immediately adjacent to the line is part of the staircase kernel. Proof. The situation is illustrated in Figure 3. The fact that none of the regions adjacent to the sweep line is part of the kernel follows directly from the violation of the definition of staircase visibility, as shown in the figure. As proven, the kernel, or any part of it when it consists of disjoint parts has to be orthogonally convex. Here the horizontal (or vertical, in the case of vertical line) convexity is violated. Lemma 4 (Pocket lemma). If a horizontal (or vertical) line intersects an orthogonal polygon P such that the intersection is non-convex, and the next (previous) position of the sweep line is also non-convex, but with smaller number of disjoint segments, then the entire part of the polygon below the second line does not contain any part of the kernel. Proof. The situation is illustrated in Figure 4. What the lemma says is that if we perform a horizontal line sweep, top-down and we are going through parallel corridors, they are not part of the kernel, as proven in Lemma 3. Here, a stronger statement is true. Consider the region (or regions) that is (are) becoming closed, while some other regions are still extending down. We call such a closing region a pocket. In the figure, the pocket is the leftmost of the three parallel corridors. It is clear that any point in the pocket cannot be visible via staircase paths of either type from any point below the sweep line past the "bottom" of the pocket. Thus, the part of the polygon below the "bottom" of the pocket cannot contain any points from the kernel of the polygon. 82

Visibility: Finding the Staircase Kernel in Orthogonal Polygons Figure 3. Parallel Corridor Lemma, Violation of the Staircase Visibility Conditions Figure 4. Pocket Lemma, Violation of the Staircase Visibility Condition Note that the Pocket Lemma is more versatile than it seems. It can be applied in either direction, i.e. if we get another parallel corridor, while sweeping through parallel corridors, then nothing previously seen sees that pocket, therefore we have no part of the kernel in the already swept part of the polygon. Algorithmically, one can do two passes of sweeping in the same direction - one top-down, and one bottom-up. Same applies to the vertical 83

Essays on Mathematics and Statistics sweeps with respect to both lemmas. Now, we have a solid basis to formulate our algorithmic approach. The Algorithm Algorithm StaircaseKernel(P) Input: An orthogonal polygon P R 2, possibly with holes. Output: List K containing the staircase kernel of P. 1. Build two lists EX, EY containing the horizontal and vertical edges of P, respectively, sorted. 2. Use EX to perform horizontal line sweep of P in the following way: 3. if the next edge e in EX is a single edge 4. then close the current region(s), add them to the list XR 5. if there is more than one region 6. then mark each of them as impossible 7. else mark the current region as possible 8. if the edge e is not adjacent to any of the current regions 9. then exit the vertical sweep, go to 12. 10. else start a new region with a top edge e 11. else perform steps 4-10 for each of the edges ei with same x-coordinate simultaneously 12. Use EY to perform vertical line sweep of P in the following way: 13. if the next edge e in EY is a single edge 14. then close the current region(s), add them to the list YR 15. if there is more than one region 16. then mark each of them as impossible 17. else mark the current region as possible 18. if the edge e is not adjacent to any of the current regions 19. then exit the vertical sweep, go to 22 20. else start a new region with a left edge e 21. else perform steps 14-20 for each of the edges e i with same y- coordinate simultaneously 22. Obtain the list HR from the list XR by eliminating all the impossible regions from XR 23. Obtain the list VR from the list YR by eliminating all the impossible regions from YR 24. if either HR or VR is empty, report K is empty, exit 25. Obtain the list K[i, j] by intersecting each entry i in HR with each entry j from VR 26. if K is empty, report and exit 27. for i := 1 to HR 28. for j := 1 to VR -1 do 29. if K[i, j] and K[i, j + 1] are disjoint 30. then if P has no holes report K is empty, exit 31. else skip to the next iteration on i 32. K[i, j + 1] := K[i, j] K[i, j + 1] 33. report K 84

Analysis of the Algorithm Visibility: Finding the Staircase Kernel in Orthogonal Polygons Theorem 2. The algorithm StaircaseKernel(P) computes correctly the staircase kernel of an orthogonal polygon P, possibly with holes, in quadratic time and space, O(n2), where n is the total number of vertices in P, including holes' vertices. Proof. The correctness of the computation of the kernel follows from the theoretical considerations earlier in the paper, in particular, Theorem 1 and Lemmas 1 through 4. The timing analysis follows. Computing the sorted lists of horizontal and vertical edges, EX and EY in line 1 takes O(n log n) time, since each of them is of at most O(n) size. The horizontal line sweep, lines 2-11, and the vertical line sweep, lines 12-21 take O(n log n) time each. This is due to the fact that we have to use balanced binary search trees as a status structure. This is done in the standard way shown in [2], with one exception. When we encounter edges that are sharing the same x (or y) coordinate, we have to deal with them simultaneously, due to the nature of our problem here. However, it is clear that the new regions created are at most one per new edge, all the current regions are closed and marked/labeled correctly as per Lemmas 3 and 4. Further, because of charging each new region to its top/left edge, the size of the lists that we create, HR and YR is at most linear in n. Lines 22 and 23 clearly take linear time, O(n). Line 25 takes quadratic time, O(n2). The fragment in lines 27-32 takes quadratic time in total, O(n2), due to the fact that each of the operations inside the two nested loops of size O(n) each is performed in constant time: union or checking for intersection of rectangles. Note that here we take union and check for intersection of two rectangles that are not in general position with respect to each other. Here the two rectangles are part of the same horizontal strip given by the initial i-th entry in HR. Line 33 takes at most O(n2) time. Finally, lines 24 and 26 are performed in constant time, O(1). Examples In this section we present experimental results of our algorithm on polygons covering the most typical cases. The first example, the H polygon shows an orthogonal polygon with holes that has nonempty kernel. The second example, the so-called amoeba shows another orthogonal polygon with holes that has non-empty kernel. The purpose of this example is to illustrate the elimination of the "false" parts of the kernel. The third example, the double E polygon is a polygon that has no holes, but is not an s-star, i.e. its staircase kernel is empty. Our final example, the so-called teapot is an orthogonal polygon with holes, and its kernel consists of disjoint parts. 85

Essays on Mathematics and Statistics The H Polygon Figure 5. The Horizontal Convex Regions, Vertical Convex Regions, and the Staircase Kernel of the H Polygon The Amoeba Figure 6. The Amoeba Polygon 86

Visibility: Finding the Staircase Kernel in Orthogonal Polygons Figure 7. The Horizontal Convex Regions and Vertical Convex Regions of the Amoeba Polygon Figure 8. The Intersection of the Regions and the Kernel of the Amoeba Polygon 87

Essays on Mathematics and Statistics The Double E Figure 9. The Double E Polygon and its Horizontal and Vertical Convex Regions Figure 10. The Intersection of the Regions for the Double E Polygon, the Kernel is Disjoint, i.e. not an s-star 88

Visibility: Finding the Staircase Kernel in Orthogonal Polygons The Teapot Figure 11. The Teapot Polygon and its Horizontal and Vertical Convex Regions Figure 12. The Staircase Kernel of the Teapot Polygon Acknowledgements Dr. Tzvetalin Vassilev's research is supported by NSERC Discovery Grant. Stefan Pape wants to acknowledge the supervision of Dr. Vassilev during the work on this project. Both authors would like to acknowledge the help of Dr. Marilyn Breen during the work on this paper. References [1] Marilyn Breen. Staircase kernel in orthogonal polygons. Archiv der Mathematik, 59:588-594, 1992. [2] Mark de Berg, O. Cheong, Marc van Kreveld, and Mark Overmars. Computational Geometry: Algorithms and Applications, 3rd Edition. Springer-Verlag, 2008. [3] Laxmi P. Gewali. Recognizing s-star polygons. Pattern Recognition, 28(7):1019-1032, 1995. [4] Rajeev Motwani, Arvind Raghunathan, and Huzur Saran. Covering orthogonal polygons with star polygons: The perfect graph approach. In Symposium on Computational Geometry'88, pages 211-223, 1988. 89