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

\hideLIPIcs

University of Bonn, Bonn, [email protected]://orcid.org/0000-0002-8259-1187Partially funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - 313421352 (FOR 2535 Anticipating Human Behavior). Affiliated with Lamarr Institute for Machine Learning and Artificial Intelligence. Hausdorff Center for Mathematics, University of Bonn, [email protected]://orcid.org/0000-0002-1943-2589Affiliated with Lamarr Institute for Machine Learning and Artificial Intelligence. Hausdorff Center for Mathematics, University of Bonn, Bonn, [email protected] funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – 459420781. \CopyrightJacobus Conradi, Anne Driemel, Benedikt Kolbe \ccsdesc[500] Theory of computation   Design and analysis of algorithms

Revisiting the Fréchet distance between piecewise smooth curves

Jacobus Conradi    Anne Driemel    Benedikt Kolbe
Abstract

Since its introduction to computational geometry by Alt and Godau in 1992, the Fréchet distance has been a mainstay of algorithmic research on curve similarity computations. The focus of the research has been on comparing polygonal curves, with the notable exception of an algorithm for the decision problem for planar piecewise smooth curves due to Rote (2007). We present an algorithm for the decision problem for piecewise smooth curves that is both conceptually simpler and naturally extends to the first algorithm for the problem for piecewise smooth curves in d\mathbb{R}^{d}.

We assume that the algorithm is given two continuous curves, each consisting of a sequence of mm, resp. nn, smooth pieces, where each piece belongs to a sufficiently well-behaved class of curves, such as the set of algebraic curves of bounded degree. We introduce a decomposition of the free space diagram into a controlled number of pieces that can be used to solve the decision problem similarly to the polygonal case, in O(mn)O(mn) time, leading to a computation of the Fréchet distance that runs in O(mnlog(mn))O(mn\log(mn)) time.

Furthermore, we study approximation algorithms for piecewise smooth curves that are also cc-packed for some fixed value cc. We adapt the existing framework for (1+ε)(1+\varepsilon)-approximations and show that an approximate decision can be computed in O(cn/ε)O(cn/\varepsilon) time for any ε>0\varepsilon>0.

keywords:
Fréchet distance, piecewise smooth curves, decision algorithm

1 Introduction and motivation

The Fréchet distance is a well-studied distance measure between curves, with a long history in both applications and algorithmic research. The wealth of work surrounding the analysis of algorithms for computing the Fréchet distance is centered primarily on polygonal curves. However, more complicated curves and especially splines have become commonplace in industrial applications for, e.g., computer graphics, robotics and to represent motion tracking or planning data. In such applications, the number of dimensions corresponds to the number of tracked parameters, leading to a high-dimensional ambient space. On the other hand, polygonal curves in applications often represent (unnecessarily complex) discretizations approximating an underlying smooth curve that can be described more efficiently as a smooth curve using only a small number of parameters. For an algorithmic example, smooth curves may help in more naturally describing the average of a set of polygonal curves. A crucial prerequisite to using smooth curves similarly to polygonal curves in such contexts is the ability to effectively answer elementary algorithmic questions for such curves. A natural and fundamental task in computational geometry is therefore to devise algorithms for the computation of the Fréchet distance between smooth curves such as splines. Despite this, as far as we know, there is no known approach to realizing such a computation for curves in d\mathbb{R}^{d}. To tackle the case of smooth curves in the plane (d=2d=2), Rote [13] introduced an approach based on analyzing the turning angle and planar curvature of the planar curves. However, this approach does not easily generalize to higher dimensions. We revisit this problem and present a novel, simpler approach, with the additional benefit that it works for higher dimensions, with the same time complexity. Our methods are conceptually simple, but rely on a number of key technical ingredients.

Problem definition

Throughout the paper, γ1\gamma_{1} and γ2\gamma_{2} will be used to denote two piecewise smooth curves in d\mathbb{R}^{d} with dd fixed, that is, continuous maps γ1,γ2:[0,1]d\gamma_{1},\gamma_{2}:[0,1]\to\mathbb{R}^{d} that are comprised of mm and nn smooth pieces, each of class C2C^{2}. Let A[0,1]A_{[0,1]} be the set of continuous and bijective maps α:[0,1][0,1]\alpha:[0,1]\to[0,1] that are increasing. The Fréchet distance between γ1\gamma_{1} and γ2\gamma_{2} is defined as d(γ1,γ2):=infα,βA[0,1]maxt[0,1]γ1(α(t))γ2(β(t))\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2}):=\inf\limits_{\alpha,\beta\in A_{[0,1]}}\max\limits_{t\in[0,1]}\|\gamma_{1}(\alpha(t))-\gamma_{2}(\beta(t))\|. Our methods naturally allow any fixed p\ell_{p} norm with 1<p<1<p<\infty for the norm \|\cdot\| (the cases p=1,p=1,\infty, while possible, would add a level of technicality to our treatment that distracts from its relative simplicity). To compute d(γ1,γ2)\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2}), we mostly focus on the decision problem of deciding whether the Fréchet distance between two piecewise smooth curves is at most a given δ>0\delta>0.

Results

Our first main contribution is that we establish an algorithm to solve the decision problem for the Fréchet distance between piecewise smooth curves. Assuming that the curves are algebraically bounded curves, i.e., piecewise smooth algebraic curves where the degree of the curves is bounded by a constant, we obtain a bound of O(mn)O(mn) for the time complexity of the decision problem, which matches the polygonal case. The running time is independent of the ambient dimension but the algebraic complexity of the operations involved in the algorithm depends on the dimension and the nature of the curves. Our algorithm for the decision problem results in an algorithm for the computation of the Fréchet distance for algebraically bounded curves in O(mnlog(mn))O(mn\log(mn)) time using parametric search, similarly to the polygonal case.

It is known [4] that the decision problem cannot be solved in strongly subquadratic time, so research has focused on investigating algorithms for restricted classes of curves. Our second contribution is that we show that we can adapt the framework from [7] for an efficient (1+ϵ)(1+\epsilon)-approximation algorithm for the Fréchet distance between two cc-packed, polyognal curves to the setting of cc-packed piecewise smooth curves in d\mathbb{R}^{d}. To this end, we introduce a simplification procedure for piecewise smooth curves and distill the necessary ingredients to obtain a linear time decision algorithm for algebraically bounded cc-packed curves.

Comparison to previous work

To arrive at an algorithm for the decision problem for smooth planar curves for the 2\ell_{2}-norm for a given δ\delta in general position, Rote uses a partitioning of the smooth curves to obtain pieces for which the associated free space diagram FSDδ\mathrm{FSD}_{\delta} (Section 2) is well-behaved. His approach relies on analyzing the curves γ1\gamma_{1} and γ2\gamma_{2}, introducing cuts to control the turning angle and at points with a certain value for the planar curvature. In contrast to this, our approach is to analyze the free space diagram directly, by studying the boundary of the free space 𝒟δ\mathcal{D}_{\delta} in FSDδ\mathrm{FSD}_{\delta}. The free space is defined as the set of parameter value pairs at which the curves are at most a distance of δ\delta apart. Working directly with the free space not only leads to a conceptually simpler algorithm, but also avoids relatively complicated integral equations related to the curvature and the turning angle. We propose a refined decomposition of each cell of FSDδ\mathrm{FSD}_{\delta} into a controlled number (depending on the degree of the curves) of subcells (Section 2), for which the existence of a monotone path connecting two intervals on the boundary of a subcell can be read off. Here, the role of convexity of the free space in a cell for polygonal curves is replaced by monotonicity of the boundary curves of 𝒟δ\mathcal{D}_{\delta} within each subcell of the refined decomposition. We emphasize here that our construction of the refined decomposition exclusively accesses the same values that are also required in Rote’s work to process each subcell of FSDδ\mathrm{FSD}_{\delta}.

Unlike the polygonal case, the free space within a cell of FSDδ\mathrm{FSD}_{\delta} can be very complicated, as illustrated by a contour plot of the distance function in parameter space for two degree 3 splines in 3\mathbb{R}^{3} in Figure 1 for different values of δ\delta.

Refer to caption
Figure 1: Two smooth curves in 3\mathbb{R}^{3} and a contour plot of the associated distance function in the joint parametric space of the curves.

Figure 2 shows another example of the kind of behavior of the free space one can expect within a cell.

We note that both Rote’s decision algorithm as well as ours assume values of δ\delta for which the boundary of 𝒟δ\mathcal{D}_{\delta} has no singularities. A key technical result we show (Section 3) is that singularities of the boundary of 𝒟δ\mathcal{D}_{\delta} are confined to a small number of critical values of δ\delta and are not necessary for the computation of d\mathrm{d}_{\mathcal{F}}. Together with the approximation schemes for smooth curves we introduce later on, our results show that the setting of smooth curves provides a natural extended framework for algorithmic approaches to the Fréchet distance.

Computational model

We make the same assumptions as Rote in his work on planar smooth curves, subsuming the real RAM model. In essence, we assume that we can compare two real solutions of an algebraic equation. Specifically, we require being able to compute the intersection of a curve with a sphere of a given radius centered at a point of another curve and find the parameter values in [0,1][0,1] that correspond to the intersections. While we limit the use of such algebraic operations where possible, our approach to the decision problem via construction of a specific partitioning of the free space diagram, the subsequent computation of d\mathrm{d}_{\mathcal{F}}, as well as the simplification ultimately make use of this assumption. Studying the algebraic numbers involved in the computations for different classes of curves goes beyond the scope of this paper.

2 A combinatorial description of the free space diagram

For two piecewise smooth curves γ1,γ2:[0,1]d\gamma_{1},\gamma_{2}:[0,1]\to\mathbb{R}^{d} consisting of mm and nn pieces, respectively, and δ>0\delta>0, the free space 𝒟δ=𝒟δ(γ1,γ2)\mathcal{D}_{\delta}=\mathcal{D}_{\delta}(\gamma_{1},\gamma_{2}) is defined as

𝒟δ(γ1,γ2)={(x,y)[0,1]2|γ1(x)γ2(y)δ}.\mathcal{D}_{\delta}(\gamma_{1},\gamma_{2})=\left\{(x,y)\in[0,1]^{2}|\|\gamma_{1}(x)-\gamma_{2}(y)\|\leq\delta\right\}.

The complement of 𝒟δ\mathcal{D}_{\delta} in [0,1]2[0,1]^{2} is commonly referred to as the forbidden region.

There is a natural partition of the joint parameter space [0,1]2[0,1]^{2} of both curves into mnm\cdot n rectangular cells such that γ1\gamma_{1} and γ2\gamma_{2} are smooth when restricting to the interior of each rectangle. We refer to the resulting decomposition of [0,1]2[0,1]^{2} together with the partitioning into the free space and forbidden region as the free space diagram FSDδ\mathrm{FSD}_{\delta}. The primary motivation behind the introduction of the free space diagram is the elementary observation that d(γ1,γ2)δ\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2})\leq\delta iff there is a path from (0,0)(0,0) to (1,1)(1,1) through the free space in [0,1]2[0,1]^{2} that is monotone in both coordinates.

2.1 Overview of the algorithm

Similarly to the classical polygonal case, to solve the decision problem, we investigate the existence of a monotone (in both coordinates) path from (0,0)(0,0) to (1,1)(1,1) in the free space 𝒟δ\mathcal{D}_{\delta}. To this end, we refine the free space diagram using the boundary BδB_{\delta} of the free space. Our decision algorithm has the following high-level description.

  1. 1.

    Mark the minima and maxima of the boundary BδB_{\delta} of the free space in FSDδ\mathrm{FSD}_{\delta} in the xx (horizontal) and yy (vertical) direction.

  2. 2.

    Cut each cell of FSDδ\mathrm{FSD}_{\delta} into subcells, horizontally (vertically) through each marked point if it has a vertical (horizontal) tangent. Mark each point of intersection of a cut with BδB_{\delta}.

  3. 3.

    For each resulting subcell, pair the marked points on the boundary according to how they are connected by BδB_{\delta} through monotone arcs, so that adjacent points are paired.

  4. 4.

    Solve the decision problem for FSDδ\mathrm{FSD}_{\delta} using only the marked points and pairings by computing reachable intervals on the boundaries of cells, in particular

    1. (a)

      process all cells in lexicographical order of their indices (row by row, from the left);

    2. (b)

      for each cell, process all subcells within the cell in lexicographical order.

In our analysis, we make certain assumptions on the given δ\delta with respect to the input curves, which can be ensured by applying a random small perturbation. We follow up our presentation of the decision algorithm with a justification for why this assumption does not lead to loss of generality in the context of using the decision algorithm in practice and to compute the Fréchet distance (Section 3).

2.2 Refining the free space diagram

We consider the boundary BδB_{\delta} of FSDδ\mathrm{FSD}_{\delta} as a set of curves, as opposed to the boundary of a region. We define the three sets Eh,EvE_{h},E_{v} and IsingI_{\text{sing}} of points on BδB_{\delta}:

  1. 1.

    The set EhBδE_{h}\subset B_{\delta} of extrema of the free space in the yy direction (with horizontal tangent).

  2. 2.

    The set EvBδE_{v}\subset B_{\delta} of extrema of the free space in the xx direction (with vertical tangent).

  3. 3.

    The set IsingI_{\text{sing}} of singularities of BδB_{\delta} in the interior of the cells of FSDδ\mathrm{FSD}_{\delta}, consisting of points where BδB_{\delta} is not C1C^{1}, which includes points of self-intersection and cusps.

The geometry of BδB_{\delta} is related to the geometry of equidistant curves and can be quite complicated in general. In Section 3, we show that for almost all δ\delta, there are no singular points of BδB_{\delta} in the interior of each cell in FSDδ\mathrm{FSD}_{\delta} associated to the smooth pieces of the curves, so that Ising=I_{\text{sing}}=\emptyset, after possibly applying a small perturbation to δ\delta. We note that for the norms 1\ell_{1} and \ell_{\infty} in the definition of the Fréchet distance, BδB_{\delta} may contain cusp singularities for all values of δ\delta in an open interval.

Using the points in EhE_{h}, EvE_{v} (and IsingI_{\text{sing}}), we define a partition of each cell of the free space diagram FSDδ\mathrm{FSD}_{\delta} that lends itself to combinatorial investigations into the decision problem. For simplicity of exposition, we assume that each of EhE_{h}, EvE_{v} and IsingI_{\text{sing}} is a collection of isolated points. In particular, BδB_{\delta} does not have a vertical or horizontal segment, which means that there is no arc of one curve that lies at a constant distance δ\delta from a point on the other. If there are such circular arcs in any of the three sets, then in the following we represent each such arc by a single point lying on it, distinct from others in the sets.

For a point zEhz\in E_{h} (EvE_{v}), we fix the cell in FSDδ\mathrm{FSD}_{\delta} containing zz, and trace the vertical (horizontal) line incident to zz inside this cell. For every point zsIsingz_{s}\in I_{\text{sing}}, similarly trace a horizontal line incident to zsz_{s}. The result is a refinement of each cell of FSDδ\mathrm{FSD}_{\delta} into a collection of subcells {S}\{S\}. Figure 2 shows an illustration of the refinement inside a cell of FSDδ\mathrm{FSD}_{\delta}.

Lemma 2.1.

The boundary BδB_{\delta} of the free space in the interior of each subcell in {S}\{S\} is a union of smooth arcs that are monotone in both coordinates of 2\mathbb{R}^{2} and are disjoint except possibly at the boundary of a subcell.

Proof 2.2 (Proof of Lemma 2.1).

Consider a curve β\beta representing a connected component of BδB_{\delta} inside the interior of a subcell 𝒮\mathcal{S}. Observe that β\beta cannot intersect another arc of BδB_{\delta} in the interior of 𝒮\mathcal{S} and that β\beta is at least C1C^{1}, as the singular points of BδB_{\delta} are confined to the boundaries of the subcells in {S}\{S\}.

If β\beta is not monotone in either coordinate, consider the case that β\beta starts on the bottom edge of 𝒮\mathcal{S} and is not vertical and thus locally given as a function of xx. If β\beta is not monotone in the xx-coordinate, then there are x1x2x_{1}\neq x_{2} such that dβ(x1)dx=β(x1)>0>β(x2)\frac{d\beta(x_{1})}{dx}=\beta^{\prime}(x_{1})>0>\beta^{\prime}(x_{2}). By continuity, there is a point x(x1,x2)x^{*}\in(x_{1},x_{2}) with β(x)=0\beta^{\prime}(x^{*})=0, whence xEhx^{*}\in E_{h}. By construction, xx^{*} then lies on the vertical boundary of 𝒮\mathcal{S}. Other cases for β\beta can be treated similarly.

We record each intersection 𝒮\mathcal{I}_{\mathcal{S}} of BδB_{\delta} with the boundary of each subcell 𝒮\mathcal{S}, which together form the set =𝒮 is subcell𝒮\mathcal{I}=\bigcup_{\mathcal{S}\text{ is subcell}}\mathcal{I}_{\mathcal{S}} of all intersections of subcell walls with BδB_{\delta}.

The construction of \mathcal{I} consists of finding the intersections of a horizontal or vertical line in FSDδ\mathrm{FSD}_{\delta} with BδB_{\delta}, which amounts to computing the intersections of a given smooth piece of γ1\gamma_{1}, with a sphere of radius δ\delta centered at a point of γ2\gamma_{2} (and vice versa, switching the roles of γ1\gamma_{1} and γ2\gamma_{2}). The associated values for (x,y)(x,y) in FSDδ\mathrm{FSD}_{\delta} correspond to the parameter values for the computed points on each curve.

In the following, we impose the general position assumption that δ\delta is such that Ising=I_{\text{sing}}=\emptyset and postpone a justification for this assumption to Section 3. The boundary BδB_{\delta} can be naturally interpreted as a graph GδG_{\delta} with vertex set \mathcal{I}. Each edge of GδG_{\delta} is a monotone arc contained in a subcell, by Lemma 2.1. In the remainder of this section we focus on elucidating two crucial observations regarding GδG_{\delta}. The first is that the combinatorial structure of GδG_{\delta}, i.e., which points of 𝒮\mathcal{I}_{\mathcal{S}} are connected by monotone edges in BδB_{\delta}, can be deduced from the set 𝒮\mathcal{I}_{\mathcal{S}} along with what we call slope information at certain points, which is readily computable additional information which we introduce more carefully below. The second observation is that the answer to the decision problem does not depend on the monotone arcs joining points on subcell walls. In other words, the combinatorial structure of GδG_{\delta} is sufficient to answer the decision problem, which justifies referring to GδG_{\delta} as a combinatorial model for FSDδ\mathrm{FSD}_{\delta}. We elaborate on the necessary adjustments to the existing framework for the decision algorithm for polygonal curves in more detail in Subsection 2.3.

To begin with, we partition the two sets EhE_{h} and EvE_{v} into the sets Eh+E_{h}^{+} and EhE_{h}^{-}, and Ev+E_{v}^{+} and EvE_{v}^{-}, respectively, according to whether the forbidden region lies locally to the right of or above the point (-), or to the left of or below the point (++). For the bottom and left edge of each subcell 𝒮\mathcal{S}, we refer to the information of whether the boundary BδB_{\delta} at each point in 𝒮\mathcal{I}_{\mathcal{S}} is increasing or decreasing as a function of the horizontal xx-coordinate as the slope information of these points. In other words, the slope information at a point z𝒮z\in\mathcal{I}_{\mathcal{S}} can be thought of an extra bit associated to zz that encodes whether BδB_{\delta} curves to the left or to the right at zz. In Figure 2, the slope information is illustrated by an arrow pointing to the left or right (top or bottom) next to the point on the bottom (left) edge of 𝒟δ\mathcal{D}_{\delta}.

Refer to caption
Figure 2: The decomposition of a cell of the free space diagram into subcells arising from the horizontal and vertical lines at extremities of the cyan forbidden region in the coordinate directions.

The following somewhat surprising statement is the main result of this section and shows that the slope information on the bottommost and leftmost edges of the original cells of FSDδ\mathrm{FSD}_{\delta} leads to a construction recipe for the combinatorial structure of GδG_{\delta}.

Lemma 2.3.

Assume δ\delta is such that Ising=I_{\text{sing}}=\emptyset. There is an algorithm that reproduces the combinatorial structure of GδG_{\delta}, using the sets Eh+,Eh,Ev+,EvE_{h}^{+},E_{h}^{-},E_{v}^{+},E_{v}^{-}, and \mathcal{I} along with the slope information on the bottommost and leftmost edges of FSDδ\mathrm{FSD}_{\delta}, in time O(||)O(\lvert\mathcal{I}\rvert).

Proof 2.4.

By Lemma 2.1, each subcell 𝒮\mathcal{S} contains only arcs that are monotone in both coordinates. We show that the slope information at the points in 𝒮\mathcal{I}_{\mathcal{S}} that lie on the lower and left edge of 𝒮\mathcal{S} is sufficient to know how they are connected through arcs in BδB_{\delta} inside 𝒮\mathcal{S}. Transferring the slope information along arcs, we can thus find the structure of GδG_{\delta} in all subcells incrementally, starting from the bottom left, where after every step there is a (new) subcell in {𝒮}\{\mathcal{S}\} where the slope information is known on the bottom and left edges.

Assume first for simplicity that there are no points on the corners of 𝒮\mathcal{S}. We remove all points in 𝒮\mathcal{I}_{\mathcal{S}} (corresponding to points in EvE_{v} or EhE_{h}) that only touch 𝒮\mathcal{S}, so that BδB_{\delta} does not enter 𝒮\mathcal{S}. Each point z𝒮z\in\mathcal{I}_{\mathcal{S}} then has an incident arc that enters the interior of 𝒮\mathcal{S}, so every point in 𝒮\mathcal{I}_{\mathcal{S}} has to be paired with another such point. To find how they are matched, the algorithm proceeds incrementally, deducing at least one set of matching points at every step.

We consider a number of cases, depending on the behavior of BδB_{\delta} at the as-of-yet unmatched points closest to the corners. Denote by eb,er,ete_{b},e_{r},e_{t} and ele_{l} the bottom, right, top, and left edge of 𝒮\mathcal{S}. We further write zlbz_{l}^{b} and zrbz_{r}^{b} for the two unmatched points in 𝒮\mathcal{I}_{\mathcal{S}} on ebe_{b} that are farthest apart, i.e., for the left-most and right-most unmatched points, respectively. We similarly define the points zbl,ztl,zlt,zrt,ztrz_{b}^{l},z_{t}^{l},z_{l}^{t},z_{r}^{t},z_{t}^{r} and zbrz_{b}^{r} on the edges el,et,e_{l},e_{t}, and ere_{r}, as illustrated in Figures 3 and 4. The combinations of the slope information at the points zlb,zrb,zblz_{l}^{b},z_{r}^{b},z_{b}^{l}, and ztlz_{t}^{l} on the left and bottom edges yields a total of 24=162^{4}=16 cases to consider, where we first assume that these 4 points are distinct. We will show how every case leads to a unique insertion of an arc of BδB_{\delta} matching at least two vertices of GδG_{\delta}, at which point we restart the process to insert another arc until every point is matched.

Case type 1

Consider the case where the arcs of BδB_{\delta} at zlbz_{l}^{b} and zrbz_{r}^{b} move toward each other as in Figure 3(left). Then there is no arc in BδB_{\delta} that connects any point on ele_{l} to ere_{r} and thus ztlz_{t}^{l} necessarily connects to zltz_{l}^{t}. Since the same argument holds if the arcs of BδB_{\delta} at ztlz_{t}^{l} and zblz_{b}^{l} curve toward each other as in Figure 3(right), this resolves a total of 77 different possibilities.

Refer to caption
Refer to caption
Figure 3: slope information - case type 1

Case type 2

Let BδB_{\delta} be decreasing at zlbz_{l}^{b} and at zblz_{b}^{l}. Since each arc is monotone, zlbz_{l}^{b} cannot be joined to any point lying above zblz_{b}^{l}, so these two points have to be matched. This takes care of 44 further cases.

Refer to caption
Refer to caption
Figure 4: Examples of different cases.

Consider next the case where BδB_{\delta} is decreasing at zlbz_{l}^{b}. The case of BδB_{\delta} decreasing at zblz_{b}^{l} having already been treated above, assume otherwise, so that zlbz_{l}^{b} does not connect to a point on ele_{l}. Moreover, none of the points on ele_{l} can connect to points on ere_{r} or ebe_{b}, so they have to be joined to points on ete_{t}. Therefore, if klk_{l} is the number of unmatched points on ele_{l}, zlbz_{l}^{b} connects to the (kl+1)(k_{l}+1)-th point on ete_{t} (and the leftmost klk_{l} points on ete_{t} get joined to points on ele_{l}). The case where BδB_{\delta} decreases at zblz_{b}^{l} is analogous, concluding a total of 15 cases.

Last case

The only remaining case not yet treated is the case where BδB_{\delta} is increasing at each of the four points in question, as depicted in Figure 4(right). There are two possibilities. If ztlz_{t}^{l} is not joined by an arc to zltz_{l}^{t}, then it must be joined to the (kt+1)(k_{t}+1)-th point zkt+1rz_{k_{t}+1}^{r} on ere_{r} (counted from the top), where ktk_{t} is the number of unmatched points in 𝒮\mathcal{I}_{\mathcal{S}} on ete_{t}.

The two cases can be distinguished by a simple rule. Let kbk_{b} and krk_{r} denote the number of unmatched points on ebe_{b} and ere_{r}, respectively. If ztlz_{t}^{l} is connected to the (kt+1)(k_{t}+1)-th point on ere_{r}, then all of the unmatched points in 𝒮et\mathcal{I}_{\mathcal{S}}\cap e_{t} have to be connected to ere_{r} and no point on ele_{l} can be joined to ete_{t}. Since no point on ele_{l} connects to ebe_{b} because of the slope, we find that

kl+kb+kt=kr.\displaystyle k_{l}+k_{b}+k_{t}=k_{r}. (1)

Since every point has to be joined, (1) alone also implies that no point on ele_{l} can be joined to ete_{t}, distinguishing the two cases.

After having matched all points in 𝒮\mathcal{I}_{\mathcal{S}}, we can transfer the slope information from points on the bottom and left edges to the points on ete_{t} and ere_{r}. Note for this that the behavior does not change for points that are in neither of Eh+,Eh,Ev+,E_{h}^{+},E_{h}^{-},E_{v}^{+},, or EvE_{v}^{-}, for which the slope at the corresponding points is clear. Lastly, the remaining points on ere_{r} and ete_{t} without slope information that have been matched to each other are marked as decreasing.

To conclude the proof, we next deal with degenerate cases and corner points.

The degenerate cases

Consider now the cases where there are no four pairwise distinct points zlb,zrb,zblz_{l}^{b},z_{r}^{b},z_{b}^{l}, and ztlz_{t}^{l}. Notice first that the above analysis already treats the case where there are only three distinct such unmatched points. Also, none of the above cases require the slope information for all four points, so the case study also applies in this situation.

The next case is that of only two distinct extremal points on ebele_{b}\cup e_{l}, which again can be treated very similarly. Likewise, the case of a single point on ebele_{b}\cup e_{l} can be settled in the same way. Last, consider the undiscussed situation where all points on ebe_{b} and ele_{l} have been matched. In this case, the unmatched points on ete_{t} have to be matched with those of ere_{r}.

Corner points

To conclude the proof that the points in 𝒮\mathcal{I}_{\mathcal{S}} can be uniquely joined in 𝒮\mathcal{S}, we still need to discuss the case where there are points in 𝒮\mathcal{I}_{\mathcal{S}} on the corners of 𝒮\mathcal{S}. For corner points on ebe_{b} or ele_{l}, the slope information tells us whether or not to include these points in 𝒮\mathcal{I}_{\mathcal{S}} for the matching process. To check if a point in the upper right hand corner ctr:=eterc_{tr}:=e_{t}\cap e_{r} needs to be considered in the absence of slope information for that corner point, we first observe that none of the points on ete_{t} or ere_{r} can connect to ctrc_{tr}. If ctrc_{tr} connects to some other point in 𝒮\mathcal{I}_{\mathcal{S}}, then no point on ere_{r} can connect to ete_{t}. Hence, we see that

kl+kb2nbl=kt+kr,\displaystyle k_{l}+k_{b}-2n_{bl}=k_{t}+k_{r}, (2)

where nbln_{bl} denotes the number of points on ebe_{b} that connect to a point on ele_{l}. The quantities kl,kb,kt,krk_{l},k_{b},k_{t},k_{r} are defined as above, with the convention that the top left and bottom left corner only counts for klk_{l}, the bottom right corner for kbk_{b}, and ctrc_{tr} for ktk_{t}. Note that the points in any pair of matched points in elebe_{l}\cup e_{b} are incident to a decreasing arc of BδB_{\delta}. Therefore, none of them can connect to ctrc_{tr}. Furthermore, no such pair of points can be separated by an arc from ctrc_{tr}. Thus, (2) can only be valid for a specific value of ktk_{t}.

In case ctrc_{tr} is not part of 𝒮\mathcal{I}_{\mathcal{S}}, let ntr0n_{tr}\geq 0 denote the number of points on ete_{t} that are connected to a point on ere_{r}. Then kl+kb2nbl=(kt1)+kr2ntrk_{l}+k_{b}-2n_{bl}=(k_{t}-1)+k_{r}-2n_{tr}, and we see that the right hand side decreases with each pair of matched points from ete_{t} and ere_{r}. All in all, we see that to check if ctrc_{tr} belongs to 𝒮\mathcal{I}_{\mathcal{S}}, one calculates the left and right hand side of (2). Their difference determines if ctrc_{tr} belongs to 𝒮\mathcal{I}_{\mathcal{S}}.

Remark 2.5.

Figure 5 illustrates the necessity of some knowledge of the slope information on edges of a subcell for the accurate reconstruction of BδB_{\delta} inside a cell.

Refer to caption
Figure 5: Two different sets of slope information and their combinatorial structures in a subcell.

Deriving the slope information

In the following, we explain how to derive the slope information for points in a subcell by evaluating the distance between the two curve segments at specific test points along their parametrization. The process is illustrated in Figure 6. We explain the approach using the example of an extremal point zEhz\in E_{h}, which belongs to either Eh+E_{h}^{+} or EhE_{h}^{-}, depending on the distance evaluated at three test points. The three points are any points lying, sufficiently close, below, above, and to the left (or right) of zz. Two of the three points either both belong to the free space or both to the forbidden region, and one will not, determining whether zEh+z\in E_{h}^{+} or zEhz\in E_{h}^{-}, as illustrated in Figure 6. A similar analysis can be used to determine the slope information associated to other points zIz\in I (as long as zIsingz\not\in I_{\text{sing}}).

Since zz lies on the (vertical) boundary of a cell, at least two of the points have natural candidates: We can choose any point on the boundary of the cells that is closer to zz than any other intersection point with BδB_{\delta} lying on the same (vertical) line. To guarantee that the chosen point in the horizontal direction is sufficiently close to zz for the analysis to work, we use the same machinery as before in the construction of the cell decomposition. Denoting z=(zx,zy)z=(z_{x},z_{y}), let zz^{*} be the first number smaller than zxz_{x} where γ1\gamma_{1} (parametrized by the horizontal axis) intersects the ball of radius δ\delta centered at γ2(zy)\gamma_{2}(z_{y}). Then the point of evaluation is chosen from the open interval (z,zx)(z^{*},z_{x}).

Refer to caption
Refer to caption
Figure 6: Finding slope information by evaluating the distance at points.

2.3 Monotone paths in the free space diagram and the decision problem

In this section, we use the machinery developed above to derive an algorithm that answers the decision problem.

Definition 2.6.

The reachable free space δ(γ1,γ2)\mathcal{R}_{\leq\delta}(\gamma_{1},\gamma_{2}) of two curves γ1\gamma_{1} and γ2\gamma_{2} is the subset of all points of the free space 𝒟δ(γ1,γ2)\mathcal{D}_{\delta}(\gamma_{1},\gamma_{2}) that are reachable from the origin by a path monotone in both coordinates. The complexity Nδ(γ1,γ2)N_{\leq\delta}(\gamma_{1},\gamma_{2}) of the reachable free space is the number of original cells with non-empty intersection with δ(γ1,γ2)\mathcal{R}_{\leq\delta}(\gamma_{1},\gamma_{2}).

As before, we can assume (by Proposition 3.12 below) that δ\delta is such that there are no singularities on the boundary curves BδB_{\delta} of the free space. We will later show (Proposition 3.14) that for algebraically bounded curves the decomposition of FSDδ\mathrm{FSD}_{\delta} and point set in Lemma 2.3 (corresponding to the vertices of the graph GδG_{\delta}) consists of O(mn)O(mn) elements (depending on the allowed degrees of the curves). To obtain bounds on the running time of the algorithm, in the following we assume that the investigated curves are algebraically bounded. A reachable interval RR is a maximal interval of points on a boundary edge of a subcell, such that every point in RR is reachable from the origin by a path contained in the free space, that is monotone in both coordinates. In particular, horizontal (vertical) reachable intervals always end on the right (top) either at a vertex of GδG_{\delta}, or at a cell wall, so there are at most O(mn)O(mn) reachable intervals. Consider, for example, a reachable interval RR on the bottom edge of a cell and its left-most point blb_{l}. Points reachable from blb_{l} clearly include all points reachable from any point to the right of blb_{l} within the same interval of free space on the edge. By Lemma 2.1, there is at most one reachable interval on each of the top and right edges of a subcell 𝒮\mathcal{S} that is reachable by a monotone path starting from a reachable interval on the left (or bottom) edge of 𝒮\mathcal{S}, as illustrated in Figure 7. The set of reachable intervals on the top and right edges of 𝒮\mathcal{S} can be readily computed in constant time from the coordinates of the vertices of GδG_{\delta} along with its combinatorial information.

Refer to caption
Figure 7: Computing the reachable intervals (in orange) on the top and right edges of a cell.

We obtain a graph representation of the reachable intervals as follows. Every reachable interval corresponds to a vertex and two vertices are joined by an edge if both intervals belong to the same subcell and every point of one of the reachable intervals can be joined by a monotone path to some point on the other interval. To construct the resulting graph \mathcal{R}, consider the original cell decomposition of FSDδ\mathrm{FSD}_{\delta}. We start by checking if (0,0)𝒟δ(0,0)\in\mathcal{D}_{\delta} and then iterate through the original cells from the bottom left in every row and subsequently move up row by row, computing the reachable intervals on the top and right boundary edges of each cell at every step. To compute these reachable intervals, we compute the reachable intervals on the constant number of subcells in each cell in the same fashion, processing a total of O(Nδ(γ1,γ2))O(N_{\leq\delta}(\gamma_{1},\gamma_{2})) cells. Observe that all reachable intervals have xx and yy coordinates that are each already present in the coordinates of the marked points, i.e., vertices of GδG_{\delta}. (We can also compute the combinatorial structure of GδG_{\delta} within a subcell while processing it, as described in the proof of Lemma 2.3.) All in all, we obtain the following result.

Proposition 2.7.

Given two algebraically bounded piecewise smooth curves γ1\gamma_{1}, γ2\gamma_{2} in d\mathbb{R}^{d} comprised of mm and nn pieces, respectively, and a value of δ\delta such that BδB_{\delta} has no singularities, one can decide if d(γ1,γ2)δ\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2})\leq\delta. The running time is bounded by O(mn)O(mn).

Remark 2.8.

In contrast to the situation for polygonal curves, our solution to the decision problem does not automatically yield a parametrization of γ1\gamma_{1} and γ2\gamma_{2} that realizes the given distance of δ\delta. One way of obtaining such parametrizations would be through parametrizations of the arcs of BδB_{\delta}.

We note that a necessary ingredient for the above decision algorithm is being able to compare the coordinates of the points in the set of points used in the construction of the partitioning of FSDδ\mathrm{FSD}_{\delta}. No further algebraic operations are required to solve the decision problem. Observe that the answer to the decision problem depends only on the combinatorial structure of GδG_{\delta} and the ordering of the xx- and yy-coordinates of the marked points \mathcal{I} that give rise to the partition. Away from critical values of δ\delta, the answer therefore does not change when applying a sufficiently small perturbation of the marked points. Furthermore, in the following section, we deduce that the number of marked points for algebraically bounded curves is bounded, and also show that the number of values of δ\delta for which the answer to the decision problem is subject to change is bounded for such curves. In particular, we observe that the decision algorithm does not crucially depend on evaluating the required algebraic operations exactly, but can also be carried out approximately.

3 The structure of the boundary BδB_{\delta} of the free space

In this section, we complement the introduced computational approach with results concerning the structure of singular points on BδB_{\delta} that guarantee that our algorithms work correctly. The material in this section provides the technical foundation for the approach outlined above. Observe that even for straight edges, in case of the 1\ell_{1} or \ell_{\infty} norm, BδB_{\delta} can feature non-smooth points that persist when varying δ\delta, as the free space is the intersection of a parallelogram with [0,1]2[0,1]^{2} (refer to [1]). Although our framework can be adjusted to include these cases, for simplicity, we exclude the values p=1p=1 and p=p=\infty from our treatment. We discuss the different scenarios for all remaining p\ell_{p} norms, starting with general smooth curves and subsequently focusing on algebraically bounded curves; see [10] for background on algebraic curves and degree. The central property of an algebraic curve we use is that it cannot intersect a hyperplane in general position more than a constant number (depending on the allowed degree) of times.

Refer to caption
Figure 8: Illustration of singular points and changes of the boundary BδB_{\delta} as δ\delta changes.

Defining the function fp,γ1,γ2:[0,1]2f_{p,\gamma_{1},\gamma_{2}}:[0,1]^{2}\to\mathbb{R} by fp,γ1,γ2(t1,t2)=i(|(γ1)i(t1)(γ2)i(t2)|)pf_{p,\gamma_{1},\gamma_{2}}(t_{1},t_{2})=\sum_{i}(|(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})|)^{p}, we have that Bδ={(t1,t2)|fp,γ1,γ2(t1,t2)=δp}[0,1]2B_{\delta}=\{(t_{1},t_{2})|f_{p,\gamma_{1},\gamma_{2}}(t_{1},t_{2})=\delta^{p}\}\subset[0,1]^{2}. There are two possible types of singular points of BδB_{\delta} — cusps and points of self-intersection — characterized as those points that do not have a well-defined tangent defined by the Jacobi matrix (gradient) J:=Dfp,γ1,γ2J:=Df_{p,\gamma_{1},\gamma_{2}}. The singular points correspond to critical points of the function fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}. The image of a critical point is known as a critical value. The entries Jk(t1,t2)J_{k}(t_{1},t_{2}) for k=1,2k=1,2 are given by

Jk(t1,t2)=pi|(γ1)i(t1)(γ2)i(t2)|p2((γ1)i(t1)(γ2)i(t2))(1)k+1(γk)i(tk).\displaystyle J_{k}(t_{1},t_{2})=p\sum_{i}|(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})|^{p-2}((\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2}))(-1)^{k+1}(\gamma_{k})^{\prime}_{i}(t_{k}). (3)

The singular points of BδB_{\delta} can thus be described as

Ising={(t1,t2)|\displaystyle I_{\text{sing}}=\biggl{\{}(t_{1},t_{2})\bigg{|} i(|(γ1)i(t1)(γ2)i(t2)|)p2((γ1)i(t1)(γ2)i(t2))(γ1)i(t1)=0,\displaystyle\sum_{i}(|(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})|)^{p-2}((\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2}))(\gamma_{1})^{\prime}_{i}(t_{1})=0, (4)
\displaystyle- i(|(γ1)i(t1)(γ2)i(t2)|)p2((γ1)i(t1)(γ2)i(t2))(γ2)i(t2)=0}Bδ.\displaystyle\sum_{i}(|(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})|)^{p-2}((\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2}))(\gamma_{2})^{\prime}_{i}(t_{2})=0\biggr{\}}\cap B_{\delta}.

Geometrically, critical points of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} for 1<p<1<p<\infty can be described as pairs of points (t1,t2)(t_{1},t_{2}) on BδB_{\delta} satisfying the additional criteria

ddt1γ1(t1)γ2(t2)p=0=ddt2γ1(t1)γ2(t2)p.\displaystyle\frac{\mathrm{d}}{\mathrm{d}t_{1}}\|\gamma_{1}(t_{1})-\gamma_{2}(t_{2})\|_{p}=0=\frac{\mathrm{d}}{\mathrm{d}t_{2}}\|\gamma_{1}(t_{1})-\gamma_{2}(t_{2})\|_{p}. (5)

Observe that both equations in (4) (or (5)) are continuous for 1<p<1<p<\infty. The implicit function theorem guarantees that, away from critical points, BδB_{\delta} can be described as a collection of planar C1C^{1} curves, as illustrated in Figure 8.

The intuitive idea behind the investigations of this section is that since the two equations in (4) are independent of δ\delta, the solution set (the singular points) should ideally be a collection of isolated points, so that there are only isolated critical values of δ\delta to which they belong.

Since both γ1\gamma_{1} and γ2\gamma_{2} are C2C^{2}, the function fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is C2C^{2} for 2p<2\leq p<\infty, and C1C^{1} for 1<p<21<p<2 (see also (6) below). For the sake of completeness, we derive the coefficients Hkl(t1,t2)H_{kl}(t_{1},t_{2}), with k,l{1,2}k,l\in\{1,2\}, of the Hessian HH of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}, from the Jacobian JkJ_{k} in (3) of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}. Up to multiplication by a constant CC, we compute HklH_{kl} by differentiating the equations (4), which yields

CHkl(t1,t2)=\displaystyle C\cdot H_{kl}(t_{1},t_{2})= i|(γ1)i(t1)(γ2)i(t2)|p2((p2)(1)l+k(γl)i(tl)(γk)i(tk)+\displaystyle\sum\limits_{i}|(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})|^{p-2}\biggl{(}(p-2)(-1)^{l+k}(\gamma_{l})^{\prime}_{i}(t_{l})(\gamma_{k})^{\prime}_{i}(t_{k})+ (6)
(1)l+k(γk)i(tk)(γl)i(tl)+(1)k+1δkl((γ1)i(t1)(γ2)i(t2))(γk)i′′(tk))\displaystyle(-1)^{l+k}(\gamma_{k})^{\prime}_{i}(t_{k})(\gamma_{l})^{\prime}_{i}(t_{l})+(-1)^{k+1}\delta_{kl}((\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2}))(\gamma_{k})^{\prime\prime}_{i}(t_{k})\biggr{)}
=\displaystyle= i|(γ1)i(t1)(γ2)i(t2)|p2((1)k+l(p1)(γl)i(tl)(γk)i(tk)\displaystyle\sum\limits_{i}|(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})|^{p-2}\biggl{(}(-1)^{k+l}(p-1)(\gamma_{l})^{\prime}_{i}(t_{l})(\gamma_{k})^{\prime}_{i}(t_{k})
+(1)k+1δkl((γ1)i(t1)(γ2)i(t2))(γk)i′′(tk)),\displaystyle+(-1)^{k+1}\delta_{kl}((\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2}))(\gamma_{k})^{\prime\prime}_{i}(t_{k})\biggr{)},

where δkl\delta_{kl} is the Kronecker delta, which has the value one for k=lk=l and zero otherwise.

Example 3.1.

In case of the Euclidean norm, where p=2p=2, the singularities (t1,t2)(t_{1},t_{2}) satisfy the orthogonality condition

γ1(t1)γ2(t2),γ1(t1)=0=γ1(t1)γ2(t2),γ2(t2).\displaystyle\left<\gamma_{1}(t_{1})-\gamma_{2}(t_{2}),\gamma_{1}^{\prime}(t_{1})\right>=0=\left<\gamma_{1}(t_{1})-\gamma_{2}(t_{2}),\gamma_{2}^{\prime}(t_{2})\right>. (7)

The singularities thus correspond to pairs of points, one on each of the curves, at which the two tangent vectors are contained in the hyperplane orthogonal to the vector between the pair of points.

Consider the two curves γ1(t)=(t,0)\gamma_{1}(t)=(t,0) and γ2(t)=(t,t5sin(1t)+α)\gamma_{2}(t)=(t,t^{5}\sin(\frac{1}{t})+\alpha) for t0t\neq 0 and γ2(t)=(0,α)\gamma_{2}(t)=(0,\alpha), for some α\alpha\in\mathbb{R}. Notice that both γ1\gamma_{1} and γ2\gamma_{2} are C2C^{2} curves. Since (γ2)2(\gamma_{2})_{2} has infinitely many zeros in [0,1][0,1], its derivative also has infinitely many zeros in [0,1][0,1], so there are infinitely many critical points of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} in [0,1][0,1] for p=2p=2, giving rise to infinitely many critical values. Observe also that the related function γ2(t)=(t,exp(1t2)sin(1t)+α)\gamma_{2}(t)=(t,\exp(-\frac{1}{t^{2}})\sin(\frac{1}{t})+\alpha) for t0t\neq 0 and γ2(0)=(0,α)\gamma_{2}(0)=(0,\alpha) is infinitely differentiable in [0,1][0,1] and has the same property.

Remark 3.2.

One might find it desirable to find assumptions which imply that the function fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is a Morse function. A Morse function is a C2C^{2} function where the Hessian is non-singular at critical points, see [9]. The Morse lemma would then imply that the critical points described by the equations (4) are isolated, so that the same is also true for the critical values. However, it is noteworthy that there are cases where a small rotation and translation of one of the curves is not be enough to ensure that the critical points are isolated, as can be seen by an adjustment of Example 3.1.

We have the following result regarding the regular, i.e., non-critical values of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}. To simplify the exposition, we assume that γ1\gamma_{1} and γ2\gamma_{2} are smooth, so that FSDδ\mathrm{FSD}_{\delta} consists of a single cell. In particular, we can ignore singularities of BδB_{\delta} due to the nonsmoothness of the curves where the smooth pieces join.

Proposition 3.3.

The set \mathcal{R} of regular values of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is open in \mathbb{R} for 1<p<1<p<\infty and dense if 2p<2\leq p<\infty. For 1<p<21<p<2, there is a dense and open set in \mathbb{R} in which the only possible singular points of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} are the points (t1,t2)(t_{1},t_{2}) where (γ1)i(t1)=(γ1)i(t2)(\gamma_{1})_{i}(t_{1})=(\gamma_{1})_{i}(t_{2}) for some 1id1\leq i\leq d. If the points (t1,t2)(t_{1},t_{2}) where (γ1)i(t1)=(γ2)i(t2)=0(\gamma_{1})_{i}^{\prime}(t_{1})=(\gamma_{2})_{i}^{\prime}(t_{2})=0 for all ii form a null set, then \mathcal{R} is also dense for 1<p<1<p<\infty.

Proof 3.4.

Let δnnδ\delta_{n}\xrightarrow{n\to\infty}\delta be a sequence of critical values with limit δ\delta. For every δn\delta_{n}, there is a singular point (t1n,t2n)(t_{1}^{n},t_{2}^{n}) satisfying (4). Since [0,1]2[0,1]^{2} is compact, we can assume that (t1n,t2n)(t_{1}^{n},t_{2}^{n}) converges by passing over to a subsequence. The set of critical values is then closed by continuity of (4) and fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} in both t1t_{1} and t2t_{2} for 1<p<1<p<\infty.

For 2p<2\leq p<\infty, fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is C2C^{2}, so by the classical Morse-Sard theorem [14] the set of those δp>0\delta^{p}>0 that are the image of singular points in BδB_{\delta} has Lebesgue measure zero in \mathbb{R}. As the complement of a zero-set for the Lebesgue measure, the set of regular values is dense.

We argue similarly for 1<p<21<p<2. The regularity of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is insufficient to obtain strong bounds on the size of the set of singular values, even with recent generalizations of the Morse-Sard theorem [8]. We thus restrict attention to points (t1,t2)(t_{1},t_{2}) where (γ1)i(t1)(γ1)i(t2)(\gamma_{1})_{i}(t_{1})\neq(\gamma_{1})_{i}(t_{2}) for all ii, where the Jacobian (3) of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is locally Lipschitz, which implies that the set of singular values has measure zero, at least when restricted to these points [3, Theorem 1]. The critical points (t1,t2)(t_{1},t_{2}) of the equation (γ1)i(t1)(γ2)i(t2)=0(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2})=0 are given by (γ1)i(t1)=0=(γ2)i(t2)(\gamma_{1})^{\prime}_{i}(t_{1})=0=(\gamma_{2})^{\prime}_{i}(t_{2}). If these form a set of measure zero in [0,1]2[0,1]^{2} for each ii, then the image of their union under the C1C^{1} map fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is a null set with respect to the Lebesgue measure.

Remark 3.5.

If the curves (γ1)i(\gamma_{1})_{i} and (γ2)i(\gamma_{2})_{i} are both Morse functions for all ii, which is almost always the case, then (γ1)i(t1)(γ2)i(t2)(\gamma_{1})_{i}(t_{1})-(\gamma_{2})_{i}(t_{2}) also defines a Morse function [0,1]2[0,1]^{2}\to\mathbb{R} on the product space [0,1]2[0,1]^{2} [2, Exercise 4], which implies, by the Morse lemma, that the critical points are isolated [12, Theorem 3.1.1]. Therefore, the last assumption in Proposition 3.3 ensuring that \mathcal{R} is dense for 1<p<1<p<\infty is satisfied for almost all curves.

Proposition 3.3 does not rule out accumulation points of singular values for general smooth curves, even when p=2p=2, as illustrated in Example 3.1.

Lemma 3.6.

Let 1<p<1<p<\infty, cc be a simple component of BδB_{\delta}, such that [0,1]2c[0,1]^{2}\setminus c has two components, each with non-empty interior. Let RcR_{c} be a region in [0,1]2[0,1]^{2} enclosed by cc. If Rc¯\overline{R_{c}} admits a neighborhood that has empty intersection with all other components ccc^{\prime}\neq c of BδB_{\delta}, then cc is everywhere differentiable, i.e., BδB_{\delta} does not have any cusps.

Proof 3.7.

We sketch the proof, which can be seen as a consequence of the classification of the shape of the free space inside a cell of the free space diagram associated to two line segments [1, Lemma 3], as the intersection of a smooth ellipse with a rectangle. The statement there is only for the 2\ell_{2}-norm, but can be naturally extended by noting that for 1<p<1<p<\infty, the boundary of the set of all points with norm δ\leq\delta from a given point is C1C^{1}, as follows from the regular value theorem since any δ>0\delta>0 is a regular value of the p\ell_{p}-norm.

The question of whether a point (t1,t2)(t_{1},t_{2}) on cc corresponding to the two points γ1(t1)\gamma_{1}(t_{1}) and γ2(t2)\gamma_{2}(t_{2}) on the two curves with distance δ\delta is a cusp is inherently a local one. By differentiability of the two curves, they are approximated locally by their tangents and within a sufficiently small neighborhoods of t1t_{1} and t2t_{2}, we can picture the curves as a result of a differentiable deformation of their tangents at these points. Such a deformation leads to a similar local deformation of the boundary of the free space. Indeed, the boundary of the free space for the linear tangents is C1C^{1} for noncritical values of the distance parameter δ\delta, which remains that way after a small local differentiable deformation of the linear tangents. We therefore have C1C^{1} regularity of cc at (t1,t2)(t_{1},t_{2}).

As a consequence of Lemma 3.6, the critical values of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} for 1<p<1<p<\infty coincide with the appearance of a new component, or the merging of components in the free space diagram.

We will show that if the piecewise smooth curves γ1\gamma_{1} and γ2\gamma_{2} consist of algebraically bounded curves, Proposition 3.3 can be strengthened. To this end, we need some preparation.

Lemma 3.8.

Let γ\gamma be an algebraically bounded curve. Then γ\gamma is tangent to only finitely many 2\ell_{2}-spheres centered at the origin, given by {xdx2=r}\{x\in\mathbb{R}^{d}\;\mid\;\|x\|_{2}=r\} for some r+r\in\mathbb{R}_{+}, with bound depending only on the degree bound of the curve.

Proof 3.9.

First note that the statement of the lemma is well-known to be true if we replace 2\ell_{2}-spheres by hyperplanes orthogonal to a coordinate axis. Indeed, an algebraic curve of a given degree only has finitely many extrema in a given coordinate direction (if it is not contained in such a plane), as the extrema correspond to algebraic sets themselves, obtained through partial derivatives of each of the defining equations of γ\gamma. To derive the statement for 2\ell_{2}-spheres, we make use of a variant of stereographic projection that considers all 2\ell_{2}-spheres of positive radius at the same time. For a sphere SR2d1S^{d-1}_{R^{2}}, centered at the origin, with radius R2R^{2}, we define the function (see Figure 9)

SR2d1(x1,,xd)(2R2R2xd(x1,,xd1),R2),S^{d-1}_{R^{2}}\owns(x_{1},\ldots,x_{d})\mapsto\left(\frac{2R^{2}}{R^{2}-x_{d}}(x_{1},\ldots,x_{d-1}),-R^{2}\right),

with inverse

d(x1,,xd1,R2)(4R4i=1d1xi2+4R4(x1,,xd1),(124R4i=1d1xi2+4R4)R2).\mathbb{R}^{d}\owns(x_{1},\ldots,x_{d-1},-R^{2})\mapsto\left(\frac{4R^{4}}{\sum_{i=1}^{d-1}x_{i}^{2}+4R^{4}}(x_{1},\ldots,x_{d-1}),\left(1-2\frac{4R^{4}}{\sum_{i=1}^{d-1}x_{i}^{2}+4R^{4}}\right)R^{2}\right).
Refer to caption
Figure 9: Illustration of the variant of stereographic projection we use in Lemma 3.8.

Outside of the points where x1=x2==xd1=0x_{1}=x_{2}=\ldots=x_{d-1}=0, we obtain a rational map Ψ\Psi defined on all of d\mathbb{R}^{d}, mapping all 2\ell_{2}-spheres centered at the origin to hyperplanes, with rational inverse. Therefore, if γ\gamma was tangent to infinitely many spheres, the algebraic curve that is its image under Ψ\Psi would be tangent to infinitely many hyperplanes. However, as pointed out above, the number of times this can happen is a finite number depending on the degree of the algebraic curve in question, concluding the proof.

Lemma 3.10.

Algebraically bounded curves can intersect an p\ell_{p}-sphere only a finite number of times, with bound depending only on the degree bound.

Proof 3.11.

Assume otherwise, so that there is a sphere SpS_{p} that intersects a curve γ\gamma some large number of times. Since SpS_{p} is compact, there are arbitrarily many intersection points within a small neighborhood UU in SpS_{p}. Consider the pencil of 2\ell_{2}-spheres centered at a point in the middle of UU. One readily sees that the number of times γ\gamma is tangent to some sphere in this pencil can be made arbitrarily large, which would contradict Lemma 3.8.

The underlying idea of the proof of Lemma 3.10 can be also used to show the following.

Proposition 3.12.

Let γ1\gamma_{1} and γ2\gamma_{2} be algebraically bounded curves. Then there are only finitely many (with bound depending only on the degree bound) critical values of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} for 1<p<1<p<\infty.

It is instructive to first consider the important case that p=2p=2, and both γ1\gamma_{1} and γ2\gamma_{2} have (componentwise) parametrizations as polynomials or more generally rational functions. Observe that in this case the set of critical points of fp,γ1γ2f_{p,\gamma_{1}\gamma_{2}} is an algebraic set, and thus the finite union of irreducible algebraic sets, which correspond to connected components in both the Zariski and the usual topology [10] (for this, instead of just real numbers, we also allow complex numbers as input for fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}). The image on each connected set of critical points under the C1C^{1} function fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} is constant, so the image of all critical points leads to only finitely many critical values of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}. Note that the number of irreducible algebraic sets is bounded in terms of the degree bound of the curves.

Proof 3.13 (Proof of Proposition 3.12).

We now treat the general case, for which we argue geometrically. By Lemma 3.6, for 1<p<1<p<\infty, a critical value δ\delta of the function corresponds to either the appearance of a new component of BδB_{\delta}, or to two (or more) components becoming tangent, at some critical point (x,y)[0,1]2(x,y)\in[0,1]^{2}. In d\mathbb{R}^{d}, by (5), these events correspond to γ1\gamma_{1} becoming tangent at γ1(x)\gamma_{1}(x) to an p\ell_{p}-ball centered at a point γ2(y)\gamma_{2}(y); conversely, the same ball centered at γ1(x)\gamma_{1}(x) is tangent to γ2\gamma_{2} at γ2(y)\gamma_{2}(y).

Assume that there are infinitely many distinct critical values δ\delta where these events take place. Then, by compactness of [0,1]2[0,1]^{2}, there is a convergent subsequence of critical points in [0,1]2[0,1]^{2} corresponding to pairs of points on the two curves where these events happen for distinct values of δ\delta. We can assume that the terms of the sequence are pairwise distinct. We consider the sequences as given by (xk)k(x_{k})_{k\in\mathbb{N}} and (yk)k(y_{k})_{k\in\mathbb{N}} in the first and second coordinates, respectively, and assume, without loss of generality, that the yky_{k} are pairwise distinct. The tangent vectors of γ1\gamma_{1} at {xk}\{x_{k}\} lie in the hyperplanes tangent to balls centered at the convergent sequence of points γ2(yk)\gamma_{2}(y_{k}). For sufficiently large kk, the tangent vectors of γ1\gamma_{1} at γ1(xk)\gamma_{1}(x_{k}) are roughly the same. As a consequence, the pencil of 2\ell_{2}-spheres based at a point zz sufficiently close to γ1(xk)\gamma_{1}(x_{k}) contains an unbounded number of tangencies to the curve γ2\gamma_{2} as γ2\gamma_{2} alternates between moving away from and towards zz. This is illustrated in Figure 10, showing the tangent vectors of γ2\gamma_{2} ‘bundle’ together around the eventual limit vector. We can further assume that the 2\ell_{2} spheres do not contain an entire part of γ2\gamma_{2} by applying a small perturbation to the sphere if necessary. However, this would again contradict Lemma 3.8, so we can discard the assumption of infinitely many critical values of fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}}.

Refer to caption
Figure 10: A section (the dashed magenta line) of a sphere of the pencil that contains a large number of tangencies to γ2\gamma_{2}.

To see that the number of critical values is in fact bounded by a constant depending on the bound on the degrees of the algebraic curves, we assume otherwise and argue very similarly to above. Indeed, given a sequence of curves with unbounded number of critical values leads to an arbitrary number of critical points within an arbitrary small neighborhood in [0,1]2[0,1]^{2}. By rescaling, we can assume that the arclength of the curves in the sequence is bounded and thus, just as above, we have that an arbitrary number of critical points correspond to points and tangents on each of the curves that are arbitrarily close to each other.

Similarly to the proof of Proposition 3.12 which bounds the number of critical values of δ\delta, we also obtain a similar bound on the number of marked points for a regular value of δ\delta.

Proposition 3.14.

The number of points (components) in each of the sets Eh+,Eh,Ev+,EvE_{h}^{+},E_{h}^{-},E_{v}^{+},E_{v}^{-}, (and \mathcal{I}) is at most a constant in each cell, for a total of O(mn)O(mn), whenever γ1,γ2\gamma_{1},\gamma_{2} are algebraically bounded, consisting of mm, resp. nn smooth pieces, and δ\delta is a regular value. The resulting decomposition of the free space diagram consists of O(mn)O(mn) cells.

Proposition 3.14 implies that the bound on the degree of a set of algebraically bounded curves determines a bound on the number of points used in the decomposition of FSDδ\mathrm{FSD}_{\delta}, for any regular value of δ\delta, thereby providing the justification for the complexity bounds on the running-time of our decision algorithm. The proof is very similar to that of Proposition 3.12.

Proof 3.15 (Proof of Proposition 3.14).

Assume that there is a sequence of values for a given δ\delta for which the number of points in, say, EhE_{h} becomes greater than any given constant, then we can arrive at a contradiction, similarly to the proof of Proposition 3.12. The idea is that in this case, there has to be an arbitrary number of points in, say, EhE_{h}, that are arbitrarily close to each other in [0,1]2[0,1]^{2}. By rescaling the curves (and δ\delta) to normalize the length of the longer curve, we can assume that these points correspond to arbitrarily close points along γ1\gamma_{1} and in d\mathbb{R}^{d}. This again allows the construction of a pencil of 2\ell_{2}-spheres with an arbitrary number of tangencies to γ2\gamma_{2}, contradicting Lemma 3.8.

By Lemma 3.10, we see that each of the finitely many extrema leads to only finitely many marked points. Again by rescaling, one can eliminate the possibility that the maximum number of points in \mathcal{I} depends on δ\delta.

4 The minimization problem of computing the Fréchet distance

The aim of this section is to use the solution of the decision problem to solve the optimization problem of finding the minimal δ\delta for which the decision problem for two curves has a positive answer, which corresponds to the Fréchet distance between the curves. Assuming that all mm, resp. nn smooth pieces of γ1\gamma_{1}, resp. γ2\gamma_{2} are algebraically bounded curves, we show that the number of operations required for the computation is of the same complexity as the polygonal case. The results outlined in this section mostly essentially mirror those for smooth planar curves under the 2\ell_{2}-distance in [13].

The central idea is to invoke Megiddo’s parametric search technique [11], together with the optimization introduced by Cole [6]. Parametric search is the standard approach to computing the Fréchet distance and its variants [1, 15, 13, 5]. In the following, we explain the adjustments necessary to apply it to the situation of algebraically bounded curves.

The combinatorial structure of the partition of the free space diagram introduced in Section 2 changes only at certain critical values of δ\delta. In addition to these values being critical values of the function fp,γ1,γ2f_{p,\gamma_{1},\gamma_{2}} introduced in Section 3, there are further possibilities. By Lemma 3.6, the only values of δ\delta where the decision problem can change are related to the emergence or merging of components of free space, a component becoming tangent to the boundary of walls of original cells, a marked point appearing or disappearing, or the ordering of the xx- and yy-coordinates of the marked points changing. The results of the previous section imply that the set of δ\delta where none of these events occur is open. Moreover, we observe that a new marked point that is not naturally related to a previously marked point can appear (or disappear) only a finite number of times, bounded by a constant depending on the degree of the algebraically bounded curves. Similarly to the proof of Proposition 3.14, this is again a consequence of the fact that if there did exist a sequence of values of δ\delta with an ever increasing number of such events, then there is a sequence of points on the curves that ultimately contradict the property that algebraically bounded curves cannot be tangent to sphere centered at a fixed point more than a fixed number of times. A similar argument also shows that the ordering of the marked points cannot change more often than a constant depending on the degree bound of the curves, as the ordering is subject to change only when extremal points meet on the same vertical or horizontal line in FSDδ\mathrm{FSD}_{\delta}.

There are O(mn)O(mn) critical values of δ\delta between which no marked points appear or disappear, and no components merge, appear, or start touching the boundary of cells. We apply a binary search among these O(mn)O(mn) critical values so that the only changes to the answer of the decision problem are due to a change of the order of the extremal points in the xx- and yy-direction. Every step of the binary search involves running the decision algorithm, resulting in a running time of O(mnlog(mn))O(mn\log(mn)) for this step. Note that since we cannot run our decision algorithm directly on these critical values, we have to move to a value for δ\delta that lies between them. As a result, the binary search only narrows down the interval of δ\delta to two possible, adjacent intervals, instead of one. Inbetween these O(mn)O(mn) critical values, we use Cole’s variant of parametric search with a parallel sorting algorithm for both the xx- and yy-coordinates of the marked points of BδB_{\delta}, to obtain an overall running time of O(mnlog(mn))O(mn\log(mn)). The value of the Fréchet distance d(γ1,γ2)\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2}) is the lowest point of the lowest interval in which the decision problem has a positive answer. The result is summarized in Theorem 4.1.

Theorem 4.1.

Let γ1\gamma_{1} and γ2\gamma_{2} be two algebraically bounded curves in d\mathbb{R}^{d} consisting of mm and nn pieces, respectively. Then the Fréchet distance between γ1\gamma_{1} and γ2\gamma_{2} can be computed in O(mn)O(mn) space and in O(mnlog(mn))O(mn\log(mn)) operations (of bounded algebraic complexity).

5 Simplification of piecewise smooth curves

In this section, we introduce an algorithm to simplify a piecewise smooth curve consisting of nn smooth pieces and runs in O(n)O(n) time. We adapt the approach of [7] to our setting of piecewise smooth curves with appropriate changes.

Computing the simplification simp(γ)\operatorname{simp}(\gamma) of a piecewise smooth curve γ\gamma with respect to μ\mu\in\mathbb{R}.

Starting with the first smooth piece γ1\gamma_{1} of γ\gamma, consider its arc length l(γ1)l(\gamma_{1}). If l(γ1)μl(\gamma_{1})\geq\mu, then we move on to the next piece γ2\gamma_{2} and start over from there. Let γi:[0,1]d\gamma_{i}:[0,1]\to\mathbb{R}^{d} be the first piece with l(γi)<μl(\gamma_{i})<\mu. Then γi\gamma_{i} is contained in the ball B(γi(0),μ)B(\gamma_{i}(0),\mu) of radius μ\mu centered at γi(0)\gamma_{i}(0). Following the curve γ\gamma, let γj\gamma_{j} be the first piece of γ\gamma that leaves B(γi(0),μ)B(\gamma_{i}(0),\mu). We take the first point pjp_{j} on γj\gamma_{j} lying on the boundary B(γi(0),μ)B(\gamma_{i}(0),\mu) and join γi(0)\gamma_{i}(0) to pjp_{j} with a straight line of length μ\mu, replacing the part of γ\gamma between γi(0)\gamma_{i}(0) and pjp_{j}; and γj\gamma_{j} with the part of it after pjp_{j}. We then restart the procedure at pjp_{j}. If after any piece γk:[0,1]d\gamma_{k}:[0,1]\to\mathbb{R}^{d} with l(γk)<μl(\gamma_{k})<\mu, γ\gamma does not intersect the boundary of B(γk(0),μ)B(\gamma_{k}(0),\mu), then we remove the part of γ\gamma after γk(0)\gamma_{k}(0).

The simplification algorithm results in a piecewise smooth curve with each piece of having an arc length of at least μ\mu. Note that the algebraic operation of intersecting γ\gamma with a ball is the same operation required in the computation of the Fréchet distance between two curves.

Lemma 5.1.

The simplification γ=simp(γ,μ)\gamma^{\prime}=\operatorname{simp}(\gamma,\mu) of a piecewise smooth curve defined by Algorithm 5 above satisfies γγB(0,μ)\gamma\subset\gamma^{\prime}\bigoplus B(0,\mu). In particular, δF(γ,γ)μ\delta_{F}(\gamma^{\prime},\gamma)\leq\mu.

Refer to caption
Figure 11: Illustration of Lemma 5.1, showing that the simplification s=simp(s,μ)s^{\prime}=\operatorname{simp}(s,\mu) is μ\mu-close to ss.

Here, ABA\bigoplus B denotes the Minkowski sum of AA and BB. The situation is illustrated in Figure 11.

Proof 5.2.

Let ss^{\prime} be the first new segment of γ\gamma^{\prime} and ss the portion of γ\gamma that gets replaced by ss^{\prime} in γ\gamma^{\prime} and has the same endpoints p1p_{1} and p2p_{2} as ss^{\prime}. Now, ss is contained in B(p1,μ)B(p_{1},\mu), so ssB(0,μ)s\subset s^{\prime}\bigoplus B(0,\mu) and the statement about the Minkowski sum follows, which in turn implies the statement about the Fréchet distance. Indeed, we can traverse γ\gamma^{\prime} and γ\gamma until p1p_{1}, then traverse γB(p1,μ)\gamma\cap B(p_{1},\mu) while the parametrization of γ\gamma^{\prime} stays on p1p_{1}. Then, ss^{\prime} is traversed until p2p_{2} is reached for both parametrizations, while maintaining a distance of at most μ\mu.

5.1 Preserving cc-packedness

We make precise the idea that since each piece of a simplified curve simp(γ,μ)\operatorname{simp}(\gamma,\mu) is μ\mu-close to γ\gamma, the length contained in any ball cannot increase too much through the simplification.

Lemma 5.3.

Let γ=simp(γ,μ)\gamma^{\prime}=\operatorname{simp}(\gamma,\mu), with γ\gamma a piecewise smooth curve. Then for any pdp\in\mathbb{R}^{d} and rr\in\mathbb{R}, l(γB(p,r+μ))l(γB(p,r))l(\gamma\cap B(p,r+\mu))\geq l(\gamma^{\prime}\cap B(p,r)).

The situation is illustrated in Figure 12.

Refer to caption
Figure 12: Illustration of the proof of Lemma 5.3.
Proof 5.4.

Let ss^{\prime} be a segment of γ\gamma^{\prime} and sB:=sB(p,r)s^{\prime}_{B}:=s^{\prime}\cap B(p,r). Consider the subcurve ss of γ\gamma that gets replaced by ss^{\prime} in γ\gamma^{\prime} and has the same endpoints as ss^{\prime}. By Lemma 5.1, ssB(0,μ)s\subset s^{\prime}\bigoplus B(0,\mu). Moreover, sBB(0,μ)B(p,r+μ)s^{\prime}_{B}\bigoplus B(0,\mu)\subset B(p,r+\mu), so s(sBB(0,μ))B(p,r+μ)s\cap\left(s^{\prime}_{B}\bigoplus B(0,\mu)\right)\subset B(p,r+\mu). Since sBs^{\prime}_{B} is a straight line, it is the shortest path connecting its two endpoints. Therefore, we can erect two planes orthogonal to sBs^{\prime}_{B} at the endpoints such that any path connecting these two planes must have length at least l(sB)l(s^{\prime}_{B}). In particular, since ssBB(0,μ)s\cap s^{\prime}_{B}\bigoplus B(0,\mu) contains such a path, l(s(sBB(0,μ)))l(sB)l(s\cap\left(s^{\prime}_{B}\bigoplus B(0,\mu)\right))\geq l(s^{\prime}_{B}). The statement of the lemma follows by summing over the intersections of all pieces of γ\gamma^{\prime} with B(p,r)B(p,r).

Lemma 5.5.

Let γ\gamma be a cc-packed planar smooth curve and μ>0\mu>0. Then the simplified curve γ=simp(γ,μ)\gamma^{\prime}=\operatorname{simp}(\gamma,\mu) is a 7c7c-packed curve.

Proof 5.6.

For the sake of contradiction, assume that l(γB(p,r))>7crl(\gamma^{\prime}\cap B(p,r))>7cr. We consider first the case that rμr\geq\mu. Then Lemma 5.3 implies that l(γB(p,r+μ))l(γB(p,r+μ))l(γB(p,μ))>7crl(\gamma\cap B(p,r+\mu))\geq l(\gamma\cap B(p,r+\mu))\geq l(\gamma^{\prime}\cap B(p,\mu))>7cr. However, since γ\gamma is cc-packed, we also have l(γB(p,r+μ))(r+μ)c2crl(\gamma\cap B(p,r+\mu))\leq(r+\mu)c\leq 2cr, a contradiction.

Let r<μr<\mu. Let kk denote the number of curve pieces of γ\gamma^{\prime} in B(p,r)B(p,r) and consider k=kn+kok=k_{n}+k_{o}, where kok_{o} denotes the number of original pieces of γ\gamma^{\prime} in B(p,r)B(p,r) that are also present in γB(p,r)\gamma\cap B(p,r) and knk_{n} denotes the number of new curve pieces that intersect B(p,r)B(p,r). Since γ\gamma is cc-packed, the curved pieces in B(p,r)B(p,r) present in both γ\gamma and γ\gamma^{\prime} cannot have a total length greater than crcr. Therefore, if l(γB(p,r))>7crl(\gamma^{\prime}\cap B(p,r))>7cr, then the new pieces have to add up in length to at least 6cr6cr. Since the new pieces are straight lines they can contribute at most 2r2r in length to the intersection γB(p,r)\gamma^{\prime}\cap B(p,r), so kn>6cr/2r=3ck_{n}>6cr/2r=3c.

Observe that l(γB(p,2μ))l(γB(p,r+μ))knμl(\gamma^{\prime}\cap B(p,2\mu))\geq l(\gamma^{\prime}\cap B(p,r+\mu))\geq k_{n}\mu, since a new segment of γ\gamma^{\prime} intersecting B(p,r)B(p,r) also intersects B(p,r+μ)B(p,r+\mu) and each curve piece in γ\gamma^{\prime} has length at least μ\mu. Therefore, by Lemma 5.3, l(γB(p,3μ))l(γB(p,2μ))l(γB(p,r+μ))knμ>3cμl(\gamma\cap B(p,3\mu))\geq l(\gamma^{\prime}\cap B(p,2\mu))\geq l(\gamma^{\prime}\cap B(p,r+\mu))\geq k_{n}\mu>3c\mu, which contradicts the cc-packedness of γ\gamma.

We note that the results and proofs in this section are valid for all simplifications of cc-packed curves, as long as the simplified curve

  1. 1.

    is contained in a tubular neighborhood of the original curve,

  2. 2.

    consists of pieces with arc length bounded from below by μ\mu.

6 The relative free space complexity of simplified smooth curves

The central idea of the approximation algorithm for the decision problem for piecewise smooth curves is to replace the two curves in question with their simplifications. To study the complexity of the reachable free space, we examine the following central quantity.

Definition 6.1.

The ϵ\epsilon-relative free space complexity of two curves γ1\gamma_{1} and γ2\gamma_{2} is

N(ϵ,γ1,γ2)=maxδ0Nδ(simp(γ1,ϵδ),simp(γ2,ϵδ)).\displaystyle N(\epsilon,\gamma_{1},\gamma_{2})=\max\limits_{\delta\geq 0}N_{\leq\delta}(\operatorname{simp}(\gamma_{1},\epsilon\delta),\operatorname{simp}(\gamma_{2},\epsilon\delta)).
Proposition 6.2.

Let γ1\gamma_{1} and γ2\gamma_{2} be two piecewise smooth curves that are cc-packed and such that the arc length of each of the nn pieces is at least μ=ϵδ\mu=\epsilon\delta. Then the number of cells in FSDδ(γ1,γ2)\mathrm{FSD}_{\delta}(\gamma_{1},\gamma_{2}) containing non-empty free space is in O(cn/ϵ)O(cn/\epsilon).

Proof 6.3.

Assign a counter to all pieces of the two curves, starting with the value 0. Each cell in 𝒟δ(γ1,γ2)\mathcal{D}_{\leq\delta}(\gamma_{1},\gamma_{2}) has two associated smooth pieces u1u_{1} and u2u_{2} of γ1\gamma_{1} and γ2\gamma_{2}, respectively. The free space in the cell associated to u1u_{1} and u2u_{2} is non-empty if and only if there are two points p1u1p_{1}\in u_{1} and p2u2p_{2}\in u_{2} such that p1p2δ\|p_{1}-p_{2}\|\leq\delta. For every cell in 𝒟δ\mathcal{D}_{\leq\delta} with non-empty free space, we add one to the counter of the shorter of the two pieces. Figure 13 shows the pieces that contribute to the counter for u1u_{1} in red. We bound the maximal possible value of the counter of each piece as follows.

Refer to caption
Figure 13: Illustration of the situation of Proposition 6.2.

For a piece uu of γ1\gamma_{1}, consider the ball B(pm,(3/2)l(u)+δ)B(p_{m},(3/2)l(u)+\delta) of radius (3/2)l(u)+δ(3/2)l(u)+\delta centered at its midpoint pmp_{m}. By construction, the distance of every point of uu to the boundary of B(pm,(3/2)l(u)+δ)B(p_{m},(3/2)l(u)+\delta) is at least l(u)+δl(u)+\delta. Therefore, every piece of γ2\gamma_{2} that adds one to the counter of uu has an arc length of at least l(u)l(u) in B(pm,(3/2)l(u)+δ)B(p_{m},(3/2)l(u)+\delta). Since γ2\gamma_{2} is cc-packed and l(u)μl(u)\geq\mu, the number of times we add one to the counter of uu is bounded from above by

c\displaystyle c^{\prime} =l(γ2)B(pm,(3/2)l(u)+δ)l(u)crl(u)=c(3/2l(u)+δ)l(u)=32c+δcl(u)\displaystyle=\frac{l(\gamma_{2})\cap B(p_{m},(3/2)l(u)+\delta)}{l(u)}\leq\frac{cr}{l(u)}=\frac{c(3/2l(u)+\delta)}{l(u)}=\frac{3}{2}c+\frac{\delta c}{l(u)}
32c+δcμ=O(cϵ).\displaystyle\leq\frac{3}{2}c+\frac{\delta c}{\mu}=O\left(\frac{c}{\epsilon}\right).

Thus, there are at most O(cn/ϵ)O(cn/\epsilon) cells containing free space, concluding the proof of the proposition.

Theorem 6.4.

Let γ1\gamma_{1} and γ2\gamma_{2} be two cc-packed piecewise smooth curves and 0<ϵ<10<\epsilon<1. Then N(ϵ,γ1,γ2)=O(cn/ϵ)N(\epsilon,\gamma_{1},\gamma_{2})=O(cn/\epsilon).

Proof 6.5.

The simplification of a curve with parameter μ=δϵ\mu=\delta\epsilon consists of pieces with arc length at least μ\mu. By Lemma 5.5, the simplifications are moreover 7c7c-packed. The claim thus follows from Proposition 6.2.

We can now apply the solution to the decision problem from Proposition 2.7 to the decision problem for the simplified curves. Using this decision procedure in place of that for polygonal curves, the otherwise same algorithms (Lemmas 3.5 and 3.6) in [7] can be used in our context to obtain an approximate solution to the decision problem for piecewise smooth cc-packed curves that runs in O(N(ϵ,γ1,γ2))O(N(\epsilon,\gamma_{1},\gamma_{2})) time. We note that cc-packedness is used only in its role in guaranteeing that N(ϵ,γ1,γ2)=O(cn/ϵ)N(\epsilon,\gamma_{1},\gamma_{2})=O(cn/\epsilon) by Theorem 6.4.

Corollary 6.6.

Let γ1\gamma_{1} and γ2\gamma_{2} be two piecewise smooth algebraically bounded cc-packed curves, 1ϵ>01\geq\epsilon>0 and δ>0\delta>0. There is an algorithm that correctly outputs, in O(cn/ϵ)O(cn/\epsilon) time, one of the following:

  1. (i)

    a (1+ϵ)(1+\epsilon)-approximation to d(γ1,γ2)\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2}),

  2. (ii)

    d(γ1,γ2)<δ\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2})<\delta,

  3. (iii)

    d(γ1,γ2)>δ\mathrm{d}_{\mathcal{F}}(\gamma_{1},\gamma_{2})>\delta.

References

  • [1] Helmut Alt and Michael Godau. Computing the Fréchet distance between two polygonal curves. International Journal of Computational Geometry and Applications, 05(01n02):75–91, mar 1995. doi:10.1142/S0218195995000064.
  • [2] Michèle Audin and Mihai Damian. Morse Theory and Floer Homology. Universitext. Springer London, London, 2014. URL: http://link.springer.com/10.1007/978-1-4471-5496-9, doi:10.1007/978-1-4471-5496-9.
  • [3] Sean Michael Bates. Toward a Precise Smoothness Hypothesis in Sard’s Theorem. Proceedings of the American Mathematical Society, 117(1):279, 1993. doi:10.2307/2159728.
  • [4] Karl Bringmann. Why walking the dog takes time: Frechet distance has no strongly subquadratic algorithms unless SETH fails. In Proceedings - Annual IEEE Symposium on Foundations of Computer Science, FOCS, pages 661–670, 2014. arXiv:1404.1448, doi:10.1109/FOCS.2014.76.
  • [5] Erin W. Chambers, Éric Colin de Verdière, Jeff Erickson, Sylvain Lazard, Francis Lazarus, and Shripad Thite. Homotopic fréchet distance between curves or, walking your dog in the woods in polynomial time. Comput. Geom., 43(3):295–311, 2010. URL: https://doi.org/10.1016/j.comgeo.2009.02.008, doi:10.1016/J.COMGEO.2009.02.008.
  • [6] Richard Cole. Slowing down sorting networks to obtain faster sorting algorithms. Journal of the ACM, 34(1):200–208, jan 1987. doi:10.1145/7531.7537.
  • [7] Anne Driemel, Sariel Har-Peled, and Carola Wenk. Approximating the Fréchet distance for realistic curves in near linear time. Discrete and Computational Geometry, 48(1):94–127, 2012. arXiv:1003.0460, doi:10.1007/s00454-012-9402-z.
  • [8] Adele Ferone, Mikhail V. Korobkov, and Alba Roviello. On some universal Morse–Sard type theorems. Journal des Mathematiques Pures et Appliquees, 139:1–34, 2020. doi:10.1016/j.matpur.2020.05.002.
  • [9] Victor Guillemin and Alan Pollack. Differential Topology, volume 4. American Mathematical Society, Providence, Rhode Island, aug 2010. URL: http://www.ams.org/chel/370, doi:10.1090/chel/370.
  • [10] Robin Hartshorne. Algebraic Geometry, volume 52 of Graduate Texts in Mathematics. Springer New York, New York, NY, 1977. doi:10.1007/978-1-4757-3849-0.
  • [11] Nimrod Megiddo. Applying Parallel Computation Algorithms in the Design of Serial Algorithms. Journal of the ACM, 30(4):852–865, oct 1983. doi:10.1145/2157.322410.
  • [12] Louis Nirenberg. Topics in Nonlinear Functional Analysis, volume 6 of Courant Lecture Notes. American Mathematical Society, Providence, Rhode Island, apr 2001. doi:10.1090/cln/006.
  • [13] Günter Rote. Computing the Fréchet distance between piecewise smooth curves. Computational Geometry: Theory and Applications, 37(3 SPEC. ISS.):162–174, aug 2007. doi:10.1016/J.COMGEO.2005.01.004.
  • [14] Arthur Sard. The measure of the critical values of differentiable maps. Bulletin of the American Mathematical Society, 48(12):883–890, 1942. doi:10.1090/S0002-9904-1942-07811-6.
  • [15] René van Oostrum and Remco C. Veltkamp. Parametric search made practical. Comput. Geom., 28(2-3):75–88, 2004. URL: https://doi.org/10.1016/j.comgeo.2004.03.006, doi:10.1016/J.COMGEO.2004.03.006.