On Romeo and Juliet Problems: Minimizing Distance-to-Sight
Hee-Kap Ahn, Eunjin Oh, Lena Schlipf, Fabian Stehn, Darren Strash

TL;DR
This paper introduces and solves efficiently the quickest pair-visibility problem in polygons, optimizing the travel distances for two persons to see each other, with solutions for both fixed and query scenarios.
Contribution
It presents the first linear-time algorithms for the min-max and min-sum variants of the pair-visibility problem in simple polygons.
Findings
Optimal linear-time algorithms for min-max and min-sum variants.
Preprocessing enables fast query responses in O(log^2 n) time.
Solutions applicable to polygons with no holes.
Abstract
We introduce a variant of the watchman route problem, which we call the quickest pair-visibility problem. Given two persons standing at points and in a simple polygon with no holes, we want to minimize the distance they travel in order to see each other in . We solve two variants of this problem, one minimizing the longer distance the two persons travel (min-max) and one minimizing the total travel distance (min-sum), optimally in linear time. We also consider a query version of this problem for the min-max variant. We can preprocess a simple -gon in linear time so that the minimum of the longer distance the two persons travel can be computed in time for any two query positions where the two persons start.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
On Romeo and Juliet Problems: Minimizing Distance-to-Sight111This work by Ahn and Oh was supported by the MSIT (Ministry of Science and ICT), Korea, under the SW Starlab support program (IITP-2017-0-00905) supervised by the IITP (Institute for Information & Communications Technology Promotion).
An extended abstract of this paper appeared at SWAT’18.
Hee-Kap Ahn Department of Computer Science and Engineering, POSTECH, Pohang, South Korea, [email protected]
Eunjin Oh Max Planck Institute for Informatics, Saarbrücken, Germany, [email protected]
Lena Schlipf Theoretische Informatik, FernUniversität in Hagen, Hagen, Germany, [email protected]
Fabian Stehn Institut für Informatik, Universität Bayreuth, Bayreuth, Germany, [email protected]
Darren Strash Department of Computer Science, Hamilton College, Clinton, New York, USA, [email protected]
Abstract
We introduce a variant of the watchman route problem, which we call the quickest pair-visibility problem. Given two persons standing at points and in a simple polygon with no holes, we want to minimize the distance they travel in order to see each other in . We solve two variants of this problem, one minimizing the longer distance the two persons travel (min-max) and one minimizing the total travel distance (min-sum), optimally in linear time. We also consider a query version of this problem for the min-max variant. We can preprocess a simple -gon in linear time so that the minimum of the longer distance the two persons travel can be computed in time for any two query positions where the two persons start.
Keywords: visibility polygon shortest path watchman problems
1 Introduction
In the watchman route problem, a watchman takes a route to guard a given region—that is, any point in the region is visible from at least one point on the route. It is desirable to make the route as short as possible so that the entire area can be guarded as quickly as possible. The problem was first introduced in 1986 by Chin and Ntafos [1] and has been extensively studied in computational geometry [2, 3]. Though the problem is NP-hard for polygons with holes [1, 4, 5], an optimal route can be computed in time for simple -gons [6] when the tour must pass through a specified point, and time otherwise.
In this paper, we study a variant of the watchman route problem. Imagine two persons, Romeo and Juliet, travel in a region from their starting locations. They want to minimize the distance they travel in order to see each other. More precisely, given the region and the locations where Romeo and Juliet start, the objective is to compute their paths, one for Romeo and one for Juliet, such that they see each other after traveling along the paths and their travel distances are minimized. This problem can be formally defined as follows.
Problem** (quickest pair-visibility problem).**
Given two points and in a simple polygon , compute the minimum distance that and must travel in order to see each other in .
In the min-max variant of the quickest pair-visibility problem, we want to minimize the longer distance that the two points travel to see each other. In the min-sum variant, we want to minimize the total travel distance that the two points travel to see each other.
This problem may sound similar to the shortest path problem between and , in which the objective is to compute the shortest path for to reach . However, they differ even for a simple case: for any two points lying in a convex polygon, the distance in the quickest pair-visibility problem is zero while in the shortest path problem, it is their geodesic distance . We would like to mention that our algorithm to be presented later uses the shortest path as a guide in computing the quickest pair-visibility paths.
The quickest pair-visibility problem occurs in optimization tasks. For example, mobile robots that use a line-of-sight communication model are required to move to mutually-visible positions to establish communication [7]. An optimization task here is to find shortest paths for the robots to meet the visibility requirement for establishing communication among them.
Wynters and Mitchell [8] studied this problem for two agents acting in a polygonal domain in the presence of polygonal obstacles and gave an -time algorithm for the min-sum variant (where is the number of vertices of the polygonal domain, and is the number of edges of the visibility graph of all corners) and an -time algorithm for the min-max variant.
A query version of the quickest visibility problem has also been studied [9, 10, 11]. In the query problem, a polygon and a source point lying in the polygon are given, and the goal is to preprocess them and construct a data structure that supports, for a given query point, finding the shortest path taken from the source point to see the query point efficiently. Khosravi and Ghodsi [10] considered the case for a simple -gon and presented an algorithm to construct a data structure of space so that, given a query, it finds the shortest visibility path in time. Later, Arkin et al. [9] improved the result and presented an algorithm for the problem in a polygonal domain. Very recently, Wang [11] presented an improved algorithm for this problem for the case that the number of the holes in the polygon is relatively small. Figure 1(a) illustrates differences in these problems for a simple polygon and two points, and , in the polygon.
1.1 Our results
In this paper, we consider both min-max and min-sum variants of the quickest pair-visibility problem for a simple polygon. That is, either we want to minimize the maximum length of two traveled paths (min-max) or we want to minimize the sum of the lengths of two traveled paths (min-sum). We give a sweep-line-like approach that “rotates” the lines-of-sight along vertices on the shortest path between the start positions, allowing us to evaluate a linear number of candidate solutions on these lines. Throughout the sweep, we encounter solutions to both variants of the problem. We further show that our technique can be implemented in linear time.
We also consider a query version of this problem for the min-max variant. We can preprocess a simple -gon in linear time so that the minimum of the longer distance the two query points travel can be computed in time for any two query points.
2 Preliminaries
Let be a simple polygon and be its boundary where . The vertices of are given in counter-clockwise order along . We denote the shortest path within between two points by and its length by . Likewise, we denote the shortest path within between a point and a line segment by . We say a point is visible from another point (and is visible from ) if and only if the line segment is contained in .
For two starting points and , our task is to compute a pair of points such that and are visible to each other, where we wish to minimize the lengths of and . In the min-max setting, we wish to minimize . For the min-sum setting, we wish to minimize . Note that, for both variants, the optimum is not necessarily unique; see Figure 1(b) and (c).
We say a segment is tangent to a path at a vertex if and ’s neighboring vertices on are in a closed half-plane bounded by the line containing . Let be the sequence of vertices on with and .
Lemma 1**.**
Unless and are visible to each other, there is an optimal solution such that is tangent to the shortest path at a vertex of .
Proof.
We first show that there is a vertex of lying on . Without loss of generality, assume that is horizontal with lying to the left of . Let be the maximal segment contained in that contains with closer to than to . If (or ), then the lemma holds immediately because (or is an endpoint of . Assume to the contrary that contains no vertex of . Then there are points in a neighborhood of and in a neighborhood of such that and are visible to each other, and and . This contradicts the optimality of .
We now show that contains a vertex of . Let be the vertex on preceding and let be the vertex on preceding . Consider first the case that both and lie below the line through . See Figure 2(a). Then touches at a vertex locally from below. Otherwise, is not optimal by the same argument as in the previous paragraph. Then and . The path must cross at a point and at a point . Since and are visible to each other, and is a shortest path, contains , which in turn contains . Thus lies on and is tangent to at .
Consider now the case that and lie on different sides of the line through . Without loss of generality, assume that lies below the line and lies above the line. Then intersects . We first show that contains an edge of . Assume to the contrary that intersects only at a point, say . Then there is another line segment containing and intersecting both and . See Figure 2(b). This contradicts that is an optimal solution because, for and , and/or and and are visible to each other. If coincides with or , only one of the distance inequalities above holds, we hence consider lexicographic smallest (max,min) solutions in the min-max setting to establish the contradiction. Therefore, contains an edge of , say . Moreover, one of and touches from above, and the other touches from below since and are on different sides of . See Figure 2(c). Thus, we can assume that touches at a vertex locally from below. Then must cross at a point , and at a point . Since and are visible to each other, and is a shortest path, contains , which in turn contains both and . Thus both and lie on and is tangent to at both and . ∎
3 Computing All Events for a Sweep-Line-Like
Approach
In the remaining part of the paper, we use to denote the optimal solution pair from and to a given line (and not necessarily a global optimal solution for the quickest pair-visibility problem). For each vertex on we compute a finite collection of lines through , each being a configuration at which the combinatorial structure of the shortest paths and/or changes. To be more precise, at these lines either the vertices of or (except for and ) change or an edge of changes that is intersected by the extension of . To explain how to compute these lines, we introduce the concept of a line-of-sight.
Definition 1** (line-of-sight).**
We call a segment a line-of-sight if (i) is a maximal segment contained in , and (ii) is tangent to at a vertex .
The algorithm we present is in many aspects similar to a sweep-line strategy, except that we do not sweep over the scene in a standard fashion but rotate a line-of-sight in around the vertices of the shortest path in order from while making use of Lemma 1. Recall that is the sequence of vertices on with and . The process will be initialized with a line-of-sight that contains and and is then rotated around (while remaining tangent to ) until it hits , see Figure 3(a). In general, the line-of-sight is rotated around in a way so that it remains tangent to at (it is rotated in the interior of ) until the line-of-sight contains and , then the process is iterated with as the new rotation center. The process terminates as soon as the line-of-sight contains and .
While performing these rotations around the shortest path vertices, we encounter all lines-of-sight. As for a standard sweep-line approach, we will compute and consider events at which the structure of a solution changes: this is either because the interior vertices of or change or because the line-of-sight starts or ends at a different edge of . These events will be represented by points on (actually, we consider the events as vertices on unless they are already vertices). Between two consecutive events, we compute the local minima of the relevant distances for the variant at hand in constant time and hence encounter all local minima eventually.
There are three event-types to distinguish: {enumerate*}
Path-Events are endpoints of lines-of-sight that contain two consecutive vertices of the shortest path . See Figure 3(a).
Boundary-Events are endpoints of lines-of-sight that are tangent at a vertex of and contain at least one vertex of (potentially as an endpoint). See Figure 3(b).
Bend-Events are endpoints of lines-of-sight where the shortest path from (or ) to the line-of-sight gains or loses a vertex while rotating the line-of-sight around a vertex . See Figure 3(c). Note that bend-events can coincide with path- or boundary-events.
We will need to explicitly know both endpoints of the line-of-sight on at each event and the corresponding vertex of on which we rotate.
Lemma 2** **(Computing path- and
boundary-events).
For a simple polygon with vertices and points , the queue of all path- and boundary-events of the rotational sweep process, ordered according to the sequence in which the sweeping line-of-sight encounters them, can be initialized in time.
Proof.
Consider some line-of-sight that is tangent to a vertex for some . Then subdivides into a number of subpolygons. Consider as the union of two (sub)segments and of induced by such that and is incident to the subpolygon of induced by containing .
We will discuss the computation of all boundary- and path-events swept by . The other events swept by can be computed in a second round by changing the roles of and . We do not maintain a queue for the events explicitly; instead we will introduce new vertices on or label existing vertices of as events. Later the events will be considered by following two pointers to vertices on and hence by processing the vertices in the order of their occurrence on .
We start with computing all path-events swept by . For this we compute the shortest path map of in . The shortest path map of is a decomposition of in triangular cells such that the shortest path from to any point within a cell is combinatorially the same. It can be obtained by extending every edge of the shortest path tree of towards its descendants until it reaches in linear time [12]. A path-event occurs when a line-of-sight contains two consecutive vertices of . Note that for each path-event, appears as an edge of and its endpoints appear as vertices of (see also Figure 4(a)). For each index with , we find the edge incident to and parallel to by considering every edge of incident to . This takes time in total since there are edges of and we consider every edge at most once. Note that the path-event induced by and is an exception, but it can also be computed in time during the process by considering the triangle of that contains .
For computing the boundary-events, we use the following properties. While rotating around from the position where contains to the position in which contains , let () be the region of that is swept over by (). (See Figure 5.) Observe that {description*}
all for are pairwise disjoint in their interior,
all for are pairwise disjoint in their interior,
for all and all points the shortest path contains (i.e., is the predecessor of on ),
for all and all points the shortest path contains (i.e., is the successor of on ).
To compute all boundary-events that are vertices of swept by , we will make use of the shortest path tree for in . A boundary-event is defined by a vertex such that the line-of-sight that contains (potentially as one endpoint) is tangent to in . It follows from Property P3, that is an edge of (and by that it cannot be obstructed by edges of ) and . So the vertices of whose parent vertex in is a vertex of are possible boundary-events. In order to compute all boundary-events we consider all consecutive path-events and compute all corresponding boundary-events by following and checking the vertices within the candidate set (see Figure 4(b)). We compute the boundary-events that are vertices of swept by in a similar way.
So far we have labeled all vertices on that are boundary-events. We still need to compute the other endpoint of the line-of-sight that is tangent in . Let be the line-of-sight at the path-event so that . See Figure 5. While rotating around , sweeps over until the next path-event is met. Let be the sequence of the path- and boundary-events in we obtained so far sorted in counter-clockwise order along . The order of events in is the same as the order in which sweeps over them. Our goal is to compute for every event in in order. To do this, we consider the (triangular) cells of the shortest path map of incident to one by one in counter-clockwise order around starting from the cell incident to . Since every point in such cells is visible from , we can determine if is contained in a cell in constant time for any event . Therefore, we can compute for every event in in time linear in the number of the cells of incident to and the number of events of , giving us all path- and boundary-events in total time.
∎
Once we initialized the event queue , we can now compute and process bend-events as we proceed in our line-of-sight rotations.
Lemma 3**.**
All bend-events can be computed in time, sorted in the order as they appear on the boundary of .
Proof.
Bend-events occur between consecutive path- and boundary-events; they can also coincide with these events. We assume that all path- and boundary-events are already computed. Additionally, we assume that all vertices of the boundary- and path-events (the endpoints of the corresponding lines-of-sight) are inserted on . Recall that, for each event, we know both endpoints of the line-of-sight on and the corresponding vertex of on which we rotate. The path- and boundary-events define the area which is swept over by . Thus, we know which positions for we have to consider in order to compute all bend-events.
As in the proof of Lemma 2, we consider the line-of-sight tangent to a vertex as the union of two (sub)segments and of induced by such that and is incident to the subpolygon of induced by containing . We discuss the computation of all bend-events that are encountered by . The bend-events that are swept over by can be computed in a second round by changing the roles of and .
We start with the path-event defined by and , and consider all events in the order they appear. Let be the line-of-sight rotating around a vertex and denote by the endpoint of other than . To find the bend-events efficiently, we compute and maintain the shortest path over the events.
While rotates around , the combinatorial structure of may change. Specifically, let denote the edge of incident to with on . Note that during the rotation of , all the edges of are stationary, except that rotates around . Therefore, a change in the combinatorial structure of occurs only when hits a vertex of (if at this event is an endpoint of , then this bend-event coincides with a previously computed boundary-event) and splits into two edges sharing (an event of type T1) or the two edges of incident to become parallel (an event of type T2). (Then they merge into one and disappears from .) See Figure 6. From any event of the two event types above, , and are updated accordingly. Additionally, is updated and its new position is inserted as a vertex on as it represents a bend-event.
Lemma 4**.**
An event of type T1 occurs only when (i) reaches a vertex , or (ii) hits a vertex of in its interior. Moreover, for case (ii), and are consecutive in .
Proof.
Imagine is rotated around infinitesimally further from the current event. Then either is orthogonal to or not. If is not orthogonal to , the closest point in from is . Thus, the only way that hits a vertex of is that reaches . See Figure 6(a).
Now consider the case that is orthogonal to . Notice that the shortest path from a vertex to a segment within a simple polygon lies inside a funnel, a region bounded by the shortest paths from to both endpoints of the segment and the segment. For more details see [12]. Thus, is contained in . See Figure 6(b). Since is a subpath of , is a vertex of , and thus is the vertex of previous to from . ∎
Lemma 5**.**
Once a vertex disappears from , it never appears again on the shortest path during the rotation of the line-of-sight .
Proof.
Assume to the contrary that there is a vertex that disappears from , but then appears again on for two distinct lines-of-sight and during the rotation. First note that if is an endpoint of (or ), it is a boundary- and bend-event, and would only appear once when rotating the line-of-sight. Therefore, both and must contain in their interiors, and both of them also contain in their interiors. Since disappears from , the edge of incident to (on ) is orthogonal to . We claim that appears on due to case (ii) of type T1, that is, the edge of incident to hits . Assume to the contrary that appears on due to case (i) of type T1. However, (and its event vertex on ) is already swept by a line-of-sight before we consider because it appears on . By Property P2, sweeps a vertex only once. Thus, appears on due to case (ii) of type T1, and the edge of incident to is orthogonal to . This means that and are parallel.
Since and are parallel, they are tangent to at two distinct vertices, say and , respectively. Without loss of generality, assume that is closer to than . We show that contains for any two points and , where is the subpolygon bounded by containing . Since both and are vertices of , contains . Let be the point on farthest from such that contains . Since the boundary of intersect neither nor , is contained in the triangle with corners . No line segment parallel to is tangent to at , which is a contradiction. Therefore, contains for any point . Then since is tangent to , contains for any two points and . Thus, contains , and no vertex in other than the vertices of appears on . Since is contained in , it cannot appear on , which is a contradiction. ∎
Using the two lemmas, we can compute all bend-events as follows. For a line-of-sight rotating around a vertex , we have three candidates for the next bend-event. Let be the edge of containing the endpoint of other than , and let be the neighboring vertex of in . The next bend-event is (1) the endpoint of not contained in if it exists, (2) the intersection point between and the line through and orthogonal to if it exists, or (3) the intersection point between and the line through and orthogonal to if it exists, where is the neighboring vertex of in closer to . Note that the first two cases are type T1 events and the last case is a type T2 event. We can compute all of the three events in constant time. Also, we can update and accordingly in constant time. Therefore, the time for computing all bend-events is linear in the amount of the combinatorial change on . By Lemma 5, the the amount of the combinatorial change is , and therefore, we can compute all bend-events in time. ∎
4 Algorithm Based on a Sweep-Line-Like Approach
In this section, we present a linear-time algorithm for computing the minimum distance that two points and in a simple polygon travel in order to see each order. We compute all events defined in Section 3 in linear time. The remaining task is to handle the lines-of-sight lying between two consecutive events.
Lemma 6**.**
For any two consecutive events, the line-of-sight lying between them that minimizes the sum or the maximum of the distances from and to can be found in constant time.
Proof.
Let be the set of all lines-of-sight lying between the two consecutive events. We assume that contains no vertical line-of-sight. Otherwise, we consider the subset containing all lines-of-sight with positive slopes, and then the subset containing all lines-of-sight with negative slopes.
These lines-of-sight share a common vertex of . We will give an algebraic function for for . An algebraic function for can be obtained analogously. Observe that is the same for all , where is the second to the last vertex of from . Thus, we consider only the length of , which is a line segment. The length is either the Euclidean distance between and the line containing , or the Euclidean distance between and the endpoint of closest to . We show how to handle the first case only because the second case can be handled analogously.
Let denote the line of slope passing through for , which is represented as , where is a function linear in . Then the distance between and can be represented as , where and are constants depending only on and . Thus, our problem reduces to finding a minimum of the function of the form and , respectively, for four constants and , and for all such that contains a line-of-sight in . We can find a minimum in constant time using elementary analysis. ∎
Theorem 1**.**
Given a simple -gon with no holes and two points , a point-pair such that (i) and (ii) either or is minimized can be computed in time.
Proof.
Our algorithm first computes all path- and boundary-events as described in Lemma 2. The number of events introduced during this phase is bounded by the number of vertices of the shortest path maps, and , respectively, which are . In the next step, it computes the bend-events on as described in Lemma 3, which can be done in time. Finally, our algorithm traverses the sequence of events. Between any two consecutive events, it computes the respective local optimum in constant time by Lemma 6. It maintains the smallest one among the local optima computed so far, and returns it once all events are processed. Therefore the running time of the algorithm is .
For the correctness, consider the combinatorial structure of a solution and how it changes. The path-events ensure that all vertices of are considered as being the vertex lying on the segment connecting the solution (Lemma 1). While the line-of-sight rotates around one fixed vertex of , either the endpoints of line-of-sight sweep over or become tangent to a vertex of . These are exactly the boundary-events. Or the combinatorial structure of or changes as interior vertices of or appear or disappear. These happen exactly at bend-events. Therefore, our algorithm returns an optimal point-pair. ∎
Corollary 1**.**
By the same algorithm, one can also compute optimal pairs that minimize {itemize}*
* for some ,*
* for some .*
The first modification introduced in Corollary 1 models that Romeo and Juliet travel with different speeds. It is easy to see, that this formulation is equivalent to minimizing the objective for some . The second variant can be motivated as follows: Imagine Romeo (and Juliet) is driving a car that before departing from (and ) already drove a distance of (and ). The objective minimizes the largest distance any of the two cars had to drive in order to establish a line-of-sight.
5 Quickest Pair-Visibility Query Problem
In this section, we consider a query version of the min-max variant of the quickest pair-visibility problem: Preprocess a simple -gon so that the minimum traveling distance for two query points and to see each other can be computed efficiently. We can preprocess a simple -gon in linear time and answer a query in time by combining the approach in Section 4 with the data structure given by Guibas and Hershberger [13, 14]. For any two query points and in , the query algorithm for their data structure returns , represented as a binary tree of height , in time [14]. Thus, we can apply a binary search on the vertices (or the edges) on efficiently.
Imagine that we rotate a line-of-sight along the vertices of for two query points and in . Lemma 1 implies that there is a line-of-sight containing and , where is an optimal solution. We call it an optimal line-of-sight. We define the order of any two lines-of-sight as the order in which they appear during this rotational sweep process. By the following lemma, we can apply a binary search on the sequence of events along and find two consecutive events such that the respective local optimum achieved between them is a global optimal solution.
Lemma 7**.**
The geodesic distance between (and ) and the rotating line-of-sight increases (and decreases) monotonically as the line-of-sight rotates along the vertices of from .
Proof.
Let be a line-of-sight that is tangent to at a vertex . Consider the subdivision of induced by and let be the subpolygon that contains . Let be a line-of-sight that comes after during the rotational sweep process. We claim that does not intersect the interior of . If is tangent to at , it never intersects the interior of as shown in the proof of Lemma 2. Assume that is tangent to at a vertex that comes after along from , but intersects the interior of . Without loss of generality, assume that is horizontal and lies locally below . Then must lie strictly above the line containing . However, since both and are vertices of and is tangent to at , there must be another vertex of that lies on or below the line containing and appears between and along . See Figure 7.
Thus, is not visible from any point on , and does not intersect the interior of . Since intersects , we have . The claim for and the rotating line-of-sight can be shown analogously. ∎
5.1 Binary Search for the Path-Events
We first consider the path-events, and find two consecutive path-events containing an optimal line-of-sight between them. Let be the sequence of vertices on with and . Due to the shortest-path data structure by Guibas and Hershberger, we can obtain represented as a binary tree of height in time. Consider an edge of . We can determine whether or not an optimal line-of-sight is tangent to at a vertex lying after along in time. To do this, we compute the line-of-sight containing in time. We use the data structure for ray shooting given by Hershberger and Suri [15] with linear preprocessing and logarithmic query time. Then, we compute the length of and in time using the data structure given by Guibas and Hershberger for computing the distance between a query point and a query line segment in time [13]. An optimal line-of-sight is tangent to at a vertex lying after if and only if is shorter than . Therefore, we can compute the two consecutive path-events with an optimal solution lying between them in time.
5.2 Binary Search for the Boundary-Events
Now we have the vertex of contained in an optimal line-of-sight. We find two consecutive boundary-events defined by lines-of-sight tangent to at such that an optimal line-of-sight lies between them. Let and be the first points of hit by the rays from any point in towards and , respectively. See Figure 5. Similarly, let and be the first points of hit by the rays from any point in towards and , respectively. These four points of can be found in time by the ray-shooting data structure [15]. Without loss of generality, we assume that a line-of-sight rotates around in the counter-clockwise direction in the rotational sweep process. Let be the part of lying between and in counter-clockwise order, and be the part of lying between and in counter-clockwise order. An optimal line-of-sight has one endpoint on and the other endpoint on .
We first find the edge of (resp. ) containing an endpoint of by applying a binary search on the vertices of (resp. ). This gives two consecutive boundary-events such that lies between them. We now show how to find the edge of containing an endpoint of . The edge on can be found analogously.
We perform a binary search on the vertices in as follows. Let be the endpoint of contained in . For any vertex of , we can determine which part of with respect to contains in time. To do this, we consider the line-of-sight containing the edge of incident to . Observe that intersects only in the edge including its endpoints as is a shortest path. See Figure 8(a). Since we can obtain the edge of incident to in time using the shortest-path data structure, we can obtain in the same time. Here, to obtain the endpoint of on , we use the ray-shooting data structure that supports query time [15]. Then we compare and in time. The point comes after from if and only if . Therefore, we can determine which part of with respect to contains in time, and thus the binary search is completed in time. In this way, we can compute two consecutive boundary-events such that an optimal line-of-sight lies between them in time.
5.3 Binary Search for the Bend-Events
Now we have two consecutive events in the sequence of all path- and boundary-events that contain an optimal line-of-sight between them. Let and be two lines-of-sight corresponding to the two consecutive events such that comes after . The remaining task is to handle the bend-events lying between them. For the bend-events, we perform a binary search on the edges of in time. Then we perform a binary search on the edges of in time. In the following, we describe the binary search on . The other one can be done analogously.
We find the point such that is the maximal common subpath of and from in time using the shortest-path data structure [14]. See Figure 8(b). Then we obtain represented as a binary tree of height in time. Notice that is a path from to , concatenating the two shortest paths from to and from to .
For an edge of , we use to denote the line-of-sight containing and orthogonal to the line containing . Observe that comes after if and only if comes after along from (because the order of the edges of , as they appear on the path, are radially sorted around ). Also, given an edge of , we can compute in constant time. Using these properties, we can find two consecutive edges and of such that lies between and in time by applying a binary search on as we did for path- and boundary-events.
Now we have two consecutive events in the sequence of all path-, boundary- and bend-events that contain between them. Recall that the combinatorial structure of (and ) is the same for every line-of-sight lying between the two events. Let and be the edges of and incident to at and , respectively, for any line-of-sight lying between the two events. Using the shortest-path data structure, we can obtain and in time. Then we apply the algorithm in Lemma 6 to find an optimal line-of-sight in constant time. In this way, we can obtain an optimal line-of-sight in time in total.
Therefore, we can find two consecutive events with an optimal solution between them, and we can obtain an optimal solution in time in total.
Theorem 2**.**
Given a simple -gon , we can preprocess it in time to find the minimum of the longer distance that and travel in order to see each other in can be computed in time for any two query points .
6 Conclusions and Open Problems
We have presented a linear time algorithm that solves two variants of the quickest pair-visibility problem for a simple polygon: either we want to minimize the maximum length of a traveled path or we want to minimize the sum of the lengths of both traveled paths.
Additionally, we have considered a query version of the quickest-visibility problem for the min-max variant. We can preprocess a simple -gon in linear time so that the minimum of the longer distance the two query points travel can be computed in time for any two query points.
We conclude this paper with some interesting open problems.
Is there a way to extend our algorithm to more than two query points? More precisely, given points in a simple polygon, compute the minimum distance that these points must travel in order to see each other (at the same moment). 2. 2.
Find an efficient algorithm for the query version of the quickest-visibility problem for the min-sum problem.
Acknowledgments
This research was initiated at the 19th Korean Workshop on Computational Geometry in Würzburg, Germany.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] W. Chin, S. Ntafos, Optimum watchman routes, in: Proceedings of the 2nd ACM Symposium on Computational Geometry, So CG 1986, 1986, pp. 24–33. doi:10.1145/10515.10518 . · doi ↗
- 2[2] S. Carlsson, H. Jonsson, B. J. Nilsson, Finding the shortest watchman route in a simple polygon, Discrete & Computational Geometry 22 (3) (1999) 377–402. doi:10.1007/PL 00009467 . · doi ↗
- 3[3] J. S. B. Mitchell, Approximating watchman routes, in: Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms, 2013, pp. 844–855. doi:10.1137/1.9781611973105.60 . · doi ↗
- 4[4] W. Chin, S. Ntafos, Optimum watchman routes, Information Processing Letters 28 (1) (1988) 39–44. doi:10.1016/0020-0190(88)90141-X . · doi ↗
- 5[5] A. Dumitrescu, C. D. Tóth, Watchman tours for polygons with holes, Computational Geometry 45 (7) (2012) 326–333. doi:10.1016/j.comgeo.2012.02.001 . · doi ↗
- 6[6] M. Dror, A. Efrat, A. Lubiw, J. S. B. Mitchell, Touring a sequence of polygons, in: Proceedings of the 35th Annual ACM Symposium on Theory of Computing, STOC ’03, 2003, pp. 473–482. doi:10.1145/780542.780612 . · doi ↗
- 7[7] A. Ganguli, J. Cortes, F. Bullo, Visibility-based multi-agent deployment in orthogonal environments, in: Proceedings of the 2007 American Control Conference (ACC ’07), 2007, pp. 3426–3431. doi:10.1109/ACC.2007.4283034 . · doi ↗
- 8[8] E. L. Wynters, J. S. B. Mitchell, Shortest paths for a two-robot rendez-vous, in: Proceedings of the 5th Canadian Conference on Computational Geometry, 1993, pp. 216–221.
