Aug 6, 2010 ... FINDING SHORTEST GENTLE PATHS by. LIAN LIU. A Thesis Submitted to. The
Hong Kong University of Science and Technology in Partial ...
FINDING SHORTEST GENTLE PATHS
by LIAN LIU
A Thesis Submitted to The Hong Kong University of Science and Technology in Partial Fulfillment of the Requirements for the Degree of Master of Philosophy in Computer Science and Engineering
August 2010, Hong Kong
c by Lian Liu 2010 Copyright
Authorization
I hereby declare that I am the sole author of the thesis.
I authorize the Hong Kong University of Science and Technology to lend this thesis to other institutions or individuals for the purpose of scholarly research.
I further authorize the Hong Kong University of Science and Technology to reproduce the thesis by photocopying or by other means, in total or in part, at the request of other institutions or individuals for the purpose of scholarly research.
LIAN LIU
ii
FINDING SHORTEST GENTLE PATHS by LIAN LIU
This is to certify that I have examined the above M.Phil. thesis and have found that it is complete and satisfactory in all respects, and that any and all revisions required by the thesis examination committee have been made.
DR. R.WONG, THESIS SUPERVISOR
PROF. M.HAMDI, HEAD OF DEPARTMENT Department of Computer Science and Engineering 6 August 2010 iii
ACKNOWLEDGMENTS First and foremost, I would like to express my sincerest gratitude to my supervisor, Dr. Raymond Wong for his guidance, support and encouragement throughout my M.Phil study. This thesis is not possible without Dr. Wong’s suggestions and efforts. Dr. Wong is like a friend who is considerate and is always willing to provide me with his generous help in both my research and daily life. He is also a very kind supervisor who understands me well and encourages me to choose the research topics that I am interested in. Dr. Wong’s kind help and sincere advice will be memorized forever in my life. I also want to say thanks to my thesis defense committee members, Prof. Dik-Lun Lee and Prof. Dit-Yan Yeung. They are both nice and intelligent professors who gave me a lot of useful suggestions and proposed interesting new models for our problem. In the past two years, I enjoyed a lot of friendship from my friends. I would like to say thanks to all the labmates and other friends who fought and played together with me in HKUST. Besides, thanks Mr. Zhiding Yu, Mr. Jin Zhong and Miss. Hui Bian, all good old friends of mine since I was in SCUT, who always stay by my side sharing happiness and tears with me along the way. I am also grateful to Ms. Connie Lau and Mr. Isaac Ma who were always so kind and patient to answer every question that I asked. Besides, I want to express my deepest appreciation to the CS system staff who kindly helped me solve many software problems. Last but not least, I want to thank my parents and girlfriend. I attribute the level of my M.Phil degree to their unfailing love and support, without which this thesis is not possible to be completed.
iv
TABLE OF CONTENTS i
Title Page
ii
Authorization Page Signature Page
iii
Acknowledgments
iv
Table of Contents
v
List of Figures
vii
List of Tables
ix x
Abstract Chapter 1
Introduction
1
1.1 Motivation
1
1.2 History and Related Work
4
1.2.1
Shortest Paths in a Graph
4
1.2.2
Shortest Paths in a Plane
5
1.2.3
Shortest Paths on a Polyhedron
6
1.2.4
k-Nearest Neighbor Search
9
1.3 Overview and Organization Chapter 2
10
Gentle Path Finding
11
2.1 Problem Definition
11
2.1.1
Concepts and Notation
11
2.1.2
Formal Definition of FSGP
12
2.2 Geometric Properties of Shortest Gentle Paths
14
2.3 Algorithm
20
2.3.1
Local SGP
21
2.3.2
Global SGP
24
2.3.3
Analysis
29
2.4 Extension to Unreachability
31 v
2.4.1
Reachability
31
2.4.2
Algorithm
33
2.5 Variants
33
2.5.1
FSGP problem in the presence of obstacles
33
2.5.2
FSGP problem under the traveling time model
34
2.5.3
Weighted SGP
36
Chapter 3
Approximate Shortest Gentle Path
3.1 Problem Definition 3.1.1
38 38
Notation
38
3.2 Path Mapping
41
3.2.1
Algorithm
41
3.2.2
Theoretical Analysis
43
3.3 Surface Simplifier
46 47
3.3.2
e Formula for △(S, S)
Algorithm Simplifier
48
3.3.3
e Efficiently How to Compute △(S, S)
48
3.3.1
3.4 Extension to Unreachability Chapter 4
Empirical Study
51 53
4.1 Real datasets
58
4.2 Synthetic datasets
59
4.3 Visualization of Experimental Results
60
Chapter 5
Conclusion
65
References
66
vi
LIST OF FIGURES 1.1
The shortest path between s and t
1
1.2
Surface shortest paths
2
1.3
Important mathematicians/computer scientists in shortest path theory
4
1.4
Shortest path query in Google Maps
5
1.5
Finding a 2D shortest path using a visibility graph
6
1.6
Triangular Irregular Networks
7
1.7
A illustration of Chen and Han’s algorithm
8
1.8
TIN refinement with Steiner points
9
2.1
The slope of a path segment and a face
11
2.2
Global SGP and local SGP
14
2.3
Illustration for the proof of Lemma 2.2.1
15
2.4
Illustration for the proof of Lemma 2.2.4
16
2.5
Illustration for the proof of Lemma 2.2.4
18
2.6
Illustration for the proof of Corollary 4
20
2.7
Local SGP in a face sequence
23
2.8
A face sequence
25
2.9
Distance lower/upper bound
26
2.10 Face sequence domination
27
2.11 Analysis of the pruning power of Alg. 4
30
2.12 FSGP problem in the presence of obstacles
34
2.13 Illustration for the proof of Lemma 2.5.1
35
2.14 Illustration of a weighted gentle path
36
3.1
A simple TIN terrain
39
3.2
Surface simplification
39
3.3
An overview of our proposed framework
39
4.1
Effect of θm (Eagle Peak where ǫ = 0.1)
54
4.2
Effect of ǫ (Eagle Peak where θm = 0.3)
55
4.3
Effect of ǫ (Eagle Peak where θm = π/2)
55
4.4
Effect of θm (Bearhead where ǫ = 0.1)
56
4.5
Effect of ǫ (Bearhead where θm = 0.3)
56
4.6
Effect of dataset size (Synthetic datasets)
57
vii
4.7
Effect of σ (Synthetic datasets)
57
4.8
Effect of dataset size (Synthetic datasets)
57
4.9
Effect of σ (Synthetic datasets)
58
4.10 Effect of θm (Bearhead where ǫ = 0.1)
61
4.11 Effect of ǫ (Bearhead where θm = 0.3)
62
4.12 Effect of θm (Eagle Peak where ǫ = 0.1)
63
4.13 Effect of ǫ (Eagle Peak where θm = 0.3)
64
viii
LIST OF TABLES 3.1
Notation table
43
4.1
Default values
54
ix
FINDING SHORTEST GENTLE PATHS by LIAN LIU Department of Computer Science and Engineering The Hong Kong University of Science and Technology
ABSTRACT Finding shortest paths is a fundamental operator in spatial databases, which has a wide range of applications to both academia and industry. Although shortest path problems in graphs and planes are well-studied, there are not much studies about finding shortest paths on terrain surfaces. Besides, only a few related studies consider the slope of paths. In this thesis, we propose an algorithm for finding slope-constrained shortest paths or simply finding shortest gentle paths on terrain surfaces. The algorithm guarantees that the slope of the path does not exceed a maximum slope value defined by users, and the length of the path is the shortest among all such paths. Since traditional surface shortest paths can be viewed as shortest gentle paths with a maximum slope value equal to π/2, our problem is more general than the traditional surface shortest path problem. Besides, in some applications where time is a critical factor, a much faster (1 + ǫ)-approximate algorithm is also proposed. The algorithms are evaluated with both real terrain data sets including Eagle Peak (Wyoming State, U.S.A) and Bearhead (Washington State, U.S.A) and synthetic data sets.
x
CHAPTER 1 INTRODUCTION 1.1 Motivation The problem of finding the shortest path between two points is a fundamental operator in spatial databases. Many spatial database research issues and its related application, such as k-Nearest Neighbor (kNN) search, Geographic Information System (GIS) and spatial data mining, rely on the efficient computation of shortest paths. In 2-dimensional (2D) space R2 , the Euclidean shortest path between two points s and t is line segment st. However, the presence of obstacles and other constraints (e.g. curvature bound) in real applications result in many interesting variants of shortest path problem. For example, in a 2D shortest path problem, we are asked to find a path p between two given points s and t. There are polygonal obstacles on the plane and the path is not allowed to intersect with them, so the shortest path p may consist of several line segments. For example, in Fig. 1.1, the shortest path between s and t in the presence of obstacles consists of four line segments.
t
s
Figure 1.1: The shortest path between s and t Nowadays, the development of computer hardware technology has made it possible to store and manipulate 3D spatial data. And consequently, shortest path problem in general 3D spaces attracts a lot of attention from both academia and industry. However, shortest path problem in a general 3D space (i.e., finding the shortest path between two given points s and t in R3 in the presence of polyhedral obstacles) is proved to be NPhard [1]. Fortunately, only a few real applications require the computation of general 1
3D shortest paths. Instead, researchers began focusing on a more applicable special case of this problem, namely the surface shortest path problem which is also known as the 2.5D shortest path problem. In this problem, we are given a polyhedral surface S together with two points s and t on S. We are asked to find the shortest path p between s and t such that p lies completely on S. Figure 1.2(a) illustrates this problem. In this figure, ps is the surface shortest path between s and t while pe is the Euclidean shortest path. The surface shortest path problem is receiving more and more attention since it is well-motivated and it has a wide range of applications. They are widely used in terrain navigation and road planning. Besides, surface shortest paths are used in other research areas. For example, in computer graphics, the geometric properties of surface shortest paths can be exploited for mesh cutting and editting [27]. Also, shortest path is important for robot motion planning in artificial intelligence area. Besides, zoologists exploit surface shortest paths to study the patterns of wildlife movement.
t pe
s ps
(a)
(b)
Figure 1.2: Surface shortest paths
A potential drawback of surface shortest paths is that the slope factor is ignored. A path with a large slope might be too steep and thus it is difficult for people to travel. Consider Figure 1.2(b) where s and t are two points on the surface. Path p1 corresponds to the shortest path from s to t. Note that p1 involves a steep route from s to the top of the mountain and it is difficult for people to travel via a steep route. However, path p2 and path p3 are smoother and do not involve any steep route. We say that these two paths satisfy the slope requirement. We define a slope parameter θm ∈ [0, π/2] to denote whether a path is steep. Intuitively, if θm is set to 0, then the path must be flat
without any inclination. If θm is π/2, then the path can have any inclination. Different applications have different values of θm . For example, the steepest road in UK (which 2
is in Ffordd Penllech, Harlech) has a slope of 0.331 (in radian) (i.e., 19.0o ) and the steepest non-rack railway in Portugal has a slope of 0.13 (in radian) (i.e., 7.69o ) [23]. Informally speaking, given a slope parameter θm , a path p is said to satisfy the slope requirement if the slope of path p is at most θm . We will give a formal definition for the slope of a path later in Section 2.1. We also call the path satisfying the slope requirement the gentle path. In Figure 1.2(b), path p2 and path p3 are gentle but path p1 is not. In the following, we study the following problem. Given a source point s and a destination point t on the surface, we want to find the shortest gentle path (SGP) from s to t on the surface. We call this problem finding shortest gentle paths (FSGP). Note that problem FSGP is more general than the traditional problem of finding shortest path on the surface adopted in the literature [2, 9, 8, 25, 28] (which does not consider any slope requirement). This is because, when θm is set to π/2, there is no slope requirement. Then, problem FSGP becomes the traditional surface shortest path problem. In this thesis, we propose an algorithm for finding shortest paths. The algorithm was tested with real terrain data and the results show that our algorithm is efficient for real data. However, it is expected that finding an accurate SGP is still costly. In our experiment on the real terrain dataset of Bearhead area in Washington State, if we set θm = 0.3, we found that an algorithm for problem FSGP took more than 2 hours to find the shortest gentle path of length about 7km. It is expected that finding the shortest gentle path between two distant points on a larger surface takes much longer time (e.g., more than 1 day). In many applications, time is a critical factor. One example is some emergency situations (e.g., natural disaster). Quick evacuations in a natural disaster are needed as in the Australian fires in Feb 2009 and the Californian fires in Oct 2007. Besides, in a large-scale natural disaster such as the earthquake in China in May 2008, distributing relief supplies and rescuing are time-critical. In view of this, we also propose a (1 + ǫ)-approximate algorithm to solve this problem, where ǫ is the distance error parameter. That is, given any ǫ ≥ 0, the length
of the path p found by the approximate algorithm should be bounded by ǫ. That is, |p| ≤ (1 + ǫ)|po |, where po is the optimal path, and |p| (|po |) denotes the length of p
(po ). If we set θm = π/2 and ǫ = 0.1, the approximate algorithm will be 202 times faster than the accurate one.
3
1.2 History and Related Work 1.2.1 Shortest Paths in a Graph Shortest path and its generalizations have a voluminous research literature and a long history. The earliest reference to the problems of this form could be dated back to Leonhard Euler (Fig. 1.3(a)) in the 1700’s, who is regarded as the father of graph theory. His famous “K¨onigsberg bridge” problem is often regarded as the starting point of modern graph path finding.
(a) Leonhard Euler (1707-1783) (b) Edsger Dijkstra (1930-2002)
(c) Robert Floyd (1936-2001)
Figure 1.3: Important mathematicians/computer scientists in shortest path theory
The first formal graph shortest path algorithm was proposed by Dijkstra (Fig. 1.3(b)) in 1959 [10]. Dijkstra’s Algorithm was the computationally most efficient procedure till then. Given one initial node, Dijkstra’s Algorithm finds the shortest path from this node to all rest nodes in the graph. The original implementation of the algorithm runs in O(n2 ) time, where n is the number of nodes in the graph. Dijkstra’s Algorithm is regarded as one of the most important algorithms in computer science because it provides not merely a way for finding graph shortest paths, but also a general framework that can be adopted to solve other types of shortest path problems. One of such examples is the “continous Dijkstra” algorithm [20], which extends the framework for computing surface shortest paths. In 1962, Floyd (Fig. 1.3(c)) proposed the famous Floyd-Warshall algorithm that solves all-pairs shortest path problem in O(n3 ) time [12]. Graph shortest paths have a great variaty of applications. For instance, in real-world applications, road networks in cities are often modeled as graphs and stored in spatial 4
databases. The result of shortest path queries shows how to get to one place from another with the minimum time cost. Such examples are “Google Maps” (Fig. 1.4) and Microsoft “Bing Maps”.
Figure 1.4: Shortest path query in Google Maps
1.2.2 Shortest Paths in a Plane By the end of the 1970’s, researchers began to think about the problem of finding a path in a 2D plane in the presence of polygonal obstables, as illustrated in Fig. 1.1. This problem can be regarded as an application of graph shortest path technology. It can be solved in O(n2 log n) time by constructing a visibility graph [17, 18], where n is the total number of vertices of the obstacles. Here Fig. 1.5 gives us an illustration of these approaches. In the visibility graph, the source point s, the destination point t and the vertices of the obstacles are regarded as the nodes of the graph. And for each pair of nodes that are visible to each other, we create an edge between them, whose weight is the distance between them (see Fig. 1.5(a) and 1.5(b)). After that, we compute the shortest path between s and t using existing graph shortest path algorithms in the visibility grpah (see Fig. 1.5(c)), and finally we get the path for the original problem (see Fig. 1.5(d)). The state-of-the-art for solving this problem is proposed by John Hershberger et al. [13], which solves the problem in O(n log n) time with O(n log n) space, which was proved to be optimal. This problem has a few variants. For example, as proposed in [19], different regions of the plane might be assigned with different weights, since the cost in different 5
ts
s (a) Original problem
s
t (b) Construct the visibility graph
ts (c) Find the shortest path in the graph
t (d) The result of the original problem
Figure 1.5: Finding a 2D shortest path using a visibility graph
regions might be different. And then, the problem becomes a weighted 2D shortest path problem. Another variant is the anisotropy 2D shortest path problem, as discussed in [3], where the plane is divided into several anisotropic regions. That is, in each region, moving in different directions leads to different cost. 2D shortest paths are often used for robot motion planning, where the shortest path tells the robot how to get to one place without any collision in the presence of obstacles.
1.2.3 Shortest Paths on a Polyhedron The problem of finding shortest paths on a surface was first studied in the middle of the 1980’s. It is impossible for computers to store and manipulate continuous surfaces, since even in a smaller region of continuous surface, there are an infinite number of data points. As a trade-off, in spatial databases, surfaces are usually stored as triangular meshes, or more formally, Triangular Irregular Networks (TIN). In TIN model, the vertices of the mesh is picked from real spatial data. The vertices are then triangulated [6] to form a surface, as illustrated in Fig. 1.6. The number of vertices picked from real data depends on the accuracy requirement and the storage. If we pick more data points from real data, we will get a more accurate TIN surface, while the storage will consequently be larger, as shown in Fig. 1.6(b); And if we pick fewer data points, we 6
will need a smaller storage, but the TIN surface will be less accurate, as shown in Fig. 1.6(c). Although the algorithms proposed in this thesis can be adopted to any types of surfaces, we focus mainly on a special type of surface, the terrain. Given a surface, if any vertical line intersects it at no more than one point. Terrains are widely used to describe land surfaces.
(a) A continuous surface
(b) A TIN surface with more data (c) A TIN surface with less data points points
Figure 1.6: Triangular Irregular Networks
It was first proposed in [26], where an O(n3 log n) algorithm was given for computing shortest paths on the surface of a convex polyhedra. Here n is the number of faces in the surface. For the nonconvex case, [22] gave an O(n5 ) algorithm. The algorithm proposed in [20] by Mitchell et al. is regarded as an important contribution to this problem. In this approach, they extended the framework of Dijkstra’s Algorithm to solve the more general shortest path problem on the surface of a (possibly) nonconvex polyhedra, which they called continuous Dijkstra’s Algorithm. Here the term “continuous” implies the continuous nature of a surface, which is totally different from graphs, which are formed by discrete nodes and edges. Although surfaces are continuous, shortest paths can be computed in a similar way as in graphs. The idea is picking out some “event points” from the surface, and then, the problem can be similarly solved using discrete methods. The “event points” consist of vertices of the TIN surface and some special points that satisfy certain requirements on the edges of the TIN surface. The algorithm runs in O(n2 log n) time and this work is the best example that shows us how to extend Dijkstra’s framework to solve other types of shortest path problems. The current fastest shortest path algorithm for both convex and nonconvex surfaces was proposed by Chen and Han in [2], which runs in O(n2 ) time. Instead of transforming the continuous problem into a discrete problem as [20], they focus mainly on face 7
sequences. A face sequence is an ordered set of faces, denoted by F = (f1 , f2 , . . . , fn ). Any path from s to t must pass through a face sequence that connects s and t. For example, in Fig. 1.7(a), the path passes through the face sequence ξ = (f1 , f3 , f5 , f6 ). The main idea of Chen and Han’s algorithm is to construct a face sequence tree, which contains all possible face sequences that connects s and t in a breadth-first manner. Take the problem in Fig. 1.7(a) for example. Its corresponding sequence tree is shown in Fig. 1.7(b). And then, for each face sequence, we compute the shortest path that pass through that face sequence. And finally, we select the shortest one. To prevent the sequence tree from expanding exponentially, a theorem called “one angle one split” was proved. This theorem is used to prune branches in the sequence tree which are impossible to be passed through by a shortest path. They proved that after pruning, the size of the tree will be bounded by O(n2 ). f5 f2
t
f7
f4 f2
f1
f5
s
f1
f7
s
f6
f6
f4
f3
f5
f6 f4
f7
f3 f2
(a) Original problem
(b) Face sequence tree
Figure 1.7: A illustration of Chen and Han’s algorithm
There are a few approximate algorithms [14, 16] for this problem. These approaches recursively insert Steiner points into the TIN surface and then the network distance is used to approximate the surface distance. Take Fig. 1.8 as an example. In the original surface shown in Fig. 1.8(a), the path p1 = (sv, vt) is originally used as the approximate surface shortest path between s and t. After inserting Steiner points a-e as shown in Fig. 1.8(b), we will have a refined path network and the new network shortest path p2 = (se, et) will be used as the new approximate surface shortest path. Obviously, the more Steiner points we insert, the more accurate the path will be, but it also consequently makes the network more complex. Since these approximate algorithms are all based on network refinement, they do not consider the slope requirement, so they cannot be applied to our shortest gentle path problem. Besides, these approaches 8
cannot deal with the case when ǫ = 0. This is because when ǫ = 0, we must insert an infinite number of Steiner points into the surface, which is impractical.
v a
a
c e
ts
s
ts d
b (a) Original surface
c e
(b) Insert Steiner points
t b
d
(c) New shortest path
Figure 1.8: TIN refinement with Steiner points
There are several variants of this problem too. For example, as proposed in [16], each face of the surface might be assigned a certain weight and then the problem becomes a weighted surface shortest path problem. Besides, the problem could be similarly generalized into an anisotropy surface shortest path problem, which was studied in [21, 15].
1.2.4 k-Nearest Neighbor Search In the context of terrain, finding shortest paths is also involved in other spatial queries [7, 8, 25, 28]. One example is surface k-Nearest Neighbor (skNN) queries, which were first studied by [7, 8]. [8] propose a filter and refinement strategy for this kind of queries. In this paper, surfaces are stored in different resolutions, or more formally, different Levels Of Details (LOD), as illustrated in Fig. 1.6. Besides, the paper introduced methods to get the surface distance lower/upper bounds for any pair of points on that surface. Obviously, in higher resolutions, the distance lower/upper bounds are more accurate, but they also require more computation time. Beginning with the lowest resolution, the algorithm recursively refines the surface, until the nearest neighbors are finally determined. However, as pointed out by [25], the results returned by this strategy [7, 8] are not guaranteed to be correct. Motivated by this observation, [25] proposes an approach based on the Voronoi diagram for the skNN queries and guarantees that the results returned are correct. Another example of spatial queries related to finding shortest paths is continuous skNN queries which were proposed recently by [28]. [28] studies to find the k nearest neighbors when the objects on the surface are moving. 9
1.3 Overview and Organization The thesis is organized as follows: In the following chapter, we formalize our FSGP problem and present an algorithm for finding accurate shortest gentle paths on a terrain. In Chapter 3, a (1 + ǫ)-approximate algorithm for the same problem is proposed. In Chapter 4, both the accurate shortest gentle path algorithm and the approximate shortest gentle path algorithm will be evaluated with both real data and synthetic data empirically. The results of the empirical evaluation will also be presented at the end of this chapter. In the end, in Chapter 5, we will give a summary of our work and some suggestions about future work.
10
CHAPTER 2 GENTLE PATH FINDING In this chapter, we present two algorithms for finding shortest gentle paths on terrain surfaces. The former is based on a naive breadth-first search, and the latter accelerates the former by introducing pruning techniques and new termination conditions. Given a surface with n faces, our algorithms find the shortest gentle path between two given points s and t in O(n2n +T (n)·2n) time where T (n) is the cost of solving a constrained programming with n variables. The storage requirement is O(n2n ).
2.1 Problem Definition 2.1.1 Concepts and Notation In the 3D space, each point u has an x-coordinate, a y-coordinate and a z-coordinate, denoted by u.x, u.y and u.z, respectively. u.z corresponds to the elevation of point u. Given two different points u and v in 3D space, the line segment between them is denoted by uv, and its length is represented by |uv|. As we will prove later in
Section 2.2, any shortest gentle path p can be represented by a sequence, or more formally, an ordered set of line segments. In this paper, we use a pair of angle brackets (i.e., “”) to denote a sequence (ordered set). So given a path p, it can be written as the line segment sequence < p1 , p2 , . . . , pn >, where each pi (1 ≤ i ≤ n) is a line segment. We call these line segments path segments of p. Similarly, we use |p| to P denote the length of path p. Obviously, |p| = ni=1 |pi|. Given a point u, if u is along any one of the path segments of p, we write u ∈ p.
fi pi q pi
f(fi)
H
(a) Slope of a line
(b) Slope of a face
Figure 2.1: The slope of a path segment and a face 11
H
Let S be the surface of the query terrain, which is represented by the TIN model. S consists of a set of disjoint triangular faces. Sometimes, a face is also referred to as a triangle. In the following, we use term “triangle” and term “face” interchangeably. Each face is represented by three corners called vertices and three line segments connecting these three corners called edges. Note that each vertex is also a point in a three-dimensional space. In this paper, a face is denoted by f , an edge is denoted by e and a vertex is denoted by v. To distinguish different faces, a subscript may be appended. For example, fi represents the i-th face. We denote the set of all faces of S by S.F , the set of all vertices by S.V and the set of all edges by S.E. If a point u is on S, we write u ∈ S. Similarly, if point v is a vertex of a face of S, we write v ∈ S.V . Accordingly, if f (resp. e) is one face (resp. edge) of S, we write f ∈ S.F
(resp. e ∈ S.E). And let H be a (virtual) horizontal plane located at the sea level of the terrain. We define the z-coordinate of each point on plane H to be 0.
Consider a line segment pi on the surface. We define the slope of pi to be the acute angle (in radian) between pi and the horizontal plane H, denoted by θ(pi ). Fig. 2.1a shows that the slope of line segment pi is equal to θ. The slope of a path p is defined as the greatest slope of all path segments of a path. The slope of a face fi , denoted by φ(fi ), is defined to be the angle (in radian) (or formally the dihedral angle) between the plane covering face fi and the horizontal plane H. Fig. 2.1b shows that the slope of face fi is equal to φ(fi ). An important concept we will frequently refer to is face sequence. A face sequence is an ordered face set, denoted by ξ =< f1 , f2 , . . . , fm >, where face fi and face fi+1 (1 ≤ i ≤ m − 1) share a common edge ei . Face sequence ξ is said to be simple, if no face appear more than once in that sequence.
2.1.2 Formal Definition of FSGP Let Ssub be a sub-surface of S. Formally, Ssub .F ⊆ S.F . Given a path p, we say that p lies completely on Ssub if for every point u ∈ p, we know that u ∈ Ssub . We say that
Ssub is connected if there exists an arbitrary path p between any two points on Ssub and p lies completely on Ssub. In this paper, we define a gentle path (GP) and a shortest gentle path (SGP) as
follows: 12
Definition 2.1.1 (Gentle Path) Let Ssub be a connected sub-surface of S. Given a source point s ∈ Ssub , a destination point t ∈ Ssub and a maximum slope θm (in
radian), we say that path p is the gentle path from s to t on Ssub if and only if: 1. p lies completely on Ssub ;
2. The slope of path p is ≤ θm . That is, if p =< p1 , p2 , . . . , pn >, then max θ(pi ) ≤ θm i ∈ [1, n].
Definition 2.1.2 (Shortest Gentle Path) Let Ssub be a connected sub-surface of S. Given a source point s ∈ Ssub , a destination point t ∈ Ssub and a maximum slope
θm (in radian), we say that path p is the shortest gentle path from s to t in Ssub if and only if: 1. p is a gentle path from s to t in Ssub ;
2. There does not exist another gentle path p′ from s to t in Ssub , such that |p′ | < |p|. In this paper, the gentle path is denoted by gp(s, t, θm |Ssub), and the shortest gentle
path is denoted by sgp(s, t, θm |Ssub). Take Fig. 1.2(b) for illustration, p2 is the shortest
gentle path between s and t, while p3 is a gentle path, but is not the shortest one. In the
special case that Ssub is a face sequence ξ, informally, we say that ξ is passed through by sgp(s, t, θm |ξ). When Ssub .F is a proper sub-set of S.F (i.e., Ssub .F $ S.F ), we say that the path is a local shortest gentle path on Ssub . When Ssub.F = S.F , the gentle path is the shortest among all gentle paths in the whole surface S, which is called a global shortest gentle path. Fig. 2.2 shows us the difference between a local shortest path and a global shortest gentle path. In this figure, Ssub = ξ, which is a face sequence in S. The path pl = sgp(s, t, θm |ξ) (in solid line) is a local shortest gentle path, while the path pg = sgp(s, t, θm |S) (in dashed line) is a global shortest gentle path.
The goal of our problem is to find the global shortest gentle path. So, our problem of finging shortest gentle paths (FSGP) can be formalized as follows: Problem 1 (FSGP) Given a terrain surface S, a source point s ∈ S.V , a destination point t ∈ S.V , and a maximum slope value θm , find sgp(s, t, θm |S) 13
S t
pg = sgp(s, t, θm|S)
ξ pl = sgp(s, t, θm|ξ)
s
Figure 2.2: Global SGP and local SGP When θm = π/2, the problem becomes the conventional surface shortest path problem. We use sp(s, t|S) to denote the conventional surface shortest path between s and t in S. Obviously, sp(s, t|S) = sgp(s, t, π/2|S). For simplicity, sometimes we use a single letter p to denote the path if s, t, θm and S are known from the context. A natural question may be raised for problem FSGP: Does there exist a gentle path from a given source point s to a given destination t on the surface? For the sake of clarify, we first assume that there exists a gentle path from any source to any destination. In Section 2.4, we will describe how we relax this assumption.
2.2 Geometric Properties of Shortest Gentle Paths In this section, we consider the geometric properties of shortest gentle paths. First of all, we prove that shortest gentle paths can always be represented as a sequence (i.e., ordered set) of line segments, which is stated in Lemma 2.2.1. Lemma 2.2.1 Any shortest gentle path p is formed by a sequence of line segments lying on the surface. That is, p can always be written as p =< p1 , p2 , . . . , pn >, where pi (1 ≤ i ≤ n) is a line segment. Proof: Let p be the shortest gentle path between s and t on surface S. Assume that Theorem 2.2.1 is untrue. Then, we can always find two points a and b in p, such that the 14
p
b ~t m
fi
a
Figure 2.3: Illustration for the proof of Lemma 2.2.1 path segment between a and b is a continuous and differentiable curve, as illustrated in Fig. 2.3. From Mean Value Theorem, we know that there always exists a point m on p between a and b, such that the tangent of p at m is parallel with line segment ab. As illustrated in Fig. 2.3, vector ~t is the tangent vector at m, which is parallel with ab. Since p is the shortest gentle path, so the slope of ~t must be no greater than θm , because otherwise, p violates the slope constraint at point m. And since ab k ~t, so the
slope of ab is also no greater than θm . So, we can replace the path segment between
a and b by line segment ab, and p will be shorter than before, which contradicts with the assumption that p is the shortest gentle path. As a result, p is always formed by a sequence of line segments. From the definitions of gentle paths and shortest gentle paths, we directly know that for the same θm value, the length of the shortest gentle path between two given points is always shorter than or equal to the length of the gentle path. Besides, given a certain pair of s and t, it is obvious that a local shortest gentle path between them cannot be shorter than the global shortest path. This observation is formalized in Lemma 2.2.2. Lemma 2.2.2 Let S be the query surface, and let Ssub be a connected sub-surface of S. For any certain pair of s and t and any θm value, |sgp(s, t, θm|Ssub )| ≥ |sgp(s, t, θm |S)|.
Proof: Since Ssub is a sub-surface of S, any path that lies completely in Ssub must also lie completely in S. If |sgp(s, t, θm |Ssub)| < |sgp(s, t, θm |S)|, then according 15
to Definition 2.1.2, sgp(s, t, θm|S) cannot be the global shortest gentle path, which contradicts with the precondition. The next lemma shows how the length of the shortest gentle path changes with θm . ′ Lemma 2.2.3 Given source s and destination t on surface S. Let θm and θm be two ′ ′ maximum slope values and θm < θm , then |sgp(s, t, θm |S)| ≥ |sgp(s, t, θm |S)|. ′ Proof: Since θm < θm , the shortest gentle path sgp(s, t, θm|S) can always be
′ regarded as a gentle path of maximum slope θm . Since a normal gentle path cannot be ′ shorter than the shortest gentle path, sgp(s, t, θm|S)| ≥ |sgp(s, t, θm |S)|.
As a corollary, for the same pair of s and t, the length of shortest gentle path is always longer than or equal to the length of the shortest path. Corollary 1 Given source s and destination t on surface S. Given maximum slope θm ≤ π/2, then |sgp(s, t, θm|S)| ≥ |sp(s, t|S)|. Now let us consider the geometric properties of shortest gentle paths between two points on a single face. We prove that the length of shortest gentle paths on a single face satisfy the following lemma: Lemma 2.2.4 Let a and b be two points on the same face f , and θm be the maximum slope. The length of the shortest gentle path between a and b is: |sgp(a, b, θm |f )| = |ab| ·
sin (max{θ(ab), θm }) sin θm
f
pi'
qi'
a
b d b
qm
qm
e c c
qm
g e
H
Figure 2.4: Illustration for the proof of Lemma 2.2.4 16
Proof: Consider two cases. Case 1: θ(ab) ≤ θm . Since ab satisfies the slope requirement, the shortest path
from a to b is the line segment ab. Thus, the length is |ab|·sin (max{θ(ab), θm })/sin θm =
|ab|.
Case 2: θ(ab) > θm . Consider a line segment ab from a to b on face f as shown in Fig. 2.4. Since θ(ab) > θm , the path ab does not satisfy the slope constraint, we need to find a sequence of line segments from a to b such that each segment satisfies the slope constraint. Consider the following two sub-cases: Case 2(a): There exists a point c ∈ f , such that the slopes of both segments ac and
cb are equal to θm (as shown in Fig. 2.4). Notice that < ac, cb > is a gentle path of maximum slope θm between a and b on face f . From the face that a normal gentle path cannot be shorter than the shortest gentle path, we have
|sgp(a, b, θm |f )| ≤ |ac| + |cb|
(2.1)
Let H be the horizontal plane passing through a. Extend ac to e, such that |ce| =
|cb|. So,
|ae| = |ac| = |cb|
(2.2)
Create imaginary line segments bb⊥H, cc⊥H, ee⊥H, cd⊥bb and cg⊥ee, as shown in Fig. 2.4. It is clear that △cbd ∼ = △ceg, and hence |eg| = |bd|. Besides, |ge| = |cc| = |db|. And consequently, |ee| = |bb|. In other words,
|ae| · sin θm = |ab| · sin θ(ab)
(2.3)
Combine Equations 2.1, 2.2 and 2.3, we get
|sgp(a, b, θm|f )| ≤ |ab| ·
sin θ(ab) sin θm
(2.4)
However, sgp(a, b, θm |f ) cannot be shorter than |ab| · sin θ(ab)/sin θm . Consider
the evolution difference between a and b. Without loss of generality, assume b.z > a.z, so 17
b.z − a.z = |ab| · sin θ(ab) If |sgp(a, b, θm |f )| < |ab| ·
(2.5)
sin θ(ab) , then sin θm
b.z − a.z = |sgp(a, b, θm |f )| · sin θm < |ab| ·
sin θ(ab) · sin θm sin θm
(2.6)
= ab · sin θ(ab) Equation 2.5 and Equation 2.6 contradicts with each other, which proves that sgp(a, b, θm |f )
cannot be shorter than |ab| · sin θ(ab)/sin θm . So,
|sgp(a, b, θm|f )| ≥ |ab| ·
sin θ(ab) sin θm
(2.7)
Combine Equations 2.4 and 2.7, we get |sgp(a, b, θm |f )| = |ab|·sin (max{θ(ab), θm })/sin θm .
b
b f c1
p′i
c2
c1
pi
c2
pi
f c2
m
m a
a (a)
b f
c1
(b)
a (c)
Figure 2.5: Illustration for the proof of Lemma 2.2.4
Case 2(b): There does not exist a point c ∈ f such that θ(ac) = θ(cb) = θm . In
this case, when we try to find a point c in f as Case 2(a), we find that c lies out of f , as shown in Fig. 2.5(a). We can solve this problem by chopping the original path ab into two equal sub-path segments am and mb, as illustrated in Fig. 2.5(b). For each sub-path segment, try to replace it with two segments with slope θm . If Case 2(b) happens again for either of the two sub-path segments, we chop it into two equal sub-path segments again. We do this recursively, until we finally replace ab with a sequence of line segments < ac1 , c1 c2 , . . . , cn b >, as illustrated in Fig. 2.5. Thus, it is easy to verify that |ab| · sin (max{θ(ab), θm })/sin θm . 18
As we can see, if a path segment does not satisfy the slope requirement in a given face, we can replace it with a sequence of path segments that satisfies the slope constraint. We call this procedure path adjusting. In Section 2.3, we present the details of this procedure. Take Fig. 2.5(a) for example, given a path segment p′i = ab in face f , path adjusting works as follows: (1) If the slope of p′i ≤ θm , path adjusting returns
pi = p′i ; (2) If the slope of p′i > θm , path adjusting returns the sequence of path segments pi =< ac1 , c1 c2 , . . . , cn−1 cn , cn b >. The slope of each segment in pi is equal to θm , and |pi| = |p′i | · sin θ(p′i )/ sin θm . We call pi the adjusted path segment of p′i
denoted by adj(p′i ), and |pi | is called the adjusted length of p′i . Path adjusting can also
be applied to a whole path. Given a path p′ =< p′1 , p′2 , . . . , p′n >, path adjusting returns
path p =< p1 , p2 , . . . , pn >, where pi is the adjusted path segment of p′i (1 ≤ i ≤ n). p
is called the adjusted path of p′ , denoted adj(p′ ), and |p| is called the adjusted length of p′ .
As a corollary of Equations 2.4 and 2.7, we know that if s and t are on the same face, the global shortest gentle path between them can be found inside the face. In other words, there is no need to search the whole surface for the global shortest gentle path. Corollary 2 Given two points s and t on the same face f and a maximum slope θm , |sgp(s, t, θm |S)| = |sgp(s, t, θm|f )| = |adj(st)| = |st| · sin (max{θ(st), θm })/sin θm .
Also, in Fig. 2.5(b), actually, the segment ab can be arbitrarily chopped into two parts (not necessary be two equal parts). So, the resulting adjusted path may not be unique. Take Fig. 2.5(b) and 2.5(b) for example. In the former figure, ab is chopped into two equal parts, while in latter, the two parts are not the same in length. And as a result, the resulting adjusted paths are not the same. Corollary 3 Given two points s and t in S and a maximum slope θm , the shortest gentle path between s and t may not be unique. The following is another important corollary of Lemma 2.2.4: Corollary 4 For any shortest gentle path p, if the face sequence ξ passed through by p is not simple, we can always find another shortest gentle path p′ , such that the face sequence ξ ′ passed through by p′ is simple and |p′ | = |p|. 19
Proof: Consider the shortest gentle path p between s and t in Fig. 2.6 (solid line). p passes through face f twice, and thus the face sequence passed through by p is not simple. Let a and b be the first/last intersection point between p and f , respectively (Fig. 2.6). Since p is the global shortest path, so the path segment of p between a and b must be the global shortest path between a and b too. From Corollary 4, we can replace this path segment with adj(ab) (dash line) without changing the length of the path. And now, p passes through f only once. Following this method, we can finally replace p with a path of the same length, which passes through a simple face sequence.
s a
S f
p c
b
t
Figure 2.6: Illustration for the proof of Corollary 4 Corollaries 3 and 4 imply that given a pair of points, there might be multiple shortest gentle paths between them, some of which pass through simple face sequences while the rest pass through non-simple face sequences. However, their lengths are the same. In this paper, to make our algorithm much faster, we only focus on finding the shortest gentle paths that pass through simple face sequences.
2.3 Algorithm In this section, we will discuss about the algorithm for the FSGP problem. We will first begin with the local FSGP problem for a face and then for a face sequence. And finally, we will make use of these algorithms to solve the more general global FSGP problem.
20
2.3.1 Local SGP Local SGP in one face In previous sections, we described a method for finding the shortest gentle path between a pair of points a and b on the same face f . Given a path segment which does not satisfy the slope constraint, we can replace it with a sequence of line segments that satisfy the slope constraint. We call this procedure path adjusting. If θ(ab) ≤ θm , then ab is the shortest gentle path, there is no need to adjust the path; Otherwise, we will try to adjust ab by replacing it with a zig-zag line segment sequence. In this case, it is easy to find two points c1 and c2 on the plane covering f using geometric formulas such that θ(ac) = θ(cb) = θm . If either of c1 and c2 lies inside the face, as shown in Fig. 2.4, then the zig-zag path is found; otherwise, if both c1 and c2 lie outside f on the plane (Fig. 2.5(a)), we need to chop ab into smaller segments. As illustrated in Fig. 2.5(b), c1 and c2 are both outside f , then we break ab into two equal parts and then adjust each part. Algorithm 1 adj(a, b, θm , f ) 1: /*Find the SGP between a and b on a single face f */ 2: p = ab 3: if θ(ab) ≤ θm then 4: return p 5: else 6: let c1 and c2 be the two points on f ’s plane such that θ(ac1 ) = θ(c1 b) = θm and θ(ac2 ) = θ(c2 b) = θm 7: if c1 (or c2 ) lies inside f then 8: p =< ac1 , c1 b > (or p =< ac2 , c2 b >) 9: return p 10: else 11: chop p into two equal segments am and mb 12: return adj(a, m, θm , f ) ∪ adj(m, b, θm , f ) In in this algorithm, in Line 11, symbol “∪” means joining two sequences into one sequence. Note that Algorithm 1 must terminate, though there is a recursive call at Line 11. It is clear that when the segment ab gets smaller, c1 and c2 will get closer to ab. So Algorithm 1 will finally terminate. Lemma 2.3.1 Algorithm 1 always terminates.
21
Local SGP in a face sequence Let us consider how to find the shortest path in a given face sequence. As shown in Fig. 2.7, let p be the shortest gentle path from s to t in ξ. As proved in Lemma 2.2.4, we only need to consider the case that ξ is simple. Let a1 , a2 , . . . , am be the intersection points between p and the edges of the faces in ξ (Fig. 2.7). For convenience, let point a0 be s and am+1 be t. Then, p can be written as p =< adj(a0 a1 ), adj(a1 a2 ), . . . , adj(am am+1 ) > (Recall that adj(ai ai+1 ) is the adjusted path segment of ai ai+1 , which can be computed using Algorithm 1). So, the length of the path can be written as a non-linear function as follows:
|p| = =
m X
|adj(ai ai+1 )|
m X
sin(max{θ(ai ai+1 ), θm }) |ai ai+1 | · sin θm
i=0
i=0
(2.8)
Let vi and vi′ be the left/right endpoint of the edge where ai is along the edge (seeFig. 2.7). The coordinates of ai can be represented using only one variable, provided that we know that ai is along the edge. That is, let xi ∈ [0, 1] be a variable. Then,
ai .x = vi .x + (vi′ .x − vi .x) · xi . And similarly, we have the equations for ai .y and ai .z.
More generally, let E (resp. E′ ) be a (m + 1) × 3 matrix, where the i-th row is the x,
y and z-coordinate of vi (resp. vi′ ), respectively. And let x be a (m + 1) × 1 vector, where each element of x is in the interval [0, 1]. Then, Equation 2.8 can be written as
an objective function with variable x:
|p| = f (x, E, E′, θm )
(2.9)
In order to find the shortest gentle path, we need to find the vector xo such that Function 2.9 is minimized. In other words, this is a constrained programming problem. There are many studies on constrained optimization. We can choose any constrained optimizer in our algorithm. For example, in [11], the authors proposed a shuffled complex evolution (SCE) approach to solve large-scale constrained programming problems. This approach took advantages of both probabilistic and deterministic approaches to make it effective and efficient for finding the global minima of a given constrained function. And in [5, 4], the authors proposed a trust region approach to 22
t vi′
fi+4
ai vi
fi
a2
p
a1 f1
ξ s
Figure 2.7: Local SGP in a face sequence find the minima of a large-scale constrained function with simple inequality bounds on the variables. Both of the two approaches have been applied to mathematical software. For example, Mathematica uses the former as the background algorithm for the “Minimize” function. And MATLAB uses the latter for the “fmincon” function. In our experiments, we call the MATLAB optimizer from our C++ program using the interface provided by MATLAB. Algorithm 2 sgp(s, t, θm, ξ) 1: /*Find the SGP between s and t on a simple face sequence ξ that consists of m faces, where s ∈ f1 and t ∈ fm */ 2: p = ∅ 3: Find the vector xo such that Function 2.9 is minimized 4: for i = 0 to m do 5: ai = vi + (vi′ − vi ) · xo (i) ′ 6: ai+1 = vi+1 + (vi+1 − vi+1 ) · xo (i + 1) 7: p = p ∪ adj(ai , ai+1 , θm , fi ) 8: return p Note that although the objective function is not necessary to be differentiable in [11, 5], in order to speed up our algorithm, we replace some non-differentiable functions in Function 2.9 with differentiable ones. For example, the absolute value function y = |x| √ is replaced by y = x2 + c, where c > 0 is a very small constant. Similarly, the max function y = max{x1 , x2 } is replaced by tx1 + (1 − t)x2 , where t = arctan[C(x1 −
x2 )]/π + 0.5 and C is a very large constant. Since c can be arbitrarily small and C can be arbitrarily large, the accuracy of our algorithm is not affected. 23
Generally speaking, constrained programming can be extremely difficult [11]. However, considering the properties of our objective function (Equation 2.9), our algorithm is actually very fast even for very large problems. Firstly, the bounds on variables in our problem is simple. We have only lower bound and upper bound on the variables, which is a necessary requirement for using the trust region method proposed in [5]. Secondly, [5] runs efficiently if the Hessian matrix of the objective function is sparse. Consider the Hessian matrix of Function 2.9 as follows:
∂2f ∂x2 1 ∂2f ∂x ∂x 1 2 H(f ) = .. . ∂2f ∂x1 ∂xm
∂2f ∂x1 ∂x2
···
∂2f ∂x22
···
.. .
..
.
∂2f ··· ∂x2 ∂xm
∂2f ∂x1 ∂xm 2 ∂ f ∂x2 ∂xm .. . 2 ∂ f ∂x2m
(2.10)
It is easy to prove that H is an (m + 1) × (m + 1) tridiagonal matrix containing
only 3m + 1 non-zero elements, which is very sparse. Thus, some techniques such as [5] which run efficiently when the matrix is sparse can be used in our problem.
2.3.2 Global SGP We are given a face sequence ξ =< f1 , f2 , . . . , fm > where s ∈ f1 . Let ei (1 ≤ i ≤ 3)
be an edge of the last face (i.e., fm ) in ξ. If ei is not the adjacent edge between fm and fm−1 , we call ei a propagation edge of ξ. For example, in Fig. 2.8, the face sequence ξ has two propagation edges, e1 and e2 . However, e3 is not a propagation edge, since it is
an adjacent edge between fm and fm−1 . It is obvious that when m ≥ 2, ξ has exactly
two propagation edges. In the special case that ξ only contain one face, it has only one
propagation edge, which is the edge that is opposite to s. For example, in Fig. 2.8, if ξ only has one face f1 , then the propagation edge is e0 . We say that a face sequence is expanded at ei (i = 1 or 2) if we add the face adjacent to ei to the face sequence, where ei one of its propagation edge. For example, in Fig. 2.8, we say ξ is expanded at e2 if we add the new face fm+1 to ξ. fm+1 is called a propagation face of ξ. 24
e′2
ξ
fm−1 e3 fm
fm+1 e2 ′ e1
e1 e0 f1
s Figure 2.8: A face sequence As proved in Section 2.2, we need only consider simple face sequences for shortest gentle paths. So the global SGP can be found by generating a face sequence tree. As mentioned before in Section 1.2.3, face sequence tree is a hierarchical data structure for describing a set of face sequences. In the tree, each node stands for a face and the face is always adjacent with the faces represented by its children. Take Fig. 1.7 for example, f4 is adjacent with f5 and f7 . Given a node in the i-th (1 ≤ i ≤ n) level (i.e., the depth of the node is i), we can get a unique face sequence that consists of i faces
by tracing back from the node to the root. For example, in Fig. 1.7(b), given f7 in the fifth level in the tree, we get the face sequence < f7 , f4 , f5 , f3 , f1 >. In the following approach, we generate a face sequence tree that represents all possible simple face sequences in a naive breadth-first (NBF) manne, as shown in Algorithm 3: Algorithm 3 NBF -sgp(s, t, θm , S) 1: /*Find the SGP between s and t on S*/ 2: Let p = ∅ and let |p| = +∞ 3: Let Q = ∅ be an empty face sequence queue 4: For each face fi adjacent to s, create a face sequence ξi =< fi > and add ξi to Q 5: while Q = 6 ∅ do 6: Let ξ be the face sequence at the head of Q 7: if t is on the last face of ξ then 8: p′ = sgp(s, t, θm , ξ) 9: if |p′ | < |p| then 10: p = p′ 11: else 12: for each of the propagation face fi of ξ do 13: if ξ∪ < fi > is simple then 14: Add ξ∪ < fi > to Q 15: Remove ξ from Q 16: return p Note that in Line 12-14 of Algorithm 3, each face sequence with m faces generates 1 or 2 children face sequence with m+ 1 faces, which makes the face sequence tree expand exponentially. The high complexity motivates us to introduce pruning techniques 25
for eliminating unnecessary face sequences among all the face sequences generated by Algorithm 3. In order to use pruning techniques, we first introduce distance upper bound and distance lower bound of shortest gentle paths. As shown in Fig. 2.9, given a (simple) face sequence ξ where s is on the first face. And let e be an edge of the last face in ξ. We use the minimum length of all conventional shortest paths (without slope constraint) in ξ from s to every point on e as the distance lower bound of all shortest gentle paths from s to all points on e in ξ, denoted by lb(s, e|ξ). Formally, lb(s, e|ξ) = min{|sp(s, a|ξ)| for all points a ∈ e}. From Corollary 1, it is easy to prove that this distance lower bound is correct, since the SGP from s to any point a ∈ e cannot be shorter than this value. lb(s, e|ξ) can be computed by unfolding the face sequence such that all faces lie on the same plane, as discussed in [20] and [2]. The point r on e which is the closest to s in ξ is called the frontier (Fig. 2.9).
e p′
ξ
v
a b r
t po
ξo
p s
Figure 2.9: Distance lower/upper bound Lemma 2.3.2 Given two simple face sequences ξ and ξsub where s ∈ ξ, s ∈ ξsub , and ξsub is a proper sub-face sequence of ξ. That is, ξsub.F $ ξ.F . Let e be an edge
of the last face in ξ and esub be an edge of the last face in ξsub . Then, lb(s, e|ξ) ≥
lb(s, esub |ξsub).
Lemma 2.3.2 describes the fact that expanding a face sequence (by adding faces to it) only increase its distance lower bound. In our algorithm, face sequences are sorted in ascending order of the distance lower bound. Once the current smallest distance lower bound is larger than the current best known SGP’s length, the algorithm terminates. For example, in Fig. 2.9, let ξo be the face sequence that passed through by the SGP po from s to t. ξ is a sub-face sequence of ξo and e is an edge of the last face in ξ. It is obvious that lb(s, e|ξ) ≤ |po |. Similarly, the distance upper bound is defined as the maximum length of all shortest gentle paths from s to all points on e in ξ, denoted by ub(s, e|ξ). That is, ub(s, e|ξ) = 26
max{|sgp(s, a, θm|ξ)| for all points a ∈ e}. In our algorithm, we use |sgp(s, r, θm|ξ)|+ |adj(e)| as the distance upper bound from s to e in ξ. Here r is the frontier on e and
|adj(e)| is the adjusted length of edge e. Also, it is easy to prove the correctness of the upper bound. As shown in Fig. 2.9, in face sequence ξ, let a be an arbitrary point on e. Then, |sgp(s, a, θm|ξ)| ≤ |sgp(s, r, θm|ξ)| + |adj(ar)| ≤ |sgp(s, r, θm |ξ)| + |adj(e)|. Distance lower bound and upper bound could be used to prune the unnecessary face sequences generated by Algorithm 3. And this procedure is called face sequence domination. Lemma 2.3.3 (Face Sequence Domination) Let ξ and ξ ′ be two face sequences where s ∈ ξ and s ∈ ξ ′ . If ξ and ξ ′ share a common propagation edge-face pair (e, f ) and
ub(s, e|ξ) < lb(s, e|ξ ′ ), then ξ ′ cannot be passed through by the shortest gentle path
from s to t.
s ξ′
ξ
p
p′
a
e f
t Figure 2.10: Face sequence domination Proof. Take Fig. 2.10 for illustration. ξ and ξ ′ are two face sequences that share a common propagation edge e in their last faces. And f is the common propagation face. Assume there exists an SGP p′ that passes through ξ ′. Let the intersection point between p′ and e be a. Then, we replace the path segment in between s and a in p′ with the SGP between s and a in ξ to create a new SGP, p. Since ub(s, e|ξ) < lb(s, e|ξ ′ ), from the definitions of distance lower bound and upper bound, it is easy to prove that |p| < |p′ |, which contradicts with the precondition that p′ is the shortest gentle path.
Here we use (e, f ) to denote an edge-face pair, if e is an edge of f . In this case, we say that ξ strictly dominates ξ ′ for edge-face pair (e, f ), where e is the common 27
propagation edge and f is the common propagation face, denoted by ξ ≺ ξ ′|(e, f ). Face domination can be used for unnecessary face sequence pruning. It is clear that if ξ dominates ξ ′, like the one shown in Fig. 2.10, there is no need to expand ξ ′ by adding the face next to e (i.e., f ) to it. The improved algorithm adopts the framework of NBF (Algorithm 3). The differences are: (1) Face sequences are sorted by their distance lower bound in the queue; (2) We check the domination relationships before expanding a face sequence; (3) The algorithm terminates immediately when the current smallest distance lower bound is greater than the current best known SGP distance. Note that in order to check the domination relationships, we need to store a list of face sequences that are not dominated for each edge-face pair on the surface, associated with their distance lower/upper bound. Algorithm 4 P runing-sgp(s, t, θm, S) 1: /*Find the SGP between s and t on S*/ 2: Let p = ∅ and let |p| = +∞ 3: Let Q = ∅ be an empty face sequence priority queue with distance lower bound sorted in increasing order 4: Let lbmin = 0 5: For each edge-face pair, initialize its face sequence list to be ∅ 6: For each face fi adjacent to s, create a face sequence ξi =< fi >. Insert ξi to Q. 7: for each propagation face fi of ξ do 8: Let ei be the corresponding propagation edge. 9: ξ = ξ∪ < fi > 10: Add ξ to the face sequence list of edge-face pair (ei , fi ) 11: while lbmin < |p| do 12: Let ξ be the face sequence at the head of Q 13: Let lbmin = lb(s, e|ξ), where e is the propagation edge of ξ 14: if t is on the last face of ξ then 15: p′ = sgp(s, t, θm , ξ) 16: if |p′ | < |p| then 17: p = p′ 18: else 19: for each propagation face fi of ξ do 20: if ξ ′ = ξ∪ < fi > is simple then 21: Let ei be the corresponding propagation edge 22: if ξ ′ is not dominated by any one of the face sequences in the face sequence list of (ei , fi ) then 23: Insert ξ ′ into Q 24: Add ξ ′ to the face sequence list of (ei , fi ) 25: Delete all face sequences dominated by ξ ′ from the face sequence list of (ei , fi ) 26: Remove ξ from Q 27: return p
28
2.3.3 Analysis Time and storage Since SGP can always be found through simple face sequences and Algorithm 3 generates all (a finite number of) simple face sequences, it is easy to prove that Alg. 3 always finds the SGP. Algorithm 4 introduces pruning techniques and new termination conditions to Alg. 3. However, it does not affect the correctness. Firstly, it is proved in Lemma 2.3.3 that all face sequences pruned is impossible to be passed through by a SGP. In other words, all face sequences that are possible to be passed through by the SGP are considered in Alg. 4 (Line 11-13). Secondly, since all face sequences are sorted by their distance lower bound in increasing order and the minimum lower bound keeps increasing (Lemma 2.3.2), the minimum lower bound will finally exceed the length of the current best known SGP. So the algorithm always converges. And when the current minimum lower bound is greater than the length of the best SGP, it is impossible for the rest face sequences to be passed through by another shorter SGP. As a result, Alg. 4 is correct. Lemma 2.3.4 Algorithm 3 and Algorithm 4 are correct. At the i-th level of the face sequence tree, we spend O(i) time for checking whether one face sequence is simple. And there are at most O(2i) nodes at this level. That P gives a total of ni=1 i2i = O(n2n ) execution time for building the tree. Besides,
there are at most O(2n ) calls of non-linear programming. So the total complexity is O(n2n + T (n) · 2n ), where T (n) is the execution time for finding the optima of a n-dimensional function. There are 2n face sequences at the final level and each face requires O(n) storage. And thus, the total storage is O(n2n ).
Theorem 2.3.1 Algorithm 3 and 4 correctly find the shortest gentle path between two given points s and t in O(n2n + T (n) · 2n ) time, with O(n2n ) storage. A study on pruning power Let us consider the pruning power of Alg. 4. Recall that given two face sequences ξ1 and ξ2 that share a common propagation edge e, ξ2 will not be expanded at e if 29
lb(s, e|ξ2 ) ≥ ub(s, e|ξ1 )
(2.11)
Let φm be the maximum slope of all faces in S, and let |e|m be the length of the
longest edge in S. It is easy to proved that (1) If φm > θm , ub(s, e|ξ1 ) ≤ lb(s, e|ξ1 ) ·
sin φm / sin θm + |e|m ; (2) If φm ≤ θm , ub(s, e|ξ1) ≤ lb(s, e|ξ1 ) + |e|m . Let us take Case (1) as an example for analyzing the pruning power (Case (2) can be similarly analyzed). In this case, the sufficient condition for Equation 2.11 is:
lb(s, e|ξ2 ) ≥ lb(s, e|ξ1 ) · sin φm / sin θm + |e|m
(2.12)
ξ5
e
ξ1 ξ0
Ssub s
ξ2 ξ3 ξ4
Figure 2.11: Analysis of the pruning power of Alg. 4 As illustrated by Fig. 2.11, the face sequence ξ0 passed through by p0 has the minimum distance lower bound lb0 . Now let us consider what kind of face sequences will be dominated by ξ0 . Let us create a sub-surface Ssub of S such that for each point a ∈ S, a ∈ Ssub if and only if there exist a (conventional) shortest path p passing
through a and |p| ≤ lb0 · sin φm / sin θm + |e|m . Given a face sequence ξ, if there exists
a face f in ξ such that f has no intersection part with Ssub , then ξ will be dominated by ξ0 . As shown in Fig. 2.11, ξi (0 ≤ i ≤ 5) are face sequences that share a common
propagation edge e. Assume ξ0 has the minimum distance lower bound, and Ssub is the region marked with a dashed line. From the figure we can see that ξ1 and ξ2 are not
dominated by ξ0 since all their faces intersect with Ssub . However, ξ3 , ξ4 and ξ5 will be dominated by ξ0 since they both have some faces that do not have intersection part with Ssub . 30
Provided that the size of the faces in S do not differ significantly, the number of faces in Ssub can be estimated by nsub = n · |Ssub|/|S| where |Ssub| (resp. |S|) is the
area of Ssub (resp. S). And as a result, about 2nsub will be expanded at e.
The boundary of Ssub is near elliptical since edge e is far shorter than the length of ξ0 , and hence s and e can be roughly viewed as the two foci of the ellipse and lb(s, e|ξ0 ) · sin φm / sin θm + |e|m serves as its major diameter. Given a certain surface
S, φm and |e|m are fixed constants. So if θm is large (resp. small), the area of the ellipse will be small (resp. large) and thus more (resp. less) face sequences will be pruned.
2.4 Extension to Unreachability In Section 2.1, we assume that there exists a gentle path from any source point to any destination point. In this section, we relax this assumption. We will introduce a term reachable for a point q to describe whether q is reachable or not. In this section, we will show that if both the source point s and the destination point t are reachable, then there exists a gentle path from s to t. Section 2.4.1 gives the formal definition of reachability. Section 2.4.2 describes how we adapt our proposed algorithms to handle the reachability issue.
2.4.1 Reachability Given two distinct points q and q ′ on a surface, q is said to be reachable from q ′ if and only if there exists a gentle path from q ′ to q. q is said to be unreachable from q ′ if q is not reachable from q ′ . Given a point q on a surface, q is said to be reachable if and only if there exists another point q ′ on the surface such that q is reachable from q ′ . q is said to be unreachable if q is not reachable. Given a vertex q, a face f is said to be adjacent to q if one of the corners of f is q. Lemma 2.4.1 (Unreachability) A point q on a surface is unreachable if and only if q is a vertex and q is unreachable from any point on all of the faces adjacent to q. Proof: Firstly, we want to prove that, if q is a vertex and q is unreachable from any point on all of the faces adjacent to q, then q is unreachable. We prove by contradiction. 31
Suppose that q is reachable. That is, there exists another point q ′ on the surface such that q is reachable from q ′ . Consider two cases. Case 1: q ′ is on one of the faces adjacent to q. This leads to a contradiction. Case 2: q ′ is not on all of the faces adjacent to q. Since q is reachable from q ′ , there exists a gentle path from q ′ to q. Let F be the set of all faces adjacent to q. We know that path p must pass through one of the faces in F , says f . Let q ′′ be a point along path p on face f . Thus, q is reachable from q ′′ (which is on one of the faces adjacent to q). This leads to a contradiction. Secondly, we want to prove that, if q is unreachable, then q is a vertex and q is unreachable from any point on all of the faces adjacent to q. We prove by contradiction. Consider two cases. Case 1: q is a vertex and there exists another point q ′ on one of the faces adjacent to q such that q is reachable from q ′ . Thus, q is reachable, which leads to a contradiction. Case 2: q is not a vertex. That is, q is a non-vertex point on a face f . There exists another point q ′ on f such that q ′ .z = q.z. Thus, q is reachable from q. So, q is reachable, which leads to a contradiction. The above lemma suggests that all unreachable points come from vertices on the surface. Thus, we just need to check whether each vertex (instead of all possible points on the surface) is unreachable or not. How to check whether a vertex is unreachable or not efficiently will be discussed in Section 3.4. Lemma 2.4.2 (Source/Destionation Reachability) If a source point s and a destination point t are reachable, then t is reachable from s. Proof Sketch: From the proof of Lemma 2.4.1, it is easy to verify that, if a vertex q on face f is reachable, for any point q ′ on f , q is reachable from q ′ . For the sake of space, we omit the proof here. There exists a sequence of adjacent faces, namely f1 , f2 , ..., fl , such that s is on face f1 , t is on face fl and, for each i ∈ [1, l − 1], face fi is adjacent
to face fi+1 . Let ei be the edge shared by face fi and face fi+1 for i ∈ [1, l − 1]. By the first claim in this proof, we know that there exists a non-vertex point t1 on edge e1 such
that t1 is reachable from s. Similarly, we know that there exists a non-vertex point t2 on edge e2 such that t2 is reachable from t1 . In general, there exists a non-vertex point ti on edge ei such that ti is reachable from ti−1 for i ∈ [2, l − 1]. At the final step, similarly, we know that t is reachable from tl−1 (by the first claim in the proof). Since 32
t1 is reachable from s, ti is reachable from ti−1 where i ∈ [2, l − 1], and t is reachable from tl−1 , we conclude that t is reachable from s.
2.4.2 Algorithm For real data sets, less than 0.22% vertices are unreachable. For the proof of Lemma 2.4.1 we can see that although some vertices are unreachable, there exist some reachable points “close enough” to these unreachable vertices. In our algorithms, we introduce a tiny constant µ > 0 to descibe the “closeness” between an unreachable vertex and a reachable point. A point q is considered to be reachable if we can reach a point q ′ such that the distance between q and q ′ is less than µ. In the algorithm, suppose that s is unreachable. By Lemma 2.4.1, we deduce that s is a vertex. Let e be one of the edges adjacent to s. We can arbitrarily choose a point q along e such that q is not a vertex and the distance between q and s is at most µ. Since q is not a vertex, by Lemma 2.4.1, we know that q is reachable. Thus, in the above, we know that we can find another reachable point which is close to s. Similarly, we can do the same task for t if t is unreachable. After we do the above process, we can adopt the approach proposed previously.
2.5 Variants There are a few variants of the FSGP problem. In this section, we give a breif discussion about these variant problems.
2.5.1 FSGP problem in the presence of obstacles In real-world applications, there might be some regions on the terrain which can be considered as obstacles. For example, for land surface nevigation, generally speaking, the path should not pass through a lake. And for road planning, it is not desirable that the path passes through crops or residental blocks, etc. This variant problem can be solved by removing the obstacle regions from the terrain. Take Fig. 2.12(a) as an example, there are a few obstacles on the terrain (which is shown by the grey regions). We remove all the sub-surfaces that covered by these
33
(a) A terrain with obstacles
(b) A sub-terrain after the removal of obstacles
Figure 2.12: FSGP problem in the presence of obstacles
obstacles (see Fig. 2.12(b)). And then, our algorithm can be used for computing the path that is collision-free with these obstacles.
2.5.2 FSGP problem under the traveling time model Another variant is the FSGP problem that considers the traveling time. In this model, going upward takes longer traveling time than going downward. More formally, let α, β (α > β > 0) be the time cost of a unit path segment that goes upward/downward, respectively. The time cost of a single paths segment pi that goes upward (resp. downward) is calculated by |pi | · α (resp. |pi | · β). In this problem, we are asked to find the gentle path that has the lowest traveling time. First, we claim that to find the SGP with the lowest traveling time cost, we also only need to consider simple face sequences. Lemma 2.5.1 For any gentle path p with the lowest time traveling time cost, if the face sequence ξ passed through by p is not simple, we can always find another gentle path p′ , such that the face sequence ξ ′ passed through by p′ is simple and the traveling time of p′ is the same as p. Proof. As illustrated by Fig. 2.13, a and b are two points inside the same face f . There are two cases: (1) If the line segment ab does not violates the slope constraint, it is obvious that ab is the gentle path with the lowest time cost. 34
(2) If θ(ab) > θm , without the loss of generarity, we assume the elevation of b is greater than a. Let p be the SGP between a and b inside f , we claim that p is also the gentle path with the lowest traveling time. Or else, let p′ be a gentle path that passes through f twice and p′ consists only up-going path segments (See Fig. 2.13). Then the time cost of p′ cannot be smaller than p. This is because the length of p′ cannot be smaller than p (proved by Corollay 2). Provided that α > 0, we have α|p| ≤ α|p′ |. That is, the traveling time cost of p is smaller than p′ . Besides, let p′′ be a gentle path
that passes through f twice, which consists of both up-going segments and down-going segments (Fig. 2.13). The time cost of p′′ is given by α|p′′ |up + β|p′′ |dn , where |p′′ |up
(resp. |p′′ |dn ) is the total length of the up-going (resp. down-going) segments in p′′ . We can prove that |p′′ |up > |p|. Since p′′ has some down-going segments, it must has reached a point t that has a greater elevation than b, as shown in Fig. 2.13. Let p′′sub be
the sub-path of p′′ from a to t. Then |p′′sub| ≥ |t.z −a.z|/ sin θm ≥ |b.z −a.z|/ sin θm =
|p|. And as a result, α|p′′|up + β|p′′ |dn > α|p′′|up ≥ α|p′′ |sub ≥ α|p|. That is, the time
cost of p′′ is also greater than p. As we can see, the gentle path with the lowest time cost between two points on the same face can always be found inside the face. And as a result, we need only consider simple face sequences.
t p′′
b
p′ f
p
a Figure 2.13: Illustration for the proof of Lemma 2.5.1 Since we only need to consider simple face sequences, the algorithm we used for computing an SGP can also be adapted for computing a gentle path with lowest traveling time. The only thing that needs to be modified is the objective function (i.e., Equation 2.9) in the constrained programming step. That is, we need to replace the function that calculates the total length with the function that calculates the total time cost.
35
2.5.3 Weighted SGP The FSGP problem can also be extended to the weighted models. There are two types of weighted FSGP problem: one is path-independent weighted FSGP problem, and the other is path-dependent weighted FSGP problem. In the path-independent weighted FSGP problem, each face fi is assigned with a P weight wi(> 0). The cost of a path p with m path segments is given by m i=1 wi |pi |,
where pi is the intersection part between p and fi . We are asked to find the gentle path between two given points, such that the cost is minimized.
In the path-dependent weighted FSGP problem, the weight depends on the path itself. That is, each path segment pi is assigned with a weight wi, where wi is determined by the geometric properties of pi . For example, wi might be affected by the slope of pi . That is, wi = g(θ(pi )), where g is an arbitrary function. Note that the above two models can be combined and thus the weight for each path segment is determined by both the weight of the face it lies in and its geometric properties. We claim that some instances under the weighted model cannot be solved using our algorithm. Take Fig. 2.14 as an example. For two points a and b on the same face f , if the weight of f is significantly larger than the other faces, then the gentle path with the lowest cost may not lie inside f , as shown by p in Fig. 2.14. As a result, the face sequence passed through by the path might not be simple. As we know, our algorithm only consider simple face sequences. So our algorithm cannot be adapted to solve these kind of problems.
p b a
f
Figure 2.14: Illustration of a weighted gentle path However, in the other instances, it can be proved that the gentle path with the lowest cost between two points on the same face can be found only inside the face. In this 36
case, we can prove that we need only consider simple face sequences (following the strategy of the proof of Corollary 2). Our algorithm can be adapted to solve this type of problems. In this case, we only need to change the objective function given by Equation 2.9. Theorem 2.5.1 Algorithm 3 and 4 can be adapted (by changing the objective function) to solve a weighted gentle path problem P if and only if for any two points a and b inside the same face f , there exists a gentle path p such that p lies completely inside f and the cost of p is the lowest among all gentle paths between a and b
37
CHAPTER 3 APPROXIMATE SHORTEST GENTLE PATH It is expected that finding an accurate SGP is costly. In our experiment on the real terrain dataset of Bearhead area in Washington State, if we set θm = 0.3, we found that an algorithm for problem FSGP took more than 2 hours to find the shortest gentle path of length about 7km. It is expected that finding the shortest gentle path between two distant points on a larger surface takes much longer time (e.g., more than 1 day). In many applications, time is a critical factor. One example is some emergency situations (e.g., natural disaster). Quick evacuations in a natural disaster are needed as in the Australian fires in Feb 2009 and the Californian fires in Oct 2007. Besides, in a largescale natural disaster such as the earthquake in China in May 2008, distributing relief supplies and rescuing are time-critical. In this chapter, we propose a (1 + ǫ)-approximate algorithm for solving the FSGP problem. Given the maximum slope θm and the approximation factor ǫ, our algorithm finds a gentle path p such that the slope of p is bounded by θm , and |p| ≤ (1 + ǫ)|po |.
Here po is the accurate shortest gentle path. Experimental results shows that the cost
of the approximate algorithm is much less than the accurate algorithm proposed in Chapter 2.
3.1 Problem Definition 3.1.1 Notation For a clear presentation of this approximate algorithm, we introduce some new notations in this chapter. Consider Figure 3.1(a) showing a terrain with a horizontal plane H. In the following, we follow the convention that the points on the horizontal plane H are denoted by cross points and symbolized by underlined variables while the points on the surface of a terrain are denoted by dot points and symbolized by non-underlined variables. 38
For example, the cross point s is on the plane H and the dot point s is on surface S. Following the terrain model [6], we assume that any vertical line must intersect with the surface at only one point.
E H
E c a b p' s p' s a b
t
t
p a b s s a b
t
(a) S
t p
(b) S
Figure 3.1: A simple TIN terrain
t
t
t p
po
s (a) S
p
s
f1 f3
e1
s
e2 (c) S
(b) S
f2
Figure 3.2: Surface simplification Given a point q on the surface, the shadow of q, denoted by q, is defined to be a point on the plane H such that q.x = q.x, q.y = q.y and q.z = 0. Given a path p on the surface, the shadow of p, denoted by p, is defined to be the shortest path on plane H covering the shadow of any point along p. For example, in Figure 3.1(a), point s is the shadow of point s and the line segment from s to a is the shadow of the line segment from s to a. Given a face f , the shadow of f is defined to be the minimal region on plane H covering the shadow of any point on face f . original surface S
Preprocessing
Surface Simplification
simplified surface S
(a) Finding shortest gentle path from s to t on S under our proposed framework
simp. surface S
Step I: run A ( s , t | S ) to find the shortest gentle path from s to t on S where s ( t ) is a point on S with the same shadow as s ( t )
path p (on S )
Step II: Path Mapping
path p (on S )
(b)
Figure 3.3: An overview of our proposed framework As discussed in Section 1.1, solving problem FSGP directly may be too costly. 39
This motivates us to propose a framework called surface simplification. The original surface S (see Figure 3.2(a)) is simplified to surface Se (see Figure 3.2(b)) such that
the number of faces on Se is smaller than that on S. Figure 3.3(a) shows an overview
of the surface simplification. In Section 3.3, we will study this surface simplification process. Figure 3.3(b) shows an overview to find the shortest gentle path from a source e We first point s to a destination point t on surface S by using the simplified surface S.
construct a point se and another point e t on the simplified surface Se by setting se (e t) to be a point on Se with the same shadow as s (t). For example, in Figure 3.1(a), s and
t are the source point and the destination point, respectively. We construct se and e t on Se with the same shadow as s and t, respectively, as shown in Figure 3.1(b). Then, we
e to find the shortest gentle path pe from se to e run algorithm A(e s, e t|S) t on this simplified
surface Se (Step I), as shown in Figure 3.2(b). Then, we map this path pe on Se to a path
p on S (Step II) such that this mapped path satisfies the slope requirement as shown in Figure 3.2c. In Section 3.2, we will study how to perform this path mapping. As we mentioned before, even though the mapped path satisfies the slope requirement, its length may be too large compared with the optimal length. Thus, we introduce the distance requirement: given a distance error parameter ǫ ≥ 0, the length of
the (mapped) path p found should be bounded by ǫ. That is, |p| ≤ (1 + ǫ)|po | where po
is the shortest gentle path (or the optimal path) on S.
Problem 2 (Surface Simplification) Given the original surface S of a terrain, we generate a new surface Se such that (1) the total number of faces on Se is minimized and (2) for any source point s and any destination point t on S, the mapped path on
the original surface S satisfies both the slope requirement and the distance requirement. Let the algorithm which find the shortest gentle path from s to t on a surface S be A(s, t|S), which is not necessarily be the path finding algorithm that introduced in Chapter 2. Any shortest gentle path algorithm works under our framework. Note that Step I used in the step of finding shortest gentle paths involves algorithm A. Although we have introduced an algorithm for finding shortest gentle paths in Chapter 2, our contribution is the proposal of surface simplification over the terrain dataset with the guarantee of both the slope requirement and the distance requirement. Any algorithm A which finds the shortest gentle path can also be used in our framework. 40
For the sake of illustration, we follow the notation convention that all notations used in the simplified surface are symbolized with ∼ which appears at the top of the notations (e.g., point e s and path pe on the simplified surface Se in Figure 3.1(b)) while
all notations used in the original surface are not (e.g., point s and path p′ on the original surface S in Figure 3.1(a)). In the following, we first describe Step II in Section 3.2. Then, in Section 3.3, we
describe how we perform surface simplification.
3.2 Path Mapping Section 3.2.1 presents algorithm Path Mapping and then Section 3.2.2 gives a theoretical analysis on this algorithm.
3.2.1 Algorithm Let pe be the shortest gentle path on the simplified surface Se found in Step I (See Figure 3.3(b)). In this section, we study Step II (i.e., how to map pe on Se to a path p on S).
The major idea of path mapping is based on the common shadow of the path pe found on Se and the mapped path p to be found on S. Intuitively, after we find pe e we generate the shadow of pe. Then, we generate a temporary path p′ on the on S, original surface S which has the same shadow as pe. We call p′ the pseudo path of pe.
Since path p′ may violate the slope requirement, we perform an additional step called
path adjusting to adjust path p′ to path p (on surface S) such that p satisfies the slope requirement. Specifically, we propose a three-step algorithm called algorithm Path Mapping to map a path pe found on Se to a path p on S. We denote the relationship between pe and p by a path mapping function P M such that
p = P M(e p)
(3.1)
Step 1 (Shadowing): We find the shadow of pe. For example, Figure 3.1(b) shows the shortest gentle path pe from e s to e t on Se which involves (1) the line segment from se to
eb and (2) the line segment from eb to e t. The shadow of pe is pe which involves (1) the 41
line segment from se to eb and (2) the line segment from eb to e t. Note that eb is a point connecting two line segments of path pe on the surface. The reason why eb appears in
e via point eb. Thus, this leads to the existence path pe is that path pe passes through edge E of a shadow point eb on the shadow path pe. Step 2 (Segmentation): We generate a pseudo path p′ on the original surface S which has the same shadow as pe. For instance, shadow p′ shown in Figure 3.1(a) (for S) is
e Note that shadow p′ involves (1) same as shadow pe shown in Figure 3.1(b) (for S).
the line segment from s to b and (2) the line segment from b to t. Path p′ shown in
Figure 3.1(a) is the pseudo path. Although the shadow involves a single line segment from s to b, we have to divide this line into two segments, namely (1) the segment from s to a and (2) the segment from a to b, due to the existence of edge E. Thus, in Step 2, in addition to creating path p′ with the same shadow as pe, we have to divide p′ into a
number of line segments such that each line segment does not pass across any edge on the original surface. After Step 2, we obtain p′ which involves k line segments, namely p′1 , p′2 , ..., p′k . For example, in Figure 3.1(a), we have 4 line segments of p′ and thus k is equal to 4. Step 3 (Path Adjusting): After we obtain a pseudo path p′ from Step 2, we perform a step called path adjusting, which has been introduced in Section 2.3 in Algorithm 1. Recall that given an arbitrary path p′ , path adjusting generates a unique corresponding path p, such that p satisfies the slope constraint. For each line segment p′i of p′ (obtained
in Step 2) with the source point a and the destination point b where i ∈ [1, k], if it
satisfies the slope requirement, we set pi to be p′i . Otherwise, let the face that ab lies
in be f , we execute algorithm adj(a, b, θm , f ) to find the shortest gentle path from a to b on S, the original surface, and assign it to pi . The combination of the resulting (sub-)paths p1 , p2 , ..., pk is called the adjusted path of path p′ , which is the path in the output. Intuitively, each line segment (or path) violating the slope requirement will be adjusted accordingly such that the final adjusted (sub-)path satisfies the slope requirement. Thus, we give the following theorem. Theorem 3.2.1 (Slope Requirement) Let pe be the shortest gentle path on the simplie The path p on the original surface S mapped from pe by algorithm Path fied surface S. Mapping satisfies the slope requirement.
42
po pe p′ p
shortest gentle path on S shortest gentle path on Se pseudo path on S final path (or adjusted path) returned by algorithm Path Mapping Table 3.1: Notation table
For the ease of reference, we give a notation table (Table 3.1) for paths we described in this section.
3.2.2 Theoretical Analysis Section 3.2.2 first analyzes the distance bound of a single path and then Section 3.2.2 analyzes the distance bound of an arbitrary path.
Distance Analysis for a Single Path e (in Step I). Consider a single path pe from se to e t on surface Se returned by A(e s, e t|S)
In the previous section, we learn that we can perform Path Mapping to map a path
pe to a pseudo-path p′ (by Step 1 and Step 2) and then adjust p′ to the final path p (by
Step 3). In our algorithm, according to Step 3, we generate k sub-paths in the final
path p, namely p1 , p2 , ..., pk . In the example shown in Figure 3.1(a), k is equal to 4. Let the correspondence pseudo-path line segments on S be p′1 , p′2 , ..., p′k . For example, in Figure 3.1(a), the line from a to b is an example of a line segment p′i of p′ . In order to perform analysis for the distance requirement, we also find the corresponding line segment pei of pe which has the same shadow as line segment p′i of p′ for i ∈ [1, k]. For
instance, in Figure 3.1(b), the line from e a to eb is an example of a line segment pei of pe which has the same shadow as p′i .
In the following, we want to analyze the ratio of |pi| to |e pi | (i.e., |pi |/|e pi|) for each
i ∈ [1, k] when we map a given gentle line segment pei to pi . We call this ratio the mapping ratio of a single gentle path pei .
Note that pi is generated from pei via a pseudo-path line segment p′i . Thus, in the
following, we calculate the mapping ratio with |p′i |. Specifically, we have |pi | |p′ | |pi | = ′ × i |e pi | |pi | |e pi | In the following, we will derive
|p′i | |e pi |
from Step 1 and Step 2, and derive 43
(3.2)
|pi | |p′i |
from
Step 3. Consider Step 1 and Step 2. After Step 2, we obtain a pseudo-path p′ on S which has already been segmented. Consider a line segment p′i of p′ . e Since p′ and pei have the same shadow, Suppose p′i is on face f and pei is on face f. i
we derive that face f and face fe have an overlapping shadow X.
Let the slope of p′i and the slope of pei be θi′ and θei , respectively. Define the rela-
tionship between θi′ and θei by function AM such that θi′ = AM(θei )
(3.3)
We have the following lemma. Lemma 3.2.1 (Distance Bound) Let pei be a line segment of path pe. Let p′i be a line
segment of the pseudo path of pe. Let θi′ and θei be the slope of p′i and the slope of pei , respectively. We have
|p′i | |e pi |
=
cos θei . cos θi′
Proof: Since line segment p′i is a line, the shadow of p′i is also a line. Consider Figure 2.1(a) where pi is set to p′i . It is easy to verify that the length of the shadow of p′i is |p′i | cos θi′ . Similarly, the length of the shadow of pei is |e pi | cos θei . Since p′i and pei has the same shadow, we have the following equation: |p′i | cos θi′ = |e pi | cos θei . By changing the subject to
|p′i | , |e pi |
we have
|p′i | |e pi |
=
cos θei . cos θi′
Consider Step 3. For each line segment p′i , we perform a path adjusting step and create a (sub-)path pi (which satisfies the slope requirement). We have the following lemma. Lemma 3.2.2 (Distance Bound) Let p′i be a line segment of the pseudo path. Let pi be the adjusted path of p′i . Let θi′ be the slope of p′i . We have
|pi | |p′i |
≤
sin(max{θi′ ,θm }) . sin θm
Proof: The lemma is simply derived from Lemma 2.2.4 in Section 2.2. By Lemma 3.2.1 and Lemma 3.2.2, we re-write Equation (3.2) as follows. sin(max{θi′ , θm }) cos θei |pi | ≤ × |e pi | sin θm cos θi′ 44
e The right hand side of the above Note that pi is on face f and pei is on face f.
inequality corresponds to the upper bound of the m(a)pping r(a)tio of a single gentle path. We denote it by MRS(< pi , f >, < pei , fe >). That is, sin(max{θi′ , θm }) cos θei × MRS(< pi , f >, < pei , fe >) = sin θm cos θi′
(3.4)
where pi is a mapped path of pei . Distance Analysis for an Arbitrary Path In the previous section, we derive a mapping ratio of a single gentle path. In this section, we derive a mapping ratio of an arbitrary gentle path. e X) be a set of all possible gentle Note that X is a region on plane H. Let GP (f,
paths on face fe which shadows are inside X. Note that, from Equation (3.1), we have
pi = P M(e pi ). The greatest possible m(a)pping r(a)tio of an arbitrary gentle path (segment), denoted by MR(f, fe), is equal to max MRS(< pi , f >, < pei , fe >) e pei ∈ GP (f, X) where pi = P M(e pi )
(3.5)
The above term MR(f, fe) can be regarded as the greatest possible mapping ratio
of an arbitrary gentle path pei when we map a gentle path (segment) pei on a simplified face fe to a path pi on an original face f . In general, the above term can be generalized as follows. Consider two different surfaces S and S ′ each of which represents the
same terrain (in the above derivation, S is the original surface and S ′ is the simplified surface). Given a face f on S and another face f ′ on S ′ with an overlapping shadow X, MR(f, f ′ ) can be regarded as the greatest possible mapping ratio of an arbitrary gentle path p′ when we map a gentle path (segment) p′ on face f ′ to a path p on face f . With this reasoning, in addition to MR(f, fe), we can also define MR(fe, f ) similarly (i.e., the greatest possible ratio of an arbitrary gentle path pi when we map a gentle path (segment) pi on an original face f to a path pei on a simplified face fe). With the above definition of MR(f, f ′ ), we have the following lemma.
Lemma 3.2.3 (Distance Bound for Arbitrary Path) Let S and S ′ be two different surfaces each of which represents the same terrain. Let f be a face on S and f ′ 45
be another face f ′ on S ′ such that f and f ′ have an overlapping shadow X. Suppose that p′ is the shortest gentle path (segment) on f ′ . If algorithm Path Mapping maps p′ on face f ′ to a sub-path p on face f , then we have
|p| |p′ |
≤ MR(f, f ′ ).
3.3 Surface Simplifier In the previous section, from Theorem 3.2.1, we know that a mapped path found by algorithm Path Mapping satisfies the slope requirement in Theorem 3.2.1. In this section, we present an algorithm called Surface Simplifier to simplify surface S to surface Se such that any mapped path p found by algorithm Path Mapping satisfies the distance requirement (in addition to the slope requirement).
Let p be the mapped path on surface S (obtained in Step II in Figure 3.3(b)). Let po be the optimal path (i.e., the shortest gentle path) on surface S. The distance requirement specifies that, given a distance error parameter ǫ ≥ 0, we have |p| ≤ (1 + ǫ)|po | or
|p| |po |
|p| . |po |
≤ 1 + ǫ. We define the distance error ratio of path p, denoted by ER(p), to be
Note that ER(p) ≥ 1 since |p| ≥ |po|. If p is the optimal path, then ER(p) = 1.
Obviously, if surface Se is exactly the same as the original surface S, then any
mapped path p found must be optimal and thus ER(p) = 1. This is because the mapped path p on S is exactly the same as the path pe found on Se which is considered e as the shortest gentle path on S. However, if surface Se is different from the original surface S, then it is likely that
a mapped path p found is not optimal and thus ER(p) > 1. Besides, intuitively, if the “difference” between S and Se is greater, then it is more likely that ER(p) is greater
where p is a mapped path. In order to satisfy the distance requirement, we want that the “difference” between S and Se should not be too large.
e In Section 3.3.1, we will The “difference” between S and Se is denoted by △(S, S).
e such that the following property holds. describe an exact formula for △(S, S)
Property 1 (Surface Bound) Let S be the original surface and Se be the simplified e ≤ 1 + ǫ, then for any mapped path p, ER(p) ≤ 1 + ǫ. surface. If △(S, S) If this property holds, the distance requirement is satisfied. After we give the exact e we will show the correctness of this property in Lemma 3.3.1. formula for △(S, S), 46
e 3.3.1 Formula for △(S, S) e such that Property 1 holds. In this section, we give a formula for △(S, S)
Given a face f on S and a face fe on Se where f and fe have an overlapping shadow, e as follows. we define λ(f, f) λ(f, fe) = MR(f, fe) × MR(fe, f )
(3.6)
e where f is a face on S and fe e be a set of all possible pairs (f, f) Let CS(S, S)
e is defined as is a face on Se such that f and fe have an overlapping shadow. △(S, S) follows.
e e = max e Definition 3.3.1 △(S, S) e λ(f, f ) (f,f )∈CS(S,S) With this definition, we have the following lemma for the distance requirement. e ≤ Lemma 3.3.1 Let S be the original surface and Se be the simplified surface. If △(S, S)
1 + ǫ, then for any mapped path p, ER(p) ≤ 1 + ǫ.
Proof: Let pe be a path found in Step I and p be a path found in Step II. Since pe is e pe is the shortest gentle path from e e We have the returned by A(e s, e t|S), s to e t on S. e following inequality. For any gentle path e g from e s to e t on S, |e g| ≥ |e p|
(3.7)
Consider two cases: Case 1: pe is a line segment. By Lemma 3.2.3, we have the
following.
|p| |e p|
≤ MR(f, fe)
(3.8)
Let po be the optimal path on S (i.e., the shortest gentle path on S). Consider that we apply algorithm Path Mapping to map po on the original surface S to generate a path e Similarly, by Lemma 3.2.3, we have the following. peo on the simplified surface S. |e po | |po |
≤ MR(fe, f )
(3.9)
Note that peo on Se generated by algorithm Path Mapping is a gentle path on Se (by Theorem 3.2.1). Thus, from Inequality (3.7), we have the following. |e po | ≥ |e p| 47
With the above inequality, we re-write Inequality (3.9) as follows. |e p| |po |
≤ MR(fe, f )
With Inequality (3.8), we re-write the above inequality as follows.
By Equation (3.6), we have
|p| |po |
≤ MR(f, fe) × MR(fe, f )
|p| |po |
e Since ER(p) = ≤ λ(f, f).
|p| , |po |
we have
ER(p) ≤ λ(f, fe)
(3.10)
e e ≤ 1 + ǫ, by Definition 3.3.1, we derive that max e Since △(S, S) e λ(f, f) ≤ (f,f )∈CS(S,S)
1 + ǫ. Thus, Inequality (3.10) can be re-written as follows. ER(p) ≤ 1 + ǫ
Case 2: pe is not a single line segment. In this case, we chopped pe into a number of
line segments, namely pe1 , pe2 , ..., pek . Then, each line segment pei where i ∈ [1, k] falls in Case 1. Thus, by simple derivations, it is easy to verify that ER(p) ≤ 1 + ǫ.
3.3.2 Algorithm Simplifier In this section, we present an algorithm called Surface Simplifier which adopts one of the methods for surface simplification discussed in [24]. Actually, any existing methods about surface simplification in the literature of graphics can also be adopted in e ≤ our algorithm provided that the simplified surface Se is generated such that △(S, S)
1 + ǫ. It is easy to verify the following theorem.
e ≤ Theorem 3.3.1 Algorithm Surface Simplifier generates surface Se such that △(S, S)
1 + ǫ.
e Efficiently 3.3.3 How to Compute △(S, S) e in Definition 3.3.1. In our algoIn Section 3.3.1, we describe the formula for △(S, S) rithm Surface Simplifier, we need to simplify the surface by computing this formula. In this section, we design an efficient method to compute it in O(|F |) time where |F | is the total number of faces on the original surface. 48
Note that e = △(S, S)
max
e (f,fe)∈CS(S,S)
λ(f, fe)
e ∈ CS(S, S). e Given a face f on S, let K We need to calculate λ(f, fe) for each (f, f)
be the greatest number of faces in Se which have overlapping shadows with f . Then, e In our experiments, in all cases, K there are at most K × |F | elements in CS(S, S). is equal to a small number (e.g., at most 20). Thus, the total number of elements in e is nearly linear to |F |. CS(S, S)
e comes from the computation of The major complexity issue of computing △(S, S)
λ(f, fe). From Equation (3.6),
λ(f, fe) = MR(f, fe) × MR(fe, f ) In Section 3.3.3, we will derive an efficient method to compute MR(f, fe) (and
MR(fe, f )) in O(1) time. Thus, computing λ(f, fe) takes O(1) time. Since in the for-
e the total number of terms for λ(f, fe) is O(|F |), computing △(S, S) e mula for △(S, S),
takes O(|F |) time.
How to Compute MR(f, fe) Efficiently Since computing MR(f, fe) directly is very costly (which will be explained next), in
order to simplify the surface efficiently, in this section, we give a method to compute MR(f, fe) efficiently. From Equation (3.5), MR(f, fe) is equal to:
max MRS(< pi , f >, < pei , fe >) e X) pei ∈ GP (f, where pi = P M(e pi ) e X) which We can see that computing MR(f, fe) directly requires to compute GP (f,
contains an infinite number of possible gentle paths on face fe with shadow inside X.
In the following, we propose a method to compute MR(f, fe) by avoiding enumer-
ating all possible gentle paths on face fe with shadow inside X. The computation can be done in O(1) time.
49
From Equation (3.4) and Equation (3.5), we can re-write MR(f, fe) as follows. max ( e pei ∈ GP (f, X) where pi = P M(e pi )
sin(max{θi′ , θm }) cos θei ) × sin θm cos θi′
We can further re-write the above equation as a constrained programming as follows. Maximize sin(max{θi′ , θm }) cos θei × sin θm cos θi′
(3.11)
subject to e X) pei ∈ GP (f,
(3.12)
pi = P M(e pi )
(3.13)
and
The maximized value found in this programming corresponds to MR(f, fe). Derivation There are two different domains used in the constrained programming. One is the domain based on the slope of a path which can be found in the objection function (i.e., function (3.11)). The other is the domain based on the path which can be found in Constraint (3.12) and Constraint (3.13). In fact, the domain for the path can be transformed to the domain for the slope in this constrained programming such that we have only one domain in the constrained programming. Consider Constraint (3.12). Suppose that pei is a path on face fe (which is in e X)). If the slope of face fe is at least θm (i.e., φ(f) e ≥ θm ), then the slope GP (f,
of the gentle path pei (i.e., θei ) must be at most θm . Otherwise, the slope of the gentle path must be at most φ(fe). Thus, Constraint (3.12) can be re-written in terms of the slopes of paths as follows.
e 0 ≤ θei ≤ min{θm , φ(f)} 50
(3.14)
Note that the right hand side of the above inequality is fixed since θm is a fixed e is fixed). Besides, θei is considered as a user parameter and fe is given (and thus φ(f)
variable in the constrained programming.
Consider Constraint (3.13) which specifies the relationship between pi and pei . In
fact, the objective function involves the slope of the pseudo-path p′i , namely θi′ , and the slope of the path pei , namely θei . Note that the objective function does not involve the slope of the adjusted path pi , namely θi . Thus, with Equation (3.3), Constraint (3.13)
can be also re-written in terms of the slopes of paths as follows. θi′ = AM(θei )
(3.15)
Note that θi′ is an internal variable which can be expressed in terms of the variable θei . The objective of the constrained programming (i.e., function (3.11)) involves only one variable, namely θei . We can use the method of Lagrange multipliers to solve this constrained programming. With this method, we obtain a general formula to calculate MR(f, fe) (i.e., the maximum value found in this programming) and thus the computation of MR(f, fe) can be done in O(1) time. For the sake of space, we omit the details here.
3.4 Extension to Unreachability As described in Section 2.4, some vertices are unreachable. In this general setting, Surface Simplifier will be changed as follows. The basic idea of the change is based on the following two properties. Property 1: For each vertex on S which is unreache Property 2: Whenever the able, the algorithm still keeps the original vertex v on S. e it make sure that it does not introduce any new vertex which is algorithm generates S,
unreachable.
Intuitively, if all vertices are unreachable, then we cannot simplify the surface. If there are only rare reachable vertices, then we can simplify the surface aggressively. In our experiment, there are only at most 0.22% of unreachable vertices in all real datasets, which suggests that the we can simplify the surface well. Since algorithm Surface Simplifier maintain Property 1 and Property 2, it is easy to verify that there exists a gentle path on S if and only if there exists a corresponding e Thus, algorithm Path Mapping is kept intact in this problem setting. gentle path on S. 51
Efficiency In algorithm Surface Simplifier, we have to check whether a vertex is unreachable or not. The following lemma helps us to perform this checking step efficiently. Let V be a set of vertices on a surface S. Consider that v is in V . Let N(v, V ) be a set of vertices in V /{v} each of which shares an edge with v. Lemma 3.4.1 (Reachability) Consider a vertex v and a surface S. Let V be a set of vertices on S. Let Y = N(v, V ). v is reachable if one of the following conditions holds. Condition (1): there exists two vertices in Y , namely vi and vj , such that vi .z ≥
v.z and vj .z ≤ v.z, or Condition (2): there exists an edge e with an endpoint equal to
v such that the slope of e is at most θm .
Proof: Consider the first condition. Since there exists two vertices vi and vj such that vi .z ≥ v.z and vj .z ≤ v.z, we deduce that there exists a face f adjacent to v such that
f has two corners/vertices, namely va and vb , where va , z ≥ v.z and vb .z ≤ v.z. Thus, there exists a point q on face f where q.z = v.z such that v is reachable from q. Consider the second condition. Since the edge has its slope at most θm , there exists a point q on this edge such that v is reachable from q. With the above lemma, if one of the two conditions is satisfied, we are sure that a vertex is reachable. Otherwise, it can be either reachable or unreachable. In our implementation, we can remove any vertex which falls in the former case (i.e., it is found to be reachable by this lemma). But, we keep each vertex which falls in the latter case. This implementation does not violate Property 1 and Property 2. We found that only 0.22% of vertices fall in the latter case in our experiment. The efficiency of checking whether a vertex is reachable can be improved by using this lemma. For each vertex v, we check Condition (1) and Condition (2) in the lemma. If one of the conditions holds, then v is reachable. It is easy to see that performing the checking step with Condition (1) can be done in O(|Y |) time and performing the checking step with Condition (2) can be done in O(|Y |) time.
52
CHAPTER 4 EMPIRICAL STUDY In this thesis, we used two real terrain datasets adopted in previous studies [9, 8, 25, 28]. (1) Eagle Peak (EP) area in Wyoming State: This dataset covers an area around 10.7km×14km which contains about 3,200,000 faces, and (2) Bearhead (BH) area in Washington State: This dataset covers an area around 9.7km×13.7km which contains about 2,600,000 faces. Both datasets can be downloaded from http://data.geocomm.com. We also created synthetic datasets each of which contains a terrain bounded by a 10km×10km square horizontal plane. On this horizontal plane, we randomly pick four points as the centers of the mountains. Then, the elevation of all points with respect to the center of each mountain is modeled by a 2-dimensional Gaussian distribution denoted by mean m and standard derivation σ. The mean m of each distribution (corresponding to the elevation of the center of the mountain) is randomly generated from 0 to 10000. The standard derivation σ is an input parameter. Since each point belongs to four mountains with different elevations, we take the greatest elevation among the four distributions as the final elevation of the point. The datasets generated contain 600,000-1,000,000 faces. We implemented our proposed algorithms in C/C++. All programs were executed on CentOS linux platform on a 2xQuad Core 3GHz server with 32GB RAM. For algorithm A for problem FSGP, we use the shortest gentle path algorithm that we proposed in Chapter 2. For real datasets, we study the performance of algorithms with the following two parameters, namely (1) θm and (2) ǫ. For synthetic datasets, in addition to the above two parameters, we study the performance of the proposed algorithms with the following two additional parameters: (3) Dataset size, and (4) σ. (3) Dataset size corresponds to the total number of faces on the surface. (4) σ corresponds to the standard deviation of each distribution for a mountain. The default values of the parameters can be found in Table 4.1. We evaluate our algorithms in terms of four measurements: (1) Preprocessing time, (2) Number of faces, (3) Memory consumption, (4) Time for path finding and (5) Path 53
Parameter θm ǫ Dataset size σ
Default Value 0.3 0.1 600,000 0.1
Table 4.1: Default values length. (1) Preprocessing time: Preprocessing time corresponds to the execution time to run algorithm Surface Simplifier, (2)Number of faces: We measured the number of faces on the original surface and the number of faces (remained) on the simplified surface. (3) Memory consumption: Memory consumption corresponds to the storage size to store all faces on a surface (which can be derived from the number of faces measured above). (4) Path finding time: Path finding time of our proposed algorithm under surface simplification which finds path p corresponds to the execution time to run Step I and Step II. Path finding time of the optimal algorithm which finds path po corresponds to the execution time to run algorithm A on S. (5) Path length: The length
Preprocessing time (s)
16000 14000 12000 10000 8000 6000 4000 2000 0 0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
θm
4000
No. of faces in orig. suface No. of faces remained
3500
600
2500
500
2000
400
1500
300
1000
200
500
100
0
0 0
0.1
Time for finding po Time for finding p Time for finding pc
5000
0.3
θm
0.5
0.7
(b) The length of po The length of p The length of pc Worst-case bound
24000
Path length (m)
Time for path finding (s)
(a) 6000
700
3000
Memory consumption (MB)
Number of faces (in thousands)
of p and the length of po are both measured.
4000 3000 2000 1000
22000 20000 18000 16000 14000 12000 10000
0
8000 0
0.1
0.2
0.3
0.4
θm
0.5
0.6
0.7
0.8
(c)
0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
θm
(d)
Figure 4.1: Effect of θm (Eagle Peak where ǫ = 0.1)
54
25000 20000 15000 10000 5000 0 0
0.05
0.1
0.25
0.5
0.75
1
4000 3500
No. of faces in orig. surface No. of faces remained
600
3000
500
2500 2000
400
1500
300
1000
200
500
100
0
0 0
ε
0.05 0.1 0.25 0.5 0.75
(b) 24000
Time for finding po Time for finding p Time for finding pc
The length of po The length of p The length of pc Worst-case bound
22000
Path length (m)
Time for path finding (s)
1
ε
(a) 5000
700
Memory consumption (MB)
Number of faces (in thousands)
Preprocessing time (s)
30000
4000 3000 2000 1000
20000 18000 16000 14000 12000 10000
0 0
0.2
0.4
0.6
0.8
1
0
0.2
0.4
ε
0.6
0.8
1
ε
(c)
(d)
Preprocessing time (s)
30000 25000 20000 15000 10000 5000 0 0
0.1
0.25
0.5
0.75
1
4000 3500
No. of faces in orig. suface No. of faces remained
600
3000
500
2500 2000
400
1500
300
1000
200
500
100
0
0 0
ε
0.1
0.5
0.75
1
(b) 7000
Time for finding po Time for finding p
Path length (m)
Time for path finding (s)
0.25
ε
(a) 250
700
200 150 100 50 0
The length of po The length of p Worst-case bound
6000 5000 4000 3000 2000
0
0.2
0.4
0.6
0.8
1
0
0.2
0.4
ε
0.6
0.8
ε
(c)
(d)
Figure 4.3: Effect of ǫ (Eagle Peak where θm = π/2)
55
1
Memory consumption (MB)
Number of faces (in thousands)
Figure 4.2: Effect of ǫ (Eagle Peak where θm = 0.3)
6000 5000 4000 3000 2000 1000 0 0
0.1
0.2
0.3
0.4
0.5
θm
0.6
0.7
0.8
3500
No. of faces in orig. suface No. of faces remained
3000
500
2500 2000
400
1500
300
1000
200
500
100
0
0 0
0.1
0.3
22000
Time for finding po Time for finding p Time for finding pc
6000
θm
0.5
0.7
(b) The length of po The length of p The length of pc Worst-case bound
20000
Path length (m)
Time for path finding (s)
(a) 7000
600
Memory consumption (MB)
Number of faces (in thousands)
Preprocessing time (s)
7000
5000 4000 3000 2000 1000
18000 16000 14000 12000 10000
0
8000 0
0.1
0.2
0.3
0.4
0.5
θm
0.6
0.7
0.8
0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
θm
(c)
(d)
Preprocessing time (s)
16000 14000 12000 10000 8000 6000 4000 2000 0 0
0.05
0.1
0.25
0.5
0.75
1
3500 3000
No. of faces in orig. suface No. of faces remained
500
2500 2000
400
1500
300
1000
200
500
100
0
0 0
ε
0.05 0.1 0.25 0.5 0.75
16000
Preprocessing time (s)
Time for path finding (s)
(b)
Time for finding po Time for finding p Time for finding pc
5000
1
ε
(a) 6000
600
4000 3000 2000 1000 0
14000 12000 10000 8000 6000 4000 2000 0
0
0.2
0.4
0.6
0.8
1
0
0.05
0.1
ε
0.25
0.5
ε
(c)
(d)
Figure 4.5: Effect of ǫ (Bearhead where θm = 0.3)
56
0.75
1
Memory consumption (MB)
Number of faces (in thousands)
Figure 4.4: Effect of θm (Bearhead where ǫ = 0.1)
6000 4000 2000 0 400
600
800
1200
No. of faces in orig. suface No. of faces remained
200
1000 800
150
600 100 400 50
200 0
1000
0 400
Dataset size (in thousands)
Memory consumption (MB)
Number of faces (in thousands)
Preprocessing time (s)
8000
600
800
1000
Dataset size (in thousands)
(a)
(b)
Number of faces (in thousands)
Preprocessing time (s)
6000 5000 4000 3000 2000 1000 0 0
0.05
0.1
0.15
0.2
800
150
No. of faces in orig. suface No. of faces remained
600 100 400 50 200
0
0 0
σ
Memory consumption (MB)
Figure 4.6: Effect of dataset size (Synthetic datasets)
0.05
0.1
0.15
0.2
σ
(a)
(b)
5000 4000 3000 2000 1000 0 0
0.1
0.2
0.3
0.4
θm
0.5
0.6
0.7
0.8
(a)
800
150
No. of faces in orig. suface No. of faces remained
125 600 100 400
75 50
200 25 0
0 0
0.1
0.3
θm
0.5
0.7
(b)
Figure 4.8: Effect of dataset size (Synthetic datasets)
57
Memory consumption (MB)
Preprocessing time (s)
6000
Number of faces (in thousands)
Figure 4.7: Effect of σ (Synthetic datasets)
12000
Preprocessing time (s)
Preprocessing time (s)
12000 10000 8000 6000 4000 2000 0
10000 8000 6000 4000 2000 0
0
0.1
0.25
0.5
0.75
1
0
0.1
0.25
ε
0.5
0.75
1
ε
(a)
(b)
Figure 4.9: Effect of σ (Synthetic datasets)
4.1 Real datasets We conducted experiments on two real datasets, Eagle Peak and Bearhead. The results for Eagle Peak can be found in Figure 4.1, Figure 4.2 and Figure 4.3. Effect of θm : In Figure 4.1a, when θm increases, the preprocessing time increases. This is because, when θm is larger, intuitively, the slope requirement is weaker and thus we can remove more vertices in algorithm Surface Simplifier. If there are more vertices removed, then the time to simplify the surface (in the preprocessing step) is larger. In Figure 4.1b, the number of vertices remained (and thus the memory consumption of the surface) decreases when θm increases. In Figure 4.1c, when θm increases, the time for finding p decreases. Since θm is larger, the total number of faces remained is smaller. Thus, the time for finding p is shorter. Besides, the time for finding po is much longer than the time for finding p. In particular, if ǫ = 0.1 and θm = 0.3, our proposed algorithm which finds p takes 103s but the optimal algorithm which find po 7402s. Thus, the speedup is 72 times. Besides, we also measured the execution times of Step I and Step II of our proposed algorithm. The execution time of Step I is 8 times larger than that of Step II, which suggests that algorithm A (used in Step I) spent most of the execution time. In Figure 4.1d, we denote an additional curve called “Worst-case bound” to denote the greatest theoretical error according to the length of po . This value is equal to (1 + ǫ)|po|. In this figure, the length of p (po ) decreases when
θm increases. Besides, the length of p is a little bit higher than the length of po . In particular, if ǫ = 0.1 and θm = 0.3, the ratio of the length of p to the length of po is 1.02. Effect of ǫ: Figure 4.2a show that the preprocessing time increases with ǫ. This is 58
because the number of faces removed increases with ǫ and thus algorithm Surface Simplifier needs more time to simplify the surface. In Figure 4.2b, the number of faces removed increases with ǫ. In Figure 4.2c, the time to find path p decreases when ǫ increases. This is because the total number of faces remained is smaller if ǫ is larger. In Figure 4.2d, the length of p increases slightly when ǫ increases. This is because there are more faces removed and thus the remaining faces may not represent well the surface. Thus, the length of p is larger. Effect for Traditional Problem: We studied our proposed framework, surface simplification, for the traditional problem which does not consider any slope constraint (Figure 4.3). The results are also similar to Figure 4.2 but the preprocessing time and the time for finding p (po ) are shorter. In particular, our proposed algorithm to find path p takes 1s with 10% distance error guarantee. However, the optimal algorithm takes more than 202 seconds to find po . The speedup is 202 times. In addition, interestingly, when ǫ = 0, the time for finding p is smaller than the time for finding po because Surface Simplifier merge some adjacent faces with the same slope which speeds up the computation. We also did the experiments for Bearhead to study how θm and ǫ affect the performance of the algorithms and study how the proposed algorithm works well for the traditional problem. The results are also similar to those obtained from Eagle Peak. For the sake of space, we just show the results for parameter θm in Figure 4.4.
4.2 Synthetic datasets We also conducted experiments on synthetic datasets. For the sake of space, we show the results about the preprocessing time, the number of faces and the memory consumption only. Effect of Dataset Size: In Figure 4.6a, the preprocessing time increases with the dataset size. Figure 4.6b shows that, when the dataset size increases, the number of remaining faces keeps nearly unchanged. This is because when the dataset size is large, the number of vertices on a given fixed surface will be larger. However, since the surface generated by the synthetic data generator is nearly the same when the dataset size is larger, after surface simplification, it is likely that the given surface contains nearly the same number of faces (when the dataset size increases). 59
Effect of σ: When σ increases, the surface of the mountain generated by the synthetic dataset generator becomes smoother. Thus, the number of faces removed increases and thus the preprocessing time increases. The results are shown in Figure 4.7. Effect of θm and ǫ: Figures 4.8 and 4.9 shows the results when we vary θm and ǫ, respectively. The trends for the effect of θm and ǫ on the synthetic datasets are similar to the trends on the real datasets. Conclusion: Our proposed algorithm runs efficiently if we sacrifice the length of the path a little bit. In particular, if ǫ = 0.1 and θm = 0.3, our proposed algorithm runs 72 times faster than the optimal algorithm which finds the optimal path on S if the path found by our algorithm is at most 10% longer than the optimal path. If we set θm = π/2, our proposed problem becomes the traditional problem. Our proposed algorithm runs 202 times faster than the optimal algorithm with 10% distance guarantee.
4.3 Visualization of Experimental Results In this section, we provide intuitive illustrations of the experimental results of our surface simplification algorithm. For the two real data sets, we study how the two factors θm and ǫ affect the simplification results. Take Fig. 4.10 as an example. Given a fixed approximation bound ǫ = 0.1, the surface of the terrain in Bearhead is simplified to surfaces of different resolutions when θm is set to different values (e.g. 0.1, 0.3, 0.5 and 0.7). When θm becomes larger, more vertices can be removed and thus the number of triangles is smaller. Similar observations can be found in Eagle Peak data set, as shown in Fig. 4.12. Fig. 4.11 and 4.13 shows the same surfaces but we fix the value of θm and vary the value of ǫ. Similarly, when ǫ becomes larger, more vertices can be removed.
60
(a) θm = 0.1
(b) θm = 0.3
(c) θm = 0.5
(d) θm = 0.7
Figure 4.10: Effect of θm (Bearhead where ǫ = 0.1)
61
(a) ǫ = 0.1
(b) ǫ = 0.25
(c) ǫ = 0.5
(d) ǫ = 0.75
Figure 4.11: Effect of ǫ (Bearhead where θm = 0.3)
62
(a) θm = 0.1
(b) θm = 0.3
(c) θm = 0.5
(d) θm = 0.7
Figure 4.12: Effect of θm (Eagle Peak where ǫ = 0.1)
63
(a) ǫ = 0.1
(b) ǫ = 0.25
(c) ǫ = 0.5
(d) ǫ = 0.75
Figure 4.13: Effect of ǫ (Eagle Peak where θm = 0.3)
64
CHAPTER 5 CONCLUSION In this paper, we study a fundamental operator in spatial databases, finding shortest paths on the surface of a terrain. In this problem, we consider the slope requirement such that the path is not too steep. Firstly, we proposed an algorithm for finding the accurate shortest path that satisfies a given slope constraint. The algorithm is based on a breadth-first search strategy and some pruning techniques are introduced. However, since solving this problem is more challenging than solving the traditional problem, we also propose a new framework called surface simplification. Under this framework, we can compute shortest gentle paths efficiently. We conducted the experiments to show that our proposed framework is very efficient and effective not only for problem FSGP but also for the traditional problem. There are a lot of promising research directions. Firstly, it is interesting to consider other popular spatial queries such as k nearest neighbors queries and range queries on the surface with the slope constraint. Secondly, another interesting direction is to study the real time spatial queries such as continuous k nearest neighbors in our problem setting, which have been studied extensively recently.
65
REFERENCES [1] J. Canny and J. Reif. New lower bound techniques for robot motion planning problems. Foundations of Computer Science, 1987., 28th Annual Symposium on, pages 49–60, Oct. 1987. [2] J. Chen and Y. Han. Shortest paths on a polyhedron. In SCG ’90: Proceedings of the sixth annual symposium on Computational geometry, pages 360–369, New York, NY, USA, 1990. ACM. [3] S.-W. Cheng, H.-S. Na, A. Vigneron, and Y. Wang. Approximate shortest paths in anisotropic regions. In SODA ’07: Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, pages 766–774, Philadelphia, PA, USA, 2007. Society for Industrial and Applied Mathematics. [4] T. Coleman and Y. Li. On the convergence of reflective newton methods for largescale nonlinear minimization subject to bounds. Mathematical Programming, 67(2):189–224, 1994. [5] T. F. Coleman and Y. Li. An interior trust region approach for nonlinear minimization subject to bounds. SIAM Journal on Optimization, 6(2):418–445, 1996. [6] M. de Berg, O. Cheong, M. van Kreveld, and M. Overmars. Computational Geometry: Algorithms and Applications. Springer, Berlin, 3rd ed. edition, 2008. [7] K. Deng and X. Zhou. Expansion-based algorithms for finding single pair shortest path on surface. In W2GIS, pages 151–166, 2004. [8] K. Deng, X. Zhou, H. T. Shen, Q. Liu, K. Xu, and X. Lin. A multi-resolution surface distance model for k-nn query processing. The VLDB Journal, 17(5):1101– 1119, 2008. [9] K. Deng, X. Zhou, H. T. Shen, K. Xu, and X. Lin. Surface k-nn query processing. In ICDE, 2006. [10] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische Mathematik, 1(1):269–271, December 1959. 66
[11] Q. Y. Duan, V. K. Gupta, and S. Sorooshian. Shuffled complex evolution approach for effective and efficient global minimization. Journal of optimization theory and applications, 76(3):501–521, 1993. [12] R. W. Floyd. Algorithm 97: Shortest path. Commun. ACM, 5(6):345, 1962. [13] J. Hershberger and S. Suri. An optimal algorithm for euclidean shortest paths in the plane. SIAM J. Comput, 28:2215–2256, 1999. [14] T. Kanai and H. Suzuki. Approximate shortest path on polyhedral surface based on selective refinement of the discrete graph and its applications. In GMP ’00: Proceedings of the Geometric Modeling and Processing 2000, page 241, Washington, DC, USA, 2000. IEEE Computer Society. [15] M. Lanthier, A. Maheshwari, and J.-R. Sack. Shortest anisotropic paths on terrains. In In Proceedings of the 26th International Colloquium on Automata, Languages and Programming, pages 524–533. Springer-Verlag, 1999. [16] M. A. Lanthier, A. Maheshwari, and J.-R. Sack. Approximating weighted shortest paths on polyhedral surfaces. In Proc. 13th ACM Symp. on Computational Geometry, 1997. [17] D.-T. Lee. Proximity and reachability in the plane. PhD thesis, Champaign, IL, USA, 1978. [18] T. Lozano-P´erez and M. A. Wesley. An algorithm for planning collision-free paths among polyhedral obstacles. Commun. ACM, 22(10):560–570, 1979. [19] C. S. Mata and J. S. B. Mitchell. A new algorithm for computing shortest paths in weighted planar subdivisions. In Proc. 13th ACM Symp. on Computational Geometry, 1997. [20] J. S. B. Mitchell, D. M. Mount, and C. H. Papadimitriou. The discrete geodesic problem. SIAM J. Comput., 16(4):647–668, 1987. [21] N.C.Rowe and R.S.Ross. Optimal grid-free path planning across arbitrarily contoured terrain with anisotropic friction and gravity effects. In IEEE Transactions on Robotics and Automation, Vol.6, No.5, October 1990, pp.540-533, 1990.
67
[22] J. O’Rourke, S. Suri, and H. Booth. Shortest paths on polyhedral surfaces. In Proceedings on STACS 85 2nd annual symposium on theoretical aspects of computer science, pages 245–254, New York, NY, USA, 1985. Springer-Verlag New York, Inc. [23] G. W. Records. Guinness: World Records 2010. Guinness, 2009. [24] W. J. Schroeder, J. A. Zarge, and W. E. Lorensen. Decimation of triangle meshes. In SIGGRAPH ’92: Proceedings of the 19th annual conference on Computer graphics and interactive techniques, pages 65–70, New York, NY, USA, 1992. ACM. [25] C. Shahabi, L.-A. Tang, and S. Xing. Indexing land surface for efficient knn query. PVLDB, 1(1):1020–1031, 2008. [26] M. Sharir and A. Schorr. On shortest paths in polyhedral spaces. In STOC ’84: Proceedings of the sixteenth annual ACM symposium on Theory of computing, pages 144–153, New York, NY, USA, 1984. ACM. [27] V. Surazhsky and T. Surazhsky. Fast exact and approximate geodesics on meshes. ACM Trans. Graph, 24:553–560, 2005. [28] S. Xing, C. Shahabi, and B. Pan. Continuous monitoring of nearest neighbors on land surface. PVLDB, 2(1):1114–1125, 2009.
68