Computer-Aided Design 39 (2007) 1081–1090 www.elsevier.com/locate/cad Efficiently determining a locally exact shortest path on polyhedral surfaces Shi-Qing Xin, Guo-Jin Wang ∗ Department of Mathematics and State Key Laboratory of CAD & CG, Zhejiang University, Hangzhou 310027, PR China Received 17 September 2005; accepted 3 August 2007 Abstract In this paper, we present an efficient visibility-based algorithm for determining a locally exact shortest path (LESP) from a source point to a destination point on a (triangulated) polyhedral surface. Our algorithm, of a finitely-iterative scheme, evolves an initial approximately shortest path into a LESP. During each iteration, we first compute the exact shortest path restricted on the current face sequence according to Fermat’s principle which affirms that light always follows the shortest optical path, and then optimize the face sequence where the path is not locally shortest on the polyhedral surface. Since the series of paths we obtained are monotonic decreasing in length, the algorithm gives a LESP which is shorter than the initial path, at conclusion. For comparison, we use various methods to provide an initial path. One of the methods is Dijkstra’s algorithm, and the others are the Fast Marching Method (FMM) and its improved version. Our intention for improvement is to overcome the limitation of acute triangulations in the original version. To achieve this goal, we classify all the edges into seven types according to different wavefront propagation manners, and dynamically determine the type of each edge for controlling the subsequent wavefront expansion. Furthermore, we give two approaches for backtracing the approximately shortest paths directed at the improved FMM. One exploits the known propagation manners of the edges as well as the Euler’s method. This is another contribution in this paper. c 2007 Elsevier Ltd. All rights reserved. Keywords: Computational geometry; Shortest paths; Discrete geodesics; Fast marching method 1. Introduction The problem of computing the shortest path between two points s and t on a polyhedral surface S arises naturally in a wide range of application areas such as robotics, geographic information systems and navigation [1,2]. Besides its importance in computational geometry, it is also central to many computer graphics problems. For example, cutting a mesh into several charts [3,31] and establishing a surface distance metric [30,4] often involve computation of shortest paths; see [5] for a survey. To solve the exact globally shortest path problem, Sharir and Schorr [6] first presented an O(n 3 log n) algorithm that runs on a convex polytope, where n is the complexity of the surface. The algorithm was subsequently improved by Mount [20] to O(n 2 log n). For an arbitrary polyhedral surface, Mitchell, Mount and Papadimitriou [7] (MMP) gave an O(n 2 log n) algorithm which inherits the paradigm of Dijkstra’s algorithm ∗ Corresponding author. Tel.: +86 571 87951609x8306. E-mail address: [email protected] (G.-J. Wang). c 2007 Elsevier Ltd. All rights reserved. 0010-4485/$ - see front matter doi:10.1016/j.cad.2007.08.001 [38]. Later, Chen and Han [8] (CH) provided an O(n 2 ) algorithm based on a key observation of “one angle one split”. (Also, Kapoor [9] announced a further improvement in 1999.) Recently, Xin and Wang [10] (XW) proposed two techniques for improving CH algorithm, and the new algorithm has a much higher performance than previous algorithms in time and space. To make a trade-off between computation time and path accuracy, researchers are also interested in computing an approximately shortest path at most (1 + )π(s, t), where is a given tolerance and π(s, t) denotes the exact globally shortest surface distance between the source point s and the destination point t. Approximation algorithms for the general 3D shortest path problem were first studied by Papadimitriou [21], Choi et al. [22] and Clarkson [23]. For the shortest path problem on a polyhedral surface, many known algorithms [12,14–16,11,19, 13,1,17,18,5,28] have been proposed. In this paper, we study how to efficiently determine a locally exact shortest path (LESP) between two points on a (triangulated) polyhedral surface. Our motivation is to find an almost globally shortest path that is also locally shortest in the exact sense. In fact, the local minima (maxima) makes 1082 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 sense in many problems such as gravitational lensing [32]. Just as many known approximation algorithms [13,25,35], we adopt a two-step scheme for the LESP problem, computing an approximately shortest path joining the source s and the destination t followed by evolving the initial path iteratively to a LESP. Generally speaking, an accurate initial path more possibly gives a LESP short enough. Therefore, we use various methods to provide initial paths for comparison. One of the initialization methods is Dijkstra’s algorithm [38]. The others are based on the Fast Marching Method (FMM) [16,2,29,37,36,33,34], which is a reminiscent of Dijkstra’s method and optimal in the sense that the computational complexity is O(n log n). This paper presents a variant of the FMM to overcome the limitation of acute triangulations in the original version [2], which is described in detail in Section 3. Our technique is to classify all the edges into seven types for simulating the wavefront expansion and update the wavefront around the active vertex in a wing-like fashion. In addition, we give an equivalent upwind construction of the FMM on triangulated domains. The overall process can be described as follows, and the detailed description can be seen in Algorithm 3. – While there still exist pending vertices, . Take out the pending vertex v with the smallest distance and mark it with “fixed”; . Determine the propagation type of the edges vi v incident to v in a wing-like fashion, where vi is already a fixed vertex, as Fig. 6 shows; . Update the distances of the two pending vertices which are incident to v and next to the fixed vertices. Then Section 4 proposes a finitely-iterative algorithm for evolving an initial path to a LESP. Our algorithm proceeds like this: – While the current path Γ is not a LESP, /∗ Suppose Γ lies on a face sequence F. ∗ / . Optimize the face sequence F where the path is not locally shortest; . Compute the exact shortest path restricted on the new face sequence. In fact, determining the exact shortest path lying on a face sequence is equivalent to the shortest path problem inside a simple planar polygon. Although many known algorithms [24] with low complexity have been presented, they are complicated and impractical for this specific problem. Therefore we devise a visibility-based method motivated by Fermat’s principle which alleges that light always follows the shortest optical path. Suppose the boundary of the face sequence can “absorb” light and we place a luminary at the source position. With the marching of the light, a part thereof will be absorbed by the boundary. When the light is completely absorbed, we place another luminary at the vertex that blocks the light. Repeat the process until the destination is visible. Then the light path to the destination t, actually which is a 3D polyline, can be proved to be the shortest path restricted on the current face sequence. Since the face sequences are reasonably “straight”, the intuitive algorithm is natural and efficient. Fig. 1. Definitions of the face sequence F and the edge sequence E. The thick polyline denotes the shortest path from s to t restricted on F , while the lightgray polygon denotes the boundary of F . We have made numerous tests on the improved FMM in Section 3 and the visibility-based algorithm in Section 4, and provide some comparative results by experiments in Section 5. The main observations are as follows: (1) the improved FMM performs better than the original version in [2]; (2) the visibility-based algorithm possesses faster convergence rate; and (3) combining the two algorithms together, we obtain an efficient method for solving the LESP. 2. Preliminaries Let S be a (triangulated) polyhedral surface in R3 , defined by a set of faces, edges and vertices. Assume that the surface S has n faces and s, t are two points on the surface. Our task is to compute a LESP restricted on S between s and t. We first borrow some terminologies from [7]. A face sequence F is defined by a list of adjacent faces f 1 , f 2 , . . . , f m+1 such that f i and f i+1 share a common edge ei . Then we call the list of edges E = (e1 , e2 , . . . , em ) an edge sequence. Actually, the face sequence F and the edge sequence E mean the same, as Fig. 1 shows. Without specification, the face sequences mentioned later are all simple, i.e., the faces are different from each other in a face sequence. In studying the shortest path problem, a technique called planar unfolding is often used. An edge sequence E = (e1 , e2 , . . . , em ) is unfolded in this way: rotate f 1 around e1 until its plane coincides with that of f 2 ( f 1 and f 2 are kept on different sides of e1 ), rotate f 1 and f 2 around e2 until their plane coincides with that of f 3 , and repeat the process until all the faces f 1 , f 2 , . . . , f m lie in the plane of f m+1 . Obviously, a shortest path is, without doubt, locally shortest. More properties can be seen in [6,20,8]. For example, two shortest paths from the same source cannot intersect each other unless at the source point or the destination point or a saddle vertex. For description of the general form of a shortest path, we cite a lemma from [7]. Lemma 1. The general form of a locally shortest path is a path which goes through an alternating sequence of vertices and edge sequences such that the unfolded image of the path along any edge sequence is a straight line segment and both the angles of the path passing through a vertex is greater than or equal to π . The general form of a shortest path is the same as that of a locally shortest path, except that no edge can appear in more than one edge sequence and each edge sequence must be simple. 1083 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 Now consider the shortest path problem restricted on a simple face sequence F that connects s and t. We can come to an immediate conclusion from [26,27] as follows. Lemma 2. There exists a unique locally shortest path from the source point s to the destination point t on a simple face sequence F. 3. Improving the FMM The FMM on triangulated domains was introduced by Kimmel and Sethian [16] in 1998. Its explanation in physics is to simulate an advancing wavefront from a source point and update the distance values of the vertices where the wavefront arrives. Mathematically, the FMM is a computational technique for approximating the solution to nonlinear Eikonal equations of the form |∇T | = 1, where T denotes the distance field restricted on the surface. Fig. 2. The distance value d(v) of the vertex v is determined by v1 ’s and v2 ’s distance values d(v1 ) and d(v2 ), using the upwind construction. There exists a point paccess , called the access point, on the straight line v1 v2 such that the dotted line segment vpaccess coincides with the gradient of the distance field on the face 4vv1 v2 . Note that the condition paccess ∈ v1 v2 is required so that both the vertices v1 , v2 can provide values for the vertex v. 3.1. The original FMM Here we give a brief description of the process of the FMM on triangulated domains. Technically, all vertices can be classified into three groups: Fixed vertices, whose distance values are known and fixed; Close vertices, whose distance values have been calculated, but have not been fixed yet; and Far vertices that have not been updated and lie ahead of the wavefront. Initially, we tag the source vertex s as Close and all other vertices as Far. Then the algorithm proceeds as follows: – While the destination vertex t has not been fixed, . Extract the vertex v in Close with the minimum distance value; . Tag v as Fixed and its Far neighbors as Close. . Recompute the distance values of v’s Close neighbors in an upwind finite-difference scheme as Fig. 2 shows. The above algorithm computes the approximate shortest distance from the source s to the destination t at the conclusion. However, determining the corresponding path relies on the solution to the differential equation dX (µ) = −∇T, dµ where X (µ) = 0 represents the geodesic path with respect to the arc parameter µ. As the triangulation is refined, the resulting path converges to the exact shortest path [2]. As is shown in Fig. 2, the vertices v1 , v2 can provide a validatory distance value for the vertex v if the condition paccess ∈ v1 v2 holds. However, it is not always like this. So Kimmel and Sethian [16] suggested that non-acute triangulations should be handled by splitting the obtuse angles in a special way as shown in Fig. 3. However, their idea does not work if the wavefront entering the vertex A comes across the edge D E. Therefore, we next introduce a new approach for overcoming the limitation of acute triangulations. The main difference between our approach and the original version lies in the handling after we retrieve the Close vertex with the minimum distance value; see Algorithm 3 for details. (a) Case 1: the front comes across the edge BG, giving the shortest distance to the vertex A. (b) Case 2: the front comes across the edge D E, giving the shortest distance to the vertex A. Fig. 3. A non-acute triangulation with 6 B AC > π/2. Kimmel and Sethian [16] suggested connecting the virtual edge AG in the unfolded triangulated patch, where 6 C AH1 = 6 B AH2 = π/2 and the vertex G is located in the shadow region 6 H1 AH2 so that 6 B AG and 6 C AG are acute. However, this does not work if the wavefront entering the vertex A comes across the edge D E. 3.2. Various propagation manners Since the FMM can be regarded as a simulation of an advancing wavefront [2], we should consider the propagation manner that the wavefront arrives at vertices or edges. In fact, a vertex may receive fronts from adjacent vertices or opposite edges, while an edge may receive fronts from adjacent edges or opposite vertices. In detail, we can classify all the vertices into two types, From Vertex and From Edge, for distinguishing how a vertex v gets its minimum distance value d(v), as is shown in Fig. 4. Likewise, we classify all the edges into seven types according to the manner of the incoming wavefront, as Fig. 5 shows. Technically, the two manners From Vertex and From Edge can be interpreted by Algorithm 1 and Algorithm 2. Note that as opposed to the original FMM (Fig. 2), Algorithm 2 (Fig. 4(b)) gives another explanation of the upwind construction of the FMM on the triangulated domains. Algorithm 1. If the vertex v 0 has been tagged as Fixed and its adjacent vertex v is still in Close, and the inequality d(v) > d(v 0 ) + kvv 0 k holds, then 1084 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 respectively d(v1 ) and d(v2 ), and v is on the upper side of the edge v1 v2 . (ii) Compute the coordinates (x, y) of v. If x < x1 or x > x2 , exit. /∗ x1 ≤ x ≤ x2 implies that the wavefront entering the vertex v comes across the edge v1 v2 .∗ / (iii) If y is less than the existing distance value d(v) of v, we compute the coordinates (x, y) of the access point p with (a) From Vertex: the shortest path to the vertex v goes via its adjacent vertex v 0 . (b) From Edge: the shortest path to the vertex v goes across the edge v1 v2 ; p is the access point. Fig. 4. The distance value of the vertex v may be computed in two ways, From Vertex or From Edge, where the thick arrows indicate the advancing wavefront. (a) From Left Part (resp., From Right Part): the edge v1 v3 (resp., v3 v2 ) receives wavefront coming from the left (resp., right) part of edge v1 v2 . (c) From Both Edges: the edge v2 v3 receives wavefront coming from both the edges v2 v1 and v1 v3 . (b) From Left Edge (resp., From Right Edge): the edge v1 v3 (resp., v3 v2 ) receives wavefront coming from the entire edge v1 v2 . (d) From Pseudo Source: any point p ∈ v2 v3 receives wavefront from the pseudo-source vertex v1 . (e) From End To End: the wavefront propagates from one endpoint to the other. Fig. 5. Seven manners of wavefront propagation to the edge e. The thick arrows mean the wavefront. The fronts entering the point p2 come from the point p1 in (a), (b) and (c), and from the vertex v1 in (d) and (e). (i) d(v) := d(v 0 ) + kvv 0 k; /∗ Fig. 4(a).∗ / (ii) Set a From Vertex flag to the vertex v. Algorithm 2. If a Close vertex v is opposite to the edge v1 v2 whose endpoints are both in Fixed, then the distance value d(v) of v can be updated as follows. /∗ Fig. 4(b).∗ / (i) Build an XY coordinate system in the plane of ∆v1 v2 v, such that the y-components of the points v1 and v2 are x=x and (x − x1 )d(v2 ) + (x2 − x)d(v1 ) . x2 − x1 Otherwise, exit. /∗ p is the access point.∗ / (iv) If d(v) > max(d(v1 ), d(v2 ), min(y, d(v))), then /∗ max(·) is used to guarantee that the vertices are processed in monotonic increasing order of their distance values.∗ / (a) d(v) := max(d(v1 ), d(v2 ), min(y, d(v))); (b) Set a From Edge flag to the vertex v. y= But when the wavefront advances towards a (directed) edge e, things become a bit complicated. (Without specification, the edges discussed in this paper are all directed.) The wavefront entering the edge e may come from a pseudo-source, or an edge, or a part of an edge, or both edges; see Fig. 5 for totally seven manners. Accordingly, we can label the edge e with one of the seven flags as follows (see Fig. 5): – From Left Part, From Right Part (see Fig. 5(a)): the edge v1 v3 receives wavefront coming from the left or right part of the edge v1 v2 . – From Left Edge, From Right Edge (see Fig. 5(b)): the edge v1 v3 or v3 v2 receives wavefront coming from the entire edge v1 v2 . – From Both Edges (see Fig. 5(c)): the edge v2 v3 receives wavefront coming from both the edges v2 v1 and v1 v3 . – From Pseudo Source (see Fig. 5(d)): the edge v2 v3 receives wavefront coming from the single source vertex v1 . – From End To End (see Fig. 5(e)): the wavefront cannot go across either the edge vv1 or the edge v1 v, but rather passes through the undirected edge vv1 from one endpoint to the other. These flags are set for controlling the subsequent wavefront propagation manners. Note that the propagation process in the exact shortest path problem is far more complicated. Technically speaking, the FMM simplifies the propagation process greatly based on the assumption that the fronts are locally parallel to each other. Our intention is to extend the FMM by seven propagation manners, instead of one manner. The discussions here are prepared for Algorithm 3 in the next subsection. 3.3. Wing-like update As mentioned above, the overall scheme of our improved FMM is just the same as the original version, except that we keep track of the propagation manners and adopt a wing-like update technique during each iteration. When we take out the Close vertex v with the minimum distance, we first check how 1085 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 3.4. Backtracing paths At the conclusion of Algorithm 3, it provides a distance value for each vertex. However, the corresponding paths are still unknown. This subsection gives two methods for backtracing the paths. One method utilizes the known propagation manners of the edges, and the other is Euler’s method. (a) The Fixed vertex v 0 gives the distance value of the vertex v. (b) The edge vl vr gives the shortest distance value of the vertex v. Fig. 6. Wing-like update process: the wavefront propagates ahead from two sides. The vertices marked with a “•” mark are in Fixed, while the vertices marked with a “M” mark are in Close. The wavefront advances forward from two sides until it meets v’s Close neighbors. 3.4.1. Exploiting the known propagation manners To backtrace the paths using the known propagation manners of the edges, we make an assumption that the shortest path divides the successive wavefront segments by the same proportion. Take Fig. 5(a) for example, we treat p1 ∈ v1 v2 as the access point of p2 ∈ v1 v3 if kv1 p2 k/k p2 v3 k = kv1 p1 k/k p1 paccess k. It is the same with Fig. 5(c) if kv2 p2 k/k p2 v3 k = kv2 p1 k/(k p1 v1 k + kv1 v3 k), p 1 ∈ v2 v1 or Fig. 7. The table exhibits how we label the edge v2 v3 . the vertex v gets its distance value for the last time, and then determine the propagation type of each edge incident to the vertex v in a wing-like order. Fig. 6 gives an illustration of the wing-like update process, and the detailed pseudo-code can be seen in Algorithm 3. Algorithm 3. Initially, tag the source vertex s as Close with d(s) := 0, while tag any other vertex v as Far with d(v) := +∞. Assign a From End To End label to all the edges. Then each iteration proceeds as follows. (i) Extract the Close vertex v with the minimum distance value d(v). Label v with a Fixed flag, and label its Far neighbors with a Close flag. (ii) Update the distance values of all of v’s Close neighbors with Algorithm 1. If v is the source vertex, stop this iteration. (iii) If v carries the From Vertex flag, then /∗ Suppose vertex v 0 gives d(v); see Fig. 6(a).∗ / Tag the directed edges vv 0 and v 0 v as From End To End. /∗ This prevents the approximately shortest paths from intersecting the undirected edge v 0 v.∗ / Else /∗ Suppose edge vl vr gives d(v); see Fig. 6(b).∗ / (a) Keep the access point of v. (b) Tag the directed edges vl v and vvr respectively as From Left Part and From Right Part. (iv) Label the edges opposite to v in the wing-like order, following Figs. 6 and 7, until we find v’s Close neighbors. Then we get two directed edges el and er such that the edges next to them have a Close endpoint. /∗ Fig. 6(a) and Fig. 6(b).∗ / (v) Update the distance values of the two vertices opposite to the edges el and er exploiting Algorithm 2. In fact, the above algorithm is motivated by the continuous propagation of fronts, and therefore is pretty natural. It performs well even for non-acute triangulations. kv2 p2 k/k p2 v3 k = (kv2 v1 k + kv1 p1 k)/k p1 v3 k, p 1 ∈ v1 v3 . The assumption induces a simple backtracing algorithm. We introduce a bool variable fIsVertex to indicate whether the current point p is a vertex or an inner point of an edge, and use an integer variable of index to denote the corresponding index of the vertex or the edge. Then the backtracing algorithm can be described as follows. Algorithm 4. Initially, set fIsVertex := TRUE and p := t, where t is the destination vertex. Assign index with the index of t. Then continue the following iterations. (i) Keep the position of the current point p. (ii) If fIsVertex is TRUE /∗ p is a vertex, say, v.∗ / If the vertex v coincides with the source s, then Return the resulting path and stop. Else if d(v) is given by another vertex v 0 , then (i) Let p := v 0 . (ii) Assign the index of v 0 to the variable index. Else /∗ An edge e gives d(v).∗ / (i) Assign the index of e to index. (ii) Set fIsVertex to be FALSE. (iii) Update p by the access point of v. Else /∗ p is located on an edge e.∗ / Update the variables fIsVertex, p and index according to Fig. 5. On the whole, the backtracing method here is an inverse procedure of wavefront expansion. Since the propagation manners of the edges are already known, it demands only a little computation. In addition, it can be proved that the resulting paths from different points to the source vertex do not intersect each other except at vertices at the conclusion of Algorithm 4. 1086 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 (a) Rotating I around the edge v1 v2 until I is located in the face of 4v1 v2 v3 . (b) Building a planar coordinate system in the face of 4v1 v2 v3 . (a) Initialization: the luminary is placed at the source vertex, and hence the edge e is illuminated. (b) λ ≤ a: the next edge e receives all the light from the source image I0. (c) a < λ < b: the next edge e receives part of the light from the source image I 0 . (d) λ ≥ b: the next edge e receives no light from the source image I 0 . Fig. 8. Unfolding a face sequence. 3.4.2. Euler’s method Euler’s method for backtracing the paths is to numerically solve the differential equation dX (µ)/dµ = −∇T . Suppose the planar coordinate system has been built in the face 4v1 v2 v3 . Since Euler’s method has order 1, we assume T = ax + by + c in 4v1 v2 v3 . Then ∇T = (a, b) can be determined by solving the equation array T1 = ax1 + by1 + c T2 = ax2 + by2 + c T3 = ax3 + by3 + c, where (xi , yi ) are the planar coordinates of the three vertices, as Fig. 2 shows. Along the gradient (a, b), we can compute the access point of any point on the boundary of 4v1 v2 v3 . Similarly, we can prove that the resulting paths from different points to the source vertex do not intersect each other except at vertices. 4. Evolution to a LESP Given an initial path between the source s and the destination t, we adopt a two-step scheme to compute a LESP between them: (1) determining the shortest path Γ restricted on the current face sequence F and (2) updating F if Γ is not a LESP. In detail, the first subsection introduces the process of unfolding a face sequence, and the other subsections propose a method for computing a LESP. 4.1. Unfolding a face sequence Suppose F is a face sequence connecting the source vertex s and the destination vertex t. During the planar unfolding of F, we will obtain a sequence of images of the source. Take Fig. 8(a) for example, we now rotate the source image I until I is located in the face of 4v1 v2 v3 , where 4v1 v2 v3 is a triangle among F. Assume I 0 is the image of I by rotating around the edge v1 v2 . Our intention is to denote the images I and I 0 by a pair. Let l− and r− be respectively the distances between the image I and the vertices v1 , v2 . We first build a planar coordinate system on the plane of 4v1 v2 v3 to accommodate the new source image I 0 , as shown in Fig. 8(b). Without loss of generality, we assume v1 is located at (0, 0) and v2 is located at (b, 0), where b is the length of the edge v1 v2 . (v3 and I 0 should be kept on different sides of the X -axis.) Then the planar Fig. 9. Suppose the straight line vI 0 divides the edge e by proportion λ. With the variation of λ, the next edge e0 may receive all the light, part of the light, or no light from the image I 0 . coordinates of I 0 (x− , y− ) and v3 (x+ , y+ ) can be represented as follows: q 2 )/b + b (l 2 − r− 2 − x2 , , y− = − l− x− = − − 2 and q 2 − r 2 )/b + b (l+ + 2 − x2 , , y+ = l+ x+ = + 2 with which we can compute the length of kI 0 v3k. Thus the new source image by rotating I 0 around the edge v1 v3 or v3 v2 can also be determined. Repeat the process until we compute all the source images. 4.2. The visibility-based algorithm This subsection presents a visibility-based algorithm for solving the LESP problem, according to Fermat’s principle which states that light always follows the shortest optical path. As Fig. 9 shows, the overall procedure is like this: (1) place a luminary at the source s and let the light march forward as much as possible; (2) if the light is completely “absorbed” by the boundary, then place another luminary at the vertex which blocks the light; and (3) repeat the process until the destination t is visible. In Fig. 9, the variables a, b ∈ [0, 1] are used to denote the two endpoints of a projection segment on an edge, and vl and vr are used to designate the two vertices that block the light. Then the visibility-based algorithm can be written as follows. Algorithm 5. Initially, the image I is located at the source vertex s, as Fig. 9(a) shows. Let e denote the edge opposite to I , and vl and vr denote the two endpoints of e. Set a := 0 and b := 1. Then the algorithm proceeds as follows. 1087 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 (a) A luminary is placed at s initially. (b) Light marches forward as much as possible. (c) Place another luminary at the vertex that completely blocks the light. (d) The destination point is visible at the conclusion of Algorithm 5. Fig. 10. The general execution procedure of Algorithm 5. /∗ Suppose e0 is the edge next to e. Then e0 and e determine a face f and have a common vertex. Let v be the endpoint of e0 different from the common vertex. Without loss of generality, assume v is the left endpoint of e0 as Fig. 9(b) shows. Build a locally planar coordinate system in the plane of f .∗ / (i) Compute the dividing proportion λ on the edge e0 by the straight line v I . (ii) If λ ≤ a/∗ Fig. 9(b).∗ / (a) Compute the new dividing proportions a, b on the edge e0 . (b) Compute the new source image I. Else if a < λ < b/∗ Fig. 9(c).∗ / (a) Let vl := v and a := 0. (b) Compute the new right weight b and the new source image I. Else /∗ Fig. 9(d).∗ / Let I := vr , a := 0 and b := 1. (iii) Repeat the process until the destination t is visible. Fig. 10 illustrates a general execution procedure of Algorithm 5. At the conclusion of the algorithm, we compute the LESP restricted on the current face sequence. Its correctness is given by the following theorem. Theorem 1. Algorithm 5 computes the unique shortest path on the concerning face sequence. Proof. At the conclusion of Algorithm 5, luminaries are placed at certain vertices. Suppose v is the first one except the source vertex s; see Fig. 11. Since v blocks the light from the source s at one time, there must exit an edge e such that a part of e receives light from s while the next edge e0 is entirely invisible to e. We extend the line segment sv until it intersects the boundary at a point, say, v 0 . Then we have the line segment vv 0 cutting the domain of the concerning face sequence into two parts. Thus any path Γ from the source s to the destination t intersects the line segment vv 0 at one or more points. Let p be one of the intersection points between Γ and the line segment S c can be decomposed into sp b pbt. vv 0 , and then the path spt b passes through the vertex v, Γ goes via Since the subpath sp v definitely. By analogy, we can conclude that all “luminary” vertices are definitely located on the shortest path restricted on the face sequence. Together with the observation that the portion of the path between successive “luminary” vertices is a straight line segment, we prove the theorem. Fig. 11. Algorithm 5 gives the unique shortest path on the concerning face sequence. Fig. 12. The path is locally shortest at vertex v if and only if 6θil ≥ π and 6θir ≥ π . The best time complexity of Algorithm 5 is O(k), while the worst time complexity is O(k 2 ), where k is the number of the edges contained in the current edge sequence. In our experiments (see Section 5), Algorithm 5 runs in time O(ck) (c ≤ 2), because most of the edge sequences we face with it are reasonably “straight”. 4.3. Update of the face sequence Algorithm 5 computes the shortest path Γ restricted on a given face sequence F connecting the source s and the destination t. However, Γ is not necessarily a LESP on the polyhedral surface. In fact, it is possibly not locally shortest at vertices where luminaries are placed, and hence we need check if the path Γ is a LESP every time after Algorithm 5 runs. In Fig. 12, a path Γ passes through the vertex v. Since Γ cuts the neighborhood of v into two parts, the angles incident to v are divided into two groups in accordance, {θil } and {θir }. We can affirm that Γ is locally shortest at v if and only if 6θil ≥ π and 6θir ≥ π; see Lemma 1. Therefore, we need check any “luminary” vertex v as follows. If one of the inequalities 6θil ≥ π and 6θir ≥ π does not hold, then remove the edges incident to v from the concerning edge sequence F, and insert into F the remaining edges incident to v. (Note that the edges 1088 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 (a) Exact algorithms; paths. (b) Exact algorithms; isolines. (c) DJ; paths. (d) DJ; isolines. (e) FMM; paths. (f) FMM; isolines. (g) FMM1; paths. (h) FMM1; isolines. (i) FMM2; paths. (j) FMM2; isolines. Fig. 13. Testing various initialization methods on the bunny model of 5110 faces. Figures (a), (c), (e), (g) and (i) show the (approximately) shortest paths, while figures (b), (d), (f), (h) and (j) show the corresponding isolines. should be arranged in order.) After all the “luminary” vertices are checked, we obtain a new face sequence F 0 . If F and F 0 are the same, Γ is a LESP on the surface. Otherwise, repeat such a process. Thus we obtain a sequence of face sequences F1 , F2 , . . . , and corresponding to it, a sequence of shortest paths Γ1 , Γ2 , . . . . It can be proved that the lengths of Γi are strictly monotonic decreasing with regard to i. Taking into account that there are finitely many face sequences connecting the source s and the destination t, we conclude that a LESP between s and t can be computed after finite iterations. 5. Experimental results In this section, we provide some experimental results of the initialization algorithms (see Section 3) and the visibilitybased algorithm (see Section 4). Our experiments are made on a computer with 3.00 GHz Pentium(R) 4 CPU and 1 GB memory. 5.1. Initialization algorithms This subsection compares various algorithms on the shortest path problem. Representative exact algorithms include (1) MMP algorithm [7], (2) CH algorithm [8] and (3) XW algorithm [10]. The approximation algorithms discussed here include (1) Dijkstra’s algorithm [38], (2) the FMM [2], (3) FMM1: computing the distance values using Algorithm 3 and backtracing paths exploiting Algorithm 4; and (4) FMM2: computing the distance values using Algorithm 3 and backtracing paths exploiting Euler’s method. Fig. 13 illustrates a group of experimental results on a bunny model of 5100 faces, and Table 1 lists the experimental data on running time (Time), memory requirements (Space) and length error (Error), where Error means the relative error of the length sum of the approximately shortest paths to all the vertices to the length sum of the exact globally shortest paths to all the vertices. From the experimental results, we can see that FMM2 has a desirable overall performance and therefore is more appropriate for providing an initial path, while the FMM is more time-consuming than FMM1 and FMM2. The inefficiency of the original FMM lies in that it requires connecting the virtual edges in the preprocessing step. 1089 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 (a) The bunny model of a non-acute triangulation. (b) The exact globally shortest path between s and t. (c) Initialized by DJ. (e) Initialized by FMM1. (f) Initialized by FMM2. (d) Initialized by FMM. Fig. 14. Testing various initialization algorithms on the 5k-face bunny model of a non-acute triangulation: the exact globally shortest path between the points s and t is drawn in a dashed curve; the initial paths are shown in thick curves; and the resulting LESPs are illustrated in thin curves. Table 1 Testing various 3D shortest path algorithms on the bunny model of 5110 faces MMP [7] CH [8] Time (ms) Space (MB) 797 Error (%) XW [10] DJ [38] FMM [2] FMM1 FMM2 237,593 219 3 46 8 5.42 2.35 0.23 0.04 0.2 0.12 0.12 – – – 6.36 2.38 3.12 1.73 16 5.2. Testing the visibility-based algorithm In this subsection, we test the visibility-based algorithm by using several initialization algorithms including DJ [38], FMM [2], FMM1 and FMM2 on the bunny model of a nonacute triangulation. Fig. 14 illustrates the experimental results of computing the (approximately) shortest path between the two given points s and t by the visibility-based algorithm. The globally shortest path, the initial paths and the resulting LESPs are respectively drawn in dashed curves, thick curves and thin curves. We list the experimental data in Table 2, where the notations have the following meaning: – “Iteration”: the total number of iterations required; – “Repetition”: the average visit times of an edge during an iteration; – “Error1”: the relative length error of the initial path to the exact shortest path; – “Error2”: the relative length error of the resulting LESP to the exact shortest path. Numerous experiments show that the visibility-based algorithm has a high performance. Averagely speaking, the Table 2 Testing the visibility-based algorithm with various initialization methods on the bunny model of a non-acute triangulation Initialized by → DJ FMM FMM1 FMM2 Iteration Repetition Error1 (%) Error2 (%) 4 1.55 5.39 0.007 5 1.49 1.13 0.007 5 1.52 2.67 0.007 4 1.48 0.48 0.007 initial paths given by DJ, FMM, FMM1 and FMM2 respectively have a relative error of 5.92%, 1.09%, 1.86% and 0.54% in length, and the corresponding LESPs respectively have a relative error of 0.097%, 0.031%, 0.059% and 0.017%. Furthermore, tests on a 2000 K-triangle model illustrate that we can compute a LESP between any two points in 0.2 s using the visibility-based algorithm initialized by the FMM2. Based on the experimental results, we have the following observations. – Different initial paths may give different LESPs. Wholly speaking, the FMM2 is a desirable initialization method for it runs efficiently and the resulting approximately shortest path is mostly close enough to the exact globally shortest path. – When used to solve the LESP problem, the visibility-based algorithm has a linear-time complexity experimentally since “Repetition” is always between 1 and 2. What accounts for the high performance of the visibility-based algorithm is that the edge sequences involved in the LESP problem are mostly rather “straight”. – Provided that the initial path is accurate enough, the visibility-based algorithm can determine the exact globally shortest path. 1090 S.-Q. Xin, G.-J. Wang / Computer-Aided Design 39 (2007) 1081–1090 6. Conclusions In this paper, we improve the original FMM by classifying all the edges into seven types according to different wavefront propagation manners, and dynamically determining the type of each edge for controlling the subsequent wavefront expansion. Furthermore, we give two approaches for backtracing the approximately shortest paths. One exploits the known propagation manners of the edges as well as the Euler’s method. The second contribution of the paper is a visibility-based algorithm that is specially devised for the locally exact shortest path problem on a mesh. It is based on Fermat’s principle which affirms that light follows the shortest optical path, and therefore is natural and intuitive. The visibility-based algorithm has a high performance because the edge sequences in the LESP problem are reasonably “straight”. Furthermore, provided that the initial path is accurate enough, the LESP we obtain is also globally shortest. Acknowledgements This work was supported by the National Basic Research Program of China (No. 2004CB719400), the NNSF of China (No. 60673031, No. 60333010) and the NNSF for IRG (No. 60021201). References [1] Agarwal PK, Har-Peled S, Karia M. Computing approximate shortest paths on convex polytopes. In: Symposium on computational geometry. 2000. p. 270–9. [2] Sethian JA. Fast marching methods. SIAM Review 1999;41(2):199–235. [3] Sander PV, Wood ZJ, Gortler SJ, Snyder J, Hoppe H. Multi-chart geometry images. In: Proceedings of the 2003 eurographics/ACM SIGGRAPH symposium on geometry processing. 2003. p. 146–55. [4] Peyré G, Cohen L. Geodesic computations for fast and accurate surface remeshing and parameterization. Progress in Nonlinear Differential Equations and Their Applications 2005;63:157–71. [5] Surazhsky V, Surazhsky T, Kirsanov D, Gortler SJ, Hoppe H. Fast exact and approximate geodesics on meshes. ACM Transactions on Graphics 2005;24(3):553–60. [6] Sharir M, Schorr A. On shortest paths in polyhedral spaces. SIAM Journal on Computing 1986;15(1):193–215. [7] Mitchell JSB, Mount DM, Papadimitriou CH. The discrete geodesic problem. SIAM Journal on Computing 1987;16(4):647–68. [8] Chen J, Han Y. Shortest paths on a polyhedron. In: Proceedings of the sixth annual symposium on computational geometry. 1990. p. 360–9. [9] Kapoor S. Efficient computation of geodesic shortest paths. In: Proceedings of the thirty-first annual ACM symposium on theory of computing. 1999. p. 770–9. [10] Xin S, Wang G. Improving Chen & Han’s algorithm on the discrete geodesic problem [submitted for publication]. [11] Har-Peled S. Approximate shortest paths and geodesic diameter on a convex polytope in three dimensions. Discrete & Computational Geometry 1999;21(2):217–31. [12] Hershberger J, Suri S. Practical methods for approximating shortest paths on a convex polytope in R3. In: Proceedings of the sixth annual ACMSIAM symposium on discrete algorithms. 1995. p. 447–56. [13] Kanai T, Suzuki H. Approximate shortest path on polyhedral surface based on selective refinement of the discrete graph and its applications. In: Proceedings of the geometric modeling and processing 2000. 2000. p. 241. [14] Agarwal PK, Har-Peled S, Sharir M, Varadarajan KR. Approximate shortest paths on a convex polytope in three dimensions. Journal of the Association for Computing Machinery 1997;44:567–84. [15] Varadarajan KR, Agarwal PK. Approximating shortest paths on a nonconvex polyhedron. In: IEEE symposium on foundations of computer science. 1997. p. 182–91. [16] Kimmel R, Sethian J. Computing geodesic paths on manifolds. Proceedings of National Academy of Sciences 1998;95(15):8431–5. [17] Novotni M, Klein R. Computing geodesic distances on triangular meshes. In: The 10th international conference in central Europe on computer graphics, visualization and computer vision’2002. 2002. [18] Aleksandrov L, Maheshwari A, Sack J. An improved approximation algorithm for computing geometric shortest paths. In: FCT. 2003. p. 246–57. [19] Har-Peled S. Constructing approximate shortest path maps in three dimensions. SIAM Journal on Computing 1999;28(4):1182–97. [20] Mount DM. On finding shortest paths on convex polyhedra. Technical report 1495. 1984. [21] Papadimitriou CH. An algorithm for shortest-path motion in three dimensions. Information Processing Letters 1985;20:259–63. [22] Choi J, Sellen J, Yap CK. Approximate euclidean shortest paths in 3space. International Journal of Computational Geometry and Applications 1997;7(4):271–95. [23] Clarkson K. Approximation algorithms for shortest path motion planning. In: Proceedings of the nineteenth annual ACM conference on theory of computing. 1987. p. 56–65. [24] Guibas L, Hershberger J, Leven D, Sharir M, Tarjan R. Linear time algorithms for visibility and shortest path problems inside simple polygons. In: Proceedings of the second annual symposium on computational geometry. 1986. p. 1–13. [25] Martinez D, Velho L, Carvalho PC. Geodesic paths on triangular meshes. In: Proceedings of the computer graphics and image processing, XVII Brazilian symposium. 2004. p. 210–7. [26] Tan X. Fast computation of shortest watchman routes in simple polygons. Information Processing Letters 2001;77(1):27–33. [27] Dror M, Efrat A, Lubiw A, Mitchell JSB. Touring a sequence of polygons. In: Proceedings of the thirty-fifth annual ACM symposium on theory of computing. 2003. p. 473–82. [28] Mitchell JSB, Sharir M. New results on shortest paths in three dimensions. In: Proceedings of the twentieth annual symposium on computational geometry. 2004. p. 124–33. [29] Chopp DL. Some improvements of the fast marching method. SIAM Journal on Scientific Computing 2001;23(1):230–44. [30] Zigelman G, Kimmel R, Kiryati N. Texture mapping using surface flattening via multi-dimensional scaling. IEEE Transactions on Visualization and Computer Graphics 2002;8(1):198–207. [31] Zhou K, Synder J, Guo B, Shum HY. Iso-charts: stretch-driven mesh parameterization using spectral analysis. In: Proceedings of the 2004 eurographics/ACM SIGGRAPH symposium on geometry processing. 2004. p. 45–54. [32] Saust AB. A statistical investigation of the contamination of binary gravitational lens candidates by cataclysmic variables, http://www.citebase.org/abstract?id=oai:arXiv.org:astro-ph/9606101; 1996. [33] Yan J, Zhuang T. Applying improved fast marching method to endocardial boundary detection in echocardiographic images. Pattern Recognition Letters 2003;24(15):2777–84. [34] Yatziv L, Bartesaghi A, Sapiro G. O(N ) implementation of the fast marching algorithm. Journal of Computational Physics 2006;212:393–9. [35] Wang CCL. CyberTape: An interactive measurement tool on polyhedral surface. Computers & Graphics 2004;28(5):731–45. [36] Danielsson PEE, Lin Q. A modified fast marching method. In: Scandinavian conference on image analysis. 2003. p. 1154–61. [37] Telea A, Wijk JJ. An augmented fast marching method for computing skeletons and centerlines. In: Proceedings of the symposium on data visualisation 2002. 2002. p. 251–9. [38] Dijkstra EW. A note on two problems in connexion with graphs. Numerische Mathematik 1959;1:269–71.
© Copyright 2025 Paperzz