An Approximation Algorithm for Computing Minimal Nonintersecting ...

2 downloads 0 Views 303KB Size Report
Sep 20, 1996 - required to connect u to u0 by a polygonal path lying in P. A polygonal path which uses the minimum number of required line segments isĀ ...
An Approximation Algorithm for Computing Minimal Nonintersecting Link Paths Himanshu Gupta Rephael Wengery September 20, 1996 Abstract

Let P be a simple polygon and let f(ui ; u0i )g be m pairs of distinct vertices of P where for every distinct i; j  m, there exist pairwise disjoint paths connecting ui to u0i and uj to u0j . We wish to construct m pairwise disjoint paths in the interior of P connecting ui to u0i for i = 1; : : : ; m, with minimal total number of line segments. We give an approximation algorithm which in O(n log m + M log m) time constructs such a set of paths using O(M ) line segments where M is the number of line segments in the optimal solution.

1 Introduction

Let P be a simple polygon and let u and u0 be two distinct vertices of P . The link distance from u to u0 is the minimum number of line segments (also called links) required to connect u to u0 by a polygonal path lying in P . A polygonal path which uses the minimum number of required line segments is called a minimum link path. Clearly, there may be more than one such path. Suri in [10] gave a linear time algorithm for determining the link distance and a minimal link path between two vertices. A minimum link path from u to u0 may intersect the boundary of P at many points other than u and u0. The interior link distance from u to u0 is the minimum number of line segments required to connect u to u0 by a polygonal path through the interior of P . Such a path which uses the minimum number of required line segments is called a minimum link interior path. The interior link distance from u to u0 may di er greatly from the link distance between the two points. (See Figure 1.) Let u1 ; u01; u2 ; u02 be four vertices lying in the given order around P . By virtue of the relative locations of these four vertices, there are nonintersecting paths, 1 and 2 , connecting u1 to u01 and u2 to u02, respectively. However, it is  Stanford University, Stanford CA 94305 ([email protected]). y Ohio State University, Columbus, OH 43210, U.S.A. ([email protected]).

ported by NSA grant MDA904-93-H-3026.

1

Sup-

u

u0

Figure 1: Minimum link and minimum interior link paths. u1

u2

u01

u02

Figure 2: Intersecting Link Paths possible that every minimum interior link path connecting u1 to u01 intersects every minimum interior link path connecting u2 to u02. (See Figure 2.) To simultaneously connect u1 to u01 and u2 to u02 by nonintersecting interior paths requires more line segments. In general, two additional line segments suce to construct two such nonintersecting interior paths. (See [5].) A set  = f(ui ; u0i )g, i  m, of m pairs of distinct vertices of P is untangled if some set of pairwise disjoint paths connects ui to u0i . Let  = f(ui; u0i )g, i  m, 0 be an untangled set of m pairs of distinct vertices P of P . Let0 l(ui ; ui ) be the inte0 rior link distance from u to u and let L = i=1::m l(ui ; ui ) be the sum of those distances. Clearly, L line segments are required to construct a set of pairwise disjoint interior paths connecting ui to u0i , for i = 1; : : : ; m. How many additional line segments are required? In [5] we proved that O(m log m) additional line segments suce and claimed without proof that (m log m) additional line segments may be required. In Section 2 of this paper we prove the lower bound, presenting a construction which requires (m log m) line segments. We de ne the pairwise disjoint link paths problem as: given an untangled set, f(ui ; u0i )g, of m pairs of distinct vertices of P , nd the minimum total number of line segments required by a set of pairwise disjoint interior paths connecting ui to u0i . We were unable to give a polynomial time algorithm for this problem or to determine if the problem is NP-complete. Instead we present an algorithm in Sections 3 and 4 which nds a solution within a constant factor of the optimal 2

solution. A triangulation TP of P (possibly with interior vertices) is isomorphic to a triangulation TQ of Q if there is a one-to-one, onto mapping f between the vertices of TP and the vertices of TQ such that p; p0 ; p00 are vertices of a triangle in TP if and only if f (p); f (p0 ); f (p00 ) are vertices of a triangle in TQ . An isomorphic triangulation of P and Q also de nes a piecewise linear homeomorphism between P and Q. The size of a triangulation is the total number of vertices, edges and triangles in the triangulation. Algorithms for constructing isomorphic triangulations between labelled point sets are described in [8] and [9]. Algorithms for isomorphic triangulations between simple polygons are given in [1], [7] and [5]. Our motivation for constructing pairwise disjoint paths using few line segments comes from our work on an approximation algorithm for constructing isomorphic triangulations between simple polygons in [5]. The main result in this paper improves the output size of that algorithm from O(M1 log n + n log2 n) to O(M1 log n) where n is the input size and M1 is the size of the optimal solution. In Section 5 we outline this improvement.

2 Worst Case Bounds In this section we construct polygons with n vertices, (n +1)=8 pairs of vertices, and interior link distance three, such that any set fi g of nonintersecting paths connecting the pairs requires a total of (n log n) links. For each integer k, de ne functions f and g on the integers as follows. Each integer a < 2kPcan be represented in binary as the sumPof powers of two. ) = i=1::k?1 i 8i and For each a =P i=0::k?1 i 2i , i 2 f0; 1g, de ne f (aP i i k ? 1 g(a) = 2 i=0::k?1 (1 ? i )4 . (De ning g (a) = i=0::k?1 (1 ? i )4 will k ? 1 work just as well but the 2 factor generates a more symmetric polygon.) Note that in the de nition of f , the sum is from 1 to k ? 1, not from 0 to k ? 1. Thus f (a) = f (a + 1) when a is even. Let pi be the point (0; f (i)) on the y-axis and let qi be the point (1; g(i)) on the vertical line x = 1. Let li be the line segment from pi to qi . (See Figure 3.) Let L = fli : i = 0; : : : ; 2k ? 1g. Let l be the line segment joining (1; g(0)) and (1; g(2k ? 1)). Let P be the polygon which is union of all the bounded regions in the arrangement of L [flg. (See Figure 4.) Clearly every point in P can be connected to l by a line segment in the interior of P . Thus every pair of points in P can be connected by three line segments in the interior of P and P has interior link distance three. Polygon P has 2k?1 vertices on the y-axis and two vertices on the vertical line y = 1. We will show that the total number of vertices n equals 2k+1 ? 1. The vertices of P on the y-axis are the points fp0; p2 ; : : : ; p2k ?2 g. (Remember pi = pi+1 for i even.) Pair each vertex p2i with the vertex p2k ?2i , constructing (n + 1)=8 pairs. We claim that any set of non-intersecting paths connecting these pairs requires at least (1=32)n log2 n links when k is even. We rst show that the relative position of the intersection points of two lines 3

q0 q1

80 p6 = p7 p4 = p5 60

q2 q3

40 20

q4 q5

p2 = p3

q6

p0 = p1

q7

0.5

1.0

Figure 3: Line segments li , i = 0; : : : ; 7.

la and lb can be determined by the most signi cant bit in which a and b di er. More speci cally, if the most signi cant bit in which a and b di er is less than the most signi cant bit in which a0 and b0 di er then la \ lb is to the left of la0 \ lb0 . The intersection of segment la and lb has x-coordinate 1 ; g ( 1 + f (ba))??gf((ab)) whenever f (a) ? f (b) 6= 0. If a = P i i=0::k?1 i 2 , i 2 f0; 1g, then

f (a) ? f (b) =

P

i i=0::k?1 i 2 ,

k?1 X i=1

( i ? i )8i ;

g(b) ? g(a) = 2k?1

4

i 2 f0; 1g, and b =

kX ?1 i=0

( i ? i )4i :

80 60 40 20

0.5

1.0

Figure 4: Weakly edge visible polygon. If j > 0 is the most signi cant bit in which a and b di er, then   g(b) ? g(a)  2k?1 4j + 4j?1 + 4j?2 +    + 4 + 1 = 2k?1 7 4j+1 ? 1 f (a) ? f (b) 8j + 8j?1 + 8j?2 +    + 8 3 8j+1 ? 8 and   g(b) ? g(a)  2k?1 4j ? 4j?1 ? 4j?2 ?    ? 4 ? 1 = 2k?1 7 2  4j + 1 : f (a) ? f (b) 8j ? 8j?1 ? 8j?2 ?    ? 8 3 6  8j + 8 Thus,  2  4j + 1  g(b) ? g(a)  4  4j ? 1  7 7 k ? 1 k ? 1 2 3 6  8j + 8  f (a) ? f (b)  2 3 8  8j ? 8 : Assume j > 0 is the most signi cant bit in which a and b di er, while j + 1 is the most signi cant bit in which a0 and b0 di er.     g(b0 ) ? g(a0 )  2k?1 7 4  4j+1 ? 1 < 2k?1 7 2  4j + 1  g(b) ? g(a) : f (a0 ) ? f (b0 ) 3 8  8j+1 ? 8 3 6  8j + 8 f (a) ? f (b) Thus 1 1 ; 0 )?g(a0 ) > g ( b g ( 1 + f (a0 )?f (b0 ) 1 + f (ba))??gf((ab)) 5

and the intersection point of la and lb is to the left of the intersection point of la0 and lb0 . This is also true if a and b di er only in the zero'th bit, since then their intersection lies on the x-axis. Thus the relative position of la \ lb and la0 \ lb0 can be determined by the most signi cant bits in which a and b and a0 and b0 di er. The line segments flag can be represented as the leaves in a completely balanced binary tree T , where the leaves are ordered by the values of a. Each internal node u in the tree represents the set Iu of intersections of the line

segments in the left subtree with the line segments of the right subtree. For the 2k?1 nodes at height one, each Iu contains a single intersection point and these 2k?1 intersection points are the 2k?1 vertices of polygon P on the y-axis. For the 2k?1 ? 1 nodes of height greater than one, note that the intersection points of all pairs of line segments in the left subtree and all pairs of segments in the right subtree lies to the left of any point in Iu . Thus the \lowest" and \highest" line segments from the left subtree and the \lowest" and \highest" line segments from the right subtree bound all the points in Iu . The intersection of these four segments gives four points in Iu whose convex hull is a diamond containing Iu . The three leftmost vertices of this diamond are vertices of P . Thus the 2k?1 nodes at height greater than one generate 3  2k?1 ? 3 polygon vertices. Polygon P has two more vertices on the line y = 1, so the total number n of vertices of P is 2k+1 ? 1. For each internal node u in T , again consider all the intersection points of the left and right subtrees of u. For each node u, let qul and qur be the leftmost and rightmost such intersection points. If u has height one, then qul = qur is a vertex p2i of polygon P . For each node u of height greater than one, let Ru be l l simple polygon with vertices fqu:left , qur , qu:right , qul g, where u:left and u:right are the left and right subtrees of u, respectively (Figure 5.) Let h be the height of u. Let fi g be a set of pairwise disjoint paths connecting p2i to p2k ?2i for i = 0; : : : ; 2k?2 ? 1. We claim that Ru must contain at least 2h?3 vertices of fi g. Assume that the height of u is greater than two. Deleting polygon Ru from polygon P divides P into ve pieces, four to the left and one to the right. Label the regions to the left R1 , R2 , R3 , R4 , from bottom to top, and the region to the right R5 . Any line segment in P with endpoints in R1 and R5 must intersect any line segment in P with endpoints in R4 and R5 . Thus if i and j are pairwise disjoint paths connecting R1 and R4 to R5 , respectively, then either i or j has a vertex in Ru . Assume u is not the root of T . (Note that u is the root of T in Figure 5.) If i has an endpoint in R1 , R2 , R3 or R4 , then the other endpoint of i must be in R5 . Since 2h?3 paths have endpoints in R1 and 2h?3 paths have endpoints in R4 , polygon Ru contains at least 2h?3 vertices. Now assume u is the root of T . If i has an endpoint in R1 , then the other endpoint of i must be in R4 and vice versa. Since no line segment in P connects R1 to R4 , polygon Ru must contain a vertex of each of the 2k?3 paths connecting R1 to R4 . Similarly, Ru must contain a vertex of each of the 2k?3 paths connecting R2 to R3 . Thus Ru contains at least 2k?2 path vertices. 6

80 R4

60

R3 R

40 20

u

R5

R2 R1

0.5

1.0

Figure 5: Polygon Ru . If u is an internal node of height two, then two paths i and i+1 must cross Ru . By reasoning similar to that given above, Ru contains a vertex (other than the endpoints) of at least one of these paths. Thus if u has height two, then Ru contains at least one vertex. Assume k is a positive even integer. The polygons Ru where u has even height (greater than one) are pairwise disjoint. There are 2k?h polygons Ru where u has height h and each such polygon contains at least 2h?3 path vertices. Together they contain 2k?3 path vertices. There are 2k?2 polygons Ru where u has height two and each such polygon contains at least one path vertex. Finally the polygon Ru where u is the root contains at least 2k?2 path vertices. Summing these values, we nd that the polygons Ru where u has even height together contain at least (k + 4)2k?4 = (log2 (n + 1) + 3)(n + 1)=32 path vertices. Thus the pairwise disjoint paths fi g contain at least (1=32)n log2 n line segments. For odd values of k, a similar argument gives an (n log n) lower bound with a somewhat lower constant.

7

e

Figure 6: V^ is(e).

3 Approximation Algorithm

Point p 2 P is visible from point p0 2 P if P contains the open line segment (p; p0 ). Point p is clearly visible from point p0 2 P if the interior of P contains the open line segment (p; p0 ). The (clear) visibility polygon from a point p 2 P is the set of points in P (clearly) visible from p. Point p 2 P is (clearly) visible from edge e 2 P if there is some point p0 2 e such that p is (clearly) visible from p0 . (This de nition of visibility is sometimes called weak visibility as opposed to strong visibility where p must be visible from every point p0 2 e. Throughout this paper, visibility refers to weak visibility.) Edge e or triangle t is (clearly) visible from edge e0 or triangle t0 if there are points p 2 e or p 2 t and p0 2 e0 or p0 2 t0 such that p is (clearly) visible from p0 . The (clear) visibility polygon from a line segment e  P is the set of points in P (clearly) visible from e. (See Figure 6.) We denote the visibility polygons as Vis(p) and Vis(e) and the clear visibility polygons as V^ is(p) and V^ is(e). Note that Vis(p) and Vis(e) are closed sets while V^ is(p) and V^ is(e) are usually not closed. In [3], Chazelle gives a linear time algorithm for constructing a triangulation TP of P (using no vertices other than those of P .) Using this triangulation, Guibas et al. in [4] give a linear time algorithm for constructing Vis(e). Their algorithm can be easily modi ed to construct V^ is(e). The algorithm by Guibas et al. can also be modi ed to run in time O(ne ) (after the O(n) triangulation construction) where ne is the number of triangles of TP intersected by Vis(e). A brief outline of the necessary modi cations follows. Edge or diagonal (w2 ; w3 ) intersects the visibility polygon Vis(e) of e = (w0 ; w1 ) if and only if the shortest paths inside P from w0 to w2 and from w1 to w3 are outwardly convex or vice versa. (See [4] for the de nition of outwardly convex and a complete discussion of the algorithm.) The algorithm by Guibas et al. constructs the shortest paths from w0 and w1 to each vertex of the polygon, checks for outward convexity, and then constructs Vis(e) from outward convex paths. Instead of initially constructing all shortest paths to all vertices, the 8

u1

w0

d1 d2

e

u4

u6 w1

d6

d7

u7

u2 d3

u3

d5

d4 u5

Figure 7: ?e . modi ed algorithm checks for outward convexity and visible diagonals as the shortest paths are constructed. Whenever a diagonal (w2 ; w3 ) is found which is not visible to e, the entire region which is separated from e by (w2 ; w3 ) is not visible to e and does not need to be processed. Details are left to the reader. A similar modi cation will construct V^ is(e) in O(ne ) time. Again let TP be a triangulation of polygon P using no vertices other than those of P . Let u and e be a vertex and an edge of P , respectively. Edge d of triangulation TP separates u from e if every interior path from u to the interior of e must intersect the interior of d. Triangle t of triangulation TP separates u from e if every interior path from u to the interior of e must intersect the interior of t.

Lemma 1 Let P be a simple polygon on n vertices with distinguished edge e = fw0 ; w1 g and let U be a subset of Vert(P ) n fw0 ; w1 g of size m. A set of m pairwise disjoint interior paths connecting the vertices in U to the interior of e can be constructed in O(n log m + M log m) time using a total of at most 240M line segments where M is the minimum total number of line segments necessary to connect U to e by m pairwise disjoint paths.

Proof: Let u1; u2; : : : ; um be the points in U labeled in clockwise order around

P starting at e . Construct a triangulation TP of P . Let ?e be union of the triangles of TP which are clearly visible from edge e . ?e is a simple polygon in P . (See Figure 7.) For any point p 2 P , let d(p) be the diagonal of TP lying on a triangle containing p and separating p from e . Similarly, if c is an edge of triangulation TP , let d(c) be the diagonal of TP lying on a triangle containing c and separating c from e . If p or c lie on the triangle containing e, then let d(p) or d(c) equal e . The boundary of ?e is composed of edges and chords of the original polygon

P . Each ui 2 U is either in ?e or is separated from ?e by some chord c of P 9

s5 s4

d1 d2 d3

s3 s1 s2

s6 s7

d6

d5

d7

d4

Figure 8: Line segments si = int(e ) \ V^ is(di ). on the boundary of ?e . If ui is in ?e , let di be d(ui ). If ui is separated from ?e by chord c on the boundary of ?e , let di equal d(c). Since each diagonal di is clearly visible from edge e , the edge e is clearly visible from each diagonal di . Let si be int(e ) \ V^ is(di ). (int(e ) is the interior of e .) Set si is an open line segment lying on e. Note that si may equal sj (and di may equal dj ) for many distinct points ui ; uj 2 U . (See Figure 8.) For each ui we wish to choose a point pi on e to be the endpoint of the path from ui to e . Obviously, a point in si is a good candidate since it can reach di with a single line segment. However, we also need to choose the pi such that their order on e is consistent with the order of U around P . In other words, ui ; uj ; pj ; pi should lie clockwise or counter-clockwise around P in the given order. Let S be any set of open line segments in R1 , not necessarily distinct. For each point q 2 R1 , let f (q; S ) be the number of line segments of S which contain the point q. Note that the line segments of S are open and do not contain their endpoints. Let f ? (q; S ) and f +(q; S ) be the number of line segments of S contained in the open intervals (?1; q) and (q; 1), respectively. Note that f (q; S ) + f ?(q; S ) + f + (q; S ) equals jSj. Let R be the set of midpoints of line segments of S , again not necessarily distinct. The median point of R is the djRj=2e'th point in R, ordered from ?1 to 1. Let g(S ) be this median point of R. At least jRj=2 = jSj=2 points of R lie in each of the closed intervals (?1; g(S )] and [g(S ); 1). If the midpoint of segment s 2 S lies in (?1; g(S )], then segment s either contains g(S ) or lies in the open interval (?1; g(S )). Thus f (g(S ); S ) + f ?(g(S ); S ) is greater than or equal to djSj=2e. Similarly f (g(S ); S ) + f + (g(S ); S ) is greater than or equal to djSj=2e. (See Figure 9.) Now consider two sets of line segments S0 and S1 on R1 and let S = S0 [S1 . De ne F (S0 ; S1 ) = f (g(S ); S ) + f +(g(S ); S0 ) + f ?(g(S ); S1 ): 10

s5 s4

s3

s2 s1

s7 s6 g (S )

f (g(S ); S ) = 2, f ?(g(S ); S ) = 3, f + (g(S ); S ) = 2. Figure 9: S , g(S ) and f (g(S ); S ). Without loss of generality, assume that w0 ; e ; w1 appear in counterclockwise order around P . Let SU be the sequence (s1 ; s2 ; : : : ; sm ). Embed e and the line segments si 2 S in the real line R1 , mapping w0 to zero and w1 to one. In the next section, we describe an algorithm to partition SU into contiguous subsequences 1 = (s1 ; s2 ; : : : ; si1 ), 2 = (si1 +1 ; si1 +2 ; : : : ; si2 ); : : :, 2h = (si2h?1 +1 ; si2h?1 +2 ; : : : ; sm ), such that: 1. g(1 [ 2 )  g(3 [ 4 )     : : :  g(2h?1 [ 2h ); 2. j2j?1 j = j2j j (+1) for 1  j  h; P 3. j=1::h F (2j?1 ; 2j )  m=40. (One possible partition of the segments in Figure 8 is 1 = fs1; s2 ; s3 g, 2 = fs4 ; s5 g, 3 = fs6 g, 4 = fs7g.) Let gj equal g(2j?1 [ 2j ) for j = 1; : : : ; h. Note that g1 ; g2 ; : : : ; gh lie in counter-clockwise order around P . Let Uj = fui : si 2 j g be the points in U corresponding to the line segments in j for j = 1; : : : ; h. For each gj , let ?j be the union of the triangles of TP which intersect V^ is(gj ) and separate some u 2 U2j?1 [ U2j from e . (See Figure 10.) Let ? be the union of all the ?j . Similar to ?e , ? is also a simple polygon in P , its boundary is composed of edges and chords of P , and it has a triangulation T? induced by the triangulation TP of P . Let C be the set of chords of P bounding ?. Each chord c 2 C separates P into two subpolygons. Let Pc be the subpolygon not containing ?. Let w0c and w1c be the endpoints of c. For each chord c 2 C , let Uc be the points of U nfw0c ; w1c g in Pc . Recursively, construct pairwise disjoint paths connecting the points in Uc to c. (See Figure 12.) Let D be the diagonals of T? which separate a single triangle of T? from e . Label these diagonals d~1 ; d~2 ; : : : ; d~n~ in counter-clockwise order around ?. For each diagonal d~k where k < n~ , there is a unique triangle t~k such that t~k separates d~k from d~k+1 and d~k from e and d~k+1 from e. Let w~k be the vertex of t~k which t~k separates from e . Vertex w~k lies between the endpoints of d~k 11

u1

w0

g1

u4

u6

u2 u3

u7

w1

u5

Figure 10: ?1 . u1

w0

g2

u4

u6

u2 u3

u7

w1

u5

Figure 11: ?2 . u1

w0

g1 g2 w1

u4

u6 u7

u2 u3

u5

Figure 12: ?, triangulation T? and paths to the boundary of ?. 12

u1

w~0

u2

d~1 w~1 w~2

g1 w~3

g2 w~4

u6

d~4

d~3 u7

u4

d~2

u3

u5

Figure 13: Diagonals d~k , vertices w~k and line segments i . and d~k+1 . For convenience, label vertices w0 and w1 as w~0 and w~k , respectively. (See Figure 13.) Let k be the set of vertices of U between w~k?1 and w~k , possibly including w~k?1 but not w~k . For each diagonal d~k 2 D, choose the minimum j such that d~k is an internal chord of ?j . Note that d~k is clearly visible from gj . Construct j k j distinct line segments in the interior of P connecting gj to the interior of d~k . A total of m line segments are constructed. Label these line segments 1 ; 2 ; : : : ; m , as their endpoints appear in clockwise order around P starting at w0 . Note that if ui is an element of k , then i has an endpoint on d~k . We claim that the line segments i intersect only at their endpoints. Let i and i0 be line segments connecting distinct gj and gj0 to diagonals d~k and d~k0 , respectively. Without loss of generality, assume that j is less than j 0 . Diagonal d~k is an internal chord of ?j , so diagonal d~k separates some point of Uj from e . Similarly, diagonal d~k0 separates some point of Uj0 from e . Since j is less than j 0 , points w0 , gj , gj0 , w1 lie in clockwise order around P while w0 , Uj , Uj0 , w1 lie in clockwise order around P . Thus i and i0 don't intersect. For each point ui 2 U (c), let 0 (ui ) be the endpoint on c of the path connecting ui to c. For each point ui 2 U which lies in ?, let 0 (ui ) equal ui . Let 1 (ui ) be d(0 (ui )) \ i . Let w2 be the third vertex of the triangle containing e = (w0 ; w1 ). Let 2 (ui ) be the rst intersection point of i and the polygonal line from w0 to w2 to w1 . Place m points equally spaced on e . Let 3 (ui ) be the i'th point, ordered counter-clockwise from w0 . Connect 0 (ui ) to e with a polygonal line through 0 (ui ); 1 (ui ); 2 (ui ); 3 (ui ). (See Figure 14.) We claim that this algorithm connects U to e using O(M ) links where M is the number of links in some optimal solution. For each ui 2 U , let i be the path constructed from ui to e by our algorithm while i is the path from ui to e in the optimal solution. Path i has at most three line segments in ?. Line segment si is in 2j?1 [ 2j for some j . If si contains gj , then some point on diagonal di is clearly visible from gj and di is a diagonal of ?j  ?. Since di is 13

u1

w0 3 (u3 ) 2 (u3 )

u4

u6

w1

u7

u2

1 (u3 )

u3

0 (u3 ) u5

Figure 14: Pairwise disjoint paths connecting U to e. the farthest diagonal visible from e which separates ui from e, any path from ui to e must have at least one line segment contained in ?j  ?. Thus if si contains gj , then we can charge the three links of i in ? to a line segment of i in ?. However, si may not contain gj . Consider the case where si 2 2j?1 lies between gj and w1 while si0 2 2j lies between w0 and gj . Any two paths from ui to si and ui0 to si0 must intersect. Since paths i and i0 are pairwise disjoint, either the endpoint of i must lie between w0 and gj or the endpoint of i0 must lie between gj and w1 . Without loss of generality, assume that the endpoint  of i lies between w0 and gj . In that case, gj lies between  and si . Let d be the farthest diagonal of P visible from  and separating  from ui . By the construction of di and si , diagonal d separates di from e and hence is visible to si . Since gj lies between  and si , diagonal d is also visible to gj and is contained in ?j  ?. Thus if  lies between w0 and gj , path i must have at least one line segment contained in ?j  ?. Similarly, if the endpoint of i0 lies between gj and w1 , path i0 must have at least one line segment contained in ?j  ?. It follows that either i or i0 must have a line segment contained in ?j  ?. Let m0 ; m? ; m+ equal f (gj ; 2j?1 ), f ? (gj ; 2j?1 ) and f + (gj ; 2j?1 ), respectively, while m00 ; m0? ; m0+ equal f (gj ; 2j ), f ? (gj ; 2j ) and f + (gj ; 2j ), respectively. By the arguments above, the paths connecting the points in U2j?1 [ U2j to e in the optimal solution must have at least m0 + m00 +min(m+ ; m0? ) line segments contained in ?. By the choice of point gj , m0 + m? + m00 + m0?  j2j?1 [ 2j j=2. Since j2j?1 j equals j2j j or j2j?1 j + 1, m0 + m? + m00 + m0?  j2j?1 j. On the other hand, m0 + m? + m+ = j2j j. Subtracting the second equation from the rst gives m00 + m0?  m+ . Thus

m0 + m00 + min(m+ ; m0? ) = min(m0 + m00 + m+ ; m0 + m00 + m0? )  min(m0 + m00 + m+ ; m0 + m+ ) = m0 + m+ 14

Similarly, m0 + m+  m0? and m0 + m00 + min(m+ ; m0? )  m00 + m0? . Thus m0 + m00 + min(m+ ; m0? )  max(m0 + m+ ; m00 + m0? )  F (gj ; 2j?1 ; 2j )=2: The paths connecting the points in U2j?1 [ U2j to e in the optimal solution must have at least F (gj ; 2j?1 ; 2j )=2 line segments in ?. Since P j =1::h F (2j ?1 ; 2j )  m=40, any pairwise disjoint paths connecting the points in U to e must have at least m=80 line segments contained in ?. The construction produces at most 3m line segments in ?, so the solution is at most 240 times the optimal. Finally, we analyze the running time of our algorithm. Constructing the initial triangulation TP takes O(n) time [3, 4]. Constructing the visibility region V^ is(e ) and the subpolygon ?e takes O(n ) time where n is the number of triangles of TP intersected by V^ is(e ). The segments si = int(e ) \ V^ is(di ) for i = 1; : : : ; m, can also all be constructed in O(n ) time. Instead of constructing V^ is(di ) for each di , construct V^ is(e ) in ?e using the algorithm in [4] modi ed to run in O(n ) time. For each edge e visible to e, this algorithm explicitly constructs the points on e visible to e and the points on e visible to e. Similarly, for each diagonal di visible to e , we can construct the points on di visible to e and the points on e visible to di . This set of points on e is just the line segment si . As discussed in the next section, partitioning SU into the subsequences j takes O(m log m) time. Finding gj = g(2j?1 [ 2j ) for j = 1; : : : ; h, takes O(m) time. Constructing each V^ is(gj ) and ?j individually and merging the result to form ? would take an unacceptable O(n m) time. Instead we construct ? directly. As mentioned above, the algorithm in [4] can be used to determine the points on e visible to each diagonal d of TP and thus the points gj0 ; gj+1 ; : : : ; gj1 visible to d. Let ui0 be the point with lowest index i0 in U2j0 ?1 . Let ui1 be the point with greatest index i1 in U2j1 . Diagonal d of TP is an internal diagonal of ? if and only if d separates e from some point in fui0 ; ui0 +1 ; : : : ; ui1 g. This can be determined in constant time per diagonal so ? can be constructed in O(n ) time. Construction of D = fd~1 ; d~2 ; : : : ; d~n~ g and fw~1 ; w~2 ; : : : ; w~n~ g, the partition of U into sets k , the construction of the line segments i and of the polygonal paths (0 (ui ); 1 (ui ), 2 (ui ), 3 (ui )) can all be done in O(n + m) time. Thus the non-recursive steps in this algorithm take k1 n + k2 m log m time for some constants k1 ; k2 . We wish to show that the running time of the algorithm is less than k0 (n log m + M log m) for some constant k0 . For each subpolygon Pc , c 2 C , let nc be the size of the triangulation of Pc , let mc be the size of Uc and let Mc be the size of the optimal solution connecting Uc to (w0c ; w1c ). By induction, the running time of our algorithm is less than or equal to X k1 n + k2 m log m + k0 (nc log mc + Mc log mc ): c2C

P

We partitionPthis expression into two parts, k1 n + c2C k0 (nc log mc ) and k2 m log m + c2C k0 (Mc log mc ), and bound each expression separately. 15

P

We start by bounding k2 m log m + c2C k0 (Mc log mc). Since any optimal solution must have at least m=80 line segments contained in ?,

m=80 +

X c2C

Mc  M:

Assuming that k0 is greater than 80k2 ,

k2 m log m +

X c2C

k0 Mc log mc  (80k2 m=80 +

P

X c2C

k0 Mc) log m  k0 M log m:

To bound k1 n + c2C k0 (nc log mc), we divide the n triangles in ? into those that are also in ? and those that are outside ?. Let n0 be the number of the former while n1 is the number of the latter. The n0 triangles in ? are never encountered again in the algorithm but the the n1 triangles outside ? may be processed many more times and their contribution to the running time must be carefully evaluated. The chords c 2 C which bound ? can also be divided into those that also bound ? and those that lie in the interior of ? . Let C0 be the former set while C1 is the latter set. We claim that mc is at most 2=3m for each c 2 C1 . Let sc be the open line segment int(e ) \ V^ is(c) lying on e . Note that si is a subset of sc for every ui 2 Uc . The point gj is a midpoint of one of the line segments in 2j?1 [ 2j . If U2j?1 [ U2j was a subset of Uc , then gj would lie in sc . In that case, c would be visible to gj and would lie in the interior of ?j and ?. Since c is on the boundary of ?, we conclude that no set U2j?1 [ U2j is a subset of Uc , The points in Uc must be split between two sets U2j?1 [U2j and U2j+1 [U2j+2 . Without loss of generality, assume that U2j?1 [ U2j contains at least half the points in Uc . If the size of Uc was more than 2m=3, then U2j?1 [ U2j would contain more than m=3 points of Uc and less than m=3 other points. Since gj does not lie in sc, the more than m=3 midpoints of 2j?1 [ 2j which lie in sc all lie to one side of gj . There are less than m=3 other midpoints of 2j?1 [ 2j , so gj would not evenly split the midpoints of 2j?1 [ 2j , contrary to the de nition of gj . We conclude that the size of mc is at most 2m=3 for every c 2 C1 . Since a triangle that is in ? is not in any of the polygons Pc , c 2 C ,

n0 +

X c2C

nc  n:

On the other hand, since every triangle that is in ?e but not in ? is in some polygon Pc , c 2 C1 , X

n1 

c2C1

nc :

Assuming k0 is chosen to be greater than k1 =(log(3=2)),

k1 n +

X

X

c2C

c2C0

(k0 nc log mc)  k1 n0 + k1 n1 + 16

(k0 nc log mc )

+

X c2C1

 k1 n0 + k1 n1 + +

 k1 n0 +

X c2C0

(k0 nc log mc )

X

c2C0

X

c2C1

(k0 nc log m)

(k0 nc log(2=3m))

(k0 nc log m) + +k1 n1 +

 k0 n log m + k1 n1 ?  k0 n log m:

X

c2C1

X

c2C1

X

c2C1

(k0 nc log m)

k0 (nc log(2=3))

k0 (nc log(3=2))

2

We employ arguments similar to the ones in [5] to turn Lemma 1 into a theorem about connecting pairs of vertices. Theorem 1 Let P be a simple polygon on n vertices let  = f(u; u0)g be an untangled set of m pairs of distinct vertices of P . A set of m pairwise disjoint interior paths connecting u to u0 for each (u; u0 ) 2  can be constructed in O(n + M + m log m) time using O(M ) line segments where M is the minimum total number of line segments necessary to connect all pairs (s; s0 ) 2  by pairwise disjoint paths. Proof: As in [5], we start by considering the problem of connecting vertices to edges in a triangulation of P . Let P be a simple polygon on n vertices with triangulation TP and distinguished edge e . Let ^ (u; eu) be a set of pairs of vertices and edges of TP where either eu = e or eu is a diagonal of P which separates e from u. The vertices, but not the edges, are all distinct and are not endpoints of e . Let M 0 be the minimum total number of line segments necessary to connect the vertex-edge pairs in ^ by pairwise disjoint paths. In O(n + M 0 + m0 log m0 ) time, we can construct m0 pairwise disjoint interior paths u connecting u to the interior of eu for each (u; eu ) 2 ^ where u has at most 240M 0 + 3m0 line segments. The algorithm follows the algorithm in Lemma 1. Let U 0 be the set of points for which eu is the distinguished edge e . Apply the algorithm in Lemma 1 using only the points in U 0 , construct the region ?. Removing ? subdivides P into subpolygons. Recursively solve the problem of connecting pairs of vertices and edges in each of these subpolygons. Connect each path with endpoint on the boundary of ? to the appropriate edge in ?. The only di erence is that the connection may not be to e but to some edge eu on the path to e . As argued in Lemma 1, the constructed paths connecting U 0 to e use 3jU 0 j line segments in ? while the optimal solution requires at least jU 0 j=80 line segments in ?. Each path whose endpoint is not on e but on some other edge of 17

u1 t

u1 ;u4

t

u5 ;u6

t

u2 ;u4

u4

u6

u2 u3

u5

Figure 15: Triangles tu;u0 . u1

u4

u6

u2 u3

u5

Figure 16: Paths connecting vertices.

TP lying in ? may also require three line segments. Since this can happen only once per path, the paths have a total of at most 240M 0 + 3m0 line segments. Now consider the original problem of connecting m pairs of vertices (u; u0) 2 . Arbitrarily choose an edge e of P . For each pair (u; u0 ) 2 , there is a unique triangle tu;u0 such that any path from u to u0 or any path from u to e or any path from u0 to e must pass through tu;u0 . If triangle tu;u0 does not contain u, let eu be the edge of triangle tu;u0 which separate tu;u0 from u. Otherwise, let eu be an edge of triangle tu;u0 containing u. Similarly, let eu0 be the edge of triangle tu;u0 either separating tu;u0 from u0 or containing u0 . (See Figure 15.) Let ^ be the set of m0 = 2m pairs (u; eu ) where (u; u0) 2  (or (u0 ; u) 2 .) Run the above algorithm to construct 2m pairwise disjoint interior paths, u , from u to eu for each pair (u; eu ) 2 ^ . Finally, for each (u; u0 ) 2 , connect the paths u and u0 by a line segment from eu to eu0 . (See Figure 16.) Let M and M 0 be the minimum total number of line segments needed to 18

connect the vertex-vertex and vertex-edge pairs in  and ^ , respectively. The m paths connecting pairs of vertices in  can be cut to form m0 = 2m pairwise disjoint paths connecting vertex-edge pairs in ^ using at most M + m line segments. Thus M 0 is less than or equal to M + m. Our algorithm uses at most 240M 0 + 3m0 line segments to connect the vertex-edge pairs in ^ and at most 240M 0 + 3m0 + m line segments to connect the vertex-vertex pairs in . Thus our solution uses at most 240M + 247m line segments. 2

4 Partition Algorithm In this section, we describe and analyze the algorithm for partitioning a sequence of line segments. The functions f , f + , f ? and F were de ned in the previous section.

Lemma 2 Let S be a sequence of line segments(s1; s2; : : : ; sm) on the real line R1 . In O(m log m) time, S can be partitioned into contiguous subse-

quences 1 = (s1 ; s2 ; : : : ; si1 ), 2 = (si1 +1 ; si1 +2 ; : : : ; si2 ); : : :, 2h = (si2h?1 +1 , si2h?1 +2 ; : : : ; sm ), such that: 1. g(1 [ 2 )  g(3 [ 4 )     : : :  g(2h?1 [ 2h ); 2. j2j?1 j = j2j j (+1) for 1  j  h; P 3. j=1::h F (2j?1 ; 2j )  m=40.

Proof: Split S into m distinct subsequences, (si), consisting of one element each. Store the m sets in a linked list A in the order they appear in S . Each set is stored in a separate node a in the linked list where a:seq contains the subsequence stored at a, a:size = jaj is the number of elements in the a:seq, a:next is the next node in the linked list, and a:prev is the previous node in the linked list. Let A:first and A:last be the rst and last nodes in A. We call A balanced if 3jaj  ja:nextj and 3jaj  ja:prevj for all nodes a 2 A ? fA:first; A:lastg. Clearly, A is initially balanced. While A contains some node a such that g(a:seq) > g(a:next:seq), re-

peat the following. First, merge node a with a:next, storing the result in a. Next, call procedures BALANCE-NEXT and BALANCE-PREV to rebalance the linked list by merging and splitting nodes near a. Repeat this while loop until g(a:seq)  g(a:next:seq) for each a in A. (See Figure 17.) Procedure BALANCE-NEXT rebalances nodes after a as follows. Let a0 equal a. Note that a0 was formed by merging nodes from a balanced list, so 3ja0j is automatically greater than or equal to ja0 :nextj. We need to ensure that 3ja0 :nextj  ja0 j. If ja0 j is greater than 3ja0 :nextj, then merge nodes a0 :next and a0 :next:next storing the result in a0 :next. Continue merging a0 :next and a0 :next:next until ja0 j is less than or equal to 3ja0 :nextj. If ja0 :nextj is less than or equal to 3ja0 :next:nextj, then stop. If ja0 :nextj is greater than max(3ja0 :next:nextj; (2=3)ja0 j), then split a0 :next into two nodes of approximately equal size and stop. Otherwise, let a0 equal a0 :next and start again. 19

PARTITION(S ) /* S = a sequence of line segments (s1 ; s2 ; : : : ; sm ) */ /* Returns a linked list of contiguous subsequences of S */ 1. Initialize linked list A to ;; 2. FOR i = 1 TO m DO 3. Create new node a where a:seq = (si ) and a:size = 1; 4. Add a to the end of linked list A; 5. WHILE 9a 2 A such that g(a:seq) > g(a:next:seq) DO 6. Merge a and a:next to form a new node a0 in A; 7. BALANCE-NEXT(a0 ); 8. BALANCE-PREV(a0); 9. Return(A). Figure 17: Algorithm Partition-Segments. In both cases, the condition 3ja0j  ja0 :nextj is satis ed. In a similar manner, BALANCE-PREV rebalances nodes before a. (See Figure 18.) Steps 10 and 11 in BALANCE-NEXT and BALANCE-PREV require some explanation. Let b1 ; b2 ; b3 be the three nodes after a0 at the completion of BALANCE-NEXT, where b1 = a0 :next, b2 = b1 :next and b3 = b2 :next. Nodes b1 and b2 were created by splitting a node whose size is greater than (2=3)ja0j and 3jb3 j, so 3jb1 j  ja0 j and 3jb2j  jb3 j. Nodes b1 and b2 have approximately the same size, so 3jb2 j  jb1 j and 3jb1j  jb2 j. The remaining condition we need to check is 3jb3 j  jb2 j. Let b0 be the node split to create b1 and b2. Node b0 was created by merging a sequence of nodes b01 ; b02 ; : : : ; b0k , where a0 :next = b01 and b0i :next = b0i+1 . The total number of elements in b01 ; b02 ; : : : ; b0k?1 is less than jaj=3 or b0k would not have been added to b0 . The value of jb0k j must be at least ja0 j=3 or else jb0 j would not be greater than (2=3)ja0j. Thus

jb0k j > ja0 j=3 >

X

i=1::k?1

Since the list was initially balanced,

X

jb3 j  jb0 j=3  k

Thus,

jb3 j  (jb0k j +

i=1::k?1

X i=1::k?1

jb0i j: !

jb0i j =3:

jb0i j)=6  jb2 j=3;

and the new list is balanced. Let aj be the j 'th node in A when the algorithm is completed. Partition aj :seq = (si ; : : : ; si0 ) into two approximately equal sized sequences 2j?1 = 20

BALANCE-NEXT(a) /* a = node in linked list */ /* Ensure 3ja0 j  ja0 :prevj for all a0 2 A ? fA:first; A:lastg */ 1. If a = A:last THEN RETURN; 2. a0 a; 3. WHILE a0 :next 6= A:first AND ja0 j > 3ja0 :nextj DO 4. REPEAT 5. Merge a0 :next and a0 :next:next; 6. UNTIL ja0 j  3ja0 :nextj OR a0 :next = A:last; 7. IF a0 :next = A:last THEN RETURN; 8. IF ja0 :nextj  3ja0:next:nextj THEN RETURN; 9. IF ja0 :nextj > (2=3)ja0j THEN 10. Split a0 :next into two equal sized sets; 11. RETURN; 12. a0 a0 :next; BALANCE-PREV(a) /* a = node in linked list */ /* Ensure 3ja0 j  ja0 :nextj for all a0 2 A ? fA:first; A:lastg */ 1. If a = A:first THEN RETURN; 2. a0 a; 3. WHILE a0 :prev 6= A:first AND ja0 j > 3ja0:prevj DO 4. REPEAT 5. Merge a0 :prev and a0 :prev:prev; 6. UNTIL ja0 j  3ja0 :prevj OR a0 :prev = A:first; 7. IF a0 :prev = A:first THEN RETURN; 8. IF ja0 :prevj  3ja0 :prev:prevj THEN RETURN; 9. IF ja0 :prevj > (2=3)ja0j THEN 10. Split a0 :prev into two equal sized sets; 11. RETURN; 12. a0 a0 :prev; Figure 18: Algorithms BALANCE-NEXT and BALANCE-PREV.

21

(si ; : : : ; sd(i+i0 )=2e ) and 2j = (sd(i+i0 )=2e+1 ; : : : ; si0 ). We claim that this is a partitioning of S with the desired properties. Initially, the sj are stored in A in sorted order. The merging and splitting steps in the main algorithm and in the subroutines BALANCE-NEXT and BALANCE-PREV preserve the order of the si , so the j properly partition S into contiguous subsequences. Let gj be g(aj :seq) = g(2j?1 [ 2j ). The while loop only terminates when g1  g2      gh , so property 1 is clearly satis ed. Sets 2j?1 and 2j are created by partitioning aj :seq into two equal sized sequences, so property 2 is satis ed. To show property 3 holds, note that aj could be an initial node or it could be created when g(a:seq) > g(a:next:seq) or it could be created in the rebalancing procedure. We rst show that at most (4=5)m line segments lie in nodes aj created in the balance step. Let b1 ; b2; : : : ; bk be nodes created in a call BALANCE-NEXT(a) where a:next = b1 and bj :next = bj+1 for j  k. Since BALANCE-NEXT stops whenever ja0 :nextj > (2=3)ja0j, jb1 j  (2=3)jaj and jbj j  (2=3)jbj?1 j for all 2  j  k ? 1. We claim that jbk j  (4=3)jbk?1 j. Let b01 ; b02 ; : : : ; b0h be the nodes merged to form bk , where b0j :next = b0j+1 , j  h. The total number of elements in b01 ; b02; : : : ; b0h?1 is less than jbk?1 j=3 or b0h would not have been added to bk . In particular, jb0h?1j must be less than jbk?1 j=3. Since the list was initially balanced, jb0h j  3jb0h?1j  3(jbk?1 j=3) = jbk?1 j: P Thus j=1::h jb0j j  (4=3)jbk?1 j. Summing the values of jbj j, we get:

X

i=1::k

jbj j 

X

i=1::k?1

!

(2=3)i jaj + (4=3)(2=3)k?1jaj  2jaj:

Similarly, the total size of the nodes created in a call BALANCE-PREV(a) is at most 2jaj. Since each line segment in a corresponds to at most 4 line segments in nodes created in BALANCE-NEXT(a) and BALANCE-PREV(a), there are at most (4=5)m line segments in nodes created in the balance step. If aj is an initial node, then aj :seq = fsg for some s 2 S and 2j?1 = fsg and 2j = ;. Point gj is the midpoint of s and F (2j?1 ; 2j )  1  (1=8)jaj j. Assume aj is created when g(a:seq) is greater than g(a:next:seq) and that ja:nextj  jaj. The sequence a:seq is a subsequence of 2j?1 , so f (gj ; 2j?1 )  f (gj ; a:seq) and + f (gj ; 2j?1 )  f + (gj ; a:seq): The point gj = g(aj :seq) must lie between a:g and a:next:g, so f (gj ; a:seq) + f + (gj ; a:seq)  f (g(a:seq); a:seq) + f + (g(a:seq); a:seq)  jaj=2: Since ja:nextj  3jaj, we have jaj j  4jaj. Thus, F (2j?1 ; 2j )  f (gj ; 2j?1 ) + f + (gj ; 2j?1 )  (1=8)jaj j: 22

In the case that ja:nextj < jaj, similar reasoning gives

F (2j?1 ; 2j )  f (gj ; 2j ) + f ?(gj ; 2j )  (1=8)jaj j: Since at least m=5 line segments are in nodes aj with the property that

F (2j?1 ; 2j )  (1=4)jaj j, Pi=1::k F (2j?1 ; 2j )  m=40.

Finally, we show the algorithm PARTITION runs in O(m log m) time. Steps 1-4 take O(m) time. If the sequences a:seq are stored as linked lists with pointers to the beginnings and ends of the lists, merging two nodes in step 6 takes constant time. Merging two nodes decreases the number of nodes in A by one. Procedures BALANCE-NEXT and BALANCE-PREV never increase the number of such nodes. (Node a0 :next is only split in step 10 if it is the product of merges which increased its size too drastically.) Since list A starts with m nodes, step 6 is executed at most m ? 1 times. Similarly, procedures BALANCE-NEXT and BALANCE-PREV are called at most m ? 1 times. The running time of BALANCE-NEXT is dominated by the inner loop in step 5 and the time to execute step 10. Each execution of step 5 reduces the number of nodes in A by one. Step 10 increases the number of nodes in A by one, but it is only executed once per call to BALANCE-NEXT. Since BALANCENEXT is only called m ? 1 times and there are at most m nodes in A, step 5 is executed at most 2m ? 2 times. The time to split node a0 :next in step 10 of BALANCE-NEXT is proportional to ja0 :nextj, the size of a0 :next:seq. As argued above, the total size of the nodes created in the call BALANCE-NEXT(a0 ) is at most 2ja0 j. Thus the total running time of step 10 is proportional to the sum of the sizes of nodes created in step 6 of PARTITION. Step 6 merges nodes a and a:next to create a new node a0 . The size of a0 is at least 4/3 times the size of a and 4/3 times the size of a:next. Since each time a node is merged in step 10, its size increases by 4/3, any given line segment s is in O(log m) merge steps. Thus the sum of the sizes of nodes created in step 6 of PARTITION and the total running time of step 10 of BALANCE-NEXT is O(m log m). A similar analysis applies to BALANCE-PREV. We are left with analyzing the running time of step 5 of PARTITION. Step 5 checks if a:next:g < a:g for some a 2 A. We can accomplish this by keeping a set A of nodes in A to be checked. For each node a 2 A , we check that g(a:seq)  g(a:next:seq) and that g(a:seq)  g(a:prev:seq). The points g(a:seq), g(a:next:seq) and g(a:prev:seq) can be found in time proportional to jaj, ja:nextj and ja:prevj, respectively, using a linear median nd algorithm. Since ja:nextj  3jaj and ja:prevj  3jaj, comparing g(a:seq), g(a:next:seq) and g(a:prev:seq) takes O(jaj) time. Node a can be created as a merge of two nodes in step 5 of PARTITION or in BALANCE-NEXT or BALANCE-PREV. As previously argued, the sum of the sizes of the nodes created in step 5 of PARTITION is O(m log m). Each node a0 created in step 5 can cause the creation of nodes in BALANCE-NEXT(a0 ) and BALANCE-PREV(a0 ) with a total of 4jaj elements. Thus the sum of the sizes of created nodes is O(m log m) and the running time of step 5 is O(m log m). 2 23

5 Constructing Isomorphic Triangulations A triangulation TP of P (possibly with interior vertices) is isomorphic to a triangulation TQ of Q if there is a one-to-one, onto mapping f between the vertices of TP and the vertices of TQ such that p; p0 ; p00 are vertices of a triangle in TP if and only if f (p); f (p0 ); f (p00 ) are vertices of a triangle in TQ . An isomorphic triangulation of P and Q also de nes a piecewise linear homeomorphism between P and Q. The size of a triangulation is the total number of vertices, edges and triangles in the triangulation. The result in Theorem 1 leads directly to an improvement in the output size of the algorithm for constructing isomorphic triangulations in [5]. We outline the improved algorithm here. Readers are referred to [5] for more complete details and gures of the original algorithm.

Theorem 2 Let P be a simple polygon with vertices fp1; p2; : : : ; png and Q be a simple polygon with vertices fq1; q2 ; : : : ; qn g. Let M1 be the minimum number of triangles in any isomorphic triangulation of P and Q mapping pi to qi . Isomorphic triangulations mapping pi to qi using O(M1 log n) edges can be constructed in O(M1 log n) time. Moreover, no new vertices are added to the boundary of P and Q in these triangulations. Proof: As in [5], construct a triangulation TP of P using no vertices other than those of P and choose a set of edges C from TP as follows. Arbitrarily, pick an

edge e of P . Let be the union of the set of triangles of TP which intersect V^ is(e). The boundary of is composed of edges and chords of the original polygon P . Add all the chords bounding to C . Each such chord c divides P into two polygons. Let P (c) be one not containing . Recursively apply this procedure to each such polygon P (c) starting at its edge c, to choose a set of edges from P (c) and add them to C . For each diagonal (pi ; pj ) in P there is a corresponding pair of vertices (qi ; qj ) in Q. Let k be the size of C and  be the set of k pairs of distinct vertices of Q corresponding to the diagonals in C . Note that the pairs of vertices in  are untangled. By Theorem 1, a set of k non-intersecting interior paths connecting each pair (qi ; qj ) 2  can be constructed in O(n + M2 + k log k) time using a total of at most 240M2 + 247k links, where M2 is the minimum total number of line segments necessary to connect all pairs (qi ; qj ) 2  by pairwise disjoint paths. For each new vertex q0 on the path from qi to qj create a corresponding new vertex p0 on the diagonal (pi ; pj ). The k diagonals in C split polygon P into k +1 subpolygons P1 ; P2 ; : : : ; Pk+1 . The interior paths split polygon Q into k + 1 corresponding subpolygons Q1 , Q2 ; : : :, Qk+1 . Each subpolygon Pi has an edge e which lies within link distance two of every point in Pi . Thus each Pi has link diameter at most ve. By Lemma 3.4 in [5], isomorphic triangulations of Pi and Qi can be constructed in O(ni log ni ) time using 40ni blog2 ni c + O(ni ) edges, where ni is the number of vertices of Pi and Qi . Since these isomorphic triangulations do not contain any new boundary vertices, their union is an isomorphic triangulation of P and Q. 24

The total P +1number of edges in the isomorphic triangulations of P and Q is (40niblog2 ni c + O(ni )). Since each edge of Qi is either an edge at most ki=1 Pk+1 of Q or an edge on one of the k non-intersecting interior paths, i=1 ni < n + 2(240M2 + 247k). Bounding log2 ni by log2 n and k by n gives a bound of 40(480M2 + 495n)blog2 nc + O(M2 + n) = O(M2 log n + n log n): Let TP and TQ be an optimal pair of isomorphic triangulations of P and Q mapping pi to qi and let M1 be the number of triangles in TP (which equals the number of triangles in TQ .) We claim that M2  3M1. As isomorphic triangulations de ne a piecewise linear mapping between P and Q [5], each diagonal (pi ; pj ) 2 C has a mapping, induced by the isomorphic triangulations TP and TQ , in Q. The set of diagonals (pi ; pj ) 2 C get mapped to a set of disjoint interior link paths, fi;j g, between corresponding pairs of vertices (qi ; qj ) 2  of Q. By the choice of C , no triangle of TP intersects more than three diagonals in C . Hence, no triangle of TQ intersects more than three link paths in fi;j g and contains more than three line segments of fi;j g. Therefore, the paths fi;j g use at most 3M1 line segments. As M2 is the number of line segments in an optimal construction of link paths, M2  3M1. Since M1  n ? 2, we conclude that M2 log n + n log n = O(M1 log n). As in [5], it can be shown that the running time of the above algorithm is O(M1 log n). 2

6 Conclusions Let P be a simple polygon on n vertices, let  be an untangled set of m pairs of distinct vertices of P , and let L be the sum of the interior link distances between pairs in . In [5] we proved that pairwise disjoint interior paths connecting the pairs can be constructed using L + O(m log m) line segments. In this paper we showed that L + (m log m) line segments are sometimes required. We gave an approximation algorithm for constructing pairwise disjoint paths in O(n + M + m log m) time using O(M ) line segments where M is the minimum number required. We applied this approximation algorithm to construct isomorphic triangulations of two polygons in O(M1 log n) time using O(M1 log n) edges where M1 is the size of the optimal solution. This improved our result in [5]. We still do not know if constructing pairwise disjoint paths using the fewest line segments is an NP-complete problem or whether it can be solved in polynomial time. We also do not know of an -approximation scheme for constructing such paths. Possibly the techniques of Arora in [2] for the Euclidean Travelling Salesman Problem could apply. In [6], Kahan and Snoeyink show that a polygon on n vertices with bit complexity n log n may have a minimal link path with (n2 log n) bit complexity. Similar problems plague pairwise disjoint paths with the minimum number of line segments. Because the algorithms in this paper are approximation algorithms, the bit complexity of coordinates in the output is a constant factor times the bit complexity of input coordinates. 25

References

[1] Aronov, B., Seidel, R., and Souvaine, D. On compatible triangulations of simple polygons. Comput. Geom. Theory Appl. 3, 1 (1993), 27{35. [2] Arora, S. Polynomial time approximation schemes for euclidean tsp and other geometric problems. In Proc. 37th Annu. IEEE Sympos. Found. Comput. Sci. (FOCS 96) (1996). [3] Chazelle, B. Triangulating a simple polygon in linear time. Discrete Comput. Geom. 6 (1991), 485{524. [4] Guibas, L. J., Hershberger, J., Leven, D., Sharir, M., and Tarjan, R. E. Linear-time algorithms for visibility and shortest path problems inside triangulated simple polygons. Algorithmica 2 (1987), 209{233. [5] Gupta, H., and Wenger, R. Constructing piecewise linear homeomorphisms of simple polygons. J. Algorithms (to appear). [6] Kahan, S., and Snoeyink, J. On the bit complexity of minimum link paths: Superquadratic algorithms for problems solvable in linear time. In Proc. 12th Annu. ACM Sympos. Comput. Geom. (1996), pp. 151{158. [7] Kranakis, E., and Urrutia, J. Isomorphic triangulations with small number of Steiner points. In Proc. 7th Canad. Conf. Comput. Geom. (1995), pp. 291{296. [8] Saalfeld, A. Joint triangulations and triangulation maps. In Proc. 3rd Annu. ACM Sympos. Comput. Geom. (1987), pp. 195{204. [9] Souvaine, D., and Wenger, R. Constructing piecewise linear homeomorphisms. Technical Report 94{52, DIMACS, New Brunswick, New Jersey, 1994. [10] Suri, S. A linear time algorithm for minimum link paths inside a simple polygon. Comput. Vision Graph. Image Process. 35 (1986), 99{110.

26