1 Introduction
[1]Introductionsec:introduction
The art gallery problem was introduced in 1973 when Victor Klee asked how many guards are sufficient to guard the interior of a simple polygon having vertices. Although it has been shown by Chvátal that guards are always sufficient and sometimes necessary [3], and such a set of guards can be computed easily [5], such solutions are usually far from optimal in terms of minimizing the number of guards for a particular input polygon. Moreover, it was shown that determining an optimal number of guards is NPhard, even for simple polygons [6]. Determining the actual locations of those guards is even harder [1].
Trilateration is the process of determining absolute or relative locations of points by measurement of distances, using the geometry of the environment. In addition to its interest as a geometric problem, trilateration has practical applications in surveying and navigation, including global positioning systems (GPS). Every GPS satellite transmits information about its position and the current time at regular intervals. These signals are intercepted by a GPS receiver, which calculates how far away each satellite is based on how long it took for the messages to arrive. GPS receivers take this information and use trilateration to calculate the user’s location.
In our research we combine the art gallery problem with trilateration. We address the problem of placing broadcast towers in a simple polygon in order for a point in (let us call it an agent) to locate itself. Towers can be defined as points, which can transmit their coordinates together with a time stamp to other points in their visibility region. The agent receives messages from all the towers that belong to its visibility region. Given a message from the tower , the agent can determine its distance to . In our context, trilateration is the process, during which the agent can determine its absolute coordinates from the messages the agent receives. Receiving a message from one tower only will not be sufficient for the agent to locate itself (unless the agent and the tower are at the the same location). In Euclidean plane, two distinct circles intersect in at most two points. If a point lies on two circles, then the circle centers and the two radii provide sufficient information to narrow the possible locations down to two. Additional information may narrow the possibilities down to one unique location.
In relation to GPS systems, towers can be viewed as GPS satellites, while agents (query points interior to the polygon) can be compared to GPS receivers. Naturally, we would like to minimize the number of towers.
Let be a simple polygon in general position (no three vertices are collinear) having a total of vertices on its boundary (denoted by ). Note that . Two points are visible to each other if the segment is contained in . We also say that sees . Note that may touch in one or more points. For , we let denote the visibility polygon of , as the set of all points that are visible to . Notice that is a starshaped polygon contained in and belongs to its kernel (the set of points from which all of is visible).
Problem Definition: Let be a set of points (called towers) in satisfying the following properties. For any point : for each , the point receives the coordinates of and can compute the Euclidean distance between and , denoted . From this information, can determine its coordinates. We consider the following problems:

Design an algorithm that, on any input polygon in general position, computes a “small” set of towers.

Design a localization algorithm.
We show how to compute such a set of size at most by using the polygon partition method introduced by Tóth [7]. Tóth showed that any simple polygon with vertices can be guarded by point guards whose range of vision is . Tóth partitions a polygon into subpolygons, on which he then can apply induction. He cuts along diagonals whenever it is possible, otherwise he cuts along a continuation of some edge of ; along a twoline segment made of an extension of two edges of that intersect inside ; or along the bisector of a reflex vertex of . Notice that the three latter types of cuts may introduce new vertices that are not necessarily in general position with the given set of vertices. Succeeding partitions of the subpolygons may create polygons that are not simple. However, Tóth assumed that his partition method creates subpolygons whose vertices are in general position (refer to [7] Section ). We lift this assumption and show how to adapt his method to a wider range of polygons, which we define in Section 3. Under the new conditions the partition of may contain starshaped polygons whose kernel is a single point. It does not pose an obstacle to Tóth’s problem, but it is a severe complication to our problem, because we require a pair of distinct towers in the kernel of each polygon of the partition. We modify Tóth’s partition method and show how to use it with respect to our problem. It is important to notice that we assume that the input polygon is in general position, while nongeneral position may occur for subpolygons of the partition (refer to Definition 3). We show that after the modification each guard can be replaced with a pair of towers close to . We embed the orientation of the guard into the coordinates of the towers. That is, we specify to which side of the line through the pair of towers their primary localization region resides. We do it by positioning the towers at a distance that is an exact rational number. The parity of the numerator of the rational number (in the reduced form) defines which one of the two halfplanes (defined by ) the pair of towers are responsible for. We call it the parity trick. For example, if we want a pair , of towers to be responsible for the halfplane to the left of the line through and , then we position the towers at a distance, which is a reduced rational number whose numerator is even. The localization algorithm is allowed to use this information.
Our interest in this problem started with the paper by Dippel and Sundaram [4]. They provide the first nontrivial bounds on agent localization in simple polygons, by showing that towers suffice for any nondegenerate polygon of vertices, and present an algorithm for the corresponding placement. Their approach is to decompose the polygon into at most fans. A polygon is a fan if there exist a vertex , such that for every other vertex not adjacent to , is a diagonal of ; the vertex is called the center of the fan. In each fan with fewer than triangles Dippel and Sundaram position a pair of towers on an edge of the fan; every fan with or more triangles receives a triple of towers in its kernel. In a classical trilateration, the algorithm for locating an agent knows the coordinates of the towers that can see together with distances between and the corresponding towers. However, the localization algorithm presented in [4] requires a lot of additional information, such as a complete information about the polygon, its decomposition into fans and the coordinates of all towers.
Our localization algorithm has no information about . It receives as input only the coordinates of the towers that can see together with their distances to . In addition our algorithm is empowered by the knowledge of the parity trick. When only a pair , of towers can see then the coordinates of the towers together with the distances and provide sufficient information to narrow the possible locations of down to two. Refer to Figures 1,1. Those two locations are reflections of each other over the line through and . In this situation our localization algorithm uses the parity trick. It calculates the distance between the two towers and judging by the parity of this number decides which of the two possible locations is the correct position of .
We show how to position at most towers inside , which is an improvement over the previous upper bound in [4]. We also show that towers are sometimes necessary. The comb polygon from the original art gallery problem can be used to show a lower bound. Refer to Fig. 4. No point in the comb can see two different comb spikes. Thus we need at least two towers per spike to localize all of the points in its interior. In addition we need to know the parity trick. Or, alternatively, we need to know , its exact location and orientation. We show in Theorem 2.2 that without any additional information (such as the parity trick or the complete knowledge about including its partition) it is not possible to localize an agent in a simple gon (where , for integer and , or ) with less than towers.
2 Preliminaries
[1]Preliminariessec:preliminaries
Consider a point (an agent) in the interior of , whose location is unknown. Let denote the circle centered at a point with radius . If only one tower can see then can be anywhere on (refer to Fig. 1), which may not be enough to identify the location of . By the map of we mean the complete information about including the coordinates of all the vertices of and the vertex adjacency list. Notice that one must know the map of to calculate . If two towers and can see then the location of can be narrowed down to at most two points . Refer to Fig. 1. The two points are reflections of each other over the line through and . We call this situation the ambiguity along the line, because without any additional information we do not know to which one of the two locations belongs. To avoid this uncertainty we can place both towers on the same edge of . Consider for example Fig. 1 where two towers are placed on the line segment . In this example, if the map of is known (and thus we know and ) then the intersection is a single point (highlighted in red). Alternatively, if the map of is unknown, we can place a triple of noncollinear towers in the kernel of (highlighted in cyan on Fig. 1) to localize any point interior to .
For a simple polygon in general position, we can partition it into starshaped polygons such that , for every , does not degenerate into a single point. In every () we can position a pair of towers on a line segment in (such that the towers belong to the same edge of ) or a triple of towers in if is empty or contains a single point. Notice that a pair of towers positioned on the edge of will not necessarily be on the boundary of . Thus, to localize an agent, it is not enough to know the map of . We need to know more, for example, if in addition to the map of we know the partition of into starshaped polygons and which pair of towers is responsible for which subpolygon then the agent can be localized.
In our solution we do not use this extra information or the map of . Moreover, to get a tight bound of towers, we abstain from placing a triple of towers per subpolygon, since some polygons cannot be partitioned into less than starshaped subpolygons. The idea is to use a parity trick.
Parity trick: Let be the line through points and . Let denote the half plane to the left of (or above, if is horizontal). Similarly, denotes the half plane to the right (or below) of . We embed information about the primary orientation of the pair of towers into their coordinates. If we want a pair , of towers to be responsible for (respectively
), then we position the towers at a distance which is a reduced rational number whose numerator is even (respectively odd). In this way, we specify on which side of
the primary localization region of and resides. Refer to Sect 3.4 where the parity trick is explained in greater detail.To achieve localization with at most towers we should partition into at most starshaped polygons such that there exists a line segment such that or for every (we assume that and are distinct points).
Theorem 2.1 (Chvátal’s Theorem [3])
Every triangulation of a polygon with vertices can be partitioned into fans where .
The statement of the following lemma may seem trivial, still we provide its proof for completeness.
Lemma 1
Any simple polygon with , or sides is starshaped and its kernel contains a boundary segment that is not a single point.
Proof
Let be the number of vertices of . By Theorem 2.1, can be partitioned into fans (since , or ). Notice that a fan is starshaped by definition, from which is starshaped. The kernel of is an intersection of halfplanes defined by the edges of . Let be the number of reflex angles of . There are three cases to consider:

: is a convex polygon and thus , implying .

: Let be the vertex of at the reflex angle. Refer to Fig. 2 and 2 for possible polygons. The angles at and are smaller than by the simplicity of . The claim of the lemma then is implied by inspection. Consider the edge . It contains a line segment that belongs to .
Figure 2: The kernel of is highlighted in cyan. 
: In this case . Let be the vertex of at one of the reflex angles. Refer to Fig. 2 and 2 for possible polygons. The vertex at the other reflex angle is either adjacent to or not. Consider first the case where the vertices at the reflex angles of are not adjacent. Without loss of generality let be a vertex of at reflex angle (refer to Fig. 2). The angles at , and are smaller than by the simplicity of . It follows that the edge must contain a line segment that belongs to . Consider now the case where the vertices at the reflex angles of are adjacent. Without loss of generality let be a vertex at reflex angle of (refer to Fig. 2). The claim of the lemma holds similarly to the discussion presented in the case for , Fig. 2.
∎
The problem we study is twofold:

We are given a simple polygon of size . Our goal is to position at most towers inside such that every point can be localized.

We want to design a localization algorithm which does not know , but knows that the locations of the towers were computed using the parity trick. For any point , its location can be found by using the coordinates of the towers that see and the distances from those towers to .
It may seem counterintuitive, but the knowledge of the parity trick is stronger than the knowledge of the map of . Some towers (while still on the boundary of some subpolygon of the partition) may end up in the interior of . This is not a problem when the parity trick is used but may lead to ambiguities when only the map of is known (refer for example to Fig. 1).
The following theorem shows that additional information like the parity trick or the map of (including its partition) is necessary to achieve localization with the use of less than towers.
Theorem 2.2
Let be a simple polygon with vertices. An agent cannot localize itself inside when less than towers are used if the only information available to the localization algorithm are the coordinates of the towers and the distances of the agent to the towers visible to it.
Proof
Let be an arbitrary simple polygon with vertices. Assume to the contrary, that can be trilaterated with towers. Given the coordinates of the two towers and together with the distances to a query point one can deduce that is in one of the two possible locations . But without additional information it is impossible to choose one location over another. Refer to Fig. 3. Similarly, any quadrilateral or pentagon requires at least towers to trilaterate it.
Let be a comb polygon with vertices (for integer and , or ) such that one of its spikes contains extra vertices. Refer to Fig. 4. No point of can see the complete interior of two different spikes. Assume to the contrary that can be trilaterated with less than towers. In other words, assume that can be trilaterated with towers. It follows that one of the spikes contains less than towers. We showed for smaller polygons (with , or ) that two towers cannot trilaterate it. Even if we know that the two towers are positioned on the same edge of , the polygon can be mirrored along this edge to avoid unique trilateration. Observe that no polygon or spike can be trilaterated with one or no towers.
∎
3 Tóth’s Partition
[1]Tóth’s Partitionsec:partition
A simple polygonal chain is a cut of a polygon if the two endpoints of belong to and all interior points of are interior points of . A cut decomposes into two polygons and such that and .
Definition 1 (Diagonal)
A diagonal of is a line segment that connects nonadjacent vertices of and is contained in or on the boundary of . If is a cut and a diagonal of then it is called a diagonal cut.
Notice that the above definition of the diagonal is nonstandard. We define a diagonal as a line segment that can contain boundary points in its interior, while a diagonal in a standard definition is a line segment whose intersection with the boundary is precisely its two endpoints.
Tóth showed in [7] that any simple polygon in general position of size can be guarded by point guards whose range of vision is (let us call this result Tóth’s Theorem). His approach is to decompose into subpolygons via cuts and to specify the locations of the guards. The cuts are composed of one or two line segments and are not restricted to be diagonal cuts. He uses a constructive induction to show his main result. Let (respectively ) denote the size of (respectively ). When contains a cut that satisfies , the proof of Tóth’s Theorem can be completed by applying induction to both and .
Tóth’s method heavily relies upon the partitioning of a polygon into subpolygons (on which he can apply induction). He performs diagonal cuts whenever it is possible, otherwise he cuts along a continuation of some edge of ; along a twoline segment made of an extension of two edges of that intersect inside ; or along the bisector of a reflex vertex of . Notice that the three latter types of cuts may introduce new vertices that are not necessarily in general position with the given set of vertices.
However, Tóth assumes that every cut produces polygons in general position, which is a very strong assumption. We strengthen the work [7] by lifting this assumption and reproving Tóth’s result. We assume that the input polygon is in general position, while nongeneral position may occur for subpolygons of the partition. Moreover, we found and fixed several mistakes in [7].
Definition 2 (Good Cut)
Let . A cut is called a good cut if it satisfies the following: . If a good cut is a diagonal then it is called a good diagonal cut.
Definition 3 (Polygon*)
Polygon* is a weakly simple polygon (as defined in [2]) whose vertices are distinct and whose interior angles are strictly bigger than and strictly smaller than . Notice that polygon* includes simple polygons.
We assume that every polygon of the partition (i.e. subpolygon of ) is polygon*. To avoid confusion, let refer to a polygon* to which we apply the inductive partitioning. In other words, can refer to the input polygon before any partition was applied as well as to any subpolygon of obtained during the partitioning of . Recall that is in general position, while may not be in general position.
Definition 4 (Triangulation)
A decomposition of a polygon into triangles by a maximal set of nonintersecting (but possibly overlapping) diagonals is called a triangulation of the polygon. Notice that a triangulation of polygon* may contain triangles whose three vertices are collinear.
Notice that the above definition of triangulation is different from the classical one by that that it allows overlapping diagonals and thus permits triangles with three collinear vertices.
If the polygon is not in general position then its triangulation may include triangles whose three vertices are collinear. We call such triangles degenerate triangles. Refer to Fig. 5, showing an example of a degenerate triangle . The diagonal cannot be a good diagonal cut even if it partitions into and such that , because interior points of a cut cannot contain points of .
To extend Tóth’s partition to polygons* we need to extend the definition of a cut. A simple polygonal chain is a dissection of if the two endpoints of belong to and all interior points of are either interior points of or belong to . A dissection decomposes into two polygons* and (that are not necessarily in general position) such that and . If is a dissection and a diagonal of then it is called a diagonal dissection.
Definition 5 (Good Dissection)
Let . A dissection is called a good dissection if .
We extend the results in [7] by removing the assumption that the partitioning produces subpolygons in general position and by thus strengthening the result. In this paper, we need to refer to many Lemmas, Propositions and Claims from [7]. Indeed, we apply some of these results, we fill the gaps in some proofs of these results and we generalize some others. In order for this paper to be selfcontained, we write the statements of all these results with their original numbering [7].
Simplification Step: If has consecutive vertices , and along that are collinear then:

If the angle of at is then replace together with its adjacent edges by the edge .

If the angle of at is or then delete together with its adjacent edges and add the edge . Assume w.l.o.g. that the distance between and is smaller than the distance between and . The line segment will be guarded despite that it was removed from . Refer to the following subsections for examples.
In both cases we denote the updated polygon by ; its number of vertices decreased by .
Assume for simplicity that does not contain consecutive collinear vertices along . Let be the number of vertices of . Let be a positive integer and such that . Notice that a diagonal dissects into (of size ) and (of size ) such that .
The proofs of the following three propositions are identical to those in Tóth’s paper.
Tóth’s Proposition 1
For with any diagonal is a good dissection.
Tóth’s Proposition 2
For with there exists a diagonal that represents a good dissection.
Tóth’s Proposition 3
For with a dissection is a good dissection if it decomposes into polygons* and (not necessarily simple polygons) such that and (for ).
3.1 Case Study
[2]Case Studysubsec:CaseStudy
In this subsection we study how Propositions 1, 2 and 3 can be applied to polygons*. Let be a minimum degenerate triangle in , i.e. it does not contain any vertex of other than , or . Consider the example depicted in Fig. 5. The diagonal partitions into two polygons: and ( can be further viewed as a union of two subpolygons and ). Notice that . There is a possibility for to have a vertex such that . However cannot belong to the line segment , otherwise, the triangle is not minimum, and we can choose or instead. It follows that no vertex of (respectively , ) is located on the edge (respectively , ). Notice that may contain an edge that contains ; inherits it (since ), but it won’t cause any trouble because of the “simplification” step described in the beginning of this section. Notice also, that two vertices of cannot be at the same location.
Assume that is a good dissection, i.e. it decomposes into and such that . Assume also that . Let (respectively ) be the number of vertices of (respectively ). Notice that because was counted twice. When it is possible, we prefer to avoid cutting along the diagonal . However, when necessary, it can be done in the following way. We consider three cases (refer to Fig. 5):
red Case 1: . By Tóth’s Proposition 1 every diagonal is a good dissection. If is not composed of the line segment only, then is a good diagonal dissection, that partitions into two polygons and . Otherwise, is a good diagonal dissection, that partitions into two polygons and . Notice that and cannot be both edges of because of the simplification step we applied to .
Alternatively, we can dissect along . The polygon has an edge that contains vertex . If a guard is located at for any subpolygon of , then we position the towers close to on a line segment that contains (but not necessarily in ) only if is not a vertex of the original polygon . However, if then we position our towers in the close proximity to but in the interior of , oriented towards .
red Case 2: . Since decomposes into and such that then either and , or and for . If is an edge of (meaning that consists of a line segment only) then we can dissect either along or along . In the former case will be decomposed into and ( will be deleted from during the simplification step to obtain ). In the latter case will be decomposed into and ( will be removed from during the simplification step to obtain ). In either case we do not have to specifically guard the line segment . If is guarded then so is . Similarly treat the case where is an edge of .
Assume that . Recall, that . Several cases are possible:

. Then we dissect along . This partition creates the polygons of size and of size .

. Then we dissect along . This partition creates the polygons of size and of size .

. Then:

and . Then we dissect along . This partition creates the polygons of size and of size .

and . Then both and are not good diagonal cuts. We cannot avoid dissecting along . If a guard eventually needs to be positioned at (for any subpolygon of ) and is a vertex of , then we position our towers close to but in the interior of , oriented towards .

red Case 3: . In this case and . If then either dissect along (and later delete from during the simplification step), or dissect along (delete from during the simplification step). Notice that in both cases will be guarded. The case where is similar.
If then we have no choice but to dissect along . This creates a polygon whose kernel degenerates into a single point . It is not a problem for guards but it is a serious obstacle for our problem. If is a vertex of and a guard is located at for any subpolygon of then we position our towers close to but in the interior of , and orient those towers towards . We consider the general approach to this problem in the following subsection.
3.2 PointKernel Problem
[2]PointKernel Problem.subsec:PointKernel
In Section 3.1 we studied simple cases where a diagonal dissection is applied to polygons* (or polygons in nongeneral position). In this subsection, we show how to circumvent some difficulties that arise when adapting Tóth’s partitioning to our problem.
The dissection of may create subpolygons that are polygons*. This means that the partition of may contain starshaped polygons whose kernels degenerate into a single point. While this is not a problem for guards, it is a serious obstacle for tower positioning. Indeed, we need at least two distinct points in the kernel of each part of the partition to trilaterate .
Let be a good dissection, i.e. it decomposes into and such that . Assume also that . Assume that contains at least more vertices of in its interior. Let . Refer to Fig. 6. Notice that and belong to subpolygons of on the opposite sides of . Recall that the original polygon is given in general position. Thus at most two vertices of belong to the same line. If and are not both vertices of then there is no problem for tower positioning, and the dissection via can be applied directly. We then follow Tóth’s partition and replace every guard with a pair of towers in the guard’s vicinity. However, if and are vertices of then the visibility of towers can be obstructed. Consider the example of Fig. 6. Assume that a guard is positioned at to observe a subpolygon of (say, pentagon for and ). We cannot replace the guard with a pair of towers because the kernel of the pentagon degenerates into a single point . Our attempt to position towers in the vicinity of but interior to is not successful either, because , as a vertex of , blocks visibility with respect to . We have to find another dissection. In general, we are looking for a dissection that destroys the diagonal .
Recall that in this subsection is a subpolygon of with collinear vertices , , and . Assume that and are vertices of . It follows that there are no vertices of on other than and . Assume that is a good dissection of . If one of , , , or is a good dissection then we cut along it. Only the cut along destroys the diagonal and eliminates the problem of having towers in the vicinity of (respectively ) with visibility obstructed by (respectively ). The cut along , , or only reduces . So assume that none of the diagonals , , , or represent a good dissection. It follows from Tóth’s Proposition 1 that . Consider the following cases:
red Case 1: . By Tóth’s Proposition 2 either and , or and for , where and . Assume w.l.o.g. that and . We assumed that is not a good dissection and thus the size of is a multiple of and the size of is a multiple of . Consider the following three subcases:
blue Case 1.1: ; thus or . Since the size of is a multiple of , we have or . Notice that and cannot be both of size , otherwise would be deleted during the simplification step. Both diagonals and represent a good dissection. Thus, if then dissect along ; if then dissect along . The polygon will be simplified and it will loose (which is guarded by or/and ).
blue Case 1.2: or . Then is a good diagonal dissection.
blue Case 1.3: . Then and thus is a good diagonal dissection, which creates the polygons and . The vertex will be deleted from during the simplification step. Notice that the line segment will be guarded by .
red Case 2: . Since is a good dissection, it partitions into of size and of size .
blue Case 2.1: ; thus or . We assumed that is not a good dissection and thus
. It follows that is a line segment . Symmetrically, if then . If and then we have a good dissection , which is a contradiction.
The case where and is not possible because in this case and and thus would not survive the simplification step.
Thus, if then and . Refer to Fig. 7. Let be an immediate neighbour of such that is a vertex of and . If and see each other, then is a diagonal of . It dissects into two subpolygons of size and of size . Assume now that and do not see each other. Let us give numerical labels to the vertices of as follows: gets label , gets , and so on, will be labelled . If can see a vertex of with label whose value modulo equals then dissect along the diagonal that connects and that vertex. If no such vertex can be seen from , we do the following. Let be an immediate neighbour of such that is a vertex of and . Let be the point on where the line supporting first hits (refer to Fig. 7). If belongs to an edge with vertices whose labels modulo equal and then dissect along . This dissection creates polygons of size and of size .
We are still in case and all its assumptions are still applicable. If the above scenario (about dissecting via a line that contains ) has not worked, we consider the case that we tried to avoid all along: the dissection of along such that the successive partitioning of created a subpolygon with a singlepoint kernel at whose edge contains in its interior. In other words, we assume that has undergone some partitioning that resulted in the creation of the pentagon for , such that and (refer to Fig. 8). It is impossible to localize an agent in the pentagon with a pair of towers only. However, if or then a pair of towers in the vicinity of can oversee the pentagon, because is not causing an obstruction in this case. Despite that is a line segment, the original polygon has a nonempty interior in the vicinity of to the right of the ray . Notice that may be equal to ; may be equal to . Moreover, and may not be vertices of but were created during the partition. We also assume that was not partitioned yet. Let be a subpolygon of that inherits the partition of to the side of the dissection that contains (refer Fig. 9). Notice that and can see each other. If is a diagonal dissection then instead use . In this case can be deleted and is added to . The size of does not change and the number of guards required to guard