arXiv is now an independent nonprofit! Learn more
License: arXiv.org perpetual non-exclusive license
arXiv:2004.02220v6 [cs.CG] 28 Oct 2021
\publyear

2021 \papernumber2075

\finalVersionForARXIV

Query-Points Visibility Constraint Minimum Link Paths
in Simple Polygons

Volume:Β 182Issue:Β 3
Mohammad Reza Zarrabi
Department of Electrical and Computer Engineering
Tarbiat Modares University
Tehran
††thanks: Address for correspondence: Faculty of Electrical Engineering and Computer Science, Tarbiat Modares University, Tehran, Iran.

Received September 2020; revised August 2021.
   Iran
m.zarabi@modares.ac.ir
   Nasrollah Moghaddam Charkari
Department of Electrical and Computer Engineering
Tarbiat Modares University
Tehran
   Iran
Abstract

We study the query version of constrained minimum link paths between two points inside a simple polygon PP with nn vertices such that there is at least one point on the path, visible from a query point. The method is based on partitioning PP into a number of faces of equal link distance from a point, called a link-based shortest path map (SPM). Initially, we solve this problem for two given points ss, tt and a query point qq. Then, the proposed solution is extended to a general case for three arbitrary query points ss, tt and qq. In the former, we propose an algorithm with O⁑(n)O(n) preprocessing time. Extending this approach for the latter case, we develop an algorithm with O⁑(n3)O(n^{3}) preprocessing time. The link distance of a qq-v​i​s​i​b​l​evisible path between ss, tt as well as the path are provided in time O⁑(log⁑n)O(\log n) and O⁑(m+log⁑n)O(m+\log n), respectively, for the above two cases, where mm is the number of links.

keywords
Computational Geometry; Minimum Link Path; Shortest Path Map; Map Overlay

Query-Points Visibility Constraint Minimum Link Paths in Simple Polygons

1 Introduction

One of the problems in the field of Robotics and Computational Geometry is finding a minimum link path between two points in a simple polygon. A minimum link path between two points ss and tt is a chain of line segments (links) connecting them inside a simple polygon PP with nn vertices that has the minimum number of links. The link distance between ss and tt is defined as the number of links in a minimum link path. Finding a minimum link path between two fixed points inside a simple polygon was first studied by Suri [15]. He introduced an O⁑(n)O(n) time algorithm for this problem. Afterwards, Ghosh [8] presented an alternative algorithm, which also runs in O⁑(n)O(n) time. To solve this problem in a polygonal domain, Mitchell et al. [14] proposed an incremental algorithm that runs in time O⁑(n2​log2​n)O(n^{2}\log^{2}n), where nn is the total number of edges of the obstacles. On the other hand, a more general framework was established for minimum link paths by Suri [16] based on Shortest Path Map (SPM). By the construction of SPM from a fixed point, the simple polygon PP is divided into faces of equal link distance from that point in linear time. With this property, Arkin et al. [2] developed an algorithm for computing the link distance between two arbitrary query points inside PP. The algorithm computes window partitioning (SPM) of PP from every vertex of PP and from every extension point of the visibility graph of PP. It can be seen that endpoints of these windows divide edges of PP into O⁑(n2)O(n^{2}) atomic segments. These segments satisfy the property that the combinatorial type of S​P​M​(x)SPM(x) is the same for all points xx in the interior of each segment. Thus, the algorithm requires O⁑(n3)O(n^{3}) preprocessing time and answers a link distance query in O⁑(log⁑n)O(\log n) time.

In many applications, it is required for a robot to have direct visibility from a viewpoint during its motion [5]. Some examples are moving guards, resource collectors, wireless communications, etc. Minimum link paths have important applications in Robotics since turns are costly while straight line movements are inexpensive in robot motion planning. In the minimum link paths problem with point visibility constraint, the aim is to find a minimum link path between two points ss and tt such that there is at least one point on the path from which a given viewpoint qq is visible (a qq-v​i​s​i​b​l​evisible path [18]).

The constrained version of minimum link paths problem was studied in [18] for three fixed points ss, tt and qq inside a simple polygon. In this paper, we study the query version of the problem inside a simple polygon PP with nn vertices for two cases. First, suppose that two fixed points ss and tt are given, the goal is to find a qq-v​i​s​i​b​l​evisible path between ss and tt for an arbitrary query point qq. Second, we consider the same problem for three arbitrary query points ss, tt and qq. We propose two algorithms with O⁑(n)O(n) and O⁑(n3)O(n^{3}) preprocessing time for the above cases, respectively. The link distance of a qq-v​i​s​i​b​l​evisible path between ss, tt as well as the path are provided in time O⁑(log⁑n)O(\log n) and O⁑(m+log⁑n)O(m+\log n), respectively, for both cases, where mm is the number of links.

Similarly, a qq-v​i​s​i​b​l​evisible path is defined for the Euclidean metric. In this case, the query version of the shortest Euclidean path problem for two fixed points ss, tt and a query point qq inside a simple polygon with nn vertices was studied in [13]. The given algorithm preprocesses the input in O⁑(n3)O(n^{3}) time and provides O⁑(log⁑n)O(\log n) query time. A simpler form of the problem was studied in [12] in which the goal is to find the shortest Euclidean path from ss to view qq (without going to a destination point). The algorithm requires O⁑(n2)O(n^{2}) preprocessing time and answers a query in O⁑(log⁑n)O(\log n) time. Arkin et al. [3] improved the preprocessing time to O⁑(n)O(n) for simple polygons. Also, they built a data structure of size O⁑(n2​2α⁑(n)​log⁑n)O(n^{2}2^{\alpha(n)}\log n) that can answer each query in O⁑(n​log2​n)O(n\log^{2}n) time for a polygonal domain with hh holes and nn vertices, where α⁑(n)\alpha(n) is the inverse Ackermann function. Recently, a new data structure of size O⁑(n​log⁑h+h2)O(n\log h+h^{2}) was presented for this problem that can answer each query in O⁑(h​log⁑h​log⁑n)O(h\log h\log n) time [17].

The main differences between approaches in the Euclidean metric and the link distance metric are as follows. Optimal paths that are unique under the Euclidean metric need not be unique under the link distance metric. Also, Euclidean shortest paths only turn at reflex vertices while minimum link paths can turn anywhere. Thus, minimum link paths problems are usually more difficult to solve than equivalent Euclidean shortest path problems.

The main idea of the proposed algorithms given in this paper is to consider an edge of the visibility polygon (called eqe_{q}) for a query point qq as a separator chord inside PP, i.e., if ss and tt lie in different sides of such a chord, an optimal link path between them will be the answer. Otherwise, a qq-v​i​s​i​b​l​evisible path should have a non-empty intersection with the side of the chord containing qq. Therefore, the problem can be reduced to find an appropriate edge and optimal contact points between a qq-v​i​s​i​b​l​evisible path and the other side of the edge. To answer the queries efficiently, we preprocess the input using map overlay [7], point location [6], ray shooting [9] and shortest path map [16] techniques.

In Section 2, we introduce the problem definition and notation. Section 3 gives the basic lemmas and definitions. Section 4 shows the main idea and flow of the algorithm. Section 5 describes our algorithm for single query point, and Section 6 generalizes this algorithm to triple query points. Section 7 concludes with some open problems.

2 Problem definition and notation

Let PP be a simple polygon in the plane with nn vertices. For three points ss, tt and qq inside PP, the goal is to preprocess the input to answer two types of queries:

  1. OPEN1)1)

    Given a query point qq, find all qq-v​i​s​i​b​l​evisible paths between fixed points ss and tt in PP (single query).

  2. OPEN2)2)

    Given three query points ss, tt and qq, find a qq-v​i​s​i​b​l​evisible path between ss and tt in PP (triple query).

We use the following notation throughout the paper:

  1. βˆ™\bullet

    V⁑(x):V(x): the visibility polygon of a point xx ∈\in PP

  2. βˆ™\bullet

    Ο€L​(x,y):\pi_{L}(x,y): a minimum link path from a point xx to a point yy inside PP

  3. βˆ™\bullet

    Ο€E​(x,y):\pi_{E}(x,y): the shortest Euclidean path from a point xx to a point yy inside PP

  4. βˆ™\bullet

    M​L​P​(x,y,q):MLP(x,y,q): a qq-v​i​s​i​b​l​evisible (minimum link) path from a point xx to a point yy inside PP

  5. βˆ™\bullet

    |X|:|X|: the link distance of a minimum link path XX

  6. βˆ™\bullet

    n⁑(X):n(X): the number of members of a set XX

  7. βˆ™\bullet

    P​o​c​k​e​t​(x):Pocket(x): invisible regions of PP from a point xx, which are separated from V⁑(x)V(x)

  8. βˆ™\bullet

    S​P​M​(x):SPM(x): the shortest path map (window partition) of PP with respect to a point or line segment xx [16]

More precisely, we are looking for a minimum link path between ss and tt that should have a non-empty intersection with V⁑(q)V(q) for both cases. Each region of P​o​c​k​e​t​(q)Pocket(q) has exactly one edge in common with V⁑(q)V(q), called an edge of V⁑(q)V(q). However, there is no need to compute all edges of V⁑(q)V(q). Indeed, a single edge eqe_{q} of V⁑(q)V(q) would be sufficient to find a qq-v​i​s​i​b​l​evisible path (not any such edge, see Section 4.1).

Without preprocessing the query can be answered in linear time [18], but here our goal is to achieve a logarithmic query time using a preprocessing (this would be optimal as indicated in [2]). We define two types of output for either case mentioned above: one to find out |M​L​P​(s,t,q)|\lvert MLP(s,t,q)\rvert in O⁑(log⁑n)O(\log n) time, and another to report M​L​P​(s,t,q)MLP(s,t,q) in O⁑(m+log⁑n)O(m+\log n) time, where m=|M​L​P​(s,t,q)|m=\lvert MLP(s,t,q)\rvert.

3 Basic lemmas and definitions

A planar subdivision is a partition of the 2-dimensional plane into finitely many vertices, edges and faces (V,E,F)(V,E,F). One type of planar subdivision is simply connected planar subdivision (SCPS) with an additional restriction: any closed paths lying completely in one region of a SCPS can be topologically contracted to a point. Therefore, a region in a SCPS cannot contain any other regions [7]. According to Euler’s formula for SCPS, we have the following equation: n⁑(V)βˆ’n⁑(E)+n⁑(F)=2n(V)-n(E)+n(F)=2.

As stated above, the notion of SPM introduced in [16] is central to our discussion. Indeed, S​P​M​(x)SPM(x) denotes the SCPS of PP into faces with the same link distance to a point or line segment xx. S​P​M​(x)SPM(x) has an associated set of windows, which are chords of PP that serve as boundaries between adjacent faces. Starting and end points of a window ww will be denoted by α⁑(w)\alpha(w) and β⁑(w)\beta(w), respectively. We have the following two lemmas as the basic fundamental properties of SPM:

Lemma 3.1

For any point or line segment xx ∈\in PP, S​P​M​(x)SPM(x) can be constructed in O⁑(n)O(n) time.

Proof 3.2

This follows from Theorem 1 in [16] and Chazelle’s linear time triangulation algorithm [4].

Lemma 3.3

Given a point or line segment xx ∈\in PP, any line segment LL intersects at most three faces of S​P​M​(x)SPM(x) (see the proof of Lemma 3 in [2]).

The value of each face of S​P​M​(x)SPM(x) is defined as the link distance from xx to any points of that face. These values are added to each face during the construction of S​P​M​(x)SPM(x) in LemmaΒ 3.1. Let β€–S​P​M​(x)β€–||SPM(x)|| denote the number of faces of S​P​M​(x)SPM(x). Also, let Fx​(i)F_{x}(i) be a face of S​P​M​(x)SPM(x) and let β€–Fx​(i)β€–||F_{x}(i)|| denote the value of Fx​(i)F_{x}(i), where 1≀i≀‖S​P​M​(x)β€–1\leq i\leq||SPM(x)|| (see FigureΒ 1).

Refer to caption
Figure 1: The value of each face Fs​(i)F_{s}(i) of S​P​M​(s)SPM(s), where 1≀i≀‖S​P​M​(s)β€–=151\leq i\leq||SPM(s)||=15

The window tree W​T​(x)WT(x) denotes the planar dual of S​P​M​(x)SPM(x). It has a node for each face and an arc between two nodes if their faces share an edge. W​T​(x)WT(x) is rooted at xx and each node of it is labeled with a window. The computation of W​T​(x)WT(x) takes O⁑(n)O(n) time [16]. According to [16], Fx​(i)F_{x}(i) is generated by its corresponding window wi∈W​T​(x)w_{i}\in WT(x) and vice versa, i.e., we define Gx​(wi)=Fx​(i)G_{x}(w_{i})=F_{x}(i) and wi=Gxβˆ’1​(Fx​(i))w_{i}=G^{-1}_{x}(F_{x}(i)) (1≀i≀‖S​P​M​(x)β€–1\leq i\leq||SPM(x)||). If ii is not specified, we define Gx​(w⁑(x))=FxG_{x}(w(x))=F_{x} and w⁑(x)=Gxβˆ’1​(Fx)w(x)=G^{-1}_{x}(F_{x}), where w⁑(x)w(x) is a window of W​T​(x)WT(x) and FxF_{x} is the corresponding face of S​P​M​(x)SPM(x).

Consider the shortest path maps of PP with respect to the points ss and tt. To find the intersection of the two maps S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t), the map overlay technique is employed. One of the well-known algorithms for this purpose was introduced by Finke and Hinrichs [7]. The algorithm computes the overlay of two SCPSs in optimal time O⁑(n+r)O(n+r), where nn is the total number of edges of the two SCPSs and rr is the number of intersections between the edges in the worst case. Both the input and output SCPSs are represented by the quad view data structure (a trapezoidal decomposition of a SCPS) [7].

The intersection of S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t) creates a new SCPS inside PP. We call each face of this SCPS a Cell. Also, C​eCe is defined as a set such that each member of it points to a Cell. By the construction of Cells, each Cell (C​e​(i)Ce(i)) is the intersection of two faces, one face from S​P​M​(s)SPM(s) and another face from S​P​M​(t)SPM(t), i.e., C​e​(i)Ce(i)= Fs​(j)∩Ft​(k)F_{s}(j)\cap F_{t}(k). The value of each Cell (the value of C​e​(i)Ce(i)) is defined as β€–C​e​(i)β€–=β€–Fs​(j)β€–+β€–Ft​(k)β€–||Ce(i)||=||F_{s}(j)||+||F_{t}(k)|| (1≀i≀n⁑(C​e)1\leq i\leq n(Ce), 1≀j≀‖S​P​M​(s)β€–1\leq j\leq||SPM(s)|| and 1≀k≀‖S​P​M​(t)β€–1\leq k\leq||SPM(t)||). These values are added to each Cell during the overlaying, and will later be used for computing |M​L​P​(s,t,q)||MLP(s,t,q)| (see FigureΒ 2).

Refer to caption
Figure 2: Overlaying S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t) to create Cells, and their values

Let WsW_{s} and WtW_{t} be the set of windows of S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t), respectively, and W=(WsβˆͺWt)W=(W_{s}\cup W_{t}). The following lemma shows the number of Cells (n⁑(C​e)n(Ce)):

Lemma 3.4

Overlaying S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t) inside PP creates n⁑(W)+r+1n(W)+r+1 Cells, where rr is the number of intersections inside PP (excluding the boundary of PP) between the windows of WsW_{s} and WtW_{t}.

Proof 3.5

Let (V,E,F)(V,E,F) be the triple sets of the new SCPS inside PP after overlaying. If we omit the outer face of PP from n⁑(V)βˆ’n⁑(E)+n⁑(F)=2n(V)-n(E)+n(F)=2, we conclude: n⁑(C​e)=n⁑(E)βˆ’n⁑(V)+1n(Ce)=n(E)-n(V)+1. All the vertices and edges of the new SCPS, (V,E)(V,E) can be divided into two groups, (V1,E1)(V_{1},E_{1}) on the boundary of PP and (V2,E2)(V_{2},E_{2}) inside PP, where n⁑(V)=n⁑(V1)+n⁑(V2)n(V)=n(V_{1})+n(V_{2}) and n⁑(E)=n⁑(E1)+n⁑(E2)n(E)=n(E_{1})+n(E_{2}). Let w∈Ww\in W. For the first group, n⁑(V1)n(V_{1}) and n⁑(E1)n(E_{1}) are the nn vertices and nn edges of PP, respectively, plus the number of those β⁑(w)\beta(w) not already counted among the vertices of PP. Thus, n⁑(E1)βˆ’n⁑(V1)=0n(E_{1})-n(V_{1})=0. Note that α⁑(w)\alpha(w) is always on a reflex vertex of PP and does not change n⁑(V1)n(V_{1}) or n⁑(E1)n(E_{1}). For the second group, consider the windows of WW. Based on the definition of windows, there is no intersection between the windows of SPM. Therefore, each of the rr intersections corresponds to only two windows, one from WsW_{s} and another from WtW_{t}. Suppose that there is no common window between WsW_{s} and WtW_{t}, i.e., n⁑(W)=n⁑(Ws)+n⁑(Wt)n(W)=n(W_{s})+n(W_{t}). In this case, each intersection creates four segments for two distinct windows. It is easy to deduce that by induction, the total number of edges on the windows of WW is n⁑(Ws)+n⁑(Wt)+2​rn(W_{s})+n(W_{t})+2r. But, n⁑(V2)=rn(V_{2})=r and n⁑(E2)βˆ’n⁑(V2)=n⁑(Ws)+n⁑(Wt)+r=n⁑(W)+rn(E_{2})-n(V_{2})=n(W_{s})+n(W_{t})+r=n(W)+r. For the case n⁑(Ws∩Wt)>0n(W_{s}\cap W_{t})>0, we have to consider only one of the two coincident windows due to the fact that they do not create a new segment. Therefore, n⁑(E2)βˆ’n⁑(V2)=n⁑(Ws)+n⁑(Wt)βˆ’n⁑(Ws∩Wt)+r=n⁑(WsβˆͺWt)+rn(E_{2})-n(V_{2})=n(W_{s})+n(W_{t})-n(W_{s}\cap W_{t})+r=n(W_{s}\cup W_{t})+r. Finally, n⁑(C​e)=n⁑(E1)βˆ’n⁑(V1)+n⁑(E2)βˆ’n⁑(V2)+1=n⁑(W)+r+1n(Ce)=n(E_{1})-n(V_{1})+n(E_{2})-n(V_{2})+1=n(W)+r+1.

As depicted in the example in FigureΒ 2, n⁑(C​e)=32n(Ce)=32, n⁑(Ws)=n⁑(Wt)=14n(W_{s})=n(W_{t})=14, n⁑(WsβˆͺWt)=28n(W_{s}\cup W_{t})=28 and r=3r=3. The number of the windows of SPM inside PP depends on the number of the reflex vertices of PP. Since the total internal angles of PP is (nβˆ’2)βˆ—180(n-2)*180 degrees, n⁑(Ws)n(W_{s}) and n⁑(Wt)≀nβˆ’3n(W_{t})\leq n-3. According to LemmaΒ 3.3, each window of WsW_{s} intersects at most two windows of WtW_{t} and vice versa. Thus, each window in WsW_{s} or WtW_{t} contains at most two intersection points inside PP, i.e., r≀2βˆ—min⁑(n⁑(Ws),n⁑(Wt))≀2​(nβˆ’3)r\leq 2*\min(n(W_{s}),n(W_{t}))\leq 2(n-3). Based on LemmaΒ 3.4 and the above argument, we have:

n⁑(C​e)=n⁑(W)+r+1≀n⁑(Ws)+n⁑(Wt)+r+1≀(nβˆ’3)+(nβˆ’3)+2​(nβˆ’3)+1=4​nβˆ’11=O⁑(n)n(Ce)=n(W)+r+1\leq n(W_{s})+n(W_{t})+r+1\leq(n-3)+(n-3)+2(n-3)+1=4n-11=O(n).

Lemma 3.6

Construction of Cells and computation of their values for two points ss and tt inside PP can be done in O⁑(n)O(n) time.

Proof 3.7

The construction of the two maps S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t) can be done in O⁑(n)O(n) time (LemmaΒ 3.1). The total complexity of the two created maps inside PP (total number of edges and windows) is O⁑(n)O(n). Thus, by the map overlay technique one can construct Cells in O⁑(n+r)O(n+r) time [7], but since r≀2​(nβˆ’3)r\leq 2(n-3), this is O⁑(n)O(n) time. On the other hand, n⁑(C​e)=O⁑(n)n(Ce)=O(n). Thus, assigning β€–Fs​(j)β€–+β€–Ft​(k)β€–||F_{s}(j)||+||F_{t}(k)|| to β€–C​e​(i)β€–||Ce(i)|| takes O⁑(n)O(n) time (1≀i≀n⁑(C​e)1\leq i\leq n(Ce), 1≀j≀‖S​P​M​(s)β€–1\leq j\leq||SPM(s)|| and 1≀k≀‖S​P​M​(t)β€–1\leq k\leq||SPM(t)||).

The visibility graph of PP, denoted by VG​(P)V_{G}(P) is an undirected graph of the visibility relation on the vertices of PP. VG​(P)V_{G}(P) has a node for every vertex of PP and an edge for every pair of visible vertices inside PP. Consider a visibility graph edge ee. The extension points of ee refer to the intersections of the boundary of PP with the line containing ee. VG​(P)V_{G}(P) and its extension points can be computed in time proportional to the size of VG​(P)V_{G}(P), i.e., O⁑(E)O(E), where EE is the number of edges in VG​(P)V_{G}(P) [11]. Indeed, the main algorithm in [11] outputs the edges of VG​(P)V_{G}(P) in sorted order around each vertex.

Lemma 3.8

We can preprocess PP in O⁑(E)O(E) time so that the following ray shooting query can be answered in O⁑(log⁑n)O(\log n) time: given a vertex vv of PP and a direction θ\theta, find the intersection points of the ray from vv in direction θ\theta with the boundary of PP, where the ray exits the interior of PP.

Proof 3.9

After computing VG​(P)V_{G}(P) and its extension points in O⁑(E)O(E) time, we store the sorted edges of VG​(P)V_{G}(P) according to the angle between them in some fixed directions (e.g., clockwise) about each vertex. For a given vertex vv, the binary search can be used to find two adjacent edges of VG​(P)V_{G}(P) so that the cone defined by the two edges contains only the ray emanating from vv in direction ΞΈ\theta. By finding these edges, one can specify the two extension points on an edge bb of PP. So, bb is used to find the intersection point of the ray in constant time. If the ray coincides with the edges of VG​(P)V_{G}(P), all intersection points are returned.

A more complicated algorithm is presented in [9] for the ray shooting problem in a simple polygon. This algorithm has O⁑(n)O(n) (instead of O⁑(E)O(E)) preprocessing time and the same query time (O⁑(log⁑n)O(\log n)). Note that E=Ω⁑(n)=O⁑(n2)E=\Omega(n)=O(n^{2}). We must use this algorithm for single query (Section 5), but Lemma 3.8 suffices for triple query (Section 6).

4 Main idea

The following cases (Q⁑(x)Q(x)) may occur for a query point qq:

  1. Q⁑(a)Q(a)

    At least one of ss or tt is visible from qq, i.e., ss or tt in V⁑(q)V(q). In this case, M​L​P​(s,t,q)=Ο€L​(s,t)MLP(s,t,q)=\pi_{L}(s,t).

  2. Q⁑(b)Q(b)

    The points ss and tt are in two different regions of P​o​c​k​e​t​(q)Pocket(q). Again in this case, M​L​P​(s,t,q)=Ο€L​(s,t)MLP(s,t,q)=\pi_{L}(s,t). Since Ο€L​(s,t)\pi_{L}(s,t) crosses V⁑(q)V(q), it is a qq-v​i​s​i​b​l​evisible path.

  3. Q⁑(c)Q(c)

    Both ss and tt are in the same region in P​o​c​k​e​t​(q)Pocket(q). In this case, eqe_{q} is the common edge between this region of P​o​c​k​e​t​(q)Pocket(q) and V⁑(q)V(q). Therefore, M​L​P​(s,t,q)MLP(s,t,q) should have a non-empty intersection with the side of eqe_{q}, where qq lies.

4.1 Computation of eqe_{q}

Now, we are ready to compute eqe_{q} with respect to the points ss and tt (single query and triple query). Let α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) be the starting and end points of eqe_{q}, respectively. For any three points ss, tt and qq inside PP, the last bending vertices of Ο€E​(s,q)\pi_{E}(s,q) and Ο€E​(t,q)\pi_{E}(t,q) called v1v_{1} and v2v_{2} (reflex vertices of PP), respectively, can be found in O⁑(log⁑n)O(\log n) time, after O⁑(n)O(n) time preprocessing of PP [2, 10]. If either v1v_{1} or v2v_{2} does not exist, Q⁑(a)Q(a) occurs. Otherwise, if v1=v2v_{1}=v_{2}, Q⁑(c)Q(c) occurs, otherwise, Q⁑(b)Q(b) occurs. For the two cases Q⁑(a)Q(a) and Q⁑(b)Q(b), there is no need to compute eqe_{q}. But for the case Q⁑(c)Q(c), the first intersection point of the ray emanating from α⁑(eq)=v1=v2\alpha(e_{q})=v_{1}=v_{2} in direction # οΏ½\mkern 2.0mu\textstyle\mathrel{\mathchoice{{}\hbox{$\displaystyle{\montraitd}$}}{{}\hbox{$\textstyle{\montraitd}$}}{{}\hbox{$\scriptstyle{\montraitd}$}}{{}\hbox{$\scriptscriptstyle{\montraitd}$}}}\mkern-1.5mu\leaders{\hbox{$\textstyle\mkern 0.0mu\mathrel{\mathchoice{{}\hbox{$\displaystyle{\montraita}$}}{{}\hbox{$\textstyle{\montraita}$}}{{}\hbox{$\scriptstyle{\montraita}$}}{{}\hbox{$\scriptscriptstyle{\montraita}$}}}\mkern 0.0mu$}}{\hfill}\mkern-1.5mu\fldr q​α​(eq)\hfil\textstyle q\alpha(e_{q})\hfil with the boundary of PP is specified (LemmaΒ 3.8 or [9]). Indeed, this intersection point is β⁑(eq)\beta(e_{q}). Thus, starting and end points of eqe_{q} are specified and the following corollary is concluded:

Corollary 4.1

Computation of eqe_{q} (α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q})) with respect to any two points ss and tt inside PP can be done in O⁑(log⁑n)O(\log n) time, after O⁑(E)O(E) or O⁑(n)O(n) time preprocessing of PP, if necessary (case Q⁑(c)Q(c)).

4.2 Case Q⁑(c)Q(c)

The line segment eqe_{q} divides PP into two subpolygons, only one of which contains qq. We define pp as the subpolygon containing qq (eq∈pe_{q}\in p). Let Cep={Ce(i)∩p∣Ce(i)∩pβ‰ βˆ…,1≀i≀n(Ce)}Ce_{p}=\{Ce(i)\cap p\mid Ce(i)\cap p\neq\emptyset,1\leq i\leq n(Ce)\}. Also, β€–C​ep​(j)β€–||Ce_{p}(j)|| is defined to be β€–C​e​(i)β€–||Ce(i)||, where C​ep​(j)Ce_{p}(j) and C​e​(i)Ce(i) are the corresponding members in C​epCe_{p} and C​eCe, respectively (1≀j≀n⁑(C​ep)1\leq j\leq n(Ce_{p}) and 1≀i≀n⁑(C​e)1\leq i\leq n(Ce)). Let c​e​l​l​m​i​np=mini=1n⁑(C​ep)⁑(β€–C​ep​(i)β€–)cellmin_{p}=\min^{n(Ce_{p})}_{i=1}(||Ce_{p}(i)||) and Cellminp={Cep(i)∣||Cep(i)||=cellminp,1≀i≀n(Cep)}Cellmin_{p}=\{Ce_{p}(i)\mid||Ce_{p}(i)||=cellmin_{p},1\leq i\leq n(Ce_{p})\}.

Refer to caption
Figure 3: Case Q⁑(c)Q(c) and M​L​P​(s,t,q)MLP(s,t,q) (light blue path) for the above subcases

As mentioned above, M​L​P​(s,t,q)∩pβ‰ βˆ…MLP(s,t,q)\cap p\neq\emptyset. According to [18], there is always a bending point BB (see FigureΒ 3aa) and there are at most two bending points BB and Bβ€²B^{\prime} (see FigureΒ 3bb) on M​L​P​(s,t,q)MLP(s,t,q) inside pp (this follows from the triangle inequality for link distances and the fact that ss and tt lie on the same side of eqe_{q}, see Lemma 3.1 in [18]). In the former case, BB must belong to a member of C​e​l​l​m​i​npCellmin_{p} and |M​L​P​(s,t,q)|=|Ο€L​(s,B)|+|Ο€L​(B,t)|\lvert MLP(s,t,q)\rvert=\lvert\pi_{L}(s,B)\rvert+\lvert\pi_{L}(B,t)\rvert. As for the latter case, BB and Bβ€²B^{\prime} must belong to two distinct members of C​e​l​l​m​i​npCellmin_{p} and |M​L​P​(s,t,q)|=|Ο€L​(s,B)|+1+|Ο€L​(Bβ€²,t)|=|Ο€L​(s,B)|+|Ο€L​(B,t)|=|Ο€L​(s,Bβ€²)|+|Ο€L​(Bβ€²,t)|\lvert MLP(s,t,q)\rvert=\lvert\pi_{L}(s,B)\rvert+1+\lvert\pi_{L}(B^{\prime},t)\rvert=\lvert\pi_{L}(s,B)\rvert+\lvert\pi_{L}(B,t)\rvert=\lvert\pi_{L}(s,B^{\prime})\rvert+\lvert\pi_{L}(B^{\prime},t)\rvert. Thus, for both cases, cellminp=mini=1n⁑(C​ep){|Ο€L(s,x)|+|Ο€L(x,t)|cellmin_{p}=\min^{n(Ce_{p})}_{i=1}\{|\pi_{L}(s,x)|+|\pi_{L}(x,t)| for any x∈Cep(i)}x\in Ce_{p}(i)\} has been computed correctly (remember the definition of β€–C​e​(i)β€–||Ce(i)||) and mini=1n⁑(C​ep){|Ο€L(s,x)|+|Ο€L(x,t)|βˆ’1\min^{n(Ce_{p})}_{i=1}\{|\pi_{L}(s,x)|+|\pi_{L}(x,t)|-1 for any x∈Cep(i)}x\in Ce_{p}(i)\} would not be possible for |M​L​P​(s,t,q)||MLP(s,t,q)| (Lemma 3.1 in [18]).

4.2.1 Computation of C​e​l​l​m​i​npCellmin_{p} and c​e​l​l​m​i​npcellmin_{p}

To compute C​e​l​l​m​i​npCellmin_{p} and c​e​l​l​m​i​npcellmin_{p}, we do not need to consider all members of C​epCe_{p}. Indeed, we concentrate on windows of WW that intersect eqe_{q}. As stated in LemmaΒ 3.3, eqe_{q} intersects at most two windows of WsW_{s} and at most two windows of WtW_{t}. The status of these intersections is verified by the position of α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) with respect to the faces of S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t). To specify the position of α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) with respect to the faces of S​P​M​(x)SPM(x) (x∈Px\in P is a point or line segment), we use the point location11 1 For a point lying in two faces or more than one Cell, the face or Cell with less value is considered as the output of the point location algorithm, respectively. algorithm in [6]. This can be accomplished by O⁑(n)O(n) time preprocessing of S​P​M​(x)SPM(x) (remember that β€–S​P​M​(x)β€–=O⁑(n)||SPM(x)||=O(n) and based on LemmaΒ 3.1, S​P​M​(x)SPM(x) is constructed in O⁑(n)O(n) time) to determine which face contains α⁑(eq)\alpha(e_{q}) and which face contains β⁑(eq)\beta(e_{q}) in O⁑(log⁑n)O(\log n)time.

For w∈Ww\in W, if (α⁑(w)=α⁑(eq)\alpha(w)=\alpha(e_{q}) or α⁑(w)=β⁑(eq)\alpha(w)=\beta(e_{q})) or (β⁑(w)=β⁑(eq)\beta(w)=\beta(e_{q})), we say that there is no intersection between eqe_{q} and ww except for the degenerate case, where (β⁑(w)=β⁑(eq)\beta(w)=\beta(e_{q})) and (α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) lie in different faces, and there is no window wβ€²β‰ ww^{\prime}\neq w from the same SPM crossing the interior of eqe_{q}). Note that β⁑(w)=α⁑(eq)\beta(w)=\alpha(e_{q}) never occurs.

Suppose that α⁑(eq)∈Fx​(j)\alpha(e_{q})\in F_{x}(j) and β⁑(eq)∈Fx​(k)\beta(e_{q})\in F_{x}(k). If j=kj=k, eqe_{q} does not intersect any windows of S​P​M​(x)SPM(x). Otherwise, if β€–Fx​(j)β€–>β€–Fx​(k)β€–||F_{x}(j)||>||F_{x}(k)|| or β€–Fx​(j)β€–<β€–Fx​(k)β€–||F_{x}(j)||<||F_{x}(k)||, eqe_{q} only intersects the window wjw_{j} or wkw_{k}, respectively, and if β€–Fx​(j)β€–=β€–Fx​(k)β€–||F_{x}(j)||=||F_{x}(k)||, eqe_{q} intersects both windows wjw_{j} and wkw_{k} (wj=Gxβˆ’1​(Fx​(j))w_{j}=G^{-1}_{x}(F_{x}(j)) and wk=Gxβˆ’1​(Fx​(k))w_{k}=G^{-1}_{x}(F_{x}(k))). After locating wjw_{j} or wkw_{k}, if necessary, the intersection of eqe_{q} with each of them is computed in constant time. Applying the above procedure for S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t) yields at most two intersection points s1,s2s_{1},s_{2} of eqe_{q} with w′​(s),w′′​(s)∈Wsw^{\prime}(s),w^{\prime\prime}(s)\in W_{s}, and at most two intersection points t1,t2t_{1},t_{2} of eqe_{q} with w′​(t),w′′​(t)∈Wtw^{\prime}(t),w^{\prime\prime}(t)\in W_{t}, respectively. Since n⁑(C​e)=O⁑(n)n(Ce)=O(n) and the construction of Cells is done in O⁑(n)O(n) time (LemmaΒ 3.6), once again, we can use the point location algorithm for Cells [6]. Also, the intersection points (if any) of w′​(s),w′′​(s)w^{\prime}(s),w^{\prime\prime}(s) with w′​(t),w′′​(t)w^{\prime}(t),w^{\prime\prime}(t), which are computed during the construction of Cells can be easily determined to be inside or outside pp. This is done in constant time as follows: suppose that w′​(s)w^{\prime}(s) intersects w′​(t)w^{\prime}(t) at point I1I_{1}. Since the position of s1s_{1} and β​(w′​(s))\beta(w^{\prime}(s)) are known, the position of I1I_{1} on w′​(s)w^{\prime}(s) can be determined. If I1I_{1} lies between s1s_{1} and β​(w′​(s))\beta(w^{\prime}(s)), it will be inside pp. The same computation can be applied for the other intersection points of w′​(s),w′′​(s)w^{\prime}(s),w^{\prime\prime}(s) with w′​(t),w′′​(t)w^{\prime}(t),w^{\prime\prime}(t). Let II be the set of these points (0≀n⁑(I)≀40\leq n(I)\leq 4). The status of points in the set II with respect to eqe_{q} (inside or outside pp) as well as the status of the two segments s1​s2Β―\overline{s_{1}s_{2}} and t1​t2Β―\overline{t_{1}t_{2}} on eqe_{q} (they might intersect or not) determine C​e​l​l​m​i​npCellmin_{p} using the point location algorithm for Cells (in the degenerate cases for instance, if s1s_{1} does not exist, we replace it by α⁑(eq)\alpha(e_{q}) or β⁑(eq)\beta(e_{q}) depending on which one is in the same face as s2s_{2}). Let FsF_{s} and FtF_{t} be faces of S​P​M​(s)SPM(s) and S​P​M​(t)SPM(t), respectively (determined implicitly by the single query and triple query algorithms, but arbitrary for the moment). For w∈Ww\in W and point zz on ww, we define γ⁑(w,z)\gamma(w,z) to be the point on ww, strictly between β⁑(w)\beta(w) and zz, closest to zz among all intersections of ww with other windows of WW. If ww does not intersect other windows of WW, define γ⁑(w,z)\gamma(w,z) to be β⁑(w)\beta(w). There are the following cases C⁑(x)C(x) (see FigureΒ 4) for α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) to compute C​e​l​l​m​i​npCellmin_{p} and c​e​l​l​m​i​npcellmin_{p} (we use this fact: the intersection of two faces inside PP creates a simply connected region since PP does not contain any holes):

Refer to caption
Figure 4: Cases C⁑(x)C(x) for two faces FsF_{s} (green lines) and FtF_{t} (blue lines), where each line may be a chain of line segments (windows or boundary of PP). The status of s1​s2¯∩t1​t2Β―\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}} as well as the status of the points in II indicate each of the cases
  1. C⁑(a)C(a)

    α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) are both in Fs∩FtF_{s}\cap F_{t}. In this case, eqe_{q} entirely lies in one Cell and does not intersect any window(s) of WW. The portion of this Cell, which lies in pp (like C​ep​(1)Ce_{p}(1)) is the only member of C​e​l​l​m​i​npCellmin_{p} due to the fact that walking from C​ep​(1)Ce_{p}(1) to other C​ep​(i)Ce_{p}(i) for i>1i>1 increases c​e​l​l​m​i​np=β€–C​ep​(1)β€–cellmin_{p}=||Ce_{p}(1)|| by at least one. To find C​ep​(1)Ce_{p}(1), we locate α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) in Cell CC. Consider w∈Ww\in W, where α⁑(eq)=α⁑(w)\alpha(e_{q})=\alpha(w) and γ⁑(w,α⁑(w))∈C\gamma(w,\alpha(w))\in C (there is always such a window since on q​α​(eq)Β―\overline{q\alpha(e_{q})} only α⁑(eq)\alpha(e_{q}) is visible from Gsβˆ’1​(Fs)G^{-1}_{s}(F_{s}) and Gtβˆ’1​(Ft)G^{-1}_{t}(F_{t})). Cut CC by eqe_{q} and let C​ep​(1)Ce_{p}(1) be the portion of CC, where γ⁑(w,α⁑(w))\gamma(w,\alpha(w)) is located.

  2. C⁑(b)C(b)

    α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) are both either in face FsF_{s} or FtF_{t}, but not both. Therefore, eqe_{q} entirely lies in one face and intersects window(s) of WsW_{s} or WtW_{t}, but not both. Without loss of generality, suppose that eqe_{q} is in FsF_{s} and intersects window(s), (w′​(t)CLOSE(w^{\prime}(t) or OPENw′′​(t))∈Wtw^{\prime\prime}(t))\in W_{t}. Let w⁑(s)=Gsβˆ’1​(Fs)w(s)=G^{-1}_{s}(F_{s}) and w⁑(t)∈Wtw(t)\in W_{t} be the parent of (w′​(t)CLOSE(w^{\prime}(t) or OPENw′′​(t))w^{\prime\prime}(t)) in W​T​(t)WT(t). Also, Ft=Gt​(w⁑(t))F_{t}=G_{t}(w(t)). Obviously, eqe_{q} is completely visible from w⁑(s)w(s) and a portion of eqe_{q} is visible from w⁑(t)w(t). Thus, Fs∩Ft∩pβ‰ βˆ…F_{s}\cap F_{t}\cap p\neq\emptyset. Like the argument in C⁑(a)C(a), C​ep​(1)=Fs∩Ft∩pCe_{p}(1)=F_{s}\cap F_{t}\cap p is the only member of C​e​l​l​m​i​npCellmin_{p} with c​e​l​l​m​i​np=β€–C​ep​(1)β€–cellmin_{p}=||Ce_{p}(1)||. To find C​ep​(1)Ce_{p}(1), we locate (t1CLOSE(t_{1} and OPENt2)t_{2}) in Cell CC (degenerate cases included). Cut CC by t1​t2Β―\overline{t_{1}t_{2}} and let C​ep​(1)Ce_{p}(1) be the portion of CC, where γ⁑(w′​(t),t1)\gamma(w^{\prime}(t),t_{1}) or γ⁑(w′′​(t),t2)\gamma(w^{\prime\prime}(t),t_{2}) are located.

  3. C⁑(c)C(c)

    α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) are both in different faces of S​P​M​(s)SPM(s) as well as different faces of S​P​M​(t)SPM(t). In this case, eqe_{q} intersects at least one and at most two windows of WsW_{s} and WtW_{t}. Suppose that eqe_{q} intersects windows (w′​(s)CLOSE(w^{\prime}(s) or OPENw′′​(s))∈Wsw^{\prime\prime}(s))\in W_{s} and (w′​(t)CLOSE(w^{\prime}(t) or OPENw′′​(t))∈Wtw^{\prime\prime}(t))\in W_{t}. Indeed, s1​s2Β―\overline{s_{1}s_{2}} and t1​t2Β―\overline{t_{1}t_{2}} exist even for degenerate cases. Let w⁑(s)∈Wsw(s)\in W_{s} be the parent of (w′​(s)CLOSE(w^{\prime}(s) or OPENw′′​(s))w^{\prime\prime}(s)) in W​T​(s)WT(s) and w⁑(t)∈Wtw(t)\in W_{t} be the parent of (w′​(t)CLOSE(w^{\prime}(t) or OPENw′′​(t))w^{\prime\prime}(t)) in W​T​(t)WT(t). Furthermore, Fs=Gs​(w⁑(s))F_{s}=G_{s}(w(s)) and Ft=Gt​(w⁑(t))F_{t}=G_{t}(w(t)). Accordingly, the following cases may occur:

    1. C⁑(c1)C(c_{1})

      Let Fs∩Ft=βˆ…F_{s}\cap F_{t}=\emptyset (unlike C⁑(a)C(a) and C⁑(b)C(b)). Suppose that w′​(t)w^{\prime}(t) is closer to FsF_{s} than w′′​(t)w^{\prime\prime}(t), and Ftβ€²=Gt​(w′​(t))F^{\prime}_{t}=G_{t}(w^{\prime}(t)). Since eqe_{q} intersects FsF_{s} and w′​(t)w^{\prime}(t), Fs∩Ftβ€²βˆ©pβ‰ βˆ…F_{s}\cap F^{\prime}_{t}\cap p\neq\emptyset. The same holds for FtF_{t}, Fsβ€²=Gs​(w′​(s))F^{\prime}_{s}=G_{s}(w^{\prime}(s)) and pp. Let C​ep​(1)=Fs∩Ftβ€²βˆ©pCe_{p}(1)=F_{s}\cap F^{\prime}_{t}\cap p and C​ep​(2)=Ft∩Fsβ€²βˆ©pCe_{p}(2)=F_{t}\cap F^{\prime}_{s}\cap p. For any points Xs∈FsX_{s}\in F_{s}, Xt∈FtX_{t}\in F_{t} and x∈{pβˆ’Fsβˆ’Ft}x\in\{p-F_{s}-F_{t}\}, we have |Ο€L​(s,Xs)|<|Ο€L​(s,x)|\lvert\pi_{L}(s,X_{s})\rvert<\lvert\pi_{L}(s,x)\rvert and |Ο€L​(t,Xt)|<|Ο€L​(t,x)|\lvert\pi_{L}(t,X_{t})\rvert<\lvert\pi_{L}(t,x)\rvert. Thus, |Ο€L​(s,Xs)|+|Ο€L​(t,Xt)|<|Ο€L​(s,x)|+|Ο€L​(t,x)|βˆ’1\lvert\pi_{L}(s,X_{s})\rvert+\lvert\pi_{L}(t,X_{t})\rvert<\lvert\pi_{L}(s,x)\rvert+\lvert\pi_{L}(t,x)\rvert-1. Suppose that xs∈C​ep​(1)βŠ†Fs∩px_{s}\in Ce_{p}(1)\subseteq F_{s}\cap p and xt∈C​ep​(2)βŠ†Ft∩px_{t}\in Ce_{p}(2)\subseteq F_{t}\cap p. By the construction of C​ep​(1)Ce_{p}(1) for any xsx_{s}, there is a point Xt∈FtX_{t}\in F_{t} such that xsx_{s} and XtX_{t} are visible to each other. Since Fs∩Ft=βˆ…F_{s}\cap F_{t}=\emptyset, |Ο€L​(s,xs)|+|Ο€L​(t,xs)|=|Ο€L​(s,xs)|+|Ο€L​(t,Xt)|+1<|Ο€L​(s,x)|+|Ο€L​(t,x)|\lvert\pi_{L}(s,x_{s})\rvert+\lvert\pi_{L}(t,x_{s})\rvert=\lvert\pi_{L}(s,x_{s})\rvert+\lvert\pi_{L}(t,X_{t})\rvert+1<\lvert\pi_{L}(s,x)\rvert+\lvert\pi_{L}(t,x)\rvert. The same holds, if xt∈C​ep​(2)x_{t}\in Ce_{p}(2), i.e., |Ο€L​(s,xt)|+|Ο€L​(t,xt)|<|Ο€L​(s,x)|+|Ο€L​(t,x)|\lvert\pi_{L}(s,x_{t})\rvert+\lvert\pi_{L}(t,x_{t})\rvert<\lvert\pi_{L}(s,x)\rvert+\lvert\pi_{L}(t,x)\rvert. Let x∈{(Fs∩p)βˆ’C​ep​(1)}x\in\{(F_{s}\cap p)-Ce_{p}(1)\}. Since Fs∩pF_{s}\cap p and FtF_{t} are disjoint sets, for any point Xt∈FtX_{t}\in F_{t}, |Ο€L​(x,Xt)|β‰₯2\lvert\pi_{L}(x,X_{t})\rvert\geq 2. Similarly, |Ο€L​(x,Xs)|β‰₯2\lvert\pi_{L}(x,X_{s})\rvert\geq 2 for x∈{(Ft∩p)βˆ’C​ep​(2)}x\in\{(F_{t}\cap p)-Ce_{p}(2)\} and any point Xs∈FsX_{s}\in F_{s}. This indicates that C​ep​(1)Ce_{p}(1) and C​ep​(2)Ce_{p}(2) are the only members of C​e​l​l​m​i​npCellmin_{p} with c​e​l​l​m​i​np=β€–C​ep​(1)β€–=β€–C​ep​(2)β€–cellmin_{p}=||Ce_{p}(1)||=||Ce_{p}(2)||. In this case, s1​s2¯∩t1​t2Β―=βˆ…\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}=\emptyset and n⁑(I)=0n(I)=0. Conversely, since pp and Pβˆ’pP-p do not contain any holes, and eqe_{q} crosses both FsF_{s} and FtF_{t}, it is easy to show that Fs∩Ft∩p=βˆ…F_{s}\cap F_{t}\cap p=\emptyset and Fs∩Ft∩(Pβˆ’p)=βˆ…F_{s}\cap F_{t}\cap(P-p)=\emptyset. Thus, Fs∩Ft=βˆ…F_{s}\cap F_{t}=\emptyset. To find C​ep​(1)Ce_{p}(1) and C​ep​(2)Ce_{p}(2), we locate (s1CLOSE(s_{1} and OPENs2)s_{2}) in Cell C1C_{1} and (t1CLOSE(t_{1} and OPENt2)t_{2}) in Cell C2C_{2}, respectively. Cut C1C_{1} by s1​s2Β―\overline{s_{1}s_{2}} and cut C2C_{2} by t1​t2Β―\overline{t_{1}t_{2}}. Let C​ep​(1)Ce_{p}(1) be the portion of C1C_{1}, where γ⁑(w′​(s),s1)\gamma(w^{\prime}(s),s_{1}) or γ⁑(w′′​(s),s2)\gamma(w^{\prime\prime}(s),s_{2}) are located. Also, let C​ep​(2)Ce_{p}(2) be the portion of C2C_{2}, where γ⁑(w′​(t),t1)\gamma(w^{\prime}(t),t_{1}) or γ⁑(w′′​(t),t2)\gamma(w^{\prime\prime}(t),t_{2}) are located.

    2. C⁑(c2)C(c_{2})

      Let Fs∩Ftβ‰ βˆ…F_{s}\cap F_{t}\neq\emptyset, but Fs∩Ft∩p=βˆ…F_{s}\cap F_{t}\cap p=\emptyset. In this case, Fs∩FtF_{s}\cap F_{t} must be in Pβˆ’pP-p between the intersections of the windows w′​(s),w′′​(s)w^{\prime}(s),w^{\prime\prime}(s) with w′​(t),w′′​(t)w^{\prime}(t),w^{\prime\prime}(t). Otherwise, since eqe_{q} crosses these windows, Pβˆ’pP-p contains a hole. Thus, FsF_{s} is divided by at least one window of FtF_{t} (like w′​(t)w^{\prime}(t)), where a portion of w′​(t)w^{\prime}(t) is visible from w⁑(s)w(s). This shows that Fs∩pF_{s}\cap p would be completely visible from w′​(t)w^{\prime}(t). The same holds for Ft∩pF_{t}\cap p and w′​(s)w^{\prime}(s). Therefore, like the case C⁑(c1)C(c_{1}), C​ep​(1)=Fs∩pCe_{p}(1)=F_{s}\cap p and C​ep​(2)=Ft∩pCe_{p}(2)=F_{t}\cap p are the only members of C​e​l​l​m​i​npCellmin_{p} with c​e​l​l​m​i​np=β€–C​ep​(1)β€–=β€–C​ep​(2)β€–cellmin_{p}=||Ce_{p}(1)||=||Ce_{p}(2)||. In this case, s1​s2¯∩t1​t2Β―=βˆ…\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}=\emptyset, n⁑(I)>0n(I)>0 and IβŠ‚Pβˆ’pI\subset P-p. Also, the reverse situation holds. The computation of C​ep​(1)Ce_{p}(1) and C​ep​(2)Ce_{p}(2) is similar to the case C⁑(c1)C(c_{1}).

    3. C⁑(c3)C(c_{3})

      Now, let Fs∩Ft∩pβ‰ βˆ…F_{s}\cap F_{t}\cap p\neq\emptyset. Similar to the case C⁑(b)C(b), C​ep​(1)=Fs∩Ft∩pCe_{p}(1)=F_{s}\cap F_{t}\cap p would be the only member of C​e​l​l​m​i​npCellmin_{p} with c​e​l​l​m​i​np=β€–C​ep​(1)β€–cellmin_{p}=||Ce_{p}(1)||. The following cases can be considered:

      1. C⁑(c31)C(c_{3_{1}})

        s1​s2¯∩t1​t2Β―=βˆ…\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}=\emptyset, n⁑(I)>0n(I)>0 and IβŠ‚pI\subset p (the reverse situation holds similar to the case C⁑(c2)C(c_{2})). If I1∈II_{1}\in I, we locate I1I_{1} in Cell CC and let C​ep​(1)=CCe_{p}(1)=C.

      2. C⁑(c32)C(c_{3_{2}})

        Let S​TΒ―=s1​s2¯∩t1​t2Β―β‰ βˆ…\overline{ST}=\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}\neq\emptyset. Locate (SCLOSE(S and OPENT)T) in Cell CC. Cut CC by S​TΒ―\overline{ST} and let C​ep​(1)Ce_{p}(1) be the portion of CC, where γ⁑(w,S)\gamma(w,S) or γ⁑(wβ€²,T)\gamma(w^{\prime},T) are located. Note that (w=w′​(s)CLOSE(w=w^{\prime}(s) or OPENw′′​(s))w^{\prime\prime}(s)) and (wβ€²=w′​(t)CLOSE(w^{\prime}=w^{\prime}(t) or OPENw′′​(t))w^{\prime\prime}(t)), where w,wβ€²βˆˆCw,w^{\prime}\in C (if S=TS=T22 2 If the two windows that cross at this point coincide, C​ep​(1)Ce_{p}(1) will be the portion of this window that lies in pp. and (γ⁑(w,S)\gamma(w,S) and γ⁑(wβ€²,T)\gamma(w^{\prime},T) belong to different Cells), C​ep​(1)=S=TCe_{p}(1)=S=T).

The above cases33 3 For the cases, where the computation of II is required, windows ww with (α⁑(w)=α⁑(eq)\alpha(w)=\alpha(e_{q}) or β⁑(eq)\beta(e_{q})) or (β⁑(w)=β⁑(eq)\beta(w)=\beta(e_{q})) are not needed. This is compatible with the definition of points intersecting eqe_{q} (Section 4.2.1). for C⁑(x)C(x) indicate that 1≀n⁑(C​e​l​l​m​i​np)≀21\leq n(Cellmin_{p})\leq 2 with the value c​e​l​l​m​i​npcellmin_{p} for all C​e​l​l​m​i​npCellmin_{p} members. It is easy to see that the most expensive part of these computations takes O⁑(log⁑n)O(\log n) time (others require constant time). The following corollary summarizes the above argument:

Corollary 4.2

C​e​l​l​m​i​npCellmin_{p} and c​e​l​l​m​i​npcellmin_{p} for the given eqe_{q} are computed in O⁑(log⁑n)O(\log n) time, after O⁑(n)O(n) time preprocessing of S​P​M​(s)SPM(s), S​P​M​(t)SPM(t) and Cells.

4.3 Algorithm overview

For any points ss, tt and qq inside PP, the main algorithm flow is described as follows:

  1. OPEN1)1)

    Determine which cases of Q⁑(a)Q(a), Q⁑(b)Q(b) or Q⁑(c)Q(c) occur.

    1. OPEN1.1)1.1)

      In case Q⁑(a)Q(a) or Q⁑(b)Q(b) just compute Ο€L​(s,t)\pi_{L}(s,t) and return.

    2. OPEN1.2)1.2)

      In case Q⁑(c)Q(c) compute eqe_{q} and continue.

  2. OPEN2)2)

    For single query compute C​e​l​l​m​i​npCellmin_{p} and select an arbitrary point xx from a member of C​e​l​l​m​i​npCellmin_{p}.

  3. OPEN3)3)

    For triple query select an arbitrary point xx from a portion of eqe_{q} (determined in Section 6) or let x∈Ix\in I (remember the definition of II from Section 4.2.1).

  4. OPEN4)4)

    Report Ο€L​(s,x)\pi_{L}(s,x) appended by Ο€L​(x,t)\pi_{L}(x,t).

The following sections illustrate how to compute M​L​P​(s,t,q)MLP(s,t,q) in detail.

5 Single query

We first describe the preprocessing phase of the algorithm for two given points ss, tt and a query point qq inside PP:

  1. OPENP1)P_{1})

    Build a data structure for answering shortest Euclidean path queries between two arbitrary points inside PP.

  2. OPENP2)P_{2})

    Construct S​P​M​(s)SPM(s), S​P​M​(t)SPM(t) and compute the value of each face of these maps. Also, construct the window trees W​T​(s)WT(s) and W​T​(t)WT(t) (GsG_{s}, Gsβˆ’1G^{-1}_{s} and GtG_{t}, Gtβˆ’1G^{-1}_{t}).

  3. OPENP3)P_{3})

    Construct Cells and compute their values.

  4. OPENP4)P_{4})

    Prepare S​P​M​(s)SPM(s), S​P​M​(t)SPM(t) and Cells for point location queries.

  5. OPENP5)P_{5})

    Build a data structure for ray shooting queries inside PP.

The query processing algorithm for computing |M​L​P​(s,t,q)|\lvert MLP(s,t,q)\rvert proceeds as follows (note that F​l​a​gsFlag_{s} and F​l​a​gtFlag_{t} indicate the number of windows of each face intersecting eqe_{q}):

  1. OPENQ1)Q_{1})

    Compute implicit representations of Ο€E​(s,q)\pi_{E}(s,q) and Ο€E​(t,q)\pi_{E}(t,q), and extract from them the last vertices v1v_{1} and v2v_{2}, respectively. This can be done by the data structure of Step P1P_{1}.

  2. OPENQ2)Q_{2})

    If either v1v_{1} or v2v_{2} does not exist, report |Ο€L​(s,t)|\lvert\pi_{L}(s,t)\rvert (case Q⁑(a)Q(a)), as in [16] using Steps P1P_{1}, P2P_{2} and P4P_{4}.

  3. OPENQ3)Q_{3})

    If v1β‰ v2v_{1}\neq v_{2}, again report |Ο€L​(s,t)|\lvert\pi_{L}(s,t)\rvert (case Q⁑(b)Q(b)), otherwise, compute eqe_{q} using the data structure of Step P5P_{5} (case Q⁑(c)Q(c)) and continue the following steps:

  4. OPENQ4)Q_{4})

    Locate α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) in the faces of S​P​M​(s)SPM(s) to compute two faces Fs​(j)F_{s}(j) and Fs​(k)F_{s}(k) containing them, respectively. This can be done by Steps P2P_{2} and P4P_{4} (1≀j,k≀‖S​P​M​(s)β€–1\leq j,k\leq||SPM(s)||).

  5. OPENQ5)Q_{5})

    Let wj=wk=N​u​l​lw_{j}=w_{k}=Null.

    If j=kj=k, {Flags=0}\{Flag_{s}=0\}, otherwise,

    {\{ if β€–Fs​(j)β€–>β€–Fs​(k)β€–||F_{s}(j)||>||F_{s}(k)||, {Flags=1\{Flag_{s}=1; wj=Gsβˆ’1​(Fs​(j))w_{j}=G^{-1}_{s}(F_{s}(j)); s1=wj∩eqs_{1}=w_{j}\cap e_{q}; s2=(α⁑(eq)CLOSEs_{2}=(\alpha(e_{q}) or OPENβ⁑(eq))\beta(e_{q})) depending on which one belongs to Fs(k)}F_{s}(k)\}, otherwise, if β€–Fs​(j)β€–<β€–Fs​(k)β€–||F_{s}(j)||<||F_{s}(k)||, {Flags=1\{Flag_{s}=1; wk=Gsβˆ’1​(Fs​(k))w_{k}=G^{-1}_{s}(F_{s}(k)); s1=(α⁑(eq)CLOSEs_{1}=(\alpha(e_{q}) or OPENβ⁑(eq))\beta(e_{q})) depending on which one belongs to Fs​(j)F_{s}(j); s2=wk∩eq}s_{2}=w_{k}\cap e_{q}\}, otherwise, {Flags=2\{Flag_{s}=2; wj=Gsβˆ’1​(Fs​(j))w_{j}=G^{-1}_{s}(F_{s}(j)); wk=Gsβˆ’1​(Fs​(k))w_{k}=G^{-1}_{s}(F_{s}(k)); s1=wj∩eqs_{1}=w_{j}\cap e_{q}; s2=wk∩eq}s_{2}=w_{k}\cap e_{q}\} }\}.

    Let w′​(s)=wjw^{\prime}(s)=w_{j}, w′′​(s)=wkw^{\prime\prime}(s)=w_{k}.

  6. OPENQ6)Q_{6})

    Repeat Steps Q4Q_{4} and Q5Q_{5} for S​P​M​(t)SPM(t) to compute {Flagt\{Flag_{t}, w′​(t)w^{\prime}(t), w′′​(t)w^{\prime\prime}(t), t1t_{1}, t2}t_{2}\}.

  7. OPENQ7)Q_{7})

    If (F​l​a​gs>0CLOSE(Flag_{s}>0 and OPENF​l​a​gt>0)Flag_{t}>0), compute the set II and s1​s2¯∩t1​t2Β―\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}.

  8. OPENQ8)Q_{8})

    If F​l​a​gs=F​l​a​gt=0Flag_{s}=Flag_{t}=0, do as C⁑(a)C(a), otherwise, if F​l​a​gsβˆ—F​l​a​gt=0Flag_{s}*Flag_{t}=0, do as C⁑(b)C(b), otherwise, if s1​s2¯∩t1​t2Β―β‰ βˆ…\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}\neq\emptyset, do as C⁑(c32)C(c_{3_{2}}), otherwise, if n⁑(I)=0n(I)=0, do as C⁑(c1)C(c_{1}), otherwise, if IβŠ‚pI\subset p (checkable in constant time), do as C⁑(c31)C(c_{3_{1}}), otherwise, do as C⁑(c2)C(c_{2}). This can be done by Steps P2P_{2}, P3P_{3} and P4P_{4}. For all these conditions report c​e​l​l​m​i​npcellmin_{p}.

To analyse the time complexity of this algorithm, observe that all of the above preprocessing requires altogether O⁑(n)O(n) time. This follows from [10], [16], Lemma 3.6, [6] and [9] for Steps P1P_{1}, P2P_{2}, P3P_{3}, P4P_{4} and P5P_{5}, respectively. On the other hand, based on Corollary 4.1 (with O⁑(n)O(n) preprocessing), Corollary 4.2 and [16], the query processing phase can be done in O⁑(log⁑n)O(\log n) time.

For computing M​L​P​(s,t,q)MLP(s,t,q), we must report Ο€L​(s,t)\pi_{L}(s,t) instead of |Ο€L​(s,t)|\lvert\pi_{L}(s,t)\rvert in Steps Q2Q_{2} and Q3Q_{3}. Also, Step Q8Q_{8} must be modified to report Ο€L​(s,x)\pi_{L}(s,x) appended by Ο€L​(x,t)\pi_{L}(x,t), where xx is a point in a member of C​e​l​l​m​i​npCellmin_{p} (in cases C⁑(c1)C(c_{1}) and C⁑(c2)C(c_{2}), n⁑(C​e​l​l​m​i​np)=2n(Cellmin_{p})=2). Thus, the following theorem is proved:

Theorem 5.1

Given a simple polygon PP with nn vertices and two points ss, tt inside it, we can preprocess PP in time O⁑(n)O(n) so that for a query point qq, one can find |M​L​P​(s,t,q)|\lvert MLP(s,t,q)\rvert in O⁑(log⁑n)O(\log n) time. Further, M​L​P​(s,t,q)MLP(s,t,q) can be reported in an additional time O⁑(|M​L​P​(s,t,q)|)O(\lvert MLP(s,t,q)\rvert).

6 Triple query

In this section, we propose an algorithm for three query points. Our method is closely related to the work of Arkin et al. [2] (note that the construction of VG​(P)V_{G}(P) is essential in [2]). So, we borrow the related terminology from [1, 2] and review some terms adapted to the notation used in this paper.

Consider a window ww of S​P​M​(x)SPM(x), where x∈Px\in P is a point or line segment. The combinatorial type of ww is the vertex-edge pair (v,e)(v,e), where v=α⁑(w)v=\alpha(w) is a reflex vertex of PP and β⁑(w)\beta(w) lies on an edge ee of PP. The combinatorial type of S​P​M​(x)SPM(x) is a listing of the combinatorial types of all of its windows. Constructing S​P​M​(x)SPM(x) for all vertices of PP and all extension points of VG​(P)V_{G}(P) edges creates a list of windows. The endpoints of these windows on the boundary of PP together with the vertices of PP partition the boundary of PP into O⁑(n2)O(n^{2}) intervals, called atomic segments. We can sort the endpoints of all windows along the boundary edges of PP in O⁑(n2​log⁑n)O(n^{2}\log n) time and get access to an ordered list of atomic segments on each edge of PP. The following lemma from [2] describes the special characteristic of atomic segments:

Lemma 6.1

If LL is an atomic segment on the boundary of PP, the combinatorial type of S​P​M​(x)SPM(x) is the same for all points xx in the interior of LL.

Given a polygonal path Ξ \Pi inside PP, an interior edge e∈Πe\in\Pi is called a pinned edge if it passes through two vertices of PP on opposite sides of ee such that ee is tangent to PP at these vertices. The greedy minimum link path (as defined in [2]) from a point xx to a point yy inside PP (called Ο€L​G​(x,y)\pi_{LG}(x,y) here) uses only the extensions of the windows of S​P​M​(x)SPM(x) and the last link is chosen to pass through the last vertex of Ο€E​(x,y)\pi_{E}(x,y). It is easy to verify whether Ο€L​G​(x,y)\pi_{LG}(x,y) has a pinned edge or not. This can be done in O⁑(n)O(n) time by traversing the path Ο€L​G​(x,y)\pi_{LG}(x,y) for two arbitrary points xx and yy inside PP.

On the other hand, we can check if there is a pinned edge between the atomic segment LL (any point x∈Lx\in L) and α⁑(wi)\alpha(w_{i}) for all windows wiw_{i} of S​P​M​(L)SPM(L) during the construction of S​P​M​(L)SPM(L) in O⁑(n)O(n) time. Let ww be a window of S​P​M​(L)SPM(L) such that Ο€L​G​(x,α​(w))\pi_{LG}(x,\alpha(w)) has no pinned edge. Also, let β⁑(w)\beta(w) lie on an edge ee of PP. According to LemmaΒ 6.1, the combinatorial type of ww is the pair (α⁑(w),e)(\alpha(w),e) for all x∈Lx\in L. Indeed, as xx varies along LL, β⁑(w)\beta(w) varies along ee according to a projection function f⁑(x)f(x), which can be written as a fractional linear form [1]: β⁑(w)=f⁑(x)=\beta(w)=f(x)= A​x+BC​x+D\frac{Ax+B}{Cx+D}

The four constants A,B,CA,B,C and DD depend on the atomic segment LL, the fixed point α⁑(w)\alpha(w) (reflex vertex of PP) and the edge ee. In the case that Ο€L​G​(x,α​(w))\pi_{LG}(x,\alpha(w)) has a pinned edge, it is not required to compute the projection function for LL and ww as the position of β⁑(w)\beta(w) on the edge ee would not change when xx varies along LL. Thus, for each window wiw_{i} of S​P​M​(L)SPM(L), where there is no pinned edge on Ο€L​G​(x,α⁑(wi))\pi_{LG}(x,\alpha(w_{i})) for any x∈Lx\in L, we compute and store the projection function fif_{i}. This preprocessing can be done in O⁑(n)O(n) time for each atomic segment LL during the construction of S​P​M​(L)SPM(L) [1, 2]. So, for a window wiw_{i}, we can evaluate the exact position of β⁑(wi)\beta(w_{i}) as xx varies along LL in constant time. Let S​P​MA​(L)SPM_{A}(L) be the data structure S​P​M​(L)SPM(L) plus the following: for each window wiw_{i} of S​P​M​(L)SPM(L), if there is a pinned edge between LL and α⁑(wi)\alpha(w_{i}), set f​l​a​g​(wi)=1flag(w_{i})=1, otherwise, set f​l​a​g​(wi)=0flag(w_{i})=0, then compute and store the projection function fif_{i} for wiw_{i}. The following corollary is concluded from the above argument and LemmaΒ 3.1:

Corollary 6.2

For an atomic segment LL, S​P​MA​(L)SPM_{A}(L) can be constructed in O⁑(n)O(n) time.

Now, we describe the proposed algorithm for three query points ss, tt and qq inside PP. Unlike the algorithm developed for single query, we only attempt to find s1​s2¯∩t1​t2Β―\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}} or II. Indeed, for triple query, we may need to update all the windows of a Cell. In the worst case, the number of these windows is O⁑(n)O(n), and hence the queries cannot be answered in O⁑(log⁑n)O(\log n) time. On the other hand, for any w∈Ww\in W as β⁑(w)\beta(w) varies along an edge of PP, we may need to update the value of Cells in O⁑(n)O(n) time. For these reasons, C​e​l​l​m​i​npCellmin_{p} and c​e​l​l​m​i​npcellmin_{p} cannot be used for triple query and only part of the locus (lying on eqe_{q} or a point in II) is found in O⁑(log⁑n)O(\log n) time. We perform the following preprocessing step on PP:

  1. OPENP0)P_{0})

    Build a data structure for answering minimum link path queries between two arbitrary points inside PP (this includes Steps P1P_{1}, P2P_{2} and P4P_{4} of the single query algorithm, and the construction of VG​(P)V_{G}(P) mentioned in LemmaΒ 3.8). Also, with this data structure an ordered list of atomic segments on each edge of PP is computed. We can modify this step for each atomic segment LL as follows: construct S​P​MA​(L)SPM_{A}(L) as well as the value of each face and W​T​(L)WT(L). Also, prepare S​P​MA​(L)SPM_{A}(L) for point location queries (note that windows of S​P​MA​(L)SPM_{A}(L) are in fixed positions, but the position of windows of S​P​MA​(x)SPM_{A}(x) may change for an arbitrary point x∈Lx\in L).

According to [2, 6] and Corollary 6.2, since we have O⁑(n2)O(n^{2}) atomic segments, the total time complexity of this step is O⁑(n3)O(n^{3}).

For an atomic segment LL, let δ⁑(eq,L)\delta(e_{q},L) be the set of windows wiw_{i} of S​P​MA​(L)SPM_{A}(L), where β⁑(eq)\beta(e_{q}) belongs to an edge ee of PP such that the combinatorial type of wiw_{i} is (α⁑(wi),e)(\alpha(w_{i}),e), f​l​a​g​(wi)β‰ 1flag(w_{i})\neq 1 and eq∩wi=βˆ…e_{q}\cap w_{i}=\emptyset. Based on LemmaΒ 3.3, each edge of PP intersects at most two windows of S​P​MA​(L)SPM_{A}(L). Thus, n⁑(δ⁑(eq,L))≀2n(\delta(e_{q},L))\leq 2, and by Step P0P_{0}, it can be computed in constant time. Indeed, the purpose of introducing δ⁑(eq,L)\delta(e_{q},L) is to store all the possible windows in S​P​MA​(L)SPM_{A}(L) which may intersect eqe_{q} as a point xx varies along LL except those windows that are currently intersecting eqe_{q}. Since the data structure for point location queries in the following algorithm is only preprocessed for S​P​MA​(L)SPM_{A}(L), the new intersecting windows with eqe_{q} can be updated from δ⁑(eq,L)\delta(e_{q},L) after we know xx and locate the proximity of the intersecting windows. In the case that β⁑(wi)\beta(w_{i}) coincides with β⁑(eq)\beta(e_{q}) after it varied along ee, the intersection point can be ignored (based on the definition of points intersecting eqe_{q} in Section 4.2.1). Note that β⁑(wi)\beta(w_{i}) never coincides with α⁑(eq)\alpha(e_{q}). Thus, the contribution of α⁑(eq)\alpha(e_{q}) is omitted from δ⁑(eq,L)\delta(e_{q},L).

The query processing algorithm for computing |M​L​P​(s,t,q)|\lvert MLP(s,t,q)\rvert can be outlined as follows:

  1. OPENQ1)Q_{1})

    Compute implicit representations of Ο€E​(s,q)\pi_{E}(s,q) and Ο€E​(t,q)\pi_{E}(t,q), and extract from them the first vertices u1u_{1}, u2u_{2} and last vertices v1v_{1}, v2v_{2}, respectively. This can be done by the data structure used for shortest Euclidean path queries of Step P0P_{0}.

  2. OPENQ2)Q_{2})

    If either v1v_{1} or v2v_{2} does not exist, report |Ο€L​G​(s,t)|\lvert\pi_{LG}(s,t)\rvert (case Q⁑(a)Q(a)) using the data structure of Step P0P_{0} for link distance queries.

  3. OPENQ3)Q_{3})

    If v1β‰ v2v_{1}\neq v_{2}, again report |Ο€L​G​(s,t)|\lvert\pi_{LG}(s,t)\rvert (case Q⁑(b)Q(b)), otherwise, compute eqe_{q} using VG​(P)V_{G}(P) (see CorollaryΒ 4.1 with O⁑(E)O(E) preprocessing) of Step P0P_{0} for ray shooting queries (case Q⁑(c)Q(c)) and continue the following steps:

  4. OPENQ4)Q_{4})

    Compute the intersection (called xsx_{s}) of the extension of # οΏ½\mkern 2.0mu\textstyle\mathrel{\mathchoice{{}\hbox{$\displaystyle{\montraitd}$}}{{}\hbox{$\textstyle{\montraitd}$}}{{}\hbox{$\scriptstyle{\montraitd}$}}{{}\hbox{$\scriptscriptstyle{\montraitd}$}}}\mkern-1.5mu\leaders{\hbox{$\textstyle\mkern 0.0mu\mathrel{\mathchoice{{}\hbox{$\displaystyle{\montraita}$}}{{}\hbox{$\textstyle{\montraita}$}}{{}\hbox{$\scriptstyle{\montraita}$}}{{}\hbox{$\scriptscriptstyle{\montraita}$}}}\mkern 0.0mu$}}{\hfill}\mkern-1.5mu\fldr u1​s\hfil\textstyle u_{1}s\hfil with an edge ee of PP. This can be done by VG​(P)V_{G}(P) similar to Step Q3Q_{3}. Find the atomic segment LsL_{s} by using binary search on ee, where xs∈Lsx_{s}\in L_{s}. Similarly, LtL_{t} and xt∈Ltx_{t}\in L_{t} can be computed for the extension of # οΏ½\mkern 2.0mu\textstyle\mathrel{\mathchoice{{}\hbox{$\displaystyle{\montraitd}$}}{{}\hbox{$\textstyle{\montraitd}$}}{{}\hbox{$\scriptstyle{\montraitd}$}}{{}\hbox{$\scriptscriptstyle{\montraitd}$}}}\mkern-1.5mu\leaders{\hbox{$\textstyle\mkern 0.0mu\mathrel{\mathchoice{{}\hbox{$\displaystyle{\montraita}$}}{{}\hbox{$\textstyle{\montraita}$}}{{}\hbox{$\scriptstyle{\montraita}$}}{{}\hbox{$\scriptscriptstyle{\montraita}$}}}\mkern 0.0mu$}}{\hfill}\mkern-1.5mu\fldr u2​t\hfil\textstyle u_{2}t\hfil .

  5. OPENQ5)Q_{5})

    Locate α⁑(eq)\alpha(e_{q}) and β⁑(eq)\beta(e_{q}) in the faces of S​P​MA​(Ls)SPM_{A}(L_{s}) to compute two faces Fs​(j)F_{s}(j) and Fs​(k)F_{s}(k) containing them, respectively. This can be done by the data structure used for point location queries of Step P0P_{0} (1≀j,k≀‖S​P​M​(s)β€–1\leq j,k\leq||SPM(s)||).

  6. OPENQ6)Q_{6})

    If j=kj=k, {wj=wk=Null}\{w_{j}=w_{k}=Null\}, otherwise, {\{ if β€–Fs​(j)β€–>β€–Fs​(k)β€–||F_{s}(j)||>||F_{s}(k)||, {wj=Gsβˆ’1(Fs(j))\{w_{j}=G^{-1}_{s}(F_{s}(j)); wk=Null}w_{k}=Null\}, otherwise, if β€–Fs​(j)β€–<β€–Fs​(k)β€–||F_{s}(j)||<||F_{s}(k)||, {wj=Null\{w_{j}=Null; wk=Gsβˆ’1(Fs(k))}w_{k}=G^{-1}_{s}(F_{s}(k))\}, otherwise, {wj=Gsβˆ’1(Fs(j))\{w_{j}=G^{-1}_{s}(F_{s}(j)); wk=Gsβˆ’1(Fs(k))}w_{k}=G^{-1}_{s}(F_{s}(k))\} }\}.

  7. OPENQ7)Q_{7})

    If (wjβ‰ N​u​l​lCLOSE(w_{j}\neq Null and OPENf​l​a​g​(wj)β‰ 1)flag(w_{j})\neq 1), {\{update wjw_{j} according to fjf_{j}; if (wj∩eq=βˆ…)(w_{j}\cap e_{q}=\emptyset), wj=Null}w_{j}=Null\}.

    If (wkβ‰ N​u​l​lCLOSE(w_{k}\neq Null and OPENf​l​a​g​(wk)β‰ 1)flag(w_{k})\neq 1), {\{update wkw_{k} according to fkf_{k}; if (wk∩eq=βˆ…)(w_{k}\cap e_{q}=\emptyset), wk=Null}w_{k}=Null\}.

    (fjf_{j} and fkf_{k} are the projection functions corresponding to wjw_{j} and wkw_{k} as xsx_{s} varies along LsL_{s}).

  8. OPENQ8)Q_{8})

    Compute δ⁑(eq,Ls)\delta(e_{q},L_{s}) and let Ξ”s=δ⁑(eq,Ls)\Delta_{s}=\delta(e_{q},L_{s}).

    If n⁑(Ξ”s)>0n(\Delta_{s})>0, {\{update the windows of Ξ”s\Delta_{s}, according to their corresponding projection functions and position of xsx_{s} on LsL_{s}; let Ξ”s\Delta_{s} be the set of these updated windows intersecting eq}e_{q}\}.

  9. OPENQ9)Q_{9})

    If wjβ‰ N​u​l​lw_{j}\neq Null, Ξ”s=Ξ”sβˆͺwj\Delta_{s}=\Delta_{s}\cup w_{j}.

    If wkβ‰ N​u​l​lw_{k}\neq Null, Ξ”s=Ξ”sβˆͺwk\Delta_{s}=\Delta_{s}\cup w_{k}.

  10. OPENQ10)Q_{10})

    Repeat Steps Q5Q_{5}, Q6Q_{6}, Q7Q_{7}, Q8Q_{8} and Q9Q_{9} for S​P​MA​(Lt)SPM_{A}(L_{t}) to compute Ξ”t\Delta_{t}.

  11. OPENQ11)Q_{11})

    If (n⁑(Ξ”s)>0CLOSE(n(\Delta_{s})>0 and OPENn⁑(Ξ”t)>0)n(\Delta_{t})>0), compute the set II for intersections of windows in Ξ”s\Delta_{s} and Ξ”t\Delta_{t}.

  12. OPENQ12)Q_{12})

    If n⁑(Ξ”s)=1n(\Delta_{s})=1, {\{let wβˆˆΞ”sw\in\Delta_{s}; s1=eq∩ws_{1}=e_{q}\cap w; if |Ο€L​G​(xs,α⁑(eq))|<|Ο€L​G​(xs,β⁑(eq))||\pi_{LG}(x_{s},\alpha(e_{q}))|<|\pi_{LG}(x_{s},\beta(e_{q}))|, s2=α⁑(eq)s_{2}=\alpha(e_{q}), otherwise s2=Ξ²(eq)}s_{2}=\beta(e_{q})\}. This can be done by link distance queries of Step P0P_{0}.

    If n⁑(Ξ”s)=2n(\Delta_{s})=2, {\{let w,wβ€²βˆˆΞ”sw,w^{\prime}\in\Delta_{s}; s1=eq∩ws_{1}=e_{q}\cap w; s2=eq∩wβ€²}s_{2}=e_{q}\cap w^{\prime}\}.

    Similarly, t1t_{1} and t2t_{2} are computed.

  13. OPENQ13)Q_{13})

    If n⁑(Ξ”s)=n⁑(Ξ”t)=0n(\Delta_{s})=n(\Delta_{t})=0, X=eqX=e_{q} (like C⁑(a)C(a)), otherwise, if n⁑(Ξ”s)=0n(\Delta_{s})=0, X=t1​t2Β―X=\overline{t_{1}t_{2}} (like C⁑(b)C(b)), otherwise, if n⁑(Ξ”t)=0n(\Delta_{t})=0, X=s1​s2Β―X=\overline{s_{1}s_{2}} (like C⁑(b)C(b)), otherwise, if s1​s2¯∩t1​t2Β―β‰ βˆ…\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}}\neq\emptyset, X=s1​s2¯∩t1​t2Β―X=\overline{s_{1}s_{2}}\cap\overline{t_{1}t_{2}} (like C⁑(c32)C(c_{3_{2}})), otherwise, if (n⁑(I)=0CLOSE(n(I)=0 or OPENIβŠ‚Pβˆ’p)I\subset P-p), X=(s1​s2Β―CLOSEX=(\overline{s_{1}s_{2}} or OPENt1​t2Β―)\overline{t_{1}t_{2}}) (like C⁑(c1)C(c_{1}) or C⁑(c2)C(c_{2})), otherwise, XX will be a point in II (like C⁑(c31)C(c_{3_{1}})). For all these cases |Ο€L​G​(s,X)|+|Ο€L​G​(X,t)|\lvert\pi_{LG}(s,X)\rvert+\lvert\pi_{LG}(X,t)\rvert is reported. This can be done by the data structure of Step P0P_{0}.

The main difference between triple query and single query is the computation of Ξ”s\Delta_{s} and Ξ”t\Delta_{t}. Indeed, in Step Q7Q_{7}, the windows wjw_{j} and wkw_{k} are specified for the point xs∈Lsx_{s}\in L_{s}. If they intersect eqe_{q}, we update them. On the other hand, in Step Q8Q_{8}, the windows of S​P​MA​(Ls)SPM_{A}(L_{s}), which are candidates for intersection with eqe_{q} are specified (including the windows that cross the endpoints of eqe_{q}). These windows are added to the set Ξ”s\Delta_{s} if they intersect eqe_{q} after updating. Further, in Step Q9Q_{9}, the final Ξ”s\Delta_{s} is computed (n⁑(Ξ”s)≀2n(\Delta_{s})\leq 2). The other steps are similar to single query.

To analyse the time complexity of this phase of the algorithm, it is easy to see that Steps Q6Q_{6}, Q7Q_{7}, Q8Q_{8}, Q9Q_{9} and Q11Q_{11} can be done in constant time while others require O⁑(log⁑n)O(\log n) time (like the time complexity of single query).

For computing M​L​P​(s,t,q)MLP(s,t,q), we must report Ο€L​G​(s,t)\pi_{LG}(s,t) instead of |Ο€L​G​(s,t)|\lvert\pi_{LG}(s,t)\rvert in Steps Q2Q_{2} and Q3Q_{3}. Also, Step Q13Q_{13} must be modified to report Ο€L​G​(s,x)\pi_{LG}(s,x) appended by Ο€L​G​(x,t)\pi_{LG}(x,t), where x∈Xx\in X or x=Xx=X. Thus, the following theorem is proved:

Theorem 6.3

Given a simple polygon PP with nn vertices, we can preprocess it in time O⁑(n3)O(n^{3}) so that for query points ss, tt and qq inside PP, one can find |M​L​P​(s,t,q)|\lvert MLP(s,t,q)\rvert in O⁑(log⁑n)O(\log n) time. Further, M​L​P​(s,t,q)MLP(s,t,q) can be reported in an additional time O⁑(|M​L​P​(s,t,q)|)O(\lvert MLP(s,t,q)\rvert).

7 Conclusion

We presented two algorithms to find a qq-v​i​s​i​b​l​evisible path between two points inside a simple polygon with nn vertices for single query and triple query. The proposed algorithms run with O⁑(n)O(n) and O⁑(n3)O(n^{3}) preprocessing time for each of the cases, respectively, and answer a link distance query in O⁑(log⁑n)O(\log n) time for both cases. Further, a constrained minimum link path can be reported in an additional time proportional to the number of links for either case.

One possible direction for further research on this problem is to consider the same topic in other domains such as polygonal domains or polyhedral surfaces. Another direction is to require the path in the query form to visit a more complex object like a simple polygon (convex or non-convex), as opposed to a point. In this case, if the shape of the query object is fixed, one can find a QQ-v​i​s​i​b​l​evisible path for the object QQ while it translates or rotates inside a simple polygon, i.e., the desired path should have a non-empty intersection with QQ.

Acknowledgements

The author wish to thank Dr Ali Gholami Rudi from Babol Noshirvani University and Dr Ali Rajaei from Tarbiat Modares University, Computer Sciences group, for many pleasant discussions and valuable remarks. Also, i would like to thank the anonymous referees for their valuable comments.

References

  • [1] Aggarwal A, Booth H, O’Rourke J, Suri S, Yap CK. Finding minimal convex nested polygons, Information and Computation, 1989. 83(1):98–110. doi:10.1016/0890-5401(89)90049-7.
  • [2] Arkin EM, Mitchell JSB, Suri S. Logarithmic-time link path queries in a simple polygon, International Journal of Computational Geometry and Applications, 1995. 5(4):369–395. doi:10.1142/S0218195995000234.
  • [3] Arkin EM, Efrat A, Knauer C, Mitchell JSB, Polishchuk V, Rote G, Schlipf L, Talvitie T. Shortest path to a segment and quickest visibility queries, Journal of Computational Geometry, 2016. 7(2):77–100. doi:10.4230/LIPIcs.SOCG.2015.658.
  • [4] Chazelle B. Triangulating a simple polygon in linear time, Discrete and Computational Geometry, 1991. 6(3):485–524.
  • [5] Chen DZ. Developing algorithms and software for geometric path planning problems, ACM Computing Surveys (CSUR), 1996. 28(4es):18-es. doi:10.1145/242224.242246.
  • [6] Edelsbrunner H, Guibas LJ, Stolfi J. Optimal point location in a monotone subdivision, SIAM Journal on Computing, 1986. 15(2):317–340.
  • [7] Finke U, Hinrichs KH. Overlaying simply connected planar subdivisions in linear time, In Proceedings of the eleventh annual symposium on Computational Geometry, ACM 1995:119–126. doi:10.1145/220279.220292.
  • [8] Ghosh SK. Computing the visibility polygon from a convex set and related problems, Journal of Algorithms, 1991. 12(1):75–95. doi:10.1016/0196-6774(91)90024-S.
  • [9] Guibas LJ, Hershberger J, Leven D, Sharir M, Tarjan RE. Linear-time algorithms for visibility and shortest path problems inside triangulated simple polygons, Algorithmica, 1987. 2(1-4):209–233. doi:10.1007/BF01840360.
  • [10] Guibas LJ, Hershberger J. Optimal shortest path queries in a simple polygon, Journal of Computer and System Sciences, 1989. 39(2):126–152. doi:10.1016/0022-0000(89)90041-X.
  • [11] Hershberger J. An optimal visibility graph algorithm for triangulated simple polygons, Algorithmica, 1989. 4(1-4):141–155. doi:10.1007/BF01553883.
  • [12] Khosravi R, Ghodsi M. The fastest way to view a query point in simple polygons, In Proceedings of the 21st European Workshop on Computational Geometry, 2005, pp. 187–190. ID: 2345696.
  • [13] Khosravi R, Ghodsi M. Query-point visibility constrained shortest paths in simple polygons, Theoretical Computer Science, 2007. 389(1-2):1–11. doi:10.1016/j.tcs.2007.07.003.
  • [14] Mitchell JSB, Rote G, Woeginger G. Minimum-link paths among obstacles in the plane, Algorithmica, 1992. 8(1-6):431–459. doi:10.1007/BF01758855.
  • [15] Suri S. A linear time algorithm for minimum link path inside a simple polygon, Computer Vision, Graphics and Image Processing, 1986. 35(1):99–110.
  • [16] Suri S. On some link distance problems in a simple polygon, IEEE transactions on Robotics and Automation, 1990. 6(1):108–113. doi:10.1109/70.88124.
  • [17] Wang H. Quickest visibility queries in polygonal domains, Discrete and Computational Geometry, 2019. 62(2):374–432. doi:10.1007/s00454-019-00108-8.
  • [18] Zarrabi MR, Charkari NM. Single-Point Visibility Constraint Minimum Link Paths in Simple Polygons, Submitted to Iranian Journal of Mathematical Sciences and Informatics, (Accepted 2019), arXiv preprint arXiv:2003.12778.