1 Introduction
Background
In discrete geometry, the Art Gallery problem asks to place a (preferably small) number of guards in a given enclosure, so that the guards collectively see the whole enclosure. Most classic results on the Art Gallery problem are surveyed in [5, 6, 9].
If the enclosure is a simple polygon with vertices and the guards are points, then guards are always sufficient, and there are polygons in which they are also necessary. If the polygon is orthogonal (i.e., its edges meet at right angles), then the optimal number of point guards reduces to . Furthermore, if the orthogonal polygon has holes, it can be guarded by
point guards, as established by O’Rourke (see [5, Theorem 5.1]). Because , where is the number of reflex vertices in the orthogonal polyhgon (as can be proved by a straightforward induction on ), we may express the same upper bound in terms of , as
Even though O’Rourke does not mention this aspect, a careful analysis of his method (a decomposition of the polygon into Lshaped pieces, see [5, Sections 2.5, 2.6]) reveals that, if , all the guards can be chosen to lie on reflex vertices.
More recently, the attention has shifted to 3dimensional enclosures, and especially to polyhedra. Point guards are much less effective in this setting: there exist polyhedra with vertices where guards placed at every vertex do not see the whole interior, and where nonvertex guards are required (refer to [5, Section 10.2.2]). This motivates the study of more powerful guards: an edge guard is a guard that has the extent of an entire edge; a point is visible to an edge guard if and only if there is a point of that sees .
In [3], Cano et al. proved that any polyhedron with edges can be guarded by at most edge guards. For orthogonal polyhedra (i.e., polyhedra whose faces meet at right angles), Urrutia discovered that edge guards are sufficient, and conjectured that are optimal (see [9]). Urrutia’s upper bound was later improved in [1] by Benbernou et al.: an orthogonal polyhedron with edges and genus can be guarded by edge guards; if the polyhedron has reflex edges, then edge guards are sufficient.
Another contribution of [1] was to show that the same upper bounds hold if the edge guards are deprived of their two endpoints: i.e., they hold for open edge guards. This weaker type of guard has been introduced by the author in [10] and has been studied also in [2] and [8]. For a more indepth discussion on this topic and some motivations, refer to [10, Section 3.2].
Our contributions
In this paper we study the Art Gallery problem for 2reflex orthogonal polyhedra, which are orthogonal polyhedra having reflex edges oriented in just two directions, as opposed to three. These polyhedra have been introduced by the author and investigated in the context of face guards in [11]. In Section 2 we motivate the study of this special class of polyhedra, and we establish some terminology.
In Section 3 we prove that
edge guards are sufficient to guard any 2reflex orthogonal polyhedron with reflex edges and genus . This number of edge guards is optimal if . Our strategy places guards on reflex edges only, i.e., we use reflex edge guards. Observe that this is a generalization of O’Rourke’s result for orthogonal polygons mentioned above.
In Section 4 we give a similar bound in terms of the total number of edges : we show that
reflex edge guards are sufficient. For , this reduces the best known bound by roughly . All the above results hold for both closed and open edge guards.
Finally, in Section 5 we show that guard locations achieving the above bounds can be computed in time , where is the size of a representation of the polyhedron.
A preliminary version of this paper has appeared in the author’s Ph.D. thesis, [10].
2 2reflex orthogonal polyhedra
This paper focuses on 2reflex orthogonal polyhedra, i.e., orthogonal polyhedra whose reflex edges lie in at most two different directions. This is a case of intermediate complexity between the 1reflex case (i.e., orthogonal prisms) and the full 3reflex case (i.e., general orthogonal polyhedra).
Recall that simple orthogonal polygons with reflex vertices can be guarded by guards. This obviously extends to simply connected orthogonal prisms with reflex edges. Our main research question is whether the same bound in terms of extends to the whole class of orthogonal polyhedra. We are still unable to fully answer this question, although we have evidence that this may be the case.
However, we can prove (as we will do in this paper) that the upper bound holds at least for 2reflex orthogonal polyhedra. We regard this as a very important subcase, and a necessary step toward a proof for general orthogonal polyhedra. Indeed, we believe that repeatedly “cutting away” 2reflex orthogonal subpolyhedra from a given orthogonal polyhedron eventually yields a “kernel” with enough structural properties to make it efficiently guardable.
Regardless of this theoretical aspect, 2reflex orthogonal polyhedra are of interest in themselves, as they can already express a rich variety of shapes.
Structure and terminology
For the purpose of this paper, an orthogonal polyhedron is defined as a connected 3manifold (with boundary) in that can be obtained as the union of finitely many boxes, i.e., cuboids whose edges are parallel to the coordinate axes. Without loss of generality, we stipulate that every 2reflex orthogonal polyhedron encountered in this paper has only horizontal reflex edges, and no vertical ones.
The intersection between a 2reflex orthogonal polyhedron and a horizontal plane not containing any of its vertices is a collection of pairwise disjoint rectangles. As the plane is moved upwards or downwards, the intersection does not change, until a vertex is reached. Thus, a natural way to partition a 2reflex orthogonal polyhedron is into maximal cuboids, any two of which are either disjoint or touch each other at their top or bottom faces. Each cuboid in such a partition is called a brick, and any nonempty intersection between two bricks is called their contact rectangle. Figure 1 shows all the possible ways in which two bricks can touch each other.
By “cutting” a 2reflex orthogonal polyhedron along the contact rectangle of two adjacent bricks, all the reflex edges bordering the rectangle turn into convex edges, and several different things may happen to the edge set. A convex edge may split in two distinct edges, new edges may be created, and multiple edges may merge together.
Figure 1 also indicates the number of edges gained or lost after such a split, for each different configuration. and are the number of edges in the polyhedron before and after the split, respectively. Similarly, and are the number of reflex edges before and after the split, respectively.
In Figure 2, a type(t) contact rectangle between two bricks is illustrated, before and after the cut. The polyhedron in the second picture has edges, of which are reflex. The polyhedra in the third picture have edges in total, of which are reflex (cf. Figure 1(t)).
Remark 2.1.
When cutting a polyhedron of positive genus along a contact rectangle, we may fail to disconnect it, but just lower its genus. The resulting polyhedron is degenerate, in that its boundary is selfintersecting. We will occasionally encounter such degeneracies in intermediate steps of inductive proofs, and we will tolerate them as long as their presence does not invalidate our reasoning.
Referring again to Figure 1, we call each type(a) or type(f) contact rectangle a collar, because its boundary is made of four reflex edges “winding” around a smaller brick. Singling out collars to treat them as separate cases will often be needed in our proofs. The (technical) reason is that collars minimize the ratio
This ratio is 3 for collars, whereas it is at least 4 for any other contact type.
We also want to single out contact types (d) and (i), because they produce just one reflex edge each, and this will turn out to be the hardest case to handle. These two contact types will be called primitive, and a 2reflex orthogonal polyhedron having only primitive contact rectangles will be called a stack.
Observe that each brick of a stack may have up to two bricks attached to each of its horizontal faces. A stack where each brick has either zero or two other bricks attached to its top face is called a castle (Figure 3 shows an example). The bottom brick of a castle is called its base brick. It is easy to see that a castle has an even number of reflex edges, because they all come in parallel pairs.
If a castle is turned upside down and its base brick is attached to another castle’s base brick via a primitive contact rectangle, the resulting shape is a stack called double castle (see Figure 4
). It follows that a double castle has an odd number of reflex edges.
Castles and double castles will play a fundamental role in the next section.
3 Bounds in terms of
In this section we are going to generalize O’Rourke’s theorem on orthogonal polygons to 2reflex orthogonal polyhedra, showing that the exact same upper bound holds. It turns out that the central part of O’Rourke’s main argument can be considerably simplified, and then rephrased and generalized in terms of polyhedra (Lemmas 2.13–2.15 of [5] are condensed in our Lemma 3.4), while the other parts of the proof require more sophisticated constructions and some novel ideas.
Eventually, everything boils down to guarding castles and double castles. So we will resolve these first, and then we will use them as building blocks to prove our full theorem.
We say that an orthogonal polyhedron is monotone if it is a prism and if its intersection with any vertical line is either empty or a single line segment. In other terms, a monotone orthogonal polyhedron can be constructed by extruding a monotone orthogonal polygon (refer to [5]).
Lemma 3.1.
Any monotone orthogonal polyhedron with reflex edges is guardable by at most
(1) 
(open or closed) reflex edge guards.
Proof.
Without loss of generality, suppose that the reflex edges are parallel to the axis (hence, all the points of a reflex edge have the same coordinate). Sort all reflex edges by increasing coordinate, breaking ties arbitrarily, and let be the sorted sequence. Now assign a guard to each edge whose index is an odd number, plus a guard to if is even. Thus, the bound (1) is matched.
To show that the polyhedron is guarded, let be the coordinate of , for , and let and be the minimum and the maximum coordinate of a vertex of the polyhedron, respectively. Then, it is straightforward to see that a guard lying on guards at least the points whose coordinate lies between and , as Figure 5 suggests. ∎
Of course, among the monotone orthogonal polyhedra there are all 1reflex castles. In the next lemma we show that we can actually use one less guard for the remaining castles.
Lemma 3.2.
Any castle with reflex edges that is not a prism is guardable by at most (open or closed) reflex edge guards.
Proof.
We prove our claim by wellfounded induction on . So, suppose the claim is true for all castles that are not prisms and have fewer than reflex edges, and let a nonprism castle be given, having exactly reflex edges. Note that cannot be a cuboid, and hence is strictly positive and two castles and must lie on top of . Let (resp. ) be the reflex edge bordering the contact rectangle between the base brick of and the base brick of (resp. ). Let and be the numbers of reflex edges of and , respectively. It follows that
We have three cases.

If neither nor is a prism, they both satisfy the inductive hypothesis and can be guarded by and reflex edge guards, respectively. Now we just assign a guard to in order to guard the base block of , and our upper bound of guards is matched.

If is a prism and is not (the symmetric case is analogous), then the induction hypothesis applies to , and we place reflex edge guards accordingly. Now, because is a prism, its reflex edges are all parallel, and two subcases arise.

If the reflex edges of are parallel to (or has no reflex edges), then and the base brick of together form a monotone orthogonal polyhedron with reflex edges in total. By Lemma 3.1, such a polyhedron can be guarded by guards. Along with the previously assigned guards, this yields guards, as desired.

If the reflex edges of are not parallel to , then they are orthogonal to . As a consequence, all of is visible to , and so is the base brick of , as Figure 6 illustrates. It follows that guards are sufficient in this case, which is less than .


If both and are prisms, at least one of them (say, ) must have reflex edges that are orthogonal to , otherwise would be a prism, too. Therefore , and is guarded by assigning a guard to . Again, two subcases arise.

If the reflex edges of are parallel to , then and the base brick of form a monotone orthogonal polyhedron with reflex edges, which is guardable by reflex edge guards, by Lemma 3.1. Overall, we assigned guards, as required.

If the reflex edges of are orthogonal to , then guards , along with the base brick of . We assigned only two guards, and , concluding the proof.

∎
The two previous lemmas enable us to prove that our upper bound holds at least for double castles.
Lemma 3.3.
Any double castle with reflex edges is guardable by at most
(2) 
(open or closed) reflex edge guards.
Proof.
Let be a double castle with reflex edges, made of two castles and having and reflex edges, respectively. Let be the reflex edge lying on the contact rectangle between the two castles. Because , (2) can be rewritten as
(3) 
We distinguish three cases.

If both and are prisms, we have three subcases.

Finally, if the reflex edges of both and are orthogonal to , then a guard assigned to sees all of , which obviously satisfies (3).
∎
Now that we know how to guard double castles, we can move on to more general shapes, such as stacks. This is the last step before our main theorem, and it generalizes [5, Lemmas 2.13–2.15].
Recall that a stack has only primitive contact rectangles. If two neighboring bricks and share a type(d) (resp. type(i)) contact rectangle (refer to Figure 1), and lies below (resp. above) , then we say that is a parent of , and is a child of . It follows that a brick in a stack can have at most two children above and two children below, and shares exactly one reflex edge with each child (see Figure 7). Moreover, if a brick has one parent above (resp. below), then it has no other neighboring bricks above (resp. below). Finally, if a brick has exactly one child on one side (regardless of the number of neighboring bricks on the other side), then the reflex edge shared by and is said to be isolated. It follows that the number of reflex edges in a stack and the number of isolated reflex edges have the same parity.
Lemma 3.4.
Any stack with reflex edges and genus is guardable by at most
(4) 
(open or closed) reflex edge guards.
Proof.
Our proof is by wellfounded induction on . Following O’Rourke (see [5, Section 2.5]), we say that a contact rectangle in a simply connected stack yields an odd cut if partitions into two stacks and , one of which has an odd number of reflex edges. The presence of odd cuts in a simply connected stack is very desirable, in that it permits to successfully apply the inductive hypothesis. Indeed, let and be the number of reflex edges of and (the symmetric case is analogous). Then , because the cut resolves exactly one reflex edge. Recall that is simply connected, and so are and . Since is nonconvex, we can apply the inductive hypothesis on it, guarding it with at most
reflex edge guards. Similarly, if is nonconvex, we can guard it with at most
(5) 
reflex edge guards. On the other hand, if is a cuboid, we can guard it by assigning a guard to the reflex edge lying on . In this case, , and hence (5) still holds. As a result, we have guarded all of with at most
reflex edge guards. We stress that it makes sense to talk about odd cuts only for stacks of genus 0.
Now, let be a stack with exactly reflex edges and genus , and assume that the lemma’s statement holds for all nonconvex stacks with fewer than reflex edges. There are four cases to consider.

Let . Note that each cut along a contact rectangle either disconnects or lowers its genus by 1, and each cut resolves exactly one contact rectangle without creating or modifying other contact rectangles. Because is partitioned by contact rectangles into cuboids, whose genus is zero, it follows that there exists at least one contact rectangle such that cutting through yields a (degenerate, see Remark 2.1) stack with reflex edges and genus . Observe that is nonconvex, because it is made of at least two bricks, and so we can apply the inductive hypothesis on it and guard it with at most
reflex edge guards.

If and is even, then any contact rectangle yields an odd cut. Indeed, cutting along a contact rectangle resolves exactly one reflex edge and produces two stacks (because is simply connected). The amounts of reflex edges in these two stacks must have opposite parity, because their sum must be odd. Hence, one of them is odd.

Let , and let have a brick with exactly one neighboring brick above and exactly one below (Figure 8 sketches one possible configuration for ). We show that one of the two contact rectangles bordering yields an odd cut. Let be the upper contact rectangle and be the lower one. If does not yield an odd cut, the stack above has an even number of reflex edges. But then, the stack above , which additionally includes and the reflex edge belonging to , has an odd number of reflex edges. It follows that either or yields an odd cut.

If none of the above are satisfied, we show that must be a double castle, and hence our claim holds by Lemma 3.3. Let then be odd, so that has at least one isolated reflex edge corresponding to a contact rectangle . Additionally, let no brick of have exactly one neighbor above and one neighbor below. We show that , i.e., the stack above , is a castle. (By a symmetric argument, the stack below will be an upsidedown castle, and will then be a double castle.) Although this is easy to see (build the castle from bottom to top, without adding bricks that have only one neighbor below and one above), here follows a formal proof.
Let be the minimum number of bricks one has to traverse to reach brick from (while always staying inside ), and let be the set of bricks in such that . We prove by induction on that is a castle whose base brick contains .
The claim is true for , because the brick just above (call it ) is the only one in contact with , and a brick is indeed a castle.
Observe that no brick in can be attached to the bottom face of , because the reflex edge of corresponding to is isolated. Hence, must have either zero or two neighbors in , and both of them are above. It follows that is a castle, as well.
Let now , assume that is a castle whose base brick contains , and let us show that the same holds for . Any brick such that must be attached to some brick of such that (see Figure 9). It is straightforward to see that any such has one parent brick below and no bricks above, in . Hence, can only be attached on top of . Because cannot have only one top and one bottom neighbor in , it follows that cannot be a parent of , but a child. Any other brick that is attached on top of in must also belong to , by definition. As a consequence, one such brick must indeed be in , otherwise would once again have only one top and one bottom neighbor in . No new brick is attached to , which remains the base of . Thus the base brick of contains , proving our claim and concluding the inductive proof.
Since is connected and contains only a finite number of bricks, for a largeenough we have , implying that is a castle.
∎
In the next theorem, we give an upper bound on the number of guards for a 2reflex orthogonal polyhedron in terms of , and , where is the number of collars. The presence of may look redundant (as it just contributes to lowering the bound), but we will actually have to carry this parameter along to the next section, in order to prove Theorem 4.2. The casual reader may ignore this term and read (6) simply as
Theorem 3.5.
Any 2reflex orthogonal polyhedron with reflex edges, collars and genus is guardable by at most
(6) 
(open or closed) reflex edge guards.
Proof.
We proceed by induction on the number of nonprimitive contact rectangles. The base case is given by nonconvex stacks, for which (6) holds due to Lemma 3.4 and the fact that .
For the inductive step, let be a 2reflex orthogonal polyhedron with reflex edges, collars, genus , and a nonprimitive contact rectangle . We cut through , thus resolving one nonprimitive contact rectangle, and we distinguish two cases.

If the cut does not disconnect , then it lowers its genus by 1. Let be the resulting polyhedron (which is degenerate, see Remark 2.1), and let be its genus. By inductive hypothesis, is guardable by
(7) guards, where and are, respectively, the number of reflex edges and collars of . Two subcases arise.

If the cut disconnects into and , then , where (resp. ) is the genus of (resp. ). Let and (resp. and ) be, respectively, the number of reflex edges and collars of (resp. ). Two subcases arise.

If is a collar, then and . If , then we can apply the inductive hypothesis to and guard it with at most
(8) guards. Otherwise, is a cuboid, and we can guard it by assigning a guard to any edge of (they are all reflex). In this case, , and (8) is still satisfied. We proceed similarly with , and thus we have assigned a combined number of guards that is at most
This many guards are then sufficient to guard .

If is not a collar, then . Because is not primitive, (refer to Figure 1). Once again, if , then we can apply the inductive hypothesis to and guard it with a number of guards that is bounded by (8). Otherwise, is a cuboid, and we can guard it by assigning a guard to any reflex edge of (there is at least one). In this case, , and (8) is still satisfied. Again, we do the same with , and thus we have assigned a combined number of guards that is at most
and is guarded.

We remark that also the rectangle is guarded in every case, because it is contained in , , and , as defined above. ∎
For , the upper bound given in Theorem 3.5 is tight, as Figure 10 implies. By contrast, for arbitrary genus, the situation is still unclear, and even the corresponding 2dimensional problem is open (i.e., optimally guarding orthogonal polygons with holes, see [5, 9]).
We believe that the bound given in Theorem 3.5 holds also for general (i.e., 3reflex) orthogonal polyhedra.
Conjecture 3.6.
Any orthogonal polyhedron with reflex edges and genus is guardable by at most
(open or closed) reflex edge guards.
4 Bounds in terms of
In this section we bound the number of reflex edge guards required to guard a 2reflex orthogonal polyhedron in terms of , as opposed to . Rather than providing a radically new construction, we bound with respect to , and then we apply Theorem 3.5.
Note that a naive application of this method would not improve on the state of the art. Indeed, the sharpest possible inequality between and (involving also the genus ) is
(9) 
which yields an upper bound of
guards when applied to Theorem 3.5. This result was already obtained by Urrutia in [9] and improved in [1].
To get around this, we will refine (9) by introducing the number of collars as an additional parameter.
Lemma 4.1.
In every 2reflex orthogonal polyhedron, the number of edges , the number of reflex edges , the number of collars , and the genus satisfy the inequality
Proof.
We will prove that, for any collection of (pairwise internally disjoint) 2reflex orthogonal polyhedra,
(10) 
holds. Here, (resp. , , ) is the sum of the edges (resp. reflex edges, genera, collars) of the polyhedra. Then, by plugging , we will obtain our claim.
Our proof proceeds by induction on . For we have a collection of cuboids, each of which has 12 edges, so , , and therefore (10) holds as desired.
If , there is at least one (horizontal) reflex edge, which is a side of the contact rectangle of two adjacent bricks, both belonging to the same polyhedron of the collection. We can resolve this reflex edge (and up to three others) by separating the two bricks with a horizontal cut through . As a consequence, either gets partitioned in two polyhedra (in which case the new number of polyhedra is ), or the genus of decreases by 1 (in which case the new total genus is ). Either way,
(11) 
By inductive hypothesis,
(12) 
where (resp. , ) is the new number of edges (resp. reflex edges, collars), after the cut.
Theorem 4.2.
Any nonconvex 2reflex orthogonal polyhedron with edges and genus is guardable by at most
(14) 
(open or closed) reflex edge guards.
Proof.
We remark that our Theorem 4.2 is an improvement upon the previous state of the art, in that it lowers the upper bound provided by Urrutia in [9] by roughly and the one in [1] by roughly (for ). Also, it shows how guards can be chosen to lie on reflex edges, as opposed to arbitrary edges.
We are unable to raise the lower bound of guards given in [9], even if just reflex edge guards are to be employed. On the other hand, our upper bound in terms of seems far from optimal: indeed, we could treat separately other types of contact rectangles between bricks, rather than just the collars, and this could be enough to improve Lemma 4.1 and lower the bound in (14). Therefore, we formulate a stronger version of Urrutia’s Conjecture.
Conjecture 4.3.
Any nonconvex orthogonal polyhedron with edges is guardable by at most
(open or closed) reflex edge guards.
We already know that this statement holds for simply connected prisms, and Lemma 3.4 implies that it holds more generally for simply connected stacks. Specifically, we have the following.
Theorem 4.4.
Any nonconvex stack with edges and genus is guardable by at most
(16) 
(open or closed) reflex edge guards.
5 Time complexity
To conclude the chapter, we show how to efficiently compute guard positions matching the upper bounds given in Theorems 3.5 and 4.2. Notice that both bounds refer to the very same construction, described in Section 3. In the present section, we will merely translate such a construction into an algorithm that runs in time.
Of course, to reason about running time, we have to specify how polyhedra are represented as data structures. We will assume that a polyhedron is stored as the array of its vertices, together with the array of its faces. Each face is a sequence of indices into the vertex array. The outer boundary of each face will be given in counterclockwise order with respect to a normal vector poiniting outward, while its holes will be given in clockwise order.
We assume that numbers expressing vertex coordinates, as well as indices into the vertex array, have constant size. Note that, in an orthogonal polyhedron, each vertex is shared by at most six faces. So, if an orthogonal polhedron has vertices, the size of its representation is . Since the running time of our algorithm is given in bigoh notation, we do not have to make any distinction between the number of vertices and the size of the representation of a given orthogonal polyhedron.
O’Rourke’s algorithm for simple orthogonal polygons, detailed in [5, Section 2.6], also runs in time. As observed by Urrutia in [9], it could be optimized to run in time, if Chazelle’s lineartime triangulation algorithm were used (see [4]). Unfortunately, Urrutia’s speedup is only applicable to orthogonal polygons without holes.
In principle, we could rephrase O’Rourke’s algorithm in the language of 2reflex orthogonal polyhedra and obtain a new algorithm. However, four issues arise that require additional care:

O’Rourke’s algorithm works on simply connected polygons, while our algorithm should be applied to polyhedra of any genus.

O’Rourke’s algorithm may assign guards to convex vertices, whereas we insist on having guards only on reflex edges.

O’Rourke’s method to find horizontal cuts in polygons does not trivially extend to polyhedra.

O’Rourke’s algorithm relies on guarding double histograms, whereas we need guard double castles.
We will now describe our modified algorithm, showing that each of the above issues has a relatively simple solution. Our algorithm takes as input a 2reflex orthogonal polyhedron with vertices, and outputs the set of reflex edges to which guards are assigned.
Preprocessing:
First of all, we do some preprocessing on to construct adjacency tables of faces, edges and vertices, which allow us to efficiently navigate the polyhedron’s surface. We mark each edge as reflex or convex and, if needed, we turn by so that it contains no vertical reflex edges.
Finding contact lines:
We first compute a structure that is very similar to the horizontal visibility map (also known as trapezoidization, see [5]) of each vertical face of . This is a wellstudied 2dimensional problem that consists in partitioning a polygon into trapezoids by drawing horizontal lines at vertices. In our case, faces are orthogonal polygons (perhaps with holes), trapezoids are actually rectangles, and cut lines are drawn at reflex vertices only. For reasons that will be explained later, these cut lines are called contact lines.
Note that some vertical faces of may have “degenerate” vertices lying on horizontal edges. For instance, in the middle picture of Figure 2 there is a polyhedron made of two bricks, the top of which has a rightfacing rectangular face . However, five vertices of the polyhedron lie on the perimeter of : the one lying in the middle of the bottom edge of is a degenerate vertex for . In our algorithm, a degenerate vertex is treated as a pair of coincident vertices, one reflex and one convex: it is as if a degenerate vertex were actually a (degenerate) vertical edge of length 0.
Let be a vertical face of with vertices. We sort all the vertical edges of by the coordinate of their upper vertex (in time), and we “scan” from top to bottom with a sweep line. We maintain a horizontally sorted list of all the vertical edges of pierced by the sweep line, in which insertion and deletion take time. This list also includes the degenerate edges defined above. Every time our sweep line hits a vertex that is reflex in or belongs to a reflex edge of , we draw a contact line from to the next edge or the previous edge in the sorted list (according as the vertical edge containing is facing right or left), we add a dummy vertex there (unless there is already a vertex), and we proceed with our sweep.
This process takes time and, letting , finding the contact lines on every vertical face of takes in total, because
Every time we find a new contact line, we also update the face, edge, and vertex data we computed in the preprocessing step. That is, as soon as a new contact line is found, the corresponding face gets a new edge and is perhaps partitioned in two coplanar faces (this step takes constant time). Moreover, whenever we create a new dummy vertex for , we add it to the other face sharing it (say, ). If we still have to process , we treat as a reflex vertex and draw a contact line at in when we process it. Otherwise, is now a rectangle, and we just draw an additional contact line in it at , in constant time: we call this procedure extension
of the contact line. However, if the extension generates yet another dummy vertex, there is no need to perform an “extension of the extension” to the next face, as we will see in a moment.
Finding bricks and contact rectangles:
Notice that the contact lines constructed in the previous step are precisely the edges of the contact rectangles of . Indeed, we did not draw contact lines only at the reflex vertices of each face, but also at the dummy vertices created while processing other faces and at convex vertices that lie on reflex edges of .
Observe that a dummy vertex may be created only on a contact rectangle of type (c), (d), (h), or (i) (refer to Figure 1). Indeed, in all other cases a vertex of a contact rectangle is also a vertex of the polyhedron. Moreover, only the contact rectangles of type (d) and type (i) have an edge with no endpoint on a vertex of : these are the only cases where the extension procedure is really needed, and performing it once per contact rectangle is enough to generate all its edges.
It is easy now to identify all the contact rectangles and all the bricks, navigating the boundary of using the adjacency tables that we precomputed and then updated every time a cut line was drawn. While we identify the contact rectangles, we also build a brick graph , having a node for each brick and an edge connecting each pair of bricks sharing a contact rectangle.
Observe that issue (3) above is now solved.
Resolving nonprimitive contact rectangles:
The nonprimitive contact rectangles are those that are surrounded by more than one reflex edge of and, as such, are easy to find. As proven in Theorem 3.5, it is safe to cut at a nonprimitive contact rectangle and place guards in the resulting polyhedra (or polyhedron of lower genus).
Instead of actually cutting and updating all the data structures, we merely delete the edges of corresponding to all nonprimitive contact rectangles.
Ensuring simple connectedness:
By this point, has been partitioned into several, possibly not simply connected, stacks. As proven in Theorem 3.4, it is safe to further cut the stacks until they all become simply connected. To do so, we again process only , turning it into a forest. Such a task is accomplished by a depthfirst traversal, starting at each connected component and deleting edges leading to already visited nodes. Recall that bricks in stacks have at most four neighbors, hence the time complexity of this traversal is indeed linear.
Observe that this step also solves issue (1) above.
Adjusting brick parity:
For reasons that will be clear shortly, we insist on having only stacks with an even number of bricks. O’Rourke achieves this by adding an extra “chip” to the polygon, in case he wants to change the parity of its reflex vertices. Then he applies his algorithm to the new polygon, and later removes the chip. If the chip happens to host a guard, then that guard is reassigned to the nearest convex vertex, after the chip is removed. Observe how this choice causes issue (2) above.
In order to avoid placing guards on convex edges, we proceed as follows. We compute the size of each connected component of by a simple traversal. Then, in each component with an odd number of nodes, we find one leaf (recall that is a forest) and delete the edge attached to it (if the component is already an isolated node, we leave it as it is). Finally, we collect each isolated node, remove it from , find its corresponding brick in , find a contact rectangle bordering (one must exist), find one reflex edge on it and assign it a guard. Referring to Figure 7, it is obvious that guards all of .
The correctness of this step follows from the remarks contained in the proof of Lemma 3.4, that every contact rectangle in a stack with an odd number of bricks yields an odd cut, and that it is always safe to make odd cuts.
Identifying odd cuts:
We are left with stacks having an even number of bricks, and we want to further partition them with odd cuts. In order to identify odd cuts, we pick each connected component of and we do a depthfirst traversal, rooted anywhere. During the traversal, we compute the parity of the size of the subtree dangling from each edge of we traverse. The parity is even if and only if that edge of corresponds to an odd cut.
Now, it is easy to observe that cutting a stack having an even number of bricks at an odd cut yields two stacks that again have an even number of bricks. Additionally, this operation does not change the parity of the cuts in the two resulting stacks. Hence, there is no need to reidentify the odd cuts after a cut is made. In contrast, stacks with an odd number of bricks do not have such a property, and this motivates our previous step.
It follows that we may remove all the edges of corresponding to odd cuts, without worrying about side effects.
Guarding double castles:
At this point, only nonconvex stacks without odd cuts are left. As a consequence of the observations in Lemma 3.4, these are all double castles, which we now have to guard in linear time. In contrast, O’Rourke’s algorithm was left at this point with double histograms (cf. issue (4) above).
Our algorithm is based on the proofs of Lemmas 3.1, 3.2, and 3.3, which naturally yield a procedure that cuts along certain contact rectangles and selects guards in monotone orthogonal polyhedra.
The only nontrivial aspect is that, occasionally in the procedure, we need know if some castle (or upsidedown castle) is a prism, and what the orientation of its reflex edges is. To efficiently answer this question, we precompute this information for every “subcastle” of each double castle that we have. We identify the two castles constituting each double castle (in linear time), then we do a depthfirst traversal of the subgraphs of corresponding to those castles, starting from their base bricks. When we reach an internal node , we recursively check if the subtrees dangling from its two children correspond to prisms, and if their reflex edges are oriented in the same direction. Then, after inspecting also the brick corresponding to , we know if the subtree dangling from it corresponds to a prism and, if so, the direction of its reflex edges. Leaves are trivial to handle, in that they always correspond to prisms with no reflex edges.
Theorem 5.1.
Given a 2reflex orthogonal polyhedron of genus with edges, of which are reflex, a guarding set of at most
(open or closed) reflex edge guards can be computed in time. ∎
Observe that the only superlinear step is the vertical sweep that finds the contact lines in every vertical face of the polyhedron. Whether a more efficient algorithm exists remains an open problem.
References
 [1] N. M. Benbernou, E. D. Demaine, M. L. Demaine, A. Kurdia, J. O’Rourke, G. T. Toussaint, J. Urrutia, and G. Viglietta. Edgeguarding orthogonal polyhedra. In Proceedings of the 23rd Canadian Conference on Computational Geometry (CCCG), pp. 461–466, 2011.
 [2] S. Cannon, D. L. Souvaine, and A. Winslow. Hidden mobile guards in simple polygons. In Proceedings of the 24th Canadian Conference on Computational Geometry (CCCG), pp. 161–166, 2012.
 [3] J. Cano, C. D. Tóth, and J. Urrutia. Edge guards for polyhedra in threespace. In Proceedings of 24th Canadian Conference on Computational Geometry (CCCG), pp. 163–167, 2012.
 [4] B. Chazelle. Triangulating a simple polygon in linear time. Discrete and Computational Geometry, vol. 6, pp. 485–524, 1991.
 [5] J. O’Rourke. Art Gallery Theorems and Algorithms. Oxford University Press, New York, 1987.
 [6] T. Shermer. Recent results in art galleries. In Proceedings of the IEEE, vol. 80, pp. 1384–1399, 1992.
 [7] D. L. Souvaine, R. Veroy, and A. Winslow. Face guards for art galleries. In Proceedings of the 14th Spanish Meeting on Computational Geometry, pp. 39–42, 2011.
 [8] C. D. Tóth, G. T. Toussaint, and A. Winslow. Open guard edges and edge guards in simple polygons. In Proceedings of the 23rd Canadian Conference on Computational Geometry (CCCG), pp. 449–454, 2011.
 [9] J. Urrutia. Art gallery and illumination problems. In J.R. Sack and J. Urrutia, editors, Handbook of Computational Geometry, pp. 973–1027. North Holland, 1999.
 [10] G. Viglietta. Guarding and Searching Polyhedra. Ph.D. thesis, University of Pisa, 2012.
 [11] G. Viglietta. Faceguarding polyhedra. Computational Geometry: Theory and Applications, vol. 47, no. 8, pp. 833–846, 2014.
Comments
There are no comments yet.