Star Unfolding of a Polytope with Applications - Semantic Scholar

2 downloads 0 Views 330KB Size Report
Aug 16, 1993 - We de ne the notion of a star unfolding of the surface P of a convex polytope with n ...... s1=4 log2 n) using the vertical ray shooting structure.
CS-1993-19

Star Unfolding of a Polytope with Applications Pankaj K. Agarwal Boris Aronov Joseph O'Rourke Catherine A. Schevon

Department of Computer Science Duke University Durham, North Carolina 27708{0129 August 16, 1993

Star Unfolding of a Polytope with Applications Pankaj K. Agarwaly

Boris Aronovz Joseph O'Rourkex August 16, 1993

Catherine A. Schevon{

Abstract

We de ne the notion of a star unfolding of the surface P of a convex polytope with n vertices, and use it to solve several problems related to shortest paths on P . The rst algorithm computes the edge sequences traversed by shortest paths on P in time O(n6 (n) log n), where (n) is an extremely slowly-growing function. A much simpler O(n6) time algorithm that nds a small superset of all such edge sequences is also sketched. Second, we describe an O(n8 log n) time procedure for computing the geodesic diameter of P : the maximum possible separation of two points on P , with the distance measured along P . Finally, we describe an algorithm that preprocesses P into a data structure that can eciently answer the queries of the form: \Given two points, what is the length of the shortest path connecting them?" Given a parameter n2  s  n4 , it can preprocess P , in time O(n4 s1+ ) for any  > 0, into a data structure of size O(n4s1+ ), so that a query can be answered in time O( s1n=4 log2 n). If one query point always lies on an edge of P , the algorithm can be improved to use O(n3 s1+ ) preprocessing time and storage and guarantee O( s1n=3 log2 n) query time for n2  s  n3 .

1 Introduction The problem of computing shortest paths in Euclidean space amidst polyhedral obstacles arises in planning optimal collision-free paths for a given robot, and has been widely studied. In two dimensions, the problem is easy to solve and a number of ecient algorithms have been developed, see e.g. [SS86, Wel85, Mit93]. However, the problem becomes signi cantly harder in three dimensions. Canny and Reif [CR87] have shown it to be NP-hard, and the fastest available algorithm runs in singly-exponential time [RS89, Sha87]. This has motivated researchers to develop ecient approximation algorithms [Pap85, Cla87] and to study interesting special cases [MMP87, Sha87]. An earlier version of this paper was presented at the Second Scandinavian Workshop on Algorithm Theory [AAOS90]. Part of the work was carried out when the rst two authors were at Courant Institute of Mathematical Sciences, New York University and later at Dimacs (Center for Discrete Mathematics and Theoretical Computer Science), a National Science Foundation Science and Technology Center | NSF-STC88-09648, and the fourth author was at the Department of Computer Science, The Johns Hopkins University. The work of the rst author is supported by National Science Foundation Grant CCR-91-06514. The work of the second author was also partially supported by an AT&T Bell Laboratories Ph.D. Scholarship and NSF Grant CCR-92-11541. The third author's work is supported by NSF grants CCR-88-2194 and CCR-91-22169. y Computer Science Department, Duke University, Durham, NC 27706 USA z Computer Science Department, Polytechnic University, Brooklyn, NY 11201 USA x Department of Computer Science, Smith College, Northampton, MA 01063 USA { Rm. 3B-412, AT&T Bell Laboratories, 600 Mountain Ave., P.O. Box 636, Murray Hill, NJ 07974 USA 

1

One of the most widely studied special case is computing shortest paths along the surface of a convex polytope [SS86, MMP87, Mou90]; this problem was originally formulated by H. Dudeney in 1903; see [Gar61, p. 36]. Sharir and Schorr presented an O(n3 log n) algorithm for this problem, which was subsequently improved by Mitchell et al. [MMP87] to O(n2 log n), and then by Chen and Han to O(n2 ) [CH90]. In this paper we consider three problems involving shortest paths on the surface P of a convex polytope in IR3 . A shortest path on P is identi ed uniquely by its endpoints and the sequence of edges that it encounters. Sharir [Sha87] proved that no more than O(n7 ) distinct sequences of edges are actually traversed by the shortest paths on P . This bound was subsequently improved to (n4 ) [Mou85, SO88]. Sharir also gave an O(n8 log n) time algorithm to compute an O(n7 ) size superset of shortest-path edge sequences. However computing the exact set of shortest-path edge sequences seems to be very dicult. Schevon and O'Rourke [SO89] presented an algorithm that computes the exact set of all shortest-path edge sequences and also identi es, in logarithmic time, the edge sequences traversed by all shortest paths connecting a given pair of query points lying on edges of P . The sequences can be explicitly generated, if necessary, in time proportional to their length. Their algorithm, however, requires O(n9 log n) time and O(n8) space.1 In this paper we propose two edge-sequence algorithms. The rst is a very simple O(n6) algorithm to compute a superset of shortest-path edge sequences, thus improving the result of [Sha87]; it is described in Section 5. The second computes the exact set of shortest-path edge sequences in O(n6 (n) log n) time, where (:) is an extremely slowly-growing function, a signi cant improvement over the previously mentioned O(n9 log n) algorithm. The computation of the collection of all shortest-path edge sequences on a polytope is an intermediate step of several algorithms [Sha87, OS89], and is of interest in its own right. The second problem studied in this paper is that of computing the geodesic diameter of P , i.e., the maximum distance along P between any two points on P . O'Rourke and Schevon [OS89] gave an O(n14 log n) time procedure for determining the geodesic diameter of P . In [AAOS90], we presented a simpler and faster algorithm whose running time is O(n10 ). An even faster O(n8 log n) algorithm is presented in the current version of the paper. The third problem involves answering queries of the form: \Given x; y 2 P , determine the distance between x and y along P ." Given a parameter n2  s  n4 , we present a method for preprocessing P , in O(n4 s1+ ) time, into a data structure of size O(n4 s1+ ) for any  > 0, so that a query can be answered in time O( s n= log2 n). If x is known to lie on an edge of the polytope, the preprocessing and storage requirements are reduced to O(n3 s1+ ) and query time becomes O( s n= log2 n) for n2  s  n3 . Our algorithms are based on a common geometric concept, the star unfolding. Intuitively, the star unfolding of P with respect to a point x 2 P can be viewed as follows. Suppose there exists a unique shortest path from x to every vertex of P . The object obtained after removing these n paths from P is the star unfolding of P . Remarkably, the resulting set is isometric to a simple planar polygon and the structure of shortest paths emanating from x on P corresponds to a certain Voronoi diagram in the plane [AO92]. Together with relative stability of the combinatorial structure of the unfolding as x moves within a small neighborhood on P , these properties facilitate the construction of ecient algorithms for the above three problems. 1 4

1 3

A preliminary version of this algorithm [SO88] erroneously claimed a time complexity of O(n7 2 (n) log n); this claim was corrected in [SO89]. Hwang et al. [HCT89] claimed to have a more ecient procedure for solving the same problem, but their argument as stated is awed, and no corrected version has appeared in the literature. 1

2

Chen and Han [CH90] have independently discovered the star unfolding and used it for computing the shortest-path information from a single xed point on the surface of a polytope. They however take the unfoldability proven by Aronov and O'Rourke [AO92] for granted. This paper is organized as follows. In Section 2, we formalize our terminology and list some basic properties of shortest paths. Section 3 de nes the star unfolding and establishes some of its properties. Section 4 sketches an ecient algorithm to compute a superset of all possible shortestpath edge sequences, and in Section 5 we present an algorithm for computing the exact set of sequences; both algorithms are based on the star unfolding. In Section 6 we again use the notion of star unfolding to obtain a faster algorithm for determining the geodesic diameter of a convex polytope. Section 7 deals with shortest-path queries. Section 8 contains some concluding remarks and open problems.

2 Geometric Preliminaries We begin by reviewing the geometry of shortest paths on convex polytopes. Let P be the surface of a polytope with n vertices. We refer to vertices of P as corners; the unquali ed terms face and edge are reserved for faces and edges of P . We assume that P is triangulated. This does not change the number of faces and edges of P by more than a multiplicative constant, but simpli es the description of our algorithms.

2.1 Geodesics and Shortest Paths

A path  on P that cannot be shortened by a local change at any point in its relative interior is referred to as a geodesic. Equivalently, a geodesic on the surface of a convex polytope is either a subsegment of an edge or a path that (1) does not pass through corners, though may possibly terminate at them, (2) is straight near any point in the interior of a face and (3) is transverse to every edge it meets in such a fashion that it would appear straight if one were to \unfold" the two faces incident on this edge until they lie in a common plane; see, for example, Sharir and Schorr [SS86]. The behavior of a geodesic is thus fully determined by its starting point and initial direction. In the following discussion we disregard the geodesics lying completely within a single edge of P . Given the sequence of edges a geodesic traverses (i.e., meets) and its starting and ending points, the geodesic itself can be obtained by laying the faces that it visits out in the plane, so that adjacent faces share an edge and lie on opposite sides of it, and then connecting the (images of) the two endpoints by a straight-line segment. In particular, the sequence of traversed edges together with the endpoints completely determine the geodesic. Trivially every shortest path along P is a geodesic and no shortest path meets a face or an edge more than once. We call the length of a shortest path between two points p; q 2 P the geodesic distance between p and q , and denote it by d(p; q ). The following additional properties of shortest paths are crucial for our analysis.

Lemma 2.1 (Sharir and Schorr [SS86]) Let  and  be distinct shortest paths emanating from x. Let y 2  \  be a point distinct from x. Then either one of the paths is a subpath of the 1

1

2

2

other, or neither 1 nor 2 can be extended past y while remaining a shortest path.

2

Corollary 2.2 Two shortest paths cross at most once.

2

3

Lemma 2.3 If  ;  are two distinct shortest paths connecting x; y 2 P , each of the two connected components of P n  [  contains a corner. Proof: First, Lemma 2.1 implies that removal of  [  splits P into exactly two components. If one of the two components of P ?  [  contained no corners,  and  would have to traverse 1

2

1

2

1

1

2

2

1

2

the same sequence of edges and faces. However, there exists at most one geodesic connecting a given pair of points and traversing a given sequence of edges and faces. 2

2.2 Edge Sequences and Sequence Trees

A shortest-path edge sequence is the sequence of edges intersected by some shortest path  connecting two points on P , in the order met by  . Such a sequence is maximal if it cannot be extended in either direction while remaining a shortest-path edge sequence; it is half-maximal if no extension is possible at one of the two ends. It has been shown by Schevon and O'Rourke [SO88] that the maximum total number of half-maximal sequences is (n3 ). Observe that every shortest-path edge sequence  is a pre x of some half-maximal sequence, namely the one obtained by extending  maximally at one end. Thus an exhaustive list of O(n3) half-maximal sequences contains, in a sense, all the shortest-path edge-sequence information of P . More formally, given an arbitrary collection of edge sequences emanating from a xed edge e, let the sequence tree  of this set be the tree with all distinct non-empty pre xes of the given sequences as nodes, the trivial sequence consisting solely of e as the root, and such that  is an ancestor of  0 in the tree if and only if  is pre x of  0 [HCT89]. The (n3 ) bound on the number of half-maximal sequences implies that the collection of O(n) sequence trees obtained by considering all shortest-path edge sequences from each edge of P in turn, has a total of (n3 ) leaves and (n4 ) nodes in the worst case.

2.3 Ridge Trees and the Source Unfolding

The shortest paths emanating from a xed source x 2 P cover the surface of P in a way that can be naturally represented by \unfolding" the paths to a planar layout around x. This unfolding, the \source unfolding," has been studied since the turn of the century. We will de ne it precisely in a moment. A second way to organize the paths in the plane is the \star unfolding," to be de ned in Section 3. This is not quite as natural, and of more recent lineage. Our algorithms will be built around the star unfolding, but some of the arguments do refer to the source unfolding as well. Given two points x; y on P , y 2 P is a ridge point with respect to x if there is more than one shortest path between x and y . Ridge points with respect to x form a ridge tree Tx embedded on P ,2 whose leaves are corners of P , and whose internal vertices have degree at least three and correspond to points of P with three or more distinct shortest paths to x. In a degenerate situation where x happens to lie on the ridge tree for some corner p, then p will not be a leaf of Tx , but rather lie internal to Tx ; so in general not all corners will appear as leaves of Tx . We de ne a ridge as a maximal subset of Tx consisting of points with exactly two distinct shortest paths to x, and containing no corners of P . These are the \edges" of Tx . Ridges are open geodesics [SS86]; a stronger characterization of ridges is given in Lemma 2.4. Figs. 1 and 2 show two views of a ridge tree on a pyramid. 2

For smooth surfaces (Riemannian manifolds), the ridge tree is known as the \cut locus" [Kob67].

4

p3

D

C B

x A

p5 p1

E

p4

p2

Figure 1: Pyramid, front view: source x, shortest paths to ve vertices (solid), ridge tree (dashed). Coordinates of vertices are (1; 1; 0) for p1; p2; p4; p5, and p3 = (0; 0; 4). Source x = (0; 3=4; 1). p3

A

D B

C p4

p5

E p1

p2

Figure 2: Pyramid, side view of Fig. 1. The ridges incident to p2 and p4 lie nearly on the edge p2 p4.

5

We will refer to a point y 2 P as a generic point if it is not a ridge point with respect to any corner of P . The maximal connected portion of a face (resp. an edge) of P consisting entirely of generic points will be called a ridge-free region (resp. an edgelet ).

x

Figure 3: Ridge-free regions for Fig. 1. Tp [   [ Tp are shown dashed (e.g., Tp is the `X' on the bottom face). The ridge-free region containing x is shaded darker. 1

5

3

If we cut P along the ridge tree Tx and isometrically embed the resulting set in IR2 , we obtain the source unfolding of [OS89].3 In the source unfolding, the ridges lie on the boundary of the unfolding, while x lies at its \center," which results in a star-shaped polygon [SS86]; see Fig. 4. Let a peel be the closure of a connected component of the set obtained by removing from P both the ridge tree Tx and the shortest paths from x to all corners. A peel is isometric to a convex polygon [SS86]. Each peel's boundary consists of x, the shortest paths to two corners of P , p and p0 , and the unique path in Tx connecting p to p0. A peel can be thought of as the collection of all the shortest paths emanating from x between xp and xp0. (The peel between xp1 and xp5 is shaded in Fig. 4.) We need to strengthen the characterization of ridges from geodesics to shortest paths, in order to exploit Corollary 2.2. This characterization seems to be new. Lemma 2.4 Every ridge of the ridge tree Tx, for any point x 2 P , is a shortest path. Proof: An edge  of the ridge tree is a geodesic consisting of points that have two di erent shortest paths to x [SS86]. Suppose  is not a shortest path. Then there must be two points a; b 2  so that the portion  0 of  between a and b is a shortest path, but there is another shortest path, say 00, connecting them. Refer to Figure 5. By Lemma 2.1,  0 \  00 = fa; bg. Let 1 and 2 be the two shortest paths from x to a, and 1 and 2 be the two shortest paths from x to b. Notice that  0, 1, 2 , 1, 2, do not meet except at the endpoints, by Lemma 2.1. In particular, we can relabel these paths so that the region bounded by ( 2;  0; 1) contains 1 , as illustrated in the gure, so that 1 and 1 approach  0 \from the same side." There are two cases to consider: 3 The same object is called U (P ) in [SS86], \planar layout" in [Mou85], and \outward layout" in [CH90]. For Riemannian manifolds, it is the \exponential map" [Kob67].

6

p3 D

D C

A

p2

B p4

x p1

p5 E

Figure 4: Source unfolding for the example in Figs. 1 and 2. Shortest paths to vertices (solid), polytope edges (dashed), ridges (dotted). One peel is shaded.



π

b • π′ π′′

β1

β2



•a α1

α2

x•

Figure 5: Illustration of the proof of Lemma 2.4. Here x is the source, and  a geodesic ridge, with 0   a shortest path. The region  cannot contain any vertices of P . 7

Case 1: x 62 00. Thus 00 does not meet or except at a, by Lemma 2.1. Similarly, 00 does 1

2

not meet 1 or 2 except at b. Thus, without loss of generality, we can assume that  00 lies in the portion  of P bounded by  0, 1 , and 1 , and not containing 2 or 2. Now, considering the source unfolding from x, we observe that  is (isometric to) a triangle contained within a single peel.  is the area swept by one class of shortest paths from x to y as y ranges over 0. In particular,  contains no corners. On the other hand, paths  0; 00   are distinct shortest paths connecting a to b, so by Lemma 2.3 each of the two sets obtained from P by removing  0 [  00 has to contain a corner of P . However, one of these sets is entirely contained in |a contradiction. Case 2: x 2 00. As 00 and 1 can be viewed as emanating from a and having x in common, and 00 extends past x, Lemma 2.1 implies that 1 is a pre x of  00. Similarly, 2 is a pre x of 00, contradicting distinctness of 1 and 2.

2

Remark. Case 2 in the above proof is vacuous if x is a corner, which is the case in our applications of this lemma. As de ned, Tx is a tree with n vertices of degree less than 3 and thus has (n) vertices and edges. However, the worst-case combinatorial size of Tx jumps from (n) to (n2 ) if one takes into account the fact that a ridge is a shortest path comprised of as many as (n) line segments on P in the worst case|and it is possible to exhibit a ridge tree for which the number of ridge-edge incidences is indeed (n2) [Mou85]. For simplicity we assume that ridges intersect each edge of P transversely.

3 Star Unfolding In this section we introduce the notion of the star unfolding of P and describe its geometric and combinatorial properties. Working independently, both Chen and Han [CH90] [CH91] and Rasch [Ras90] have used the same notion, and in fact the idea can be found in Aleksandrov's work [Ale58, p.226] [AZ67, p.171].

3.1 Geometry of the Star Unfolding

Let x 2 P be a generic point, so that there is a unique shortest path connecting x to each corner of P . These paths are called cuts and are comprised of cut points (see Fig. 1). If P is cut open along these cuts and embedded isometrically in the plane, then just as with the source unfolding, the result is a non-self-overlapping simple polygonal region, a two-dimensional complex that we call the star unfolding Sx . That the star unfolding avoids overlap is by no means a straightforward claim; it was rst established in [AO92]: Lemma 3.1 (Aronov and O'Rourke [AO92]) If viewed as a metric space with the natural definition of interior metric, Sx is isometric to a simple polygon in the plane (with the internal geodesic metric). The polygonal boundary @Sx consists entirely of edges originating from cuts. The vertices of Sx derive from the corners of P and from the source x. An example is shown in Fig. 6. More complex 8

x1 x5

p5

A

B

p1

x2

C E

p4

x4

D B

C

p2

x3

p3

Figure 6: Construction of the star unfolding corresponding to Figs. 1 and 2. Sx is shaded. The superimposed dashed edges show the \natural" unfolding obtained by cutting along the four edges incident to p3 . The A, B , C , D, and E labels indicate portions of Sx derived from those faces; the relative neighborhood of each xi derives from A.

9

examples will be shown in Fig. 10. The cuts partition the faces of P into subfaces, which map to what we call the plates of Sx , each a compact convex polygon with constant number of edges. See Fig. 7. We consider these plates x1 x5

p5

p1

p4

x2

p2

x4

x3

p3

Figure 7: Plates corresponding to Fig. 6. The square base E is partitioned into two triangles. to be the faces of the two-dimensional complex Sx . We assume that the complex carries with it labeling information consistent with P . Somewhat abusing the notation, we will freely switch between viewing Sx as a complex and as a simple polygon embedded in the plane. In particular, a path   Sx will be referred to as a segment if it corresponds to a straight-line segment in the planar embedding of Sx . Note that every segment in Sx is a shortest path in the intrinsic metric of the complex, but not every shortest path in Sx is a segment, as some shortest paths in Sx might bend at corners. For p 2 P , let U (p) be the set of points in Sx to which p maps; U is the \unfolding" map (with respect to x). U (p) is a single point whenever p is not a cut point. X = U (x) = fx1; : : : ; xn g is a set of n distinct points in Sx . A non-corner point y 2 P distinct from x and lying on a cut has exactly two unfolded images in Sx . The corners of P map to single points. In particular, we have: Lemma 3.2 (Sharir and Schorr [SS86]) For a point y 2 P , any shortest path  from x to y maps to a segment    Sx connecting an element of U (y ) to an element of U (x). 2 There is a view of Sx that relates it to the source unfolding: the star unfolding is just an \insideout" version of the source unfolding, in the following sense. The star unfolding can be obtained by stitching peels together along ridges; see Fig. 8. The source unfolding is obtained by gluing them along the cuts. Compare with Fig. 4. (A peel was de ned in Section 2.3 as a subset of P , but slightly abusing the terminology we also use this term to refer to the corresponding set of points in the source or star unfolding.) We next de ne the pasting tree x as the graph whose nodes are the plates of Sx , with two nodes connected by an arc if the corresponding plates share an edge in Sx. See Fig. 9. For a generic 10

x1 x5

p5

p1

p4

x2

p2

x4

x3

p3

Figure 8: Ridge tree Tx  Sx . point x, x is a tree with O(n2) nodes, as it is the dual of a convex partition of a simple polygon without Steiner points. (If x were a ridge point of some corner, Sx would not be connected and x would be a forest.) x has only n leaves, corresponding to the triangular plates incident to the n images of x in Sx or, equivalently, to x in Px . By Lemma 3.2, any shortest path from x to y 2 P corresponds to a simple path in x , originating at one of the leaves. Thus, the O(n3 ) edge sequences corresponding to the simple paths that originate from leaves of x include all shortest path edge sequences emanating from x. In fact, there are O(n2 ) maximal edge sequences in this set, one for each pair of leaves. In the following sections we will need the concept of the \kernel" of a star unfolding. Number the corners p1; : : : ; pn in the order in which cuts emanate from x. Number the n source images (elements of X = U (x)) so that @S is the cycle x1 p1 x2 : : :pn x1 comprised of 2n segments (see Fig. 6). The kernel is a subset of Sx , but to de ne it it would be most convenient to view Sx as embedded in the plane as a simple polygon. Consider the polygonal cycle p1 p2 : : :pn p1. We claim that it is the boundary of a simple polygon fully contained in (the embedding of) Sx . Indeed, each line segment pi pi+1 4 is fully contained in the peel sandwiched between xi+1 pi and xi+1 pi+1 . Thus the line segments pi pi+1 are segments in Sx in the sense de ned above and indeed form a simple cycle. The simple n-gon bounded by this cycle is referred to as the kernel Kx of the star unfolding Sx . An equivalent way of de ning Kx is by removing from Sx all triangles 4pi?1xi pi ; for i = 1; : : : ; n. Fig. 10 illustrates the star unfolding, and its kernel for several randomly generated polytopes.5 Note that neither set is necessarily star-shaped. S We extend the de nition of the map U to sets in the natural way by putting U (Q) = q2Q U (q ). The main property of the kernel that we will need later is: 4 5

Here are thereafter pn+1 = p1 , p0 = pn , xn+1 = x1 , x0 = xn . The unfoldings were produced with code written by Julie DiBiase and Stacia Wyman of Smith College.

11

x1 x5

p5

p1

p4

x2

p2

x4

x3

p3

Figure 9: Pasting tree x for Fig. 7: one node per plate.

Lemma 3.3 The image of the ridge tree is completely contained within the kernel, which is itself a subset of the star unfolding: U (Tx)  Kx  Sx . Proof: Since Kx can be de ned by subtraction from Sx, Kx  Sx is immediate. The ridge tree Tx can be thought of as the union of the peel boundaries that do not come from cuts. These boundaries remained when we removed triangles 4pi?1xi pi from Sx to form Kx (see Fig. 8). 2 Recently Aronov and O'Rourke [AO92] proved that Theorem 3.4 (Aronov and O'Rourke [AO92]) U (Tx) is exactly the restriction of the planar

Voronoi diagram of the set X = U (x) of source images to within Kx or, equivalently, to within Sx .

2

3.2 Structure of the Star Unfolding

We now describe the combinatorial structure of Sx . A vertex of Sx is an image of x, of a corner of P , or of an intersection of an edge of P with a cut. An edge of Sx is a maximal portion of an image of a cut or an edge of P delimited by vertices of Sx . It is easy to see that Sx consists of (n2 ) plates in the worst case, even though its boundary is formed by only 2n segments, the images of the cuts. We de ne the combinatorial structure of Sx as the 1-skeleton of Sx, i.e., the graph whose nodes and arcs are the vertices and edges of Sx , labeled in correspondence with the labels of Sx, which are in turn derived from labels on P . The combinatorial structure of a star unfolding has the following crucial property:

Lemma 3.5 Let x and y be two non-corner points lying in the same ridge-free region or on the same edgelet. Then Sx and Sy have the same combinatorial structure.

12

Figure 10: Four star unfoldings: n = 13, 13, 36, 42 vertices, left to right, top to bottom. The kernel is shaded darker in each gure.

13

Proof: Let f be the face containing xy in its interior. The case when xy is part of an edge is

similar. As the shortest paths from any point z 2 xy to the corners are pairwise disjoint except at z (cf. Lemma 2.1) and z is con ned to f , the combinatorial structure of Sz is uniquely determined by (1) the circular order of the cuts around z , and (2) the sequence of edges and faces of P met by each of the cuts. We will show that (1) and (2) are invariants of Sz as long as z does not cross a ridge or an edge of P . First, the set of points of f , for which some shortest path to a xed corner p traverses a xed edge sequence, is convex|it is simply the intersection of f with the appropriate peel of the source unfolding with respect to p|implying invariance of (2). Now suppose the circular order of the cuts around z is not the same for all z 2 xy . The initial portions of the cuts, as they emanate from any z , cannot coincide, as distinct cuts are disjoint except at z . Hence there can be a change in this circular order only if one of the vectors pointing along the initial portion of the cuts changes discontinuously at some intermediate point z 0 2 xy . However, this can only happen if z 0 is a ridge point, a contradiction. 2 This lemma holds under more general conditions. Namely, instead of requiring that xy be free of ridge points, it is sucient to assume that the number of distinct shortest paths connecting z to any corner does not change as z varies along xy .

Lemma 3.6 Under the assumptions of Lemma 3.5, Kx is isometric to Ky , i.e., they are congruent simple polygons. Proof: Kx is determined by the order of corners on @Kx = p1p2; : : : ; pnp1 and, for each i, by the choice of the shortest path pi pi+1 , if there are two or more such paths. The ordering is xed, once combinatorial structure of Sx is determined. The choice of the shortest path connecting pi to pi+1 is determined by the constraint that 4pi?1xi pi is free of corners. 2 Let R be a ridge-free region. By the above lemma, Sx can be embedded in the plane in such a way that the images of the corners of P are xed for all x 2 R, and the images of x in Sx move as x varies in R  P . This guarantees that Ky = Kx for all x; y 2 R. This is illustrated in Fig. 11. In what follows, we are going to assume such an embedding of Sx, and use KR to denote Kx for all points x 2 R. Similarly, de ne K" for an edgelet ".

3.3 How Many Di erent Unfoldings Are There?

For the algorithms described in this paper, it will be important to bound the number of di erent possible combinatorial structures of star unfoldings, as we vary the position of source point x, and to eciently compute these unfoldings (more precisely, compute their combinatorial structure plus some metric description, parametrized by the exact position of the source), as the source moves on the surface of the polytope. Two variants of this problem will be needed. In the rst, we assume that the source is placed on an edge of P , and in the second the source is placed anywhere on P . In view of Lemma 3.5, it suces to bound the number of edgelets and ridge-free regions.

Lemma 3.7 In the worst case, there are (n ) edgelets and they can be computed in O(n log n) 3

3

time.

Proof: Each edge can meet a ridge of the ridge tree of a corner at most once, since ridges are

shortest paths (recall that we assume that no ridge overlaps an edge|removal of this assumption does not invalidate our argument, but only adds a number of technical complications). This gives 14

x1 y1 p y2 x 1 2

y5 p5

x5

p2

p4

y4

y3 x4

x3 p3

Figure 11: The star unfolding when the source x moves to y inside a ridge-free region. The unfolding Sx (Fig. 6) is shown lightly shaded; Sy is shown dotted. Their common kernel Kx = Ky is the central dark region. an upper bound of n  O(n)  O(n) on the number of edge-ridge intersections and therefore on the number of edgelets. An example where (n3 ) edgelets are present is relatively easy to construct by modifying the lower bound construction of Mount [Mou90]. To compute the edgelets, we construct ridge trees from every corner in n  O(n2 ) time by n applications of the algorithm of Chen and Han [CH90]. The edgelets are now computed by sorting the intersections of ridges along each edge. 2

Lemma 3.8 In the worst case, there are (n ) ridge-free regions on P . They can be computed in

(n ) time.

4

4

Proof: The overlay of n ridge trees, one from each corner of P , produces a subdivision of P in

which every region is bounded by at least three edges. Thus, by Euler's formula, the number of regions in this subdivision is proportional to the number of its vertices, which we proceed to estimate. By Lemma 2.4 ridges are shortest paths and therefore two of them intersect in at most two points (cf. Corollary 2.2) or overlap. In the latter case no new vertex of the subdivision is created, so we restrict our attention to the former. In particular, as there are n  O(n) = O(n2 ) ridges, the total number of their intersection points is O(n4). Re ning this partition further by adding the edges of P does not a ect the asymptotic complexity of the partition, as ridges intersect edges in O(n3 ) points altogether. This establishes the upper bound. It is easily checked that in Mount's example of a polytope with (n4) shortest-path edge sequences [Mou90], there are (n4) ridge-free regions. Hence there are (n4 ) ridge-free regions on P in the worst case. The ridge-free regions can be computed by calculating the ridge tree for every corner, and overlaying the trees in each face of P . The rst step takes O(n3 ) time, while the second step 15

can be accomplished in time O((r + n3 ) log n) = O(n4 log n), where r is the number of ridge-free regions in P , using the line-sweep algorithm of Bentley and Ottmann [BO79]. If computing the ridge-free regions is a bottleneck, the last step can be improved to O(n4 ) by using a signi cantly more complicated algorithm of Chazelle and Edelsbrunner [CE92]. 2

3.4 How Many Di erent Ridge Trees Are There?

In Section 3.1, we proved that the combinatorial structure of Sx is the same for all points x in a ridge-free region. As x moves in a ridge-free region, the ridge tree Tx changes continuously, as a subset of P . In this subsection, we prove an upper bound on the number of di erent combinatorial structures of Tx as the source point x varies over a ridge-free region or an edgelet. Apart from being interesting in their own right, we need these results in the algorithms described in Sections 5{7. Let R be a ridge-free region, and let x be a point in R. By Theorem 3.4, Tx is the Voronoi diagram Vx of X = U (x) clipped to lie within KR . Since ridge vertices do not lie on @Sx, all changes in Tx, as x varies in R, can be attributed to changes in Vx . Thus it suces to count the number of di erent combinatorial structures of Voronoi diagrams Vx , x 2 R. Let X = U (x) = fx1; : : :xn g. For each xi = (xi1; xi2), let q fi(y) = d(xi ; y) = (xi1 ? y1 )2 + (xi2 ? y2 )2 ;

where (y1 ; y2) are the coordinates of a generic point y in the plane. Let f (y ) = min1in fi (y ) be the lower envelope of the fi 's. Then Vx is the same as (the 1-skeleton of) the orthogonal projection of the graph of f (y ) onto the y1 y2 -plane. We introduce an orthogonal coordinate system in R and let x have coordinates (s; t) in this system. Then positions of xi are linear functions of s; t of the form ! x  a  cos i sin i  s  ; i1 = i + (1) ? sin i cos i t xi2 bi where (ai ; bi) are coordinates of xi when x is at the origin of the (s; t) coordinate system in R, and i de nes the orientation of the ith image of R in the plane. We now regard f and fi 's as 4-variate functions of s; t; y1; y2 , and denote by MR the projection of the graph of f onto the (s; t; y1; y2)-plane. It can be shown that total number of di erent combinatorial structures of Vx is bounded by the number of faces in MR . Let gi(s; t; y1; y2) = (fi (y1 ; y2))2 ? (s2 + t2 + y12 + y22 ) : Using (1) we obtain

gi (s; t; y1; y2) = Ci(0) + Ci(1)y1 + Ci(2)y2 + Ci(3)s + Ci(4)t + Ci(5)sy1 + Ci(6)sy2 (2) +Ci(7) ty1 + Ci(8)ty2 ; where, for each i, the Ci's are constants that depend solely on ai ; bi ; and i . Let g (s; t; y1; y2) denote the lower envelope of the gi 's. Since g (s; t; y1; y2 ) = (f (s; t; y1; y2))2 ? (s2 + t2 + y12 + y22 ), the projection of the graph of g is the same as MR . Let v1 = sy1; v2 = sy2 ; v3 = ty1 ; v4 = ty2 (3) 16

and set

gi(s; t; y1; y2; v1; v2; v3; v4) = Ci(0) + Ci(1)y1 + Ci(2)y2 + Ci(3)s + Ci(4)t +Ci(5) v1 + Ci(6)v2 + Ci(7)v3 + Ci(8)v4 : (4) Then every face of the graph of g is the intersection of the lower envelope of gi 's with the surface de ned by the equations (3). Since each gi is a 8-variate linear function, by the Upper Bound Theorem for convex polyhedra, the graph of their lower envelope has O(n4 ) faces. Hence, the number of faces in MR is also O(n4). Using the algorithm of Chazelle [C91], all the faces of this lower envelope and thus also those of MR can be computed in O(n4 ) time. Putting everything together, we conclude

Lemma 3.9 The total number of di erent combinatorial structures of ridge trees for source points lying in a ridge-free region R is O(n4 ). Moreover, the faces of MR can be computed in time O(n4). Remark. The only reason for assuming in the above analysis that x stays away from the boundary

of R was to ensure that the vertices of the Voronoi diagram avoid the boundary of KR . However, it is easy to verify that when x is allowed to vary over the closure of R, Voronoi vertices never cross the boundary of KR , but may touch it in limiting con gurations. Thus the same analysis applies in that case as well. An immediate corollary of the above lemma and Lemma 3.8 is

Corollary 3.10 The total number of di erent combinatorial structures of ridge trees for a convex polytope in IR3 with n vertices is O(n8).

If the source point moves along an edgelet " rather in a ridge-free region, we can obtain a bound on the number of di erent combinatorial structures of ridge trees by setting t = 0 in (1). Proceeding in the same way as above, each gi now becomes

gi(s; y1 ; y2) = Ci(0) + Ci(1)y1 + Ci(2)y2 + Ci(3)s + Ci(5)sy1 + Ci(6)sy2 : We now de ne the subdivision M" as the projection of the graph of the lower envelope of gi's. Let v1 = sy1 ; v2 = sy2 , and set gi (s; y1; y2; v1; v2) = Ci(0) + Ci(1)y1 + Ci(2)y2 + Ci(3)s + Ci(5)v1 + Ci(6)v2 : Since gi is now a 5-variate linear function, by the Upper Bound Theorem, the number of faces in M" is O(n3), which implies that there are O(n3) distinct combinatorial structures of ridge trees as x varies along ". Moreover, M" can be computed in time O(n3) [C91]. Hence, we obtain

Lemma 3.11 The total number of distinct ridge trees as the source point moves in an edgelet is

O(n3 ), and the subdivision M" can be computed in O(n3 ) time.

Remarks. (i) None of Lemma 3.9, Corollary 3.10, or Lemma 3.11 are known to be tight.

(ii) In the above analysis for MR (resp. M" ) the only portion of the structure that is relevant for our algorithms is that which corresponds to points with (s; t) 2 R (resp. s 2 ") and (y1 ; y2) 2 KR (resp. (y1 ; y2) 2 K"). We will have to \ lter out" irrelevant features at a later stage in the computation. 17

4 Edge Sequences Superset In this section we describe an O(n6) algorithm for constructing a superset of the shortest-path edge sequences, which is both more ecient and conceptually simpler than previously suggested procedures, and which produces a smaller set of sequences. Observe that all shortest-path edge sequences are realized by pairs of points lying on edges of P |any other shortest path can be contracted without a ecting its edge sequence so that its endpoints lie on edges of P . Let x be a generic point lying on an edgelet ". As mentioned in Section 3.1, the pasting tree x contains all shortest path edge sequences that emanate from x. Moreover by Lemma 3.5, x is independent of choice of x in ". Therefore, the set of O(n3) pasting trees fx j x 2 " and " is an edgeletg, each of size O(n2), contains an implicit representation of a set of O(n6 ) sequences (O(n5) of which are maximal in this set), which includes all shortest-path edge sequences that emanate from generic points. Algorithm 1: Sequence Trees for

each edge e of P do e = ;. for each edgelet endpoint v 2 e do Compute shortest-path edge sequences v emanating from v . e = e [ v . for each edgelet "  e do Choose a point x 2 ". Compute x . for each maximal sequence  2 x do e = e [ f g. Te = . for each sequence  2 e do Traverse  , augmenting Te . Stop if  visits the same edge twice. Te is the sequence tree containing shortest path edge sequences emanating from e.

Hence, we can compute a superset of shortest path edge sequences in three steps: First, partition each edge of P into O(n3 ) edgelets in time O(n3) as described in Lemma 3.7. Second, compute shortest path edge sequences from the endpoints of each edgelet, using Chen and Han's shortest path algorithm. Next, compute the star unfolding from a point in each edgelet, again using the shortest path algorithm. The total time spent in the last two steps is O(n5). Finally, this representation of edge sequences is transformed into O(n) sequence trees, one for each edge (cf. Section 2.2) in time O(n6) in a straightforward manner; see Algorithm 1 for the pseudocode. We thus obtain

Theorem 4.1 Given a convex polytope in IR with n vertices, one can construct, in time O(n ), 3

6

O(n) sequence trees that store a set of O(n ) edge sequences, which include all shortest path edge 6

18

sequences of P .

2

Remark. (i) Note that our algorithm uses nothing more complex than the algorithm of Chen and Han for computing shortest paths from a xed point, plus some sorting and tree traversals. It achieves an improvement over previous algorithms mainly by reorganizing the computation around the star unfolding. (ii) The sequence-tree representation for just the shortest-path edge sequences is smaller by a factor of n2 than our estimate on the size of the set produced by Algorithm 1 (cf. Section 2.2), but computing it eciently seems dicult. In addition, it is not clear how far the actual output of our algorithm is from the set of all shortest-path edge sequences. We have a sketch of a construction for a class of polytopes that force our algorithm to produce (n5) non-shortest-path edge sequences.

5 Exact Set of Shortest-Path Edge Sequences In this section, we present an O(n3 (n) log n) algorithm, for computing the exact set of maximal shortest-path edge sequences emanating from an edgelet. Here () is an extremely slowly growing function, asymptotically smaller than log n. Running this algorithm for all edgelets of P , the exact set of maximal shortest-path edge sequences can be computed in time O(n6 (n) log n), which is a signi cant improvement over Schevon and O'Rourke's O(n9 log n) algorithm [SO89]. Let " be an edgelet. We are interested in computing maximal shortest-path edge sequences (corresponding to paths) emanating from x, for all x 2 ". For each xed x, the shortest paths originating from x can be subdivided according to their initial direction. If the path leaves x between xpi?1 and xpi , it corresponds to a segment in Sx emanating from xi , the ith image of x. The area swept by all such segments, for a xed x and i, is exactly the ith peel. Let us concentrate on the portion Px;i of the ith peel that lies in Kx = K" . One measure of how far the `in uence' of xi extends into K", as x moves along ", is the union Ci = Sx2" Px;i . Ci is the union of a family of convex sets Px;i sharing pi?1 pi as a boundary edge, therefore Ci is star-shaped with respect to any point z 2 pi?1 pi . Let i = @Ci n pi?1 pi . It is easily checked that the restriction of a plate of Sx to Kx = K" does not vary with x 2 ". It therefore makes sense to talk about the nodes of x visited by i . We say that i visits a node v of x if i intersects the plate corresponding to v . Observe that every maximal (over all x in ") edge sequence corresponding to a shortest path emanating from x between xpi?1 and xpi is realized by some shortest path that connects xi to some point y on i \ Px;i , in fact to a ridge vertex of Px;i . This sequence is determined solely by the plate of x that contains y . Hence, it is sucient to determine the furthest that i gets from xi in x . More formally, consider the minimal subtree x;i of x rooted at (the plate incident to) xi and containing all nodes of x visited by i. The paths from the root of x;i to its leaves correspond to desired maximal sequences. Repeating this procedure for all images xi , we can collect all maximal sequences corresponding to shortest paths from points on ". The above idea can be made algorithmic, but transforming it directly to an algorithm requires computing the sets Ci (i.e., taking the union of a continuous family of convex sets Px;i , each obtained by deleting 4pi?1 xi pi from the ith peel), which is rather intricate. We therefore use a shortcut, replacing i by an easier-to-compute curve i0. Since the desired maximal sequences are necessarily realized by shortest paths from xi to one of the ridge vertices lying on @Px;i, we only need to consider the portion of i that contains a vertex of Tx, for some x 2 ". We now show how to compute a curve i0 that contains this portion of i. 19

A generic ridge vertex v is incident to three open peels ci ; cj ; ck ; if v has degree more than four and exists at more than just a discrete set of positions of x 2 ", we arbitrarily pick a triple of open peels to de ne it. As x moves along ", the vertex traces an algebraic curve v = v (x) in Kx . Let a lifetime of a ridge vertex v , de ned by ci ; cj ; ck , be a maximal connected interval "0  " for which x 2 "0 implies that v is a vertex of Tx. Let ?i be the set of curves traced out by ridge vertices that appear on the boundary of Px;i during their lifetimes; set ni = j?i j. It can be veri ed that the arcs in ?i are the projections of those edges of the subdivision M" , de ned in Section 3.4, at which gi appears on the lower envelope of gi 's. (As we mentioned in Section 3.4, M" may contain \irrelevant" features. In particular, we must truncate each aforementioned arc so that it corresponds to positions of the source on ". Secondly, we must verify that the Voronoi diagram vertex corresponding to the arc indeed yields a ridge vertex. It is sucient to check, for a single point of the curve traced out by the vertex as x ranges over ", that it lies inside K" , as a ridge vertex cannot leave P K". This is easily accomplished by one point-location query per arc.) Therefore, by Lemma 3.11, i ni = O(n3), where summation is taken over all peels of Sx , and all ?i 's can be computed in time O(n3). Let z be a point on pi?1 pi . If we introduce polar coordinates with z as the origin, each arc gj 2 ?i can be regarded as a univariate function r = gj () (split gj into constant number of monotone arcs if is not -monotone; this is possible since gi is a portion of an algebraic curve of small degree). Let i00 be the graph of the upper envelope of arcs in ?i . Since i is a portion of the boundary of a set star-shaped with respect to z , the portion of i that contains a vertex of the ridge tree Tx, for some x 2 ", lies on i00. However, i00 is not necessarily a connected arc. Suppose u1 = pi?1 ; u2; : : :; um = pi are the endpoints of the connected components of i0, sorted in counterclockwise direction around z ; we connect u2i to u2i+1 by a segment for each i < m. The arc resulting curve is the desired curve i0; i0 is a piecewise algebraic -monotone arc. Since each in ?i is algebraic, i00, and therefore i0, has O(ni (ni )) breakpoints [ASS89]; here (k) = 2 s(k) , s is a constant depending on the maximum degree of arcs in ?i , and () is the inverse Ackermann function. Using a divide-and-conquer approach i00 can be computed in time O(ni (ni ) log ni ); see [HS86]. We now trace i0 through x as follows. Clearly i0 lies in the portion K" [z ] of K" visible from z . Compute this portion, in linear time [EA81], and subdivide K" [z ] into a linear number of triangles all incident to z . Now partition i0 into connected portions 1 ; : : :; u, each fully contained in one of these triangles. This can be done in time proportional to the number of arcs constituting i0 and the number of triangles involved and produces at most O(n) extra arcs, as i0 is -monotone and thus crosses each segment separating consecutive triangles in at most one point. Since each triangle 4 is fully contained in K" and thus encloses no images of a vertex of P , the set of plates of Sx met by 4 corresponds to a subtree 4 of x of linear size, with at most one vertex of degree 3 and all remaining vertices of degree at most 2. Hence, 4 can be covered by two simple paths 14 ; 24  4 , and they can be computed in linear time. For each j  4, we determine the furthest node that i reaches in 14 ; 24 by binary search. An intersection between j and a plate of K" can be detected in O(1) time, so the binary search requires only O(log n) time. The total time spent is thus O(ni (n) log n + n2 ) over all triangles of K" [z ], and O(n3 (n) log n) over all i = 1; : : : ; n. The above processing is repeated for each of the O(n3 ) edgelets ". This completes the description of the algorithm. It is summarized in Algorithm 2. 20

Algorithm 2: Exact Edge Sequences Form edgelets. for each edgelet " do Compute M" . ? := Set of projections of edges in M" . Eliminate irrelevant features from ?. for each image xi do ?i := Arcs of ? at which gi appears on the lower envelope. Compute upper envelope i00 of ?i . Convert i00 into a connected arc i0. Compute and triangulate K" [z ] for each 4 in the triangulation do Compute 4 = i0 \ 4. Compute 4 = x \ 4. Compute 14 ; 24 . Find subtrees of 14 ; 24 visited by 4 .

Theorem 5.1 The exact set of all shortest-path edge sequences on the surface of a 3-polytope on

n vertices can be computed in O(n6 (n) log n) time, where (n) = o(log n) is an extremely slowly growing function.

6 Geodesic Diameter In this section we present an O(n8 log n) time algorithm to determine the geodesic diameter of P . As mentioned in the introduction, this question was rst investigated by O'Rourke and Schevon [OS89] who presented an O(n14 log n) time algorithm for computing it. Their algorithm relies on the following observation:

Lemma 6.1 (O'Rourke and Schevon [OS89]) If a pair of points x; y 2 P realizes the diameter of P , then either x or y is a corner of P , or there are at least ve distinct shortest paths between x and y. 2 Lemma 6.1 suggests the following strategy for locating all diametral pairs. We rst dispose of the possibility that either x or y is a corner in n  O(n2) = O(n3 ) time just as in [OS89]. Next, we x a ridge-free region R and let MR be the subdivision de ned in Section 3.4. We need to compute all pairs of points x 2 cl (R) and y  2 Kx such that there are at least ve distinct shortest paths between x and y , with U (y ) = y  . By a result of Schevon [Sch89], such a pair x; y can be a diametral pair only if it is the only pair, in a suciently small neighborhood of x and y , with at least ve distinct shortest paths between them. Such a pair of points corresponds to a vertex of MR . Hence, we use the following approach. We rst compute, in O(n4 ) time, all ridge-free regions of P (cf. Lemma 3.8). Next, for each ridge-free region R, we compute KR , vertices of MR , and f (v ) for all vertices of MR (recall that 21

f (v) is the shortest distance from v to any source image; cf. Section 3.3). Next, for each vertex v = (s; t; y1; y2) of MR , we determine whether (s; t) lies in the closure of R and (y1 ; y2) 2 KR. If the answer of both of these questions is `yes', we add v to the list of candidates for diametral pairs.

(This step is exactly the elimination of \irrelevant features" mentioned at the end of Section 3.4. Once the two conditions are veri ed, we know that f (v ) is exactly d(x; y ).) Finally, among all diametral candidate pairs, we choose a pair that has the largest geodesic distance. See Algorithm 3 for the pseudocode. For each ridge-free region R, KR can be computed in time O(n2) and preprocessed for planar point location in additional O(n log n) time using the algorithm of Sarnak and Tarjan [ST86]. By Lemma 3.9, vertices of MR and f (v ), for all vertices of MR , can be computed in time O(n4). We spend O(log n) time for point location at each vertex of MR , so the total time spent is O(n8 log n). Algorithm 3: Geodesic Diameter each corner c of P do Construct the ridge tree Tc with respect to c. for each vertex v of Tc do Add d(c; v ) to the list of diameter candidates. Compute the ridge-free regions. for each ridge-free region R do Compute MR and f (v ) for all vertices v 2 MR . Compute Sx for some x 2 R. Construct KR = Kx . Preprocess KR for point location queries. Preprocess cl (R) for point location queries. for each vertex v = (s; t; y1; y2) of MR do if (s; t) 2 cl (R) and (y1 ; y2) 2 Kx then Add f (v ) = d((s; t); (y1; y2)) to the list of diameter candidates. Find a diametral candidate pair with the maximum geodesic distance. for

Theorem 6.2 The geodesic diameter of a convex polytope in IR with a total of n vertices can be 3

computed in time O(n8 log n).

7 Shortest-Path Queries In this section we discuss the preprocessing needed to support queries of the form: \Given x; y 2 P , determine d(x; y )". We assume that each point is given together with the face (or the edge) of P containing it. Two variants of the problem are considered: (1) no assumption is made about x and y and (2) x is assumed to lie on an edge of P . Our data structure is based on the following observations. Let x; y be two query points. Suppose x = (s; t) is a generic point lying in a ridge-free region R and y  = (y1 ; y2) is an image of y in Sx. 22

If y  2 KR, then

d(x; y) = f (s; t; y1; y2 ) = g(s; t; y1; y2) + (s2 + t2 + y12 + y22) : On the other hand, if y  62 Kx, then it lies in one of the triangles 4pi?1 xi pi and d(x; y ) = jxi y  j, where j : : : j denotes the Euclidean length of a line segment in (the planar embedding) of 4pi?1xi pi . We thus need a data structure that, given a point y , can determine whether U (y ) = y  2 KR. Let R denote the preimage of @KR on P , so U (R) = @KR; R partitions each face f of P into convex regions. By the nature of the way f is partitioned by R , the regions in f can be linearly ordered (i.e., their adjacency graph is a chain), so that determining the region of f containing a given point y 2 f can be done in logarithmic time by binary search. Let   f be such a region, then either U ()  KR or U () \ KR = ;. In fact, one can prove a more interesting property of .

Lemma 7.1 Let R be a ridge-free region or an edgelet, let f be a face of P , and let  be a connected component of f n R whose image is not contained in KR . Then the sequence of edges traversed by the shortest path  (x; y ) is independent of the choice of x 2 R and y 2 . Proof: For the sake of a contradiction, suppose there are two points y; y0 2  such that the

sequences of edges traversed by  (x; y 0) and  (x; y 00) are distinct. Then there must exist a point y 2 y 0y00 with two shortest paths to x|to obtain such a point, move y from one end of y 0 y00 to the other and observe that the shortest path from x to y changes continuously and maintains the set of edges of P that it meets, except at points y with more than one shortest path to x. Thus y 2 Tx , so U (y)  U (Tx)  KR. However, the segment y 0 y 00   as  is convex, implying U (y)  U ()  Sx n KR |a contradiction. Similarly, if x0 ; x00 2 R are such that the paths connecting these two points to y 2  traverse di erent edge sequences, there must exist x 2 x0 x00 which is connected to y by two shortest paths, again forcing y onto Tx and yielding a contradiction. The lemma follows easily. 2 This lemma suggests the following approach to computing d(x; y ) for U (y ) not contained in KR. For each connected component  in f n R , whose image is not contained in KR, one can precompute the edge sequence for shortest paths from a point in R to a point in . This in turn determines the transformation of coordinates from the f -based coordinates to the coordinates usable in the planar unfolding of Sx |thus we may now compute an image y  of y and the peel of Sx that contains y  under this unfolding map, which as noted above immediately yields d(x; y ). Hence, we can preprocess P in time O(n2 log n) into a data structure of size O(n2), so that one can determine in O(log n) time whether U (y ) 2 Kx and, if U (y ) 62 Kx, then it also returns d(x; y ) in additional constant time. Next assume that U (y )  KR. Note that the data structure just described can be used to compute the coordinates of U (y ) even if U (y )  KR . Now one has to compute

g(s; t; y1; y2) = 1min g (s; t; y1; y2 ; v1; v2; v3; v4) ; in i where vi 's are the same as in (3). Let H be the set of hyperplanes in IR 9 corresponding to the graphs of gi's, i.e.,

hi : v5 = Ci(0) + Ci(1)y1 + Ci(2)y2 + Ci(3)s + Ci(4)t + Ci(5)v1 + Ci(6)v2 + Ci(7)v3 + Ci(8)v4 : 23

Then computing the value of g (s; t; y1; y2) is the same as determining the rst hyperplane of H intersected by the vertical ray emanating from the point (s; t; y1; y2; sy1; sy2 ; ty1; ty2 ; ?1) in the positive v5 -direction. Agarwal and Matousek [AM92] have described a data structure that, given a set G of n hyperplanes in IRd and a parameter n  s  nbd=2c, can preprocess G, in time O(s1+ ), into a data structure of size O(s1+ ), so that the rst hyperplane of G intersected by a vertical ray emanating from a point with xd = ?1 can be computed in time O( s =bnd= c log2 n). Since d = 9 in our case, we obtain a data structure of size O(s1+ ) so that a query can be answered in time O( s n= log2 n). As described in Lemma 3.8, one can partition all faces of P into ridge-free regions in time O(n4 ). For each ridge-free region, we construct the above data structures. Finally, if x is not a generic point then, as mentioned in the remark following Lemma 3.9, we can use the data structures of any of the ridge-free regions whose boundaries contain x. It is easy to see by a continuity argument that all shortest paths from such a point are encoded equally well in the data structures of all the ridge-tree regions touching x. In summary, for a pair of points x; y 2 P , d(x; y ) is computed in the following three steps. We assume that we are given the faces fx ; fy containing x; y , respectively. First nd in O(log n) time the ridge-free region R of fx whose closure contains x. Next nd in O(log n) time the region  of fy n R that contains y. If  does not lie in KR , using the information stored at , compute d(x; y). (The data structure required for handling this case has size (n2 ) per ridge-free region in the worst case. Hence choosing s = o(n2) does not produce asymptotic space savings while reducing query time.) Otherwise, compute d(x; y ) in time O( s n= log2 n) using the vertical ray shooting structure. Hence, we can conclude Theorem 7.2 Given a polytope P in IR3 with n vertices and a parameter n2  s  n4, one can construct, in time O(n4s1+ ) for any  > 0, a data structure of size O(n4s1+ ), so that d(x; y ) for any two points x; y 2 P can be computed in time O( s n= log2 n). 1

2

1 4

1 4

1 4

If x always lies on an edge, then H is a set of hyperplanes in IR6 , so the query time of the vertical ray shooting data structure is now O( s n= log2 n) for n2  s  n3 . Moreover, we have to construct only O(n3) di erent data structures, one for each edgelet, so we can conclude Theorem 7.3 Given a polytope P in IR3 with n vertices and a parameter n2  s  n3, one can construct in time, O(n3 s1+ ) for any  > 0, a data structure of size O(n3 s1+ ), so that for any two points x; y 2 P such that x lies on an edge of P one can compute d(x; y ) in time O( s n= log2 n). Remark. The performance can be slightly improved by employing the algorithm of Matousek and Schwarzkopf [MS93]. 1 3

1 3

8 Discussion and Open Problems We have shown that use of the star unfolding of a polytope leads to substantial improvements in the time complexity of three problems related to shortest paths on the surface of a convex polytope: nding edge sequences, computing the geodesic diameter, and distance queries. Moreover, the algorithms are not only theoretical improvements, but also, we believe, signi cant conceptual simpli cations. This demonstrates the utility of the star unfolding. We conclude by mentioning some open problems 24

1. Can one obtain a better upper bound on the number of di erent combinatorial structures of ridge trees by using a more global argument? Such an improvement will yield a similar improvement in the time complexities of diameter and exact shortest path edge sequences algorithms. 2. Can one answer answer a shortest path query faster if both x and y lie on some edge of P ? This special case is important for planning paths among convex polyhedra (see Sharir [Sha87]).

References [AAOS90] P. K. Agarwal, B. Aronov, J. O'Rourke, and C. Schevon. Star unfolding of a polytope with applications. In J. R. Gilbert and R. Karlsson, editors, Proc. of 2nd Scandanavian Workshop on Algorithm Theory, pages 251{263. Springer-Verlag, July 1990. Lecture Notes in Computer Science, Vol. 447. [Ale58] A. D. Aleksandrov. Konvexe Polyeder. Akademie-Verlag, Berlin, 1958. Math. Lehrbucher und Monographien. [AM92] P. K. Agarwal and J. Matousek. Ray shooting and parametric search. Proc. 24th ACM Symposium on Theory of Computing, 1992, 517{526. [AO92] B. Aronov and J. O'Rourke. Nonoverlap of the star unfolding. Discrete Comput. Geom., 8:219{250, 1992. [ASS89] P. K. Agarwal, M. Sharir, and P. Shor. Sharp upper and lower bounds on the length of general Davenport-Schinzel sequences, J. Comb. Theory, Ser. A, 52:228{274, 1989. [AZ67] A. D. Aleksandrov and V. A. Zalgaller. Intrinsic Geometry of Surfaces. American Mathematical Society, Providence, RI, 1967. Translation of the 1962 Russian original. [BO79] J. L. Bentley and T. A. Ottmann. Algorithms for reporting and counting geometric intersections. IEEE Trans. Comput., C-28:643{647, 1979. [CR87] J. Canny and J. Reif. New lower bound techniques for robot motion planning problems. Proc. 28th IEEE Symp. Foundations of Computer Science , 1987, pages 49{60. [C91] B. Chazelle, An optimal convex hull algorithm for point sets in any xed dimension. Technical Report CS-TR-336-91, Dept. Comput. Sci., Princeton Univ., Princeton, NJ, 1991. [CE92] B. Chazelle and H. Edelsbrunner. An optimal algorithm for intersecting line segments in the plane. J. ACM, 39:1{54, 1992. [CH90] J. Chen and Y. Han. Shortest paths on a polyhedron. In Proc. 6th Annu. ACM Sympos. Comput. Geom., pages 360{369, 1990. [CH91] J. Chen and Y. Han. Storing shortest paths for a polyhedron. In F. Dehne, F. Fiala, and W. W. Koczkodaj, editors, Advances in Computing and Information - ICCI '91 International Conference Proceedings, pages 169{80. Springer-Verlag, 1991. 25

[Cla87] [EA81] [Gar61] [HS86] [HCT89] [Kob67] [Mou85] [Mit93] [MMP87] [Mou90] [MS93] [OS89] [Pap85] [Ras90] [RS89] [Sch89] [Sei81]

K. Clarkson. Approximate algorithms for shortest path motion planning. Proc. 19th ACM Symp. Theory of Computing , 1987, pages 56{65. H. El Gindy and D. Avis. A linear algorithm for computing the visibility polygon from a point. Journal of Algorithms, 2:186{197, 1981. M. Gardner. The 2nd Scienti c AMerican Book of Mathematical Puzzles and Diversions . Simon and Schuster, New York, 1961. S. Hart and M. Sharir. Nonlinearity of Davenport-Schinzel sequences and of generalized path compression schemes. Combinatorica 6 (1986), 151{177. Y.-H. Hwang, R.-C. Chang, and H.-Y. Tu. Finding all shortest path edge sequences on a convex polyhedron. In Proc. 1st Workshop Algorithms Data Struct., volume 382 of Lecture Notes in Computer Science, pages 251{266. Springer-Verlag, 1989. S. Kobayashi. On conjugate and cut loci. In S. S. Chern, editor, Studies in Global Geometry and Analysis, pages 96{122. Mathematical Association of America, 1967. D. Mount. On nding shortest paths on convex polyhedra. Technical Report 1495, Department of Computer Science, University of Maryland, 1985. J. Mitchell. Shortest paths among obstacles in the plane. Proc. 9th ACM Symp. Computational Gemetry , 1993, pages 308{317. J. Mitchell, D. Mount, and C. Papadimitriou. The discrete geodesic problem. SIAM J. Comput., 16 (1987), 647{668. D. M. Mount. The number of shortest paths on the surface of a polyhedron. SIAM J. Comput., 19:593{611, 1990. J. Matousek and O. Schwarzkopf, J. On ray shooting in convex polytopes. Discrete Comput. Geom., 10:215{232, 1993. J. O'Rourke and C. Schevon. Computing the geodesic diameter of a 3-polytope. In Proc. 5th ACM Symposium on Computational Geometry, pages 370{379, June 1989. C. Papdimitriou. An algorithm for shortest paths motion in three dimensions, Info. Proc. Lett., 20 (1985), 259{263. R. Rasch. Shortest paths along a convex polyhedron. Master's thesis, University of Saarland, 1990. Diploma Thesis. J. Reif and J. Storer. Shortest paths in Euclidean space with polyhedral obstacles, J. ACM, to appear. C. Schevon. Algorithms for geodesics on polytopes. PhD thesis, Johns Hopkins University, 1989. R. Seidel. A convex hull algorithm optimal for point sets in even dimensions. Tech. Rept. 81/14, Dept. Computer Science, Univ. of British Columbia, Vancouver, 1981. 26

[Sha87] [SO88] [SO89] [SS86] [ST86] [Wel85]

M. Sharir. On shortest paths amidst convex polyhedra. SIAM J. Comput., 16:561{572, 1987. C. Schevon and J. O'Rourke. The number of maximal edge sequences on a convex polytope. In Proc. 26th Allerton Conf. Commun. Control Comput., pages 49{57, October 1988. C. Schevon and J. O'Rourke. An algorithm for nding edge sequences on a polytope. Technical Report JHU-89/03, Dept. Comput. Sci., Johns Hopkins Univ., Baltimore, MD, February 1989. M. Sharir and A. Schorr. On shortest paths in polyhedral spaces. SIAM J. Comput., 15:193{215, 1986. N. Sarnak and R. E. Tarjan. Planar point location using persistent search trees. Comm. ACM, 29:609-679, 1986. E. Welzl. Constructing the visibility graph for n line segments in O(n2 ) time. Info. Proc. Lett., 20 (1985), 167{171.

27