 # Vertex guarding for dynamic orthogonal art galleries

Given an orthogonal polygon with orthogonal holes, we devise a dynamic algorithm for guarding with vertex guards, i.e., whenever orthogonal polygon is modified, algorithm updates the set of vertex guards and their positions for guarding the modified orthogonal polygon. Our algorithm modifies the guard placement locally while ensuring the updated orthogonal polygon with h holes and n vertices, is guarded using at most ⌊ (n+2h)/4 ⌋ vertex guards. The algorithm to update vertex guards after any modification to the polygon takes O(k (n+ n')) amortized time. Here, n' and n are the number of vertices of the orthogonal polygon before and after the update, respectively; and, k is the sum of the number of vertices added to or removed from the orthogonal polygon, the number of cuts in the L-shaped partitioning of the free space of the orthogonal polygon that got affected due to the update, and the number of channels affected due to the update. For the special case of the initial orthogonal polygon being hole-free, and each update resulting in a hole-free orthogonal polygon, our dynamic guard updating algorithm takes O(k(n+n')) worst-case time. Initially, we preprocess the input orthogonal polygon with q vertices in O(q q) time to construct data structures of size O(qq/q).

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Any two points in a simple polygon are said to be visible to each other whenever the line segment joining and contains no point on the exterior of . Given a polygon , the art gallery problem seeks to locate a set of guards in such that (i) every point in is visible to at least one guard in , and (ii) the cardinality of is the minimum possible. A guard in is a vertex guard if is located at a vertex of the polygon. Otherwise, is a point guard. If all the guards in are vertex guards, then that polygon is said to have been guarded with vertex guards. In , Chvatal had shown that vertex guards are both necessary and sufficient to guard a simple polygon. A different and simpler sufficiency proof of the same result was given in by Fisk in . Based on the proof given in , Avis and Toussaint devised an algorithm to position the vertex guards in time. Several algorithms for visibility computation are detailed in the text by Ghosh in . Both the visibility and art gallery problems, algorithms, and hardness results are presented in  by O’ Rourke. Algorithms for a number of guarding and illumination problems are presented in .

An orthogonal polygon is one whose edges are aligned with a pair of orthogonal coordinate axes, which we take to be horizontal and vertical, without losing generality. Thus the edges alternate between horizontal and vertical, and always meet orthogonally, with internal angles either or . The orthogonal polygons are useful as approximations to simple polygons, and they arise naturally in several domains, ex., computer graphics, VLSI design, and architecture. First, Kahn et al. gave the orthogonal art gallery theorem in . They showed that vertex guards are occasionally necessary and always sufficient to guard the orthogonal polygon with vertices. Their algorithm partitions the orthogonal polygon into convex quadrilaterals, and uses the ideas in  to color the vertices of the orthogonal polygon using at most vertex guards. An time algorithm for convex quadrilateralization was presented by Sack in . A simpler algorithm for convex quadrilateralization was presented by Lubiw in , which also takes worst-case time. O’Rourke in  gave a different approach to show vertex guards are sufficient to guard any orthogonal art gallery with vertices. The algorithm in  partitions the given orthogonal polygon into L-shaped orthogonal polygons in time, rather than convex quadrilaterals. (The main ideas of this algorithm are presented in Section 2.) The problem of finding the minimum number of vertex guards to guard the given orthogonal polygon is known to be NP-hard (refer [16, 22]), and there are a number of approximation algorithms devised for this problem (refer [14, 9, 15, 3]). The text by O’ Rourke  gives a detailed presentation of various well-known algorithms for guarding orthogonal art galleries.

By applying the convex quadrilaterlization algorithm in  to an orthogonal polygon with holes, O’Rourke  had shown that vertex guards are sufficient to guard any orthogonal polygon with holes and vertices. Nevertheless, no examples of orthogonal polygons with holes are known to require more than vertex guards. Aggarwal  established that vertex guards suffice for and . Aggarwal  and Shermer  respectively conjectured that and vertex guards are sufficient to guard any orthogonal polygon with number of holes and number of vertices. A simple polygon containing number of disjoint simple polygonal holes within it is termed polygonal domain . The free space of the given polygonal domain is defined as the closure of , excluding the union of the interior of polygons contained in . Bjorling-Sachs and Souvaine  studied the problem of guarding the free space of any polygon domain with holes and vertices; they devised an worst-case time algorithm to place point guards to guard .

When an orthogonal polygon is modified, instead of applying any of the algorithms mentioned above, it is desirable to have a dynamic algorithm, which essentially changes the set of guards and their positions locally with respect to the recent modification of the orthogonal polygon. The proposed algorithm is dynamic in the sense that the vertex guarding is locally modified where necessary after each update in a long sequence of updates to the orthogonal polygon. In the context of maintaining the guards of a polygonal art gallery, an algorithm is called incremental if it updates the guards whenever a polygonal region is unioned with the polygonal art gallery being guarded. Similarly, an algorithm is called decremental if it updates the guards and their positions whenever a polygonal section of the art gallery is removed. If the algorithm is both incremental and decremental, then it is termed fully dynamic. Both Inkulu and Nitish , and Inkulu et al.  devised fully dynamic algorithms for maintaining the visibility polygon of a query point in a dynamic simple polygon. Choudhury and Inkulu  devised a fully dynamic algorithm for maintaining the visibility graph of a dynamic simple polygon. A recent result by Agrawal and Inkulu  addresses the visibility polygon queries among dynamic simple polygonal obstacles in the plane.

### Our results

In this paper, a fully dynamic algorithm for updating the set of vertex guards and repositioning a subset of the current set of vertex guards is proposed in the presence of dynamic updates to any orthogonal polygon with holes. Our dynamic algorithm uses at most vertex guards when the updated polygon has vertices and orthogonal holes. (Note that guarding the given polygon with the optimal number of guards or its approximation is not our objective.) Our algorithm modifies the guard placement locally around the newly modified section of the orthogonal polygon, and it takes amortized time. Here, and are the number of vertices of the orthogonal polygon before and after the update, respectively; is the sum of the number of vertices added to or deleted from the orthogonal polygon, the number of cuts in the L-shaped partitioning of the polygon that got affected due to the modification to the orthogonal polygon, and the number of affected channels (detailed later) in the polygon. When there are no holes in the initial input orthogonal polygon as well as in subsequent orthogonal polygons resultant of updates, our guard updating algorithm takes worst-case time. The initial orthogonal polygon (the one before any modifications) with vertices is preprocessed in time to construct a few data structures of size as well as to vertex guard . We note that in the time complexities of algorithms for both the orthogonal polygon with holes as well as without holes is ; indeed, since the dynamic updates to the polygon are typically local, the value of is in general much smaller to ; hence, our algorithm is in general efficient in handling dynamic updates as compared to applying any of the traditional guarding algorithms to the entire polygon. To our knowledge, this is the first algorithm for guarding a dynamic art gallery. This algorithm obviates guarding the entire orthogonal polygon whenever a small section of the polygon is modified.

We reduce the problem of vertex guarding any orthogonal polygon with vertices and holes to the problem of vertex guarding a hole-free orthogonal polygon with vertices. This is accomplished by constructing horizontal channels in the free space of the orthogonal polygon with holes. We specialize the channel notion in Bjorling-Sachs and Souvaine  to orthogonal polygons with orthogonal holes. Mainly, after every update to the orthogonal polygon with holes, we update the relevant channels to transform it into a hole-free orthogonal polygon. Then we update the guarding of that hole-free orthogonal polygon using the algorithm for dynamic hole-free orthogonal polygons. Let be a hole-free orthogonal polygon just before an update. Also, let be the orthogonal polygon just after an update to . We trace the boundary of the section of the hole-free orthogonal polygon in , whose guarding may need to be updated. We independently vertex guard using the algorithm in . The vertex guards computed for together with the vertex guards located in together are shown to guard . Notably, if is the number of vertices of , our algorithm places at most vertex guards to guard . As mentioned above, we maintain the hole-free orthogonal polygon with vertices corresponding to an orthogonal polygon with holes and vertices, such that . Before any modification to the initial input orthogonal polygon with holes defined with vertices, by removing channels from , we compute a hole-free orthogonal polygon . Then using the algorithm in , we preprocess to vertex guard by partitioning it into L-shaped pieces. In addition, to help efficiently determine cuts in L-shaped partitioning that are affected due to the section of the modified polygon and to maintain channels efficiently in the updated polygon, we construct a few data structures in the preprocessing phase.

We assume the initial orthogonal polygon and every orthogonal polygon that is resulted due to updates, are in general position, i.e., there are no two reflex vertices that are visible to each other either along a vertical line segment or along a horizontal line segment. Unless specified otherwise, the term polygon in this paper refers to an orthogonal polygon. A hole-free orthogonal polygon is also called a piece. For any hole-free orthogonal polygon , the reflex parity of is the parity of the number of reflex vertices of . The initial input polygon that is preprocessed is denoted by . We denote any polygon just before the update with and any polygon after the update with . The orthogonal polygon is called an updated (orthogonal) polygon. Further, we let , and be the number of vertices of , and , respectively. Also, is the number of holes in . For any simple polygon , the boundary of is denoted by .

Section 2 details an algorithm for vertex guarding dynamic hole-free orthogonal polygons. The algorithm to update the vertex guards of a dynamic orthogonal polygon with orthogonal holes is presented in Section 3. The conclusions are in Section 4.

## 2 Handling updates in a dynamic hole-free orthogonal polygon

In this section, we devise an algorithm to update the vertex guards, when the initial input orthogonal polygon is hole-free, and each update also leads to a hole-free orthogonal polygon. The input polygon is preprocessed to compute a few data structures, and to partition into L-shaped pieces, in turn, guarding using at most vertex guards. In the updating algorithm, we separate an orthogonal polygon from the updated polygon whose vertex guarding may need to be updated, and we independently guard . In Subsection 2.1, we define a few properties of , and the algorithm to separate from is given in Subsection 2.2.

### 2.1 Characterizing the affected region of P

We first briefly present a few observations from . It is known that vertex guards are occasionally necessary and always sufficient to guard any orthogonal art gallery with vertices. Since a single vertex guard can guard any L-shaped orthogonal polygon, to guard any orthogonal polygon with vertices, it suffices to partition into at most L-shaped orthogonal polygons. Let be the number of reflex vertices of . Then, it is immediate to note that . Hence, , or . Therefore, to guard using at most guards, it is sufficient to partition into L-shaped pieces. In an orthogonal polygon , for any reflex vertex , the horizontal cut (resp. vertical cut) incident to is the horizontal (resp. vertical) line segment joining with a point on the boundary of such that the open line segment is located interior to . A horizontal or vertical cut that is incident to a reflex vertex resolves , i.e., vertex is no longer reflex in either of the two pieces of the partition determined by . A cut is said to be an odd cut if at least one of the two pieces determined by

has an odd number of reflex vertices. The main observation in

 is that the odd cuts help in devising a natural divide-and-conquer algorithm to partition the orthogonal polygon into L-shaped pieces: If we partition an orthogonal polygon by cutting along any odd cut , the two pieces that are determined by can be partitioned into L-shaped pieces independently. Let be an odd cut of (such that partitions into two pieces). Also, let and be the number of reflex vertices in each of the pieces determined by , without losing generality, say, is odd. Then, as , and since is odd, it is immediate that . This says that if the piece with reflex vertices can be partitioned into at most L-shaped pieces, and the piece with reflex vertices can be partitioned into at most L-shaped pieces, then can be partitioned into at most L-shaped pieces, provided that has an odd cut. However, as shown in , for any orthogonal polygon in general position, it is guaranteed that there exists an odd cut in . Therefore, it is evident that to partition any orthogonal polygon into L-shaped pieces algorithm needs to find odd cuts efficiently. No other detail from  is needed to understand the rest of the paper. We also like to mention that in the below descriptions, replacing all the horizontal cuts with respective vertical cuts and replacing all the vertical cuts with respective horizontal cuts, does not affect the correctness. Figure 1: Illustrating type-I updates: R is subtracted from P′ (left), and R is unioned with P′ (right). The boundary of R is shown in red color. Figure 2: Illustrating type-II updates: R is unioned with P′ while a staicase belongs to both bd(R) and bd(P′) (left), and two reflex vertices a,b in P both of which are incident on an edge of P′ (right). The boundary of R is shown in red color.

We first preprocess the orthogonal input polygon using the algorithm in . We note that this algorithm partitions into L-shaped pieces, and it places one vertex guard at the reflex vertex of every L-shaped piece. Let be an orthogonal polygon just before any update. We support the following two types of updates to . In a type-I update, an orthogonal polygon with even reflex parity is subtracted from (resp. unioned with) while is positioned such that (a) is interior (resp. exeterior) to , and (b) an edge of is abutting a section of an edge of or an edge of is abutting a section of an edge of . (Refer to Fig. 1.) In a type-II update, an orthogonal polygon is unioned with while the reflex parities of both the polygons and are same and is positioned such that (a) it is exterior to , and (b) it abuts along a rectilinear staircase on . (Refer to Fig. 2.) We remind that a section of an edge is a special case of a staircase.

We note the type-I and type-II updates together are exhaustive with respect to possible updates while being a simply connected orthogonal polygon, except for the parity restriction imposed on in the type-II update. In the following, by giving an example construction, we show without this restriction, every guard in needs to be repositioned to guard with vertices using at most vertex guards. The orthogonal polygon in Fig. 3(a) has vertices, and it can be guarded using two guards. By attaching two rectangles in two successive type-II updates, one touching edge , and the other touching edge of , the resultant polygon after these two updates is shown in Fig. 3(b), and the new polygon can be guarded using guards. However, positions of all the vertex guards for surveying polygon in Fig. 3(a) need to be repositioned for guarding the polygon in Fig. 3(b) using at most vertex guards. Figure 3: Illustrating two rectangles attached to the left polygon yielding the polygon in right; specifically, guarding the right polygon requires relocating all the vertex guards of the left polygon.

Extending this argument, for a polygon of analogous shape (a contiguous sequence of L-shapes) with an asymptotically large number of reflex vertices, say , when is updated as mentioned above, to meet the upper bound on the number of vertex guards, it necessitates relocating vertex guards in . Figure 4: Illustrating an affected cut ef, since ef is incident on an affected cut ab. Note that since ab intersects R, ab is an affected cut.

A cut in the updated orthogonal polygon is said to be an affected cut whenever intersects the polygon removed from , or is incident to a cut that intersects . (Refer to Fig. 4.) A cut that is not an affected cut is called an unaffected cut. Note that, if , then the maximal line segment of that abuts , is essentially an affected cut in . Further, every cut that is incident to is also an affected cut.

Without loss of generality, we assume the polygon has an odd number of reflex vertices. Otherwise, as in , we can introduce an additional reflex vertex by removing a rectangular chip around a vertex, and adding that chip back after guarding the rest of the orthogonal polygon. As detailed in , the advantage of having an odd number of reflex vertices is that if we split the polygon into two by cutting along an odd cut, then the parity of all the cuts in two smaller polygons remain unchanged. Figure 5: Illustrating unaffected (vertical) cuts ab, cd, and ef in P′, which remain unaffected cuts in P as well. The shaded region is the polygon R′.

This fact does not hold for polygons with an even number of reflex vertices.

We note that for any unaffected horizontal odd cut in , the newly introduced reflex vertices in (that are not present in ) are to one of the sides of . Since the reflex parity of both and is odd, all unaffected horizontal odd cuts remain horizontal odd cuts after modifying with a type-I or a type-II update.

###### Observation 1.

If is an unaffected horizontal odd cut in a hole-free orthogonal polygon , then is an horizontal odd cut in .

In specific, cutting along all unaffected horizontal cuts lead to a set of polygons, with each polygon in having only vertical cuts. Indeed, as noted in , each polygon in is a union of two histograms, both having the same horizontal line segment as their base. Essentially, as all unaffected vertical and horizontal cuts are odd cuts, we separate the affected region from by cutting along a subset of these cuts. Here, is a minimum sized orthogonal polygon that intersects all the affected cuts in . (Refer to Fig. 5.) The following observation is helpful for our algorithm.

###### Observation 2.

For any unaffected cut of any hole-free orthogonal polygon with an odd number of reflex vertices, the parity of remains same after removing the affected region from .

Since is an orthogonal polygon, for guarding , we use the algorithm in . From the following observation, the number of vertex guards used to guard is at most .

###### Observation 3.

Let (resp. ) be the set comprising of vertex guards to guard (resp. ) determined by applying the algorithm in  to (resp. ). As each edge of is an odd cut in , the cardinality of is upper bounded by .

In the following section, we describe an algorithm to compute the affected region efficiently.

### 2.2 Algorithm for separating the affected region R′ from P

To help in finding the affected region efficiently, in the preprocessing phase, we construct a data structure comprising of all the horizontal cuts in . The is constructed using the preprocessing algorithm for finding all the horizontal line segments that intersect any vertical line segment, which is from . At the end of processing any update to , our algorithm ensures precisely comprises of horizontal cuts in . This data structure helps in finding all the horizontal cuts that intersect each vertical edge of . By removing each affected horizontal cut that is reported to have been intersected with a vertical edge of from , we ensure that no affected horizontal cut is reported more than once. Analogously, we find all the vertical cuts that intersect with horizontal edges of (i.e., by maintaining vertical cuts of in a data structure similar to ). Figure 6: Illustrating the horizontal cuts c1,c2, and c3. The endpoints of these cuts which lie on the vertical edge e are stored in a max-heap, with their respective y coordinates as keys of the max-heap. Also, illustrates the cut c2 that has the maximum y-coordinate among all the unaffected horizontal cuts incident to edge e.

Since any odd cut whose one endpoint lies on an affected odd cut is also an affected cut, next, we describe how to determine all such affected odd cuts. We maintain two heaps (one max heap and one min heap) for each cut in the polygon and one heap for each edge of the polygon. These heaps, help in efficiently tracing , in specific, by finding vertices of in the clockwise order of their occurrence along .

Let be any horizontal cut. Also, let be the set comprising of all the vertical cuts that are intersecting . Then, the bottom (resp. top) endpoint of each cut that is lying above (resp. below) is stored in a max heap (resp. min-heap) associated with . Analogously, endpoints of cuts that are incident on a vertical cut are also distributed into two heaps. For each edge , either a max heap or a min-heap is maintained with . For a vertical edge that is bounding from the right (resp. left), all the horizontal cuts that intersect are stored in a max heap (resp. min-heap) associated with . Analogously, each horizontal edge of is associated with a heap. (Refer to Fig. 6.)

Naturally, the affected region is found by determining the vertices of . These vertices are found while traversing in the clockwise direction, starting from an arbitrary vertex of that is located on an edge of . We first note that each vertex of is either a vertex of , or a vertex of , or an endpoint of an unaffected cut. In specific, vertex is guaranteed to be a vertex of . We find the vertex of that is closest to in the clockwise direction along the , by using the heap associated with the edge on which is lying. Analogously, we find the next vertex in the clockwise direction that is closest to along the boundary of by using the heap associated with the edge or a cut that occurs next to . Our traversal algorithm essentially determines the specific heap used for each cut encountered during the traversal. The algorithm continues to find vertices of the affected region till , the vertex from where the traversal started, is again found by the algorithm.

Given a hole-free orthgonal polygon defined with vertices, we preprocess in time to construct data structures of size so that whenever any orthogonal polygon , which is obtained by a sequence of type-I and type-II updates to , is updated to an orthogonal polygon , the algorithm takes worst-case time to guard using at most vertex guards. Here, and are the number of vertices of and respectively, and is the sum of the number of vertices added to or removed from and the number of affected cuts in .

###### Proof.

In Subsection 2.1, we had shown that all the unaffected odd cuts remain odd cuts. Following the argument in , we can always cut any orthogonal polygon at an odd cut and guard the two smaller pieces defined by that cut independently; and, for any orthogonal polygon in general position, it is guaranteed that there exists an odd cut in . The affected region is separated from by cutting along a subset of unaffected cuts which together separate a minimal sized polygon that contains all the affected cuts from . These unaffected cuts together define . The orthogonal polygon has L-shaped partitioning, and it is guarded in using at most vertex guards, where is the number of vertices of . The orthogonal polygon is guarded using the algorithm described in ; hence, the number of vertex guards to guard is upper bounded by , where is the number of vertices of . Since every unaffected cut in is shown to be an odd cut, is at most .

The preprocessing involves L-shaped partitioning using , constructing the data structure following , and the heaps, which together take time, and the size of these structures is . Let be the number of affected cuts in . Also, let be the number of vertices of . It is immediate to note the number of vertices of is . Hence, the number of L-shaped pieces in is , i.e., . Using the query algorithm in  for outputting the intersection of dynamic horizontal (resp. vertical) line segments with a vertical (resp. horizontal) line segment, finding all the affected cuts together takes worst-case time. Removing the affected cuts from the respective heaps takes worst-case time. The algorithm in  takes time in the worst-case to guard as well as to yield an L-shaped partitioning of . From , introducing entries corresponding to cuts generated by L-shaped partitioning of into takes worst-case time. Updating heaps by inserting cuts generated by L-shaped partitioning of together take worst-case time. ∎

## 3 Handling updates in a dynamic orthogonal polygon with holes

In this section, we devise an algorithm to dynamically update vertex guards in guarding a dynamic orthogonal polygon with (dynamic orthogonal) holes. Like in , by joining every hole to another hole or the exterior boundary of the polygon with channels, we reduce the problem of guarding an orthogonal polygon with holes to an orthogonal polygon with no holes. To vertex guard the resultant hole-free orthogonal polygon, we use the preprocessing and updating algorithms mentioned in Section 2. Since the channels computed here are for orthogonal polygons, their construction is simpler and are specialized from the channels for polygonal domains given in . In specific, every channel in our algorithm is a thin horizontal rectangle. For any hole of any orthogonal polygon with holes , the (horizontal) channel of is a thin rectangle in the free space of with its top edge the line segment between vertex of that has the maximum -coordinate in (if more than one vertex has the same -coordinate, then is the leftmost one among those) and the leftward horizontal projection of onto another obstacle in or onto the outer boundary of . Figure 7: Illustrating the channel of an obstacle introduced due to a type-III update.

This way of defining ensures that does not strike before striking either another hole of or the exterior boundary of . (Refer to Fig. 7.) Since the channels are thin horizontal rectangles, no two channels intersect. All other properties of channels remain same as presented in . In specific, the following variant of a theorem from  is useful.

###### Proposition 1.

Any orthogonal polygon with holes can be converted to a hole-free orthogonal polygon by removing horizontal channels from .

Every channel introduces three new vertices; however, none of them is reflex. Since the L-shaped partitioning algorithm  places guards at only reflex vertices, no guard is placed at any of the additional vertices introduced by channels. Let be an orthogonal polygon with holes. For any vertex of a hole of with the channel of is incident to , since is guaranteed to be not a vertex in , and since any channel introduces two additional vertices, has a total of vertices. Hence, in guarding , the algorithm is allowed to use at most guards so that these guards together survey . The following proposition formalizes this observation.

###### Proposition 2 (Theorem 3.1, ).

For any orthogonal polygon with holes and the hole-free orthogonal polygon constructed as described, the guard placement of due to the L-shaped partitioning algorithm  guards the free space of using at most vertex guards.

For any current orthogonal polygon with holes , apart from type-I and type-II updates mentioned in Subsection 2.1, we allow a type-III update in which an orthogonal polygon is inserted to the interior of such that does not intersect any hole of as well as the exterior boundary of .

### 3.1 Preprocessing

Given an orthogonal polygon with (orthogonal) holes with vertices, here we describe an algorithm to preprocess to build a few data structures. Also, using the preprocessing algorithm in  for finding the first vertical line segment intersected by a horizontal query ray among a dynamic set of vertical line segments, in amortized time, we build a data structure of size comprising of all the vertical edges of . This data structure mainly helps in efficiently updating any channel that intersects . We also use to compute channels for all the holes of in time: this is accomplished with number of ray shooting queries (with horizontal rays) among the line segments (vertical edges of ) in . Using the preprocessing algorithm in  for finding dynamic set of horizontal line segments that intersect any query vertical line segment, in worst-case time, we build a data structure of size comprising of all the channels (horizontal line segments) in . This data structure helps in efficiently finding all the channels that intersect any vertical edge of the orthogonal polygon that is inserted to any (including ). Apart from this, the preprocessing algorithm in Section 2 is applied to the hole-free orthogonal polygon .

### 3.2 Algorithm to update vertex guards

After any update to , resulting in an orthogonal polygon with holes , using Proposition 1, we transform to an orthogonal polygon with no holes by modifying the channels in . After the channels of are determined, we use the algorithm given in Section 2 to update the vertex guarding of . From Proposition 2, we note the set of vertex guards to guard together guard .

In the following, we devise an efficient algorithm to dynamically transform to by introducing at most one new channel and with updating a subset of existing channels in . When an orthogonal hole is inserted to the current polygon , the polygon may intersect some of the current channels in . (Refer to Fig. 8.) Let be the set of channels that intersect with . We need to update every channel in . Let be a vertex of a hole of on which the channel of is incident. For a channel of a hole with endpoints and , updating involves determining the point on line segment such that belongs to a vertical edge of and the interior of line segment is in the free space of . Essentially, the channel is replaced with a horizontal channel with its top edge being . With the horizontal ray shooting with ray , using the data structure , we determine the point .

In addition, we update the channel in . For number of channels affected due to , computing the updated channels using and inserting the modified channels into together take amortized time. There are only two ways in which any cut in could get affected: one way is due to its intersection with , and the other is due to the reconstruction of the affected channels in . Following the algorithm in Subsection 2.2, we determine all the affected cuts.

For type-I and type-II updates, computing the channels intersected by , and updating these channels together takes amortized time. In worst-case time, we update with the updated affected channels. From Theorem 2.2, finding , guarding , and updating the associate data structures together takes worst-case time. Updating with vertical edges of takes amortized time. Hence, in any type-I or type-II update, the algorithm takes amortized time to modify the guarding, where is . For any type-III update, apart from the computations in type-I and type-II updates, we need to compute the channel due to . Using , doing a ray-shooting query to find the channel of takes amortized time. Like type-I and type-II updates, updating with vertical edges of takes amortized time. As a whole, any type-III update takes amorized time, where is .

Given an orthgonal polygon defined with vertices, we preprocess in time to construct data structures of size so that whenever any orthogonal polygon , which is obtained by a sequence of type-I, type-II, and type-III updates to , is updated to an orthogonal polygon , the algorithm takes amortized time to guard using at most vertex guards. Here, is the number of orthogonal holes in , and are the number of vertices of and respectively, and is the sum of the number of vertices added to or removed from , the number of affected cuts in and the number of affected channels in .

## 4 Conclusions

This paper considered the first dynamic algorithm for an art gallery problem. Specifically, we devised an algorithm to update the set of vertex guards to survey the free space of a dynamic orthogonal polygonal domain. Our algorithm takes amortized time to update the vertex guarding of a dynamic orthogonal polygon with orthogonal holes, and it takes worst-case time to update the vertex guarding of a dynamic hole-free orthogonal polygon. Here, is the number of vertices in the polygon before the update, is the number of vertices in the polygon after the update, and is the sum of the number of affected cuts, the number of affected channels, and the number of vertices added to or removed in the update. One possible extension of this problem is to consider the dynamic art gallery problem for polygonal domains and to guard these polygons using point guards. The other direction could be to maintain a set of guards so that the number of guards is an approximation to the optimal number of guards required to guard a dynamic polygonal domain.

## References

•  A. Aggarwal. The art gallery theorem: its variations, applications and algorithmic aspects. Ph.D. Thesis, Johns Hopkins University, 1984.
•  S. Agrawal and R. Inkulu. Visibility polygon queries among dynamic polygonal obstacles in plane. Accepted to Proceedings of International Computing and Combinatorics Conference, 2020.
•  P. Bhattacharya, S. K. Ghosh, and B." Roy. Approximability of guarding weak visibility polygons. Discrete Applied Mathematics, 228:109–129, 2017.
•  I. Bjorling-Sachs and D. L. Souvaine. An efficient algorithm for guard placement in polygons with holes. Discrete & Computational Geometry, 13:77–109, 1995.
•  T. Choudhury and R. Inkulu. Maintaining the visibility graph of a dynamic simple polygon. In Proceedings of Conference on Algorithms and Discrete Applied Mathematics, pages 42–52, 2019.
•  V. Chvatal. A combinatorial theorem in plane geometry. Journal of Combinatorial Theory, Series B, 18:39–41, 1975.
•  S. Fisk. A short proof of Chvatal’s watchman theorem. Journal of Combinatorial Theory, Series B, 24:374, 1978.
•  S. K. Ghosh. Visibility algorithms in the plane. Cambridge University Press, New York, USA, 2007.
•  S. K. Ghosh. Approximation algorithms for art gallery problems in polygons. Discrete Applied Mathematics, 158(6):718–722, 2010.
•  Y. Giyora and H. Kaplan. Optimal dynamic vertical ray shooting in rectilinear planar subdivisions. In Proceedings of the Symposium on Discrete Algorithms, pages 19–28, 2007.
•  R. Inkulu and T. Nitish. Incremental algorithms to update visibility polygons. In Proceedings of Conference on Algorithms and Discrete Applied Mathematics, pages 205–218, 2017.
•  R. Inkulu, K. Sowmya, and N. P. Thakur. Dynamic algorithms for visibility polygons in simple polygons. Accepted to International Journal of Computational Geometry & Applications (CoRR 1704.08219), 2020.
•  J. Kahn, M. Klawe, and D. Kleitman. Traditional galleries require fewer watchmen. SIAM Journal of Algebraic and Discrete Methods, 4:194–206, 1983.
•  M. J. Katz and G. S. Roisman. On guarding the vertices of rectilinear domains. Computational Geometry, 39(3):219–228, 2008.
•  J. King. Fast vertex guarding for polygons with and without holes. Computational Geometry, 46(3):219–231, 2013.
•  D. T. Lee and A. K. Lin. Computational complexity of art gallery problems, pages 303–309. Springer New York, 1990.
•  A. Lubiw. Decomposing polygonal regions into convex quadrilaterals. In Proceedings of the Symposium on Computational Geometry, pages 97–106, 1985.
•  C. W. Mortensen. Fully dynamic two dimensional range and line segment intersection reporting in logarithmic time. In Proceedings of the Symposium on Discrete Algorithms, pages 618–627, 2003.
•  J. O’ Rourke. An alternate proof of the rectilinear art gallery theorem. Journal of Geometry, 2:118–130, 1983.
•  J. O’ Rourke. Art gallery theorems and algorithms. Oxford University Press, 1987.
•  J. R. Sack and G. Toussaint. Guard placement in rectilinear polygons. Computational Morphology, pages 153–175, 1988.
•  D. Schuchardt and H.-D. Hecker. Two NP-hard art gallery problems for Ortho-polygons. Mathematical Logic Quarterly, 41(2):261–267, 1995.
•  T. Shermer. Polygon guarding II: efficient reduction of triangulation fragments. NYIT Computer Graphics tech report, report 3D-16, 1985.
•  J. Urrutia. Art gallery and illumination problems. In J.-R. Sack and J. Urrutia, editors, Handbook of Computational Geometry, pages 973–1027. North-Holland, 2000.