This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Efficient Exact Enumeration of Single-Source Geodesics on a Non-Convex Polyhedron

Kazuma Tateiri Graduate School of Information Science and Technology, Hokkaido University,Sapporo 060-0810, Japan [email protected]
(Date: 16 December 2023)
Abstract.

In this paper, we consider enumeration of geodesics on a polyhedron, where a geodesic means locally-shortest path between two points. Particularly, we consider the following preprocessing problem: given a point ss on a polyhedral surface and a positive real number rr, to build a data structure that enables, for any point tt on the surface, to enumerate all geodesics from ss to tt whose length is less than rr. First, we present a naive algorithm by removing the trimming process from the MMP algorithm (1987). Next, we present an improved algorithm which is practically more efficient on a non-convex polyhedron, in terms of preprocessing time and memory consumption. Moreover, we introduce a single-pair geodesic graph to succinctly encode a result of geodesic query. Lastly, we compare these naive and improved algorithms by some computer experiments.

Key words and phrases:
Geodesics; enumeration; locally-shortest paths; polyhedral geodesics; discrete geodesics

1. Introduction

The shortest path problem is a fundamental problem in the field of discrete algorithm, which is also practically important and has been extensively investigated. Particularly, there is a variety of work for the single-source shortest path problem on a polyhedral surface [1, 2, 3, 4]. The single-source shortest path problem on a polyhedron is defined as follows: An input to the problem consists of a polyhedron 𝒫\mathcal{P} and a point ss on 𝒫\mathcal{P}. The task is to find a shortest path from ss to tt for all vertices tt of 𝒫\mathcal{P}. Mitchell, Mount and Papadimitriou [1] first presented an efficient algorithm for the problem, which computes the shortest path between two points on a polyhedron. Following [1], there has been a variety of work for the single-source shortest path problem on a polyhedron, including the CH algorithm by Chen and Han [2] and the ICH algorithm by Xin and Wang [3]. Moreover, a graph-based approach to the vertex-to-vertex all-pairs shortest path problem on a polyhedron is given based on the Saddle Vertex Graph by Ying, Wang, and He [4]. On the other hand, geodesics on a smooth surface are defined to be locally shortest paths in differential geometry, and have applications in subfields of physics such as mechanics and optics, but relatively less attention has been attracted in the discrete algorithm field. Particularly, the problem of enumerating locally shortest geodesics with given two endpoints on a polyhedron has not been studied to date.

In this paper, firstly we define geodesics on a polyhedron, and formulate the single-source geodesics enumeration problem as a generalization of the single-source shortest path problem on a polyhedron. The problem is stated as follows: given a point ss on a polyhedral surface and a positive real number RR, an algorithm is asked to build a data structure 𝒯\mathcal{T} for queries of enumeration of all (possibly non-shortest) geodesics shorter than RR, which goes from ss to arbitrarily chosen point tt on the surface. Such a query is called a geodesics enumeration query. For the purpose, we first introduce a naive version of the data structure, called the complete geodesic interval tree, that is computed from a point ss on a polyhedral surface and a positive real number RR in O(NlogN)O(N\log N) time using O(N)O(N) space, where NN is the number of intervals contained in 𝒯\mathcal{T}. Next, we consider the problem of reducing the number of intervals in 𝒯\mathcal{T}, which leads to the reduction of time and space of enumerating geodesic paths. To tackle this problem, we present an improved version of the data structure, called the reduced geodesic interval tree, where we remove the overlaps between adjacent intervals around a hyperbolic vertex. Moreover, we show that the reduced geodesic interval tree allows a query result to be succinctly encoded as a single-pair geodesic graph. By our experiments, it was shown that the reduced geodesic interval tree is smaller than the complete geodesic interval tree, and the reduced geodesic interval tree is better in practical running time and memory consumption.

2. Preliminaries

Throughout this paper, we simply use the term polyhedron (plural polyhedra) to mean a (possibly non-convex) polyhedral surface, not solid polyhedron. We deal with simplicial (which means triangulated) orientable polyhedra in 3\mathbb{R}^{3}, and the symbol 𝒫\mathcal{P} is dedicated to mean such one.

Definition 2.1.

Let vv be a vertex of 𝒫\mathcal{P}. Let τ\tau be the sum of angles around vv (measured along the faces) and we call it the total angle of vv. Following [5], we say that

  • if τ<2π\tau<2\pi, vv is spherical;

  • if τ=2π\tau=2\pi, vv is Euclidean;

  • if τ>2π\tau>2\pi, vv is hyperbolic.

Refer to caption
(a) spherical
Refer to caption
(b) hyperbolic
Figure 1. A spherical vertex and a hyperbolic vertex
Remark 2.2.

If 𝒫\mathcal{P} is convex, every vertex is spherical or Euclidean. Note that the angle defect 2πτ2\pi-\tau can be interpreted as the discrete Gaussian curvature at vv. For example, a discrete analog of the Gauss-Bonnet theorem holds for a polyhedron [6].

We define a geodesic as follows:

Definition 2.3.

(geodesics) Let γ\gamma be a path connecting ss and tt on 𝒫\mathcal{P}. We say that γ\gamma is a geodesic if and only if:

  1. (1)

    γ\gamma is straight inside any face, and where γ\gamma passes through an edge sequence =(e1,,ek)\mathcal{E}=(e_{1},\dots,e_{k}), γ\gamma is straight on the unfolding obtained from \mathcal{E};

  2. (2)

    where γ\gamma passes through a vertex, the angle at the vertex made on the both sides of γ\gamma are greater than or equal to π\pi (see Figure 2).

Refer to caption
Refer to caption
Figure 2. Geodesic passing through a vertex. Here απ\alpha\geq\pi and βπ\beta\geq\pi.
Left: 3D perspective view, right: top view
Lemma 2.4.

A geodesic never passes through any spherical vertex.

Proof.

Since the angle α\alpha and β\beta at the vertex made on the both sides of γ\gamma satisfy απ\alpha\geq\pi and βπ\beta\geq\pi (see Figure 2), the total angle of this vertex is τ=α+β2π\tau=\alpha+\beta\geq 2\pi. ∎

Remark 2.5.

Although a geodesic does not pass through a spherical vertex, its endpoints may be spherical vertices. Moreover, a geodesic may pass through an arbitrarily close neighbor of a spherical vertex.

Remark 2.6.

In Figure 2, we depicted the angles at a vertex in two different styles: in a 3D perspective view and a top view. Whenever we present a top-view style figure (like the right one in Figure 2), angles described in it are intended to be measured along the faces.

Intuitively, a geodesic is a locally-shortest path. Geodesics on a polyhedron, defined above, can be used to approximate geodesics on a smooth surface, defined in differential geometry. Nevertheless, there are some important differences between the discrete geodesics and the smooth geodesics. Let us take a look at some examples.

Figure 3 shows the shortest geodesic (red) and other geodesics (green) on a discrete ellipsoid. Since it is convex (and does not have Euclidean vertices), every vertex is spherical and geodesics pass through no vertices. Instead, there are often multiple similar geodesics that differ in how they “bypass” the vertices. As a result, when a smooth surface is discretized into a polyhedron, a single geodesic on the smooth surface often corresponds to multiple geodesics on the discretized polyhedral surface.

Refer to caption
Figure 3. Geodesics on a discrete ellipsoid

If the polyhedron has hyperbolic vertices, the geodesics can pass through them. Figure 4 shows that the shortest geodesic (red) passes through consecutive four hyperbolic vertices, as well as some of non-shortest geodesics (green) also pass through several vertices. These vertices are marked in yellow. In general, a geodesic can be decomposed into a sequence of geodesics passing through no hyperbolic vertices. We call them primitive geodesics.

Definition 2.7 (primitive geodesic).

A geodesic passing through no hyperbolic vertices is called a primitive geodesic.

Remark 2.8.

Endpoints of a primitive geodesic may be hyperbolic vertices.

Refer to caption
Figure 4. Geodesics on a discrete torus

2.1. Our problem

Let 𝒫\mathcal{P} be a simplicial polyhedron in 3\mathbb{R}^{3}. When we give a source ss on 𝒫\mathcal{P}, we want to compute all geodesics from ss to an arbitrary point tt on 𝒫\mathcal{P}. Since we have infinitely many choice of tt, we consider a query that inputs tt and outputs these geodesics. And yet, there are likely to be infinitely many such geodesics and we give an upperbound of their length RR to obtain finite result.

It is widely known that single-source shortest path problems (SSSPs) for graphs or polyhedra can be efficiently solved using a queue or a priority queue. Here, we can think of a generalization of SSSPs, namely, single-source geodesics enumeration problem on a polyhedron.

Definition 2.9 (single-source geodesics enumeration problem).

Suppose that 𝒫\mathcal{P} is a simplicial polyhedron in 3\mathbb{R}^{3}, ss is a point on 𝒫\mathcal{P} and RR is a positive real number. We define our single-source geodesics enumeration problem to be the problem of building data structure that enables to query, for any point tt on 𝒫\mathcal{P}, all geodesics from ss to tt whose length is less than RR. We call an algorithm for this problem a single-source geodesics enumeration algorithm, or simply geodesics enumeration algorithm.

3. Related work

As far as we know, there is no prior work for enumerating geodesics on a polyhedron. However, there is a variety of research relating to geodesics on polyhedral meshes.

3.1. Shortest geodesics

The shortest path problem on a polyhedron has been extensively researched. On a polyhedron without boundary, a shortest path is a geodesic in our sense [1], thus the shortest path problem is equivalent to the shortest geodesic problem. Shortest geodesic algorithms can be divided into exact algorithms and approximate algorithms. Since the interest of this paper is exact algorithms, approximate algorithms are not discussed in detail here. Detailed survey of this topic is given by [7, 8].

3.1.1. Interval propagation algorithms for the SSSP

The MMP algorithm given by Mitchell, Mount and Papadimitriou [1] is an important exact algorithm for the SSSP on a polyhedron. It retains intervals on each edge, so that the shortest path to any point within an interval has the same combinatorial structure (faces, edges and vertices). Information required to reconstruct geodesics is appended to these intervals. However, each interval only represents geodesics passing through a particular face among the two faces incident to the edge. This can be interpreted that each interval is assigned to a directed edge and only represents geodesics through one side (in the original paper, it is the right side along the directed edge).

In the earliest stage of the MMP algorithm, intervals are created only for the edges facing ss. Each interval is propagated using the continuous Dijkstra scheme. When it detects a shortest geodesic reaching a hyperbolic vertex, it generates the intervals representing the geodesics passing through that vertex. Intervals on the same directed edge are ordered, and a newly-propagated interval is inserted into the ordered list of the intervals already-existing on the directed edge. Then, it performs trimming among the new interval and adjacent intervals. By trimming, intervals are cut to ensure shortestness against other intervals, and intervals on a directed edge become disjoint. Intervals may become empty as a result of trimming, and such intervals are not propagated. When no non-empty intervals are newly created and the priority queue becomes empty, the algorithm terminates and outputs the shortest geodesics. Its computational complexity given by the original authors is O(n2logn)O(n^{2}\log n) time and O(n2)O(n^{2}) space, where nn is the number of the edges of the input polyhedron. However, according to an experiment by Surazhsky et al. [9], its practical complexity is subquadratic and could be considered as approximately O(n1.5logn)O(n^{1.5}\log n) time and O(n1.5)O(n^{1.5}) space. They analyzed the reason behind it as that, the number of intervals per edge is approximately O(n0.5)O(n^{0.5}) in practice, despite the O(n)O(n) estimation by MMP.

Most of exact algorithms for the SSSP on a polyhedron, published after the MMP algorithm, contain the concept of interval propagation. The CH algorithm by Chen and Han [2] uses a FIFO queue instead of a priority queue. Its theoretical complexity is O(n2)O(n^{2}) time and O(n)O(n) space, but its practical performance is not as good as the MMP algorithm. The ICH (improved CH) algorithm by Xin and Wang [3] introduces into the CH algorithm a priority queue as well as several new rules to exclude intervals not contributing to any shortest paths. In theory, the usage of a priority queue increases its time complexity to O(n2logn)O(n^{2}\log n), but greatly improves its practical performance. While the MMP algorithm requires inserting an interval into an ordered list and solving a quadratic equation to get the intersection of the interval and certain hyperbola, the ICH algorithm does not. As a result, the ICH algorithm may outperform the MMP algorithm despite the ICH algorithm may generate more intervals than the MMP algorithm. Moreover, the ICH algorithm does not require the history of the propagated intervals to be retained. As a result, the space complexity of the ICH algorithm is O(n)O(n), which is significantly smaller than the MMP algorithm.

3.1.2. Saddle Vertex Graph

The Saddle Vertex Graph (SVG) by Ying, Wang and He [4] is an approach to the vertex-to-vertex all-pairs shortest path problem on a polyhedron. They noticed that a shortest geodesic between two hyperbolic vertices may be shared by multiple longer shortest geodesics, and reduced the problem to the well-known shortest path problem on a graph by precomputing shortest primitive geodesics connecting two vertices. However, when the given polyhedron is convex, it has no hyperbolic vertices and there is no difference from precomputing the shortest path for every pair of vertices. However, they observed real-world meshes contain 40-60% hyperbolic vertices and more than 90% of shortest paths pass through at least one hyperbolic vertex. Also, they considered the exact SVG is too large to be tractable for large meshes and proposed a method to sparsify it, and evaluated error by computer experiments.

3.2. General geodesics

Geodesics, which are not limited to shortest, also have been researched in the context of geodesic tracing and path shortening.

3.2.1. Geodesic tracing

A classical problem about a smooth surface in differential geometry is to trace the smooth geodesic from a given point pp and a tangent direction vv. Concerning the corresponding problem on a polyhedron, this can be done at almost every point. However, a geodesic cannot proceed beyond a spherical vertex, and it cannot uniquely determine its direction when it hits a hyperbolic vertex. To cope with this problem, Polthier and Schmies suggested a straightest geodesic which goes through a vertex to halve the total angle of the vertex [5]. However, it is not necessarily locally-shortest anymore, and does not have continuity respect to pp and vv, i.e. it jumps when it moves onto or across a non-Euclidean vertex, thus its nature vastly differs from a geodesic on a smooth surface. To fill this gap, Cheng, Miao, Liu, Tu and He suggested a method to trace smooth geodesics on a tangent-continuous curved surface constructed from the input polyhedron using PN-triangles, and evaluated its accuracy by computer experiments [10].

3.2.2. Path shortening

In this approach, an input polyline on a polyhedron is shortened until it becomes a geodesic. The shortening process is performed according to local configuration of the path. It is implemented in e.g. [11, 12, 13] and they used it to refine a path obtained by Dijkstra’s algorithm on the edge graph or other approximate shortest path algorithms on the polyhedron.

Recently, a flip-based algorithm was developed by Sharp and Crane [14]. An initial path is given as an edge sequence, and until the path becomes a geodesic, the algorithm modifies the triangulation by flipping an edge so that the new shortened path is still on the edges of the new triangulation. It works on intrinsic triangulations of a polyhedron — that is, the new triangulation is intrinsically embedded in the original surface, and its edges are no longer straight when it is viewed as an object in 3\mathbb{R}^{3}. It allows the geometry of the original surface to remain unchanged by flipping. Their method can yield not only open geodesics but also closed geodesics. Although they did not give worst-case bounds, they proved that it always obtains a geodesic by finite operations, and observed that its practical running time is on the order of milliseconds.

4. Geodesics and intervals

To explain how intervals can be used to express geodesics, we begin with an observation of geodesics on a polyhedron. In Figure 5, a geodesic gg from the source ss, to tt on a face σ\sigma, is shown in red. Since gg passes through a vertex vv, it can be decomposed into the two primitive geodesics, between svsv and between vtvt. By Definition 2.3 (1), a primitive geodesic can be unfolded into a line segment. Particularly, the primitive geodesic between vtvt can be unfolded into the line segment v~t\tilde{v}t on the plane containing σ\sigma (Figure 6).

Refer to caption
Figure 5. A geodesic from ss to tt via vv
Refer to caption
Figure 6. Geodesic and unfolding

This unfolding of the geodesic between vtvt is shown in 2D in Figure 7. As a simple observation, when one moves tt in the region shaded in yellow, the line segment v~t\tilde{v}t still gives a geodesic on the unfolding. This region is chosen so that the line segment v~t\tilde{v}t does not go out of the unfolding and satisfies the condition (2) in Definition 2.3 at vv.

Refer to caption
Figure 7. The same unfolding in 2D

When tt is inside a face, one can extend the geodesic until hitting an edge, thus here we only consider geodesics to a point on an edge. We introduce concept of intervals generalizing the ones in the MMP algorithm (or other interval propagation algorithm) to express geodesics to a particular range on an edge. Figure 8 shows an outline of this expression. The yellow and green line segments represent the range of the intervals and indicate the range on which geodesics can be given in this unfolding. The region darkly shaded in their respective color indicates the region in which the interval is used in the geodesic query. As a remark, when a geodesic passes through no vertices, we consider the unfolding of the whole geodesic from ss, and when it passes through multiple vertices, we consider the unfolding of the primitive geodesic between the last vertex and tt.

Figure 9 shows the intervals to express the geodesics immediately after passing through a vertex. We call them pseudo-source intervals.

Refer to caption
Figure 8. Geodesic and intervals
Refer to caption
Refer to caption
Figure 9. pseudo-source intervals, made at a hyperbolic vertex
Definition 4.1.

An interval II is defined to be the following data structure:

  • I.ParentI.\mbox{Parent}: the interval which generated II (by propagation)

  • I.EdgeI.\mbox{Edge}: the target edge

  • I.FaceI.\mbox{Face}: the target face

  • I.ExtentI.\mbox{Extent}: the target line segment on I.EdgeI.\mbox{Edge} (identified with II itself)

  • I.CenterI.\mbox{Center}: the unfolded position of the last vertex

  • I.DepthI.\mbox{Depth}: the length of the geodesic between ss and the last vertex

It is used to express all geodesics reaching the line segment I.ExtentI.\mbox{Extent} on the edge I.EdgeI.\mbox{Edge} through the last vertex. If the geodesics have not passed through a hyperbolic vertex yet, I.CenterI.\mbox{Center} is the unfolded position of ss and I.DepthI.\mbox{Depth} is 0.

We regard II to be oriented so that I.FaceI.\mbox{Face} is seen on the left side along I.EdgeI.\mbox{Edge}. We define the starting point of II with respect to this orientation. Moreover, II has the following two functions:

  • I.Project(p:pI.Face)I.\mbox{Project}(p:p\in I.\mbox{Face}) := the intersection point of I.EdgeI.\mbox{Edge} and the line connecting pp and I.CenterI.\mbox{Center}

  • I.Distance(p:pI.Face)I.\mbox{Distance}(p:p\in I.\mbox{Face}) := (the distance of pp and I.CenterI.\mbox{Center}) + I.DepthI.\mbox{Depth}

The interval II can yield a geodesic at pI.Facep\in I.\mbox{Face} if I.Project(p)I.ExtentI.\mbox{Project}(p)\in I.\mbox{Extent}, and its length is given by I.Distance(p)I.\mbox{Distance}(p).

Remark 4.2.

I.CenterI.\mbox{Center} can be expressed in either the 3D global coordinate system or a 2D local coordinate system on I.FaceI.\mbox{Face}. 2D local coordinates are slightly faster and memory efficient, as well as ensure that given coordinates are always on the plane. Our implementation uses the 3D global coordinate system in input and output, but uses a 2D local coordinate system in internal storage and computation, and converts one to the other when necessary. That means, our algorithms could run on a polyhedron in higher-dimensional Euclidean space as well.

Remark 4.3.

Our algorithms can also work on a self-intersecting polyhedral surface. In this case, geodesics are not bent at the intersection and pass through it as if there were no intersection — geodesics are completely defined locally. On the other hand, we assume the orientability of the surface, which may not be the case for a self-intersecting (or higher-dimensional) polyhedron. If this is an issue, one can take the orientable double covering of the surface, as demonstrated in Figure 10. In this figure, geodesics are computed on a discretized version of the orientable double covering, which is homeomorphic to the sphere, of the (non-orientable) Roman surface (a realization of the real projective plane in 3\mathbb{R}^{3}). The source ss is given once, but the target tt is given twice, correspondingly to its two images on the double covering. In the figure, two different colors are used accordingly.

Refer to caption
Figure 10. Geodesics on a discretized Roman surface
Remark 4.4.

Our implementation uses the half-edge data structure as the internal representation of a polyhedron, thus every edge is directed. Here the 2D local coordinate system is defined by the directed edge e=I.Edgee=I.\mbox{Edge} so that its origin is the starting point of ee, its positive xx direction is the direction of ee, its yy axis is orthogonal to the xx axis and any point inside I.FaceI.\mbox{Face} has positive yy value. Complex numbers are convenient for expressing the local coordinates, because

  • we often need an 1D parametric coordinate on ee as well. Since a real number is considered to be a complex number whose imaginary part is zero, we can naturally treat it as a special case of 2D local coordinates;

  • when we express I.CenterI.\mbox{Center} in the 2D local coordinate system, we need to apply coordinate transformation to propagate an interval. This transformation consists of 2D rotation and translation, which can be expressed in terms of complex multiplication and addition;

  • functions such as abs\mathrm{abs} and arg\mathrm{arg} are also useful to implement our algorithm.

5. Naive geodesics enumeration algorithm

We can make a naive geodesics enumeration algorithm by propagating intervals without the trimming process in the MMP algorithm. All intervals generated in this way form a tree structure by the Parent pointer. we call it the complete geodesic interval tree or the complete GIT.

This algorithm firstly performs initialization of generating several intervals, and proceeds by processing events. We define propagation to be the act of generating one or more new intervals by processing an event. Events consist of the following two types:

  • edge event : when a geodesic given by II reaches I.ExtentI.\mbox{Extent} for the first time

    • this event is associated with II

    • time of occurrence: (the distance of I.ExtentI.\mbox{Extent} and I.CenterI.\mbox{Center}) + I.DepthI.\mbox{Depth}

  • vertex event : when a geodesic reaches a vertex vv

    • this event is associated with the interval II of which the starting point is vv

    • time of occurrence: (the distance of vv and I.CenterI.\mbox{Center}) + I.DepthI.\mbox{Depth}

We introduce an event queue to manage the order of events. It is a priority queue, and lets the algorithm process events in the ascending order of their time of occurrence.

The outline is described in Algorithm 1 as a pseudocode.

Algorithm 1 (Building the geodesic interval tree)
1:function BuildGeodesicIntervalTree(ss: source, RR: upperbound of length)
2:     QQ := the event queue
3:     Initialize(QQ, ss)
4:     while the time of occurence of the top event of QQ <R<R do
5:         QQ.Pop().Handle(QQ)
6:     end while
7:end function
Remark 5.1.

In Algorithm 1 (and Definition 2.9), we assume that RR is given ahead of time. Alternatively, we can rewrite the line 4 with another arbitrary terminating condition (or as an infinite loop which can be stopped by a human), and when the loop terminates, RR can be obtained as the time of occurrence of the top event of QQ. This also applies to the improved algorithm in the next section.

5.1. Initialization

Firstly, the intervals for all edges facing ss are generated. Figure 11 shows the cases of ss being inside a face (left), inside an edge (middle), and at a vertex (right). For each II of these initial intervals, I.ParentI.\mbox{Parent} is Null, I.CenterI.\mbox{Center} is ss, I.DepthI.\mbox{Depth} is 0, I.ExtentI.\mbox{Extent} is the whole I.EdgeI.\mbox{Edge}, and I.FaceI.\mbox{Face} is the face containing both ss and I.EdgeI.\mbox{Edge}. For each II, the associated edge event and vertex event are inserted into the event queue. (Algorithm 2)

Refer to caption
Refer to caption
Refer to caption
Figure 11. Initialization
Algorithm 2 (Initialization)
1:function Initialize(QQ, ss)
2:     I1IkI_{1}\dots I_{k} := the initial intervals
3:     for ii in 1k1\dots k do
4:         QQ.Push(EdgeEvent(IiI_{i}))
5:         QQ.Push(VertexEvent(IiI_{i}))
6:     end for
7:end function

5.2. Procedure for edge events

When an edge event occurs, the associated interval II is projected from I.CenterI.\mbox{Center} into the opposite edges of I.EdgeI.\mbox{Edge} (Figure 12). The projection result is on either one edge (left) or two edges (right). For each newly created interval IiI_{i} (left: I1I_{1}, right: I1,I2I_{1},I_{2}), Ii.Parent=II_{i}.\mbox{Parent}=I, Ii.Depth=I.DepthI_{i}.\mbox{Depth}=I.\mbox{Depth} and Ii.FaceI_{i}.\mbox{Face} is the triangular face in Figure 12. Ii.CenterI_{i}.\mbox{Center} is obtained by certain 3D rotation around I.EdgeI.\mbox{Edge} to make it coplanar with Ii.FaceI_{i}.\mbox{Face}. For each IiI_{i}, the associated edge event is inserted into the event queue. In the two-interval case (right), the vertex event at the intermediate vertex vv is associated with the interval starting at vv (that is I2I_{2}) and inserted into the event queue. (Algorithm 3)

Refer to caption
Refer to caption
Figure 12. Projection of an interval
Algorithm 3 (Processing an edge event)
1:function EdgeEvent.Handle(QQ)
2:     II := the associated interval
3:     if II is projected into one interval I1I_{1} then
4:         QQ.Push(EdgeEvent(I1I_{1}))
5:     else  // II is projected into two intervals I1I_{1} and I2I_{2}
6:         QQ.Push(EdgeEvent(I1I_{1}))
7:         QQ.Push(EdgeEvent(I2I_{2}))
8:         QQ.Push(VertexEvent(I2I_{2}))
9:     end if
10:end function

5.3. Procedure for vertex events

When a vertex event occurs, the associated interval II is recorded on vv as it gives the geodesic arriving at vv. If vv is hyperbolic, one or more pseudo-source intervals are generated. In Figure 9, one interval in the left subfigure, two intervals in the right are generated. For each newly-created interval IiI_{i}, Ii.Parent=II_{i}.\mbox{Parent}=I, Ii.Center=vI_{i}.\mbox{Center}=v, Ii.DepthI_{i}.\mbox{Depth} is the length of the geodesic to vv (= the time of occurrence of this event), and the associated edge event and vertex event (if exists) are inserted into the event queue. (Algorithm 4)

Algorithm 4 (Processing a vertex event, for the complete GIT)
1:function VertexEvent.Handle(QQ)
2:     II := the associated interval
3:     vv := the starting point of II
4:     Record II on vv
5:     if vv is not hyperbolic then
6:         return
7:     end if
8:     I1Ik:=I_{1}\dots I_{k}:= the corresponding pseudo-source intervals
9:     for ii in 1k1\dots k do
10:         QQ.Push(EdgeEvent(IiI_{i}))
11:     end for
12:     for ii in 2k2\dots k do
13:         QQ.Push(VertexEvent(IiI_{i}))
14:     end for
15:end function

5.4. Geodesics enumeration query

After building the complete geodesic interval tree, it can accept the geodesics enumeration query which inputs a point tt on 𝒫\mathcal{P} and outputs the set GstRG_{st}^{R} of geodesics from ss to tt, whose length is less than RR. First, we must determine which intervals are responsible for the output. It can be done using the GetIntervals function:

Definition 5.2.

We define the GetIntervals(tt) function as follows:

  • If tt is a vertex vv, GetIntervals(tt) returns the set of intervals recorded on vv.

  • If tt is on an edge ee, GetIntervals(tt) returns the set of all generated intervals II such that I.Edge=eI.\mbox{Edge}=e, tI.Extentt\in I.\mbox{Extent} and I.Distance(t)<RI.\mbox{Distance}(t)<R.

  • If tt is on a face ff, GetIntervals(tt) returns the set of all generated intervals II such that I.Face=fI.\mbox{Face}=f, I.Project(t)I.ExtentI.\mbox{Project}(t)\in I.\mbox{Extent} and I.Distance(t)<RI.\mbox{Distance}(t)<R.

For each obtained interval, using Algorithm 5, the geodesic is constructed from tt to ss by backtracking I.ParentI.\mbox{Parent}. The whole procedure is given by Algorithm 6. In the pseudocode, Intersect is the function of getting the intersection, and AddFront is the operation of inserting a point at the front of the list.

Algorithm 5 (Construct a geodesic)
1:function ConstructGeodesic(II, pp)
2:     gg := (p)(p)
3:     while I.ParentNullI.\mbox{Parent}\neq\mbox{Null} do
4:         ee := I.Parent.EdgeI.\mbox{Parent}.\mbox{Edge}
5:         pp := Intersect(ee, the line segment connecting pp and I.CenterI.\mbox{Center})
6:         gg.AddFront(pp)
7:         II := I.ParentI.\mbox{Parent}
8:     end while
9:     gg.AddFront(ss)
10:     return gg
11:end function
Algorithm 6 (Geodesics enumeration query, for the complete GIT)
1:function GeodesicEnumQuery(tt)
2:     GG := \emptyset (the set of geodesics for output)
3:     for II in GetIntervals(ttdo
4:         GG.Add(ConstructGeodesic(II, tt)) \triangleright Algorithm 5
5:     end for
6:     return GG
7:end function

6. Improved geodesics enumeration algorithm

The difference between the MMP algorithm and the geodesics enumeration algorithm in the previous section based on the complete geodesic interval tree is that, since we are also interested in non-shortest geodesics, our intervals are never trimmed. However, this change largely increases the computational complexity. Here, when 𝒫\mathcal{P} is non-convex, we can reduce required amount of time and memory by placing pseudo-source intervals without overlap. We can understand the redundancy of the naive algorithm using Figure 13. In the figure, the source ss is indicated as the yellow cross sign (×\times) and the target tt is indicated as the yellow plus sign (++). While multiple geodesics are outgoing from ss, they merge at some hyperbolic vertices until reaching tt and they all share some part near tt. However, the naive algorithm cannot recognize and utilize this property; the shared part of the geodesics is independently encoded in multiple intervals and rediscovered for each geodesic during the query process. The basic idea of improvement is shown in Figure 14. In this figure, a geodesic g1g_{1} already arrived at a hyperbolic vertex and yielded a pseudo-source interval I1I_{1}. Now, another geodesic g2g_{2} arrives at the vertex. Although g2g_{2} can go through the dotted blue line, I2I_{2} can be chosen to exclude the region already searched by I1I_{1}. As we will see later, we can still restore all geodesics in the query process.

Refer to caption
Figure 13. Geodesics on a pumpkin
Refer to caption
Figure 14. When g2g_{2} arrives at a hyperbolic vertex after g1g_{1}, I2.ExtentI_{2}.\mbox{Extent} is chosen not to have overlap with I1.ExtentI_{1}.\mbox{Extent}.

6.1. Procedure of reduction

For the purpose of generalizing this argument, for each hyperbolic vertex vv, we arbitrarily choose an edge eve_{v} among those incident to vv and we fix the choice (Figure 15). It allows us to numericalize the direction of gg (seen from vv) into α\alpha (measured along the faces). When gg is incoming into vv, we call α\alpha the incoming angle of gg, and when gg is outgoing from vv, we call α\alpha the outgoing angle of gg. Also, we use the term outgoing angle range ι=[μ,ν]\iota=[\mu,\nu] (νμ<τ\nu-\mu<\tau) to assert that all values within this range are considered as outgoing angles, here τ\tau is the total angle of vv. By convention, if μ>ν\mu>\nu then ι\iota is empty, and if ντ\nu\geq\tau then all values within ι\iota are subject to the “mod τ\tau” operation.

Refer to caption
Figure 15. Fix eve_{v} and encode the direction of gg into α\alpha

Let us explain how it works in the example shown in Figure 16. In this figure, the five geodesics g1,,g5g_{1},\dots,g_{5} of incoming angles α1,,α5\alpha_{1},\dots,\alpha_{5} (respectively) arrive at the vertex in this order. Here we assume α1<α2<α5<α4<α3<α1+τ\alpha_{1}<\alpha_{2}<\alpha_{5}<\alpha_{4}<\alpha_{3}<\alpha_{1}+\tau. Each incoming angle αi\alpha_{i} is mapped to the corresponding outgoing angle range ιi=[μi,νi]\iota_{i}=[\mu_{i},\nu_{i}] as follows:

  1. (1)

    α1\alpha_{1}: the outgoing angle range is ι1=[α1+π,α1π+τ]\iota_{1}=[\alpha_{1}+\pi,\alpha_{1}-\pi+\tau] and corresponding one pseudo-source interval (not shown) is generated.

  2. (2)

    α2\alpha_{2}: μ2\mu_{2} is limited by g1g_{1} while ν2\nu_{2} is not, thus ι2=[α1π+τ,α2π+τ]\iota_{2}=[\alpha_{1}-\pi+\tau,\alpha_{2}-\pi+\tau] and two corresponding pseudo-source intervals (not shown) are created.

  3. (3)

    α3\alpha_{3}: neither g1g_{1} nor g2g_{2} limits ι3\iota_{3}, thus ι3=[α3+π,α3π+τ]\iota_{3}=[\alpha_{3}+\pi,\alpha_{3}-\pi+\tau].

  4. (4)

    α4\alpha_{4}: ι4\iota_{4} is limited by g2g_{2} and g3g_{3}, thus ι4=[α2π+τ,α3+π]\iota_{4}=[\alpha_{2}-\pi+\tau,\alpha_{3}+\pi].

  5. (5)

    α5\alpha_{5}: ι5\iota_{5} is limited by g2g_{2} and g4g_{4} thus ι5\iota_{5} is temporarily computed as ι5=[α2π+τ,α4+π]\iota_{5}=[\alpha_{2}-\pi+\tau,\alpha_{4}+\pi]. However, it is empty and no pseudo-source intervals are created.

Refer to caption
Figure 16. Incoming angles αi\alpha_{i} and outgoing angle ranges ιi\iota_{i}. ι5=\iota_{5}=\emptyset

Since the outline, initialization and procedure for edge events (Algorithm 123) are identical, we only explain the procedure for vertex events and geodesics query. All intervals generated in this way form a tree structure by the Parent pointer. we call it the reduced geodesic interval tree or the reduced GIT.

Remark 6.1.

In the reduced geodesic interval tree, only pseudo-source intervals generated at a common vertex are ensured to be disjoint. There may be an overlap between two non-pseudo-source intervals, or between a pseudo-source interval and a non-pseudo-source interval.

6.2. Procedure for vertex events

Like the naive version, when a vertex event occurs, the associated interval II is recorded on vv. If vv is hyperbolic, it performs the procedure of the reduction explained in the previous subsection, and, if the resulting outgoing angle range is not empty, pseudo-source intervals are generated and the associated edge events and vertex events (if exist) are inserted into the event queue. (Algorithm 7)

Algorithm 7 (Processing a vertex event, for the reduced GIT)
1:function VertexEvent.Handle(QQ)
2:     II := the associated interval
3:     vv := the starting point of II
4:     Record II on vv
5:     if vv is not hyperbolic then return
6:     α\alpha := the incoming angle of the geodesic at vv
7:     τ\tau := the total angle of vv
8:     δ:=τ2π\delta:=\tau-2\pi
9:     if there exist no incoming angles within (αδ,α)(\alpha-\delta,\alpha) then
10:         μ:=α+π\mu:=\alpha+\pi
11:     else
12:         μ:=(the largest incoming angle within (αδ,α))π+τ\mu:=(\mbox{the largest incoming angle within }(\alpha-\delta,\alpha))-\pi+\tau
13:     end if
14:     if there exist no incoming angles within (α,α+δ)(\alpha,\alpha+\delta) then
15:         ν:=απ+τ\nu:=\alpha-\pi+\tau
16:     else
17:         ν:=(the smallest incoming angle within (α,α+δ))+π\nu:=(\mbox{the smallest incoming angle within }(\alpha,\alpha+\delta))+\pi
18:     end if
19:     if μν\mu\geq\nu then return
20:     I1Ik:=I_{1}\dots I_{k}:= the pseudo-source intervals for the outgoing angle range [μ,ν][\mu,\nu]
21:     for ii in 1k1\dots k do
22:         QQ.Push(EdgeEvent(IiI_{i}))
23:     end for
24:     for ii in 2k2\dots k do
25:         QQ.Push(VertexEvent(IiI_{i}))
26:     end for
27:end function

6.3. Geodesics enumeration query

In this subsection, we discuss the geodesics enumeration query for the reduced geodesic interval tree, which inputs a point tt on 𝒫\mathcal{P} and outputs the set GstRG_{st}^{R} of directed geodesics from ss to tt, whose length is less than RR.

In the complete geodesic interval tree, a geodesic is given for each pair (I,p)(I,p) by the ConstructGeodesic function (Algorithm 5). On the other hand, in the reduced geodesic interval tree, geodesics of the same path between the last vertex vv and pp are given together for the pair (I,p)(I,p). The primitive geodesic between vpvp is given by the ConstructPrimitiveGeodesic function (Algorithm 8). The geodesic is constructed from tt to ss, and every time it hits a hyperbolic vertex, possible branches must be enumerated.

Let us take a look at the example illustrated in Figure 17. In this figure, each arrow indicates the direction from ss to tt, although the actual query is performed backwards. Let us assume that we have just found a geodesic gg outgoing from vv, and there are three geodesics g1g_{1}, g2g_{2} and g3g_{3} incoming into vv, and each of g1g_{1} and g2g_{2} is connectable with gg as a geodesic while g3g_{3} is not. Then, for each of g1g_{1} and g2g_{2}, we check it can satisfy the length upperbound, and if so, we connect it with gg and perform this process recursively.

In general, we can use a simple depth-first search here. For each interval II, I.DepthI.\mbox{Depth} is the minimum of the depths of these geodesics grouped together. Since GstRG_{st}^{R} contains at least one geodesic represented by the pair (I,t)(I,t) if and only if the minimum of their lengths is less than RR, the procedure of the GetIntervals function (Definition 5.2) is identical. The whole procedure is given by Algorithm 9. In the pseudocode, RemoveLast is the operation of removing the last point from the sequence, and is used for endpoints of primitive geodesics not to appear twice.

Refer to caption
Figure 17. During the geodesics query, a geodesic is traced backwards. For the geodesic gg outgoing from vv, we enumerate all connectable geodesics (g1g_{1} and g2g_{2}) incoming into vv and check whether each can satisfy the upperbound. We recursively perform this process.
Algorithm 8 (Construction of a primitive geodesic)
1:function ConstructPrimitiveGeodesic(II, pp) // pI.Facep\in I.\mbox{Face}
2:     gg := (p)(p)
3:     // when reached ss, I.Parent=I.\mbox{Parent}= Null
4:     // when reached a hyperbolic vertex, I.Parent.Depth<I.DepthI.\mbox{Parent}.\mbox{Depth}<I.\mbox{Depth}
5:     while I.ParentI.\mbox{Parent}\neq Null and I.Parent.Depth=I.DepthI.\mbox{Parent}.\mbox{Depth}=I.\mbox{Depth} do
6:         ee := I.Parent.EdgeI.\mbox{Parent}.\mbox{Edge}
7:         pp := Intersect(ee, the line segment connecting pp and I.CenterI.\mbox{Center})
8:         gg.AddFront(pp)
9:         II := I.ParentI.\mbox{Parent}
10:     end while
11:     gg.AddFront(I.CenterI.\mbox{Center}) \triangleright I.CenterI.\mbox{Center} is ss or a hyperbolic vertex
12:     return (gg, I.Parent=I.\mbox{Parent}= Null) \triangleright tuple of a path and a Boolean value
13:end function
Algorithm 9 (Geodesics enumeration query, for the reduced GIT)
1:function GeodesicEnumQuery(tt)
2:     GG := \emptyset
3:     for II in GetIntervals(ttdo \triangleright Definition 5.2
4:         dd := Distance(tt, I.CenterI.\mbox{Center}) \triangleright length of the primitive geodesic
5:         GeodesicEnumQueryRec(GG, (t)(t), II, tt, dd)
6:     end for
7:     return GG
8:end function
1:function GeodesicEnumQueryRec(GG, gg, II, pp, dd)
2:     (hh, IsSource) := ConstructPrimitiveGeodesic(II, pp) \triangleright Algorithm 8
3:     hh.RemoveLast()
4:     if IsSource then
5:         GG.Add(h+gh+g) \triangleright ++ denotes concatenation of sequences
6:         return
7:     end if
8:     vv := the starting point of hh \triangleright this is a hyperbolic vertex
9:     α\alpha := the outgoing angle of hh at vv
10:     for all JJ : the intervals of incoming angle within [α+π,απ+τ][\alpha+\pi,\alpha-\pi+\tau] at vv do
11:         ll := Distance(vv, J.CenterJ.\mbox{Center}) \triangleright length of the primitive geodesic
12:         if d+l+J.Depth<Rd+l+J.\mbox{Depth}<R then
13:              GeodesicEnumQueryRec(GG, h+gh+g, JJ, vv, d+ld+l) \triangleright recursive call
14:         end if
15:     end for
16:end function

6.4. Constructing single-pair geodesic graph

Since a geodesic is a sequence of primitive geodesics, we can reduce GstRG_{st}^{R} into a graph whose edges are primitive geodesics (Figure 18). We call it a single-pair geodesic graph, or simply a geodesic graph. It can be computed directly using the reduced geodesic interval tree.

Refer to caption
Figure 18. Concept of geodesic graph. Each arc represents a primitive geodesic. The red arc is connectable to the green arcs and the blue arcs.
Definition 6.2 (Single-pair geodesic graph).

The (single-pair) geodesic graph 𝒢stR\mathcal{G}_{st}^{R} with respect to GstRG_{st}^{R}, is the directed graph satisfying the following conditions:

  • The vertices of 𝒢stR\mathcal{G}_{st}^{R} are s,ts,t and the vertices of 𝒫\mathcal{P} through which at least one geodesic in GstRG_{st}^{R} passes.

  • The edges of 𝒢stR\mathcal{G}_{st}^{R} are the directed primitive geodesics connecting two vertices of 𝒢stR\mathcal{G}_{st}^{R}, such that each of them is contained in at least one directed geodesic in GstRG_{st}^{R}.

Remark 6.3.

In a geodesic graph 𝒢stR\mathcal{G}_{st}^{R}, ss and tt act as the source and the sink (respectively). Even if ss (resp. tt) is placed at a vertex and geodesics pass through the vertex, we regard ss (resp. tt), as a vertex of 𝒢stR\mathcal{G}_{st}^{R}, to be distinct from any other vertex of 𝒫\mathcal{P}. This convention allows us to design the algorithm without special treatment of ss (resp. tt) being a vertex or not.

Remark 6.4.

A geodesic graph can have multi-edges. That is, there may exist pairs of edges such that the both endpoints coincide.

Remark 6.5.

Our geodesic graph bears some resemblance to the Saddle Vertex Graph (SVG) [4], but fundamentally differs as follows:

  • The SVG only considers shortest geodesics, while our geodesic graph considers non-shortest geodesics as well.

  • The SVG considers shortest geodesics for all pairs of vertices, while our geodesic graph only considers geodesics connecting ss and tt.

  • More importantly, the SVG is constructed before their geodesic query and the query is performed on the SVG, while our geodesic query is performed on the reduced geodesic interval tree and yields a geodesic graph. In other words, our geodesic graph is a representation of the query result.

Remark 6.6.

Our geodesic graph 𝒢stR\mathcal{G}_{st}^{R} is an exact representation of the query result for the given ss, tt and RR. The naive representation GstRG_{st}^{R} often have many overlapped sub-geodesics. In this situation, we can compress them into a graph, eliminating redundancy that can be combinatorially reconstructed from the graph.

Remark 6.7.

Every figure in this paper that renders computed geodesics (such as Figure 4 and Figure 13) is a 3D-rendered version of a geodesic graph presented in this subsection.

A geodesic graph is constructed from tt to ss using Algorithm 10. We use a modified version of Dijkstra’s algorithm to determine the shortest possible length from tt for each primitive geodesic. We have two points to remark:

  • When tt is given, an interval can yield at most two primitive geodesics, and each primitive geodesic can be specified by the pair (I,IsTarget)(I,\mbox{\sc IsTarget}) where II is an interval and IsTarget is a Boolean value indicating whether the primitive geodesic ends with tt (otherwise it ends with the starting point of II). Note that IsTarget is set to be True only through the initialization of the algorithm since we regard tt to be a vertex of 𝒢stR\mathcal{G}_{st}^{R} distinct from any other vertex (Remark 6.3). Since we can assume that no duplicated intervals are supplied by the GetIntervals function, we need to check visitedness only when IsTarget is set to False (the line 11–14).

  • In the line 23, ll is the length of the primitive geodesic given by (J,False)(J,\mbox{\sc False}). A conceptual figure is described in Figure 18. Let the red curve be the primitive geodesic and denoted as hh. Not necessarily all geodesics in GstRG_{st}^{R} contain hh. Let the green part and blue part be the subgraph of GstRG_{st}^{R} between susu and vtvt respectively through which a geodesic containing hh can pass (in general the green and blue subgraph may be overlapped). Then, the distance between susu on the green subgraph is J.DepthJ.\mbox{Depth}, because of the construction method of the reduced geodesic interval tree. Moreover, the distance between vtvt on the blue subgraph is dd, because of the construction algorithm of the geodesic graph, which is derived from Dijkstra’s algorithm. Therefore the minimum length of geodesics between stst containing hh is J.Depth+l+dJ.\mbox{Depth}+l+d, and hh is contained in 𝒢\mathcal{G} as an edge if and only if it is less than RR.

Algorithm 10 (Construction of a geodesic graph, for the reduced GIT)
1:function ConstructGeodesicGraph(tt)
2:     QrQ_{r} := a priority queue
3:     vis\mathcal{I}_{\rm vis} := \emptyset (the set of visited intervals)
4:     𝒢\mathcal{G} := \emptyset (the set of edges of the output geodesic graph)
5:     for II in GetIntervals(ttdo \triangleright Definition 5.2
6:         dd := Distance(tt, I.CenterI.\mbox{Center}) \triangleright length of the primitive geodesic
7:         QrQ_{r}.Push((I,True,priority: d)(I,\mbox{\sc True},\mbox{priority: }d))
8:     end for
9:     while QrQ_{r} is not empty do
10:         (I,IsTarget,priority: d)(I,\mbox{\sc IsTarget},\mbox{priority: }d) := QrQ_{r}.Pop()
11:         if not IsTarget then
12:              if vis\mathcal{I}_{\rm vis} contains II then continue
13:              \mathcal{I}.Add(II)
14:         end if
15:         pp := if IsTarget then tt else the starting point of II
16:         (gg, IsSource) := ConstructPrimitiveGeodesic(II, pp) \triangleright Algorithm 8
17:         𝒢\mathcal{G}.AddEdge(gg)
18:         if IsSource then continue
19:         vv := the starting point of hh \triangleright this is a hyperbolic vertex
20:         α\alpha := the outgoing angle of gg at vv
21:         for all JJ : the intervals of incoming angle within [α+π,απ+τ][\alpha+\pi,\alpha-\pi+\tau] at vv do
22:              ll := Distance(v,J.Centerv,J.\mbox{Center})
23:              if (vis\mathcal{I}_{\rm vis} does not contain JJ) and (d+l+J.Depth<Rd+l+J.\mbox{Depth}<Rthen
24:                  QrQ_{r}.Push((J,False,priority: d+l)(J,\mbox{False},\mbox{priority: }d+l))
25:              end if
26:         end for
27:     end while
28:     return 𝒢\mathcal{G}
29:end function

7. Performance

In this section, since we evaluate both the naive version that generates a complete geodesic interval tree and the improved version that generates a reduced geodesic interval tree, we call them geodesic interval trees. Since the size of an output geodesic interval tree greatly depends on the geometry, it is difficult to express it only in terms of input size and RR. The efficiency of a reduced geodesic interval tree is due to its small size compared with the corresponding complete one, and we evaluate it by experiments in the next subsection. First, we state an output-sensitive complexity evaluation:

Theorem 7.1.

Let 𝒯\mathcal{T} be a (complete or reduced) geodesic interval tree and N=|𝒯|N=|\mathcal{T}| be the number of intervals in it. The corresponding algorithm for generating 𝒯\mathcal{T} runs in O(NlogN)O(N\log N) time and O(N)O(N) space.

Proof.

Since the number of the whole generated intervals is NN, the numbers of edge events and vertex events are O(N)O(N). Thus, the size of the event queue is O(N)O(N) at any time. Therefore, the pop operation of the event queue takes O(logN)O(\log N) time per event. Concerning processing time of an event, an edge event can be processed in constant time. A vertex event requires time proportional to the number of the intervals it generates, but it sums up to O(N)O(N). Also, in the reduced version, the two adjacent incoming angles of an incoming angle must be acquired, but it can be done in O(logN)O(\log N) time per event using a balanced binary search tree. Therefore, the time complexity is O(NlogN)O(N\log N). On the other hand, since the required space is the whole output tree 𝒯\mathcal{T} and the event queue, and each interval or event consumes constant space, the space complexity is O(N)O(N). ∎

7.1. Experimental Result

For the purpose of evaluating performance of our methods, we mainly use the Elephant mesh contained in the CGAL (Computational Geometry Algorithms Library) [15]. The proposed methods consist of two parts, i.e., the construction of a geodesic interval tree, and the geodesics query or the construction of a geodesic graph. Since the geodesics query consumes much less (often negligible) time, we only evaluate the performance of the construction of a geodesic interval tree, except Figure 34. We implemented our (single-threaded) algorithms in C++ and tested them using a machine with Intel(R) Core(TM) i9-9980XE CPU @ 3.00GHz and 128GB RAM running Linux. Except Figure 3030 and 34, we ran our program for 300 seconds and took statistics every second. In Figure 30 and 30, we manually recorded the amount of memory consumption measured by the OS, when it elapsed 10, 20, 30, 40, 60, 80, 100, 125, 150, 180, 210, 240, 270 and 300 seconds since each program started.

Relation of RR (normalized so that the mean edge length is 1) and running time is shown in Figure 25, and its log-linear plot and log-log plot are shown in Figure 25 and Figure 25. We can observe that the running time of the naive version grows exponentially to RR, while that of improved version grows more slowly. A log-linear plot and log-log plot of the total number of generated intervals |𝒯||\mathcal{T}| are shown in Figure 25 and Figure 25, and they exhibit a pattern similar to that of the computation time. Figure 25 shows the slope of the log-log plot, i.e. Δ(log|𝒯|)/Δ(logR)\Delta(\log|\mathcal{T}|)/\Delta(\log R), which can be considered as the exponent α\alpha when |𝒯||\mathcal{T}| is locally fit by kRαkR^{\alpha} (kk and α\alpha are constants). This value is increasing in the naive version but decreasing in the improved version, as RR increases. Figure 30 shows relation of |𝒯||\mathcal{T}| and computation time, and exhibits a pattern similar to the quasilinear growth. Memory consumption is shown in Figure 30 (to RR) and Figure 30 (to |𝒯||\mathcal{T}|). We can observe that the memory consumption seems to grow linearly to |𝒯||\mathcal{T}|. Figure 30 shows the ratio of the number of propagating vertex events (vertex events that generated at least one interval) to the number of hyperbolic vertex events (vertex events that occurs at a hyperbolic vertex), among newly-processed events in one second. This value is 1 in the naive version but around 0.2 in the improved version in this instance, which means that, in the improved version, there are less vertex events that actually generate intervals compared with the naive version.

We also tested on a synthesized simple torus (Figure 313333). We can observe that, for sufficiently large RR, the total number of generated intervals |𝒯||\mathcal{T}| in the improved version is approximately Θ(R3)\Theta(R^{3}). We have not established a theory, but we could guess the reason behind it as follows:

  • For sufficiently (very) large RR (and in generic cases), pseudo-source intervals are likely to “fill up” all angles around hyperbolic vertices so that no new pseudo-source intervals are generated.

  • In this situation, the area “swept” by the imaginary wavefront of intervals is Θ(R2)\Theta(R^{2}). That is, the number of vertex events is likely to be Θ(R2)\Theta(R^{2}). Since an interval in the wavefront splits into two intervals when it meets a vertex, the number of intervals in the wavefront is also likely to be Θ(R2)\Theta(R^{2}). Since |𝒯||\mathcal{T}| can be obtained by summing the size of each generation, it is likely to be Θ(R3)\Theta(R^{3}).

To evaluate relationship of smoothness of the mesh and performance, we used the recursively subdivided surfaces of Elephant using the Loop subdivision scheme [16]. In Figure 30, the computation time is shown for the original mesh (orig), and the surface subdivided once (sub1) and twice (sub2). Here RR is relative to the mean edge length of the original mesh. We can see that the computation time of the improved version becomes closer to that of the naive version as the mesh becomes more detailed. The reason behind it is that, pseudo-source intervals become more unlikely to overlap in the naive version, since the total angle of each vertex becomes closer to 2π2\pi. The surface subdivided twice (sub2) from Elephant is used in Figure 34 to evaluate practical performance. The detail of the experiment is explained in the caption of this figure, but compared with the naive version, we can observe that the improved version took nearly half computation time and used approximately 56% memory to produce this result.

Refer to caption
Figure 19. Elephant (2775 vertices and 5558 faces). Figures 2530 are concerned on this mesh.
Refer to caption
Figure 20. Linear plot of time vs RR
Refer to caption
Figure 21. Log-linear plot of time vs RR
Refer to caption
Figure 22. Log-log plot of time vs RR
Refer to caption
Figure 23. Log-linear plot of |𝒯||\mathcal{T}| vs RR
Refer to caption
Figure 24. Log-log plot of |𝒯||\mathcal{T}| vs RR
Refer to caption
Figure 25. Δ(log|𝒯|)/Δ(logR)\Delta(\log|\mathcal{T}|)/\Delta(\log R) vs RR
Refer to caption
Figure 26. Time vs |𝒯||\mathcal{T}|
Refer to caption
Figure 27. Memory vs RR
Refer to caption
Figure 28. Memory vs |𝒯||\mathcal{T}|
Refer to caption
Figure 29. Ratio of the propagating vertex events to the hyperbolic ones among newly-processed events in one second
Refer to caption
Figure 30. Subdivision and computation time of Elephant; sub1: 11K vertices, sub2: 44K vertices
Refer to caption
Figure 31. Simple Torus. Figures 3333 are concerned on this mesh.
Refer to caption
Figure 32. Δ(log|𝒯|)/Δ(logR)\Delta(\log|\mathcal{T}|)/\Delta(\log R) vs RR in the naive version
Refer to caption
Figure 33. Δ(log|𝒯|)/Δ(logR)\Delta(\log|\mathcal{T}|)/\Delta(\log R) vs RR in the improved version
Refer to caption
Figure 34. Surface (with 44460 vertices) obtained by subdividing twice from Elephant, R=131R=131 (relative to the mean edge length of this subdivided mesh); building the geodesic interval tree took 60.4 seconds (naive), 30.3 seconds (improved) and the total memory consumption (measured by the OS) is 5.5GB (naive), 3.1GB (improved); 83K intervals (naive), 46K intervals (improved) are generated; geodesics query took less than 1ms (both version).

8. Conclusion

In this paper, we have formulated the single-source geodesics enumeration problem and presented two data structures for the problem: the complete geodesic interval tree and the reduced geodesic interval tree. Although we could not provide their worst-case bounds in terms of the input size, experiments suggested that the reduced geodesic interval tree is practically more efficient on a nonconvex polyhedron in terms of running time and memory consumption. On the assumption of reasonable complexity of the input mesh, our method allows geodesics to be computed in reasonable time, which opens up possibility of finding useful non-shortest geodesics which traditional shortest path algorithms cannot find.

We have given the complexity of our algorithms in terms of the size of the output geodesic interval trees. However, it largely depends on the geometry of the polyhedron, and a (non-trivial) complexity estimation is likely to include not only the input size (such as the number of vertices) and RR, but also geometrical characteristics of the polyhedron (such as discretized curvatures). Therefore, rigorous analysis of complexity may involve mathematical study of geodesics themselves on a polyhedron. Geodesics yielded by our method can be used to approximate geodesics on a smooth surface, although more accurate or efficient algorithms tailored for smooth surfaces could be developed.

Acknowledgements

The author sincerely appreciates Professor Hiroki Arimura and Professor Toru Ohmoto for giving many valuable advices.

References

  • [1] J. S. B. Mitchell, D. M. Mount and C. H. Papadimitriou, The discrete geodesic problem, SIAM J. Comput. 16 (1987) 647.
  • [2] J. Chen and Y. Han, Shortest paths on a polyhedron, in Proceedings of the Sixth Annual Symposium on Computational Geometry, Berkeley, CA, USA, June 6-8, 1990, ed. R. Seidel (ACM, 1990), pp. 360–369.
  • [3] S. Xin and G. Wang, Improving Chen and Han’s algorithm on the discrete geodesic problem, ACM Trans. Graph. 28 (2009) 104:1.
  • [4] X. Ying, X. Wang and Y. He, Saddle vertex graph (SVG): a novel solution to the discrete geodesic problem, ACM Trans. Graph. 32 (2013) 170:1.
  • [5] K. Polthier and M. Schmies, Straightest geodesics on polyhedral surfaces, in International Conference on Computer Graphics and Interactive Techniques, SIGGRAPH 2006, Boston, Massachusetts, USA, July 30 - August 3, 2006, Courses, eds. J. W. Finnegan and D. Shreiner (ACM, 2006), pp. 30–38.
  • [6] K. Crane, Discrete differential geometry: An applied introduction, Notices of the AMS, Communication (2018) 1153.
  • [7] P. Bose, A. Maheshwari, C. Shu and S. Wuhrer, A survey of geodesic paths on 3D surfaces, Comput. Geom. 44 (2011) 486.
  • [8] K. Crane, M. Livesu, E. Puppo and Y. Qin, A survey of algorithms for geodesic paths and distances, CoRR abs/2007.10430.
  • [9] V. Surazhsky, T. Surazhsky, D. Kirsanov, S. J. Gortler and H. Hoppe, Fast exact and approximate geodesics on meshes, ACM Trans. Graph. 24 (2005) 553.
  • [10] P. Cheng, C. Miao, Y. Liu, C. Tu and Y. He, Solving the initial value problem of discrete geodesics, Comput. Aided Des. 70 (2016) 144.
  • [11] C. C. L. Wang, Cybertape: an interactive measurement tool on polyhedral surface, Comput. Graph. 28 (2004) 731.
  • [12] D. M. Morera, L. Velho and P. C. P. Carvalho, Computing geodesics on triangular meshes, Comput. Graph. 29 (2005) 667.
  • [13] S. Xin and G. Wang, Efficiently determining a locally exact shortest path on polyhedral surfaces, Comput. Aided Des. 39 (2007) 1081.
  • [14] N. Sharp and K. Crane, You can find geodesic paths in triangle meshes by just flipping edges, ACM Trans. Graph. 39 (2020) 249:1.
  • [15] The CGAL Project, CGAL User and Reference Manual (CGAL Editorial Board, 2023), 5.5.2 edition.
  • [16] C. Loop, Smooth subdivision surfaces based on triangles, master’s thesis, University of Utah, Department of Mathematics .