1 Introduction

Length is the simplest action describing motion of a particle in space-time, and its proper time-parametrized critical trajectories are geodesics. On the other hand, bending energies based on the squared first Frenet curvature and its high-dimensional counterpart, the mean curvature function, have been used since the seventeenth century to model the shape of different types of elastic materials both in physics and biophysics. In fact, extremals of the bending energy correspond to the classical elasticae as proposed by D. Bernoulli around 1740 and have been widely studied (see for instance, [11, 1518]). In \({\mathbb {R}}^{3}\), they can be used also to model a variety of physical objects as stiff rods, stiff polymers, vortices in fluids, superconductors, membranes and mechanical properties of DNA molecules (for more details see [8, 21] and the references therein). Moreover, geometrical models describing particle motion, that involve functionals depending on several Frenet–Serret curvatures associated with a worldline, have been considered recently (see, for example, [1, 3] and references therein).

In particular, work on functionals depending only on the first Frenet curvature, \(\kappa \), has demonstrated very clearly the natural division of the variational problem into two parts: In the first part, first integrals of the equations of motion, in terms of the extremal’s curvature and torsion and their derivatives, are obtained; then, in the second part, one tries to solve these equations and then integrate the Frenet–Serret equations to get the position vector of the minimizing trajectory. In general, however, this program cannot be totally accomplished, but there are some cases for which the problem can be solved to a large extent. One of these remarkable cases concerns the classical elastic or bending energy which we describe below.

Regular curves in Riemannian manifolds \(M^{n}\) which are critical points of the elastic energy \( \int _{\gamma }\kappa ^{2}\) (\(\kappa \) being the geodesic curvature of the curve \(\gamma \)) have been intensively investigated under various points of view. In particular, their possible shapes in \({\mathbb {R}}^2\) where discovered by L. Euler. There are no closed plane free elasticae. Using a Lagrange multiplier argument, extremals of the bending energy among curves with the same length can be considered as critical curves of \( \int _{\gamma }\kappa ^{2}+\lambda \), \(\lambda \in {\mathbb {R}}\). Only two types of closed extremals in \({\mathbb {R}}^2\) appear in this case: circles and Bernoulli’s eight figure. Moreover, closed extremals of \( \int _{\gamma }\kappa ^{2}\) in \({\mathbb {R}}^2\) among curves with same length and enclosed area have applications in material science [2, 22]. Closed classical elastic curves in \({\mathbb {R}}^3\) have been analyzed in [17].

On the other hand, curve optimization plays a major role in imaging and visual perception. Mostly, these optimal curve models rely on Euler’s elastica, but this approach has two important problems: First, there are many local minimizers which are not global, and, while local stationarity can be reasonably checked, global optimality is much more difficult to deal with; and second, the boundary value problem for elastica is very hard to solve analytically.

To overcome these problems, another approach based on Sub-Riemannian geodesics of the unit tangent bundle has been raised recently in image reconstruction, [9, 13] (see also Sect. 2). Once the unit tangent bundle has been taken as a natural space for examining curve completion, one may explore the use of additional completion principles defined on this bundle to study combinations of other image plane properties. Thus, for example, one could attempt to study not only geodesics in the tangent bundle, but also its curves of least elastic energy (i.e., the elastica) and their projections in the image plane. More generally, since in dimension three the geometry of a curve is determined by the arc-length and the two first Frenet–Serret curvatures (simply called curvature and torsion, respectively, in this paper), one might consider energies on the unit tangent bundle which include torsion, in addition to length and curvature, and analyze its implications on image plane properties [9]. In other words, we are led to study extremal curves of Lagrangians depending on the Frenet–Serret curvature in \({\mathbb {R}}^2\times {\mathbb {S}}^1\) and their plane projections.

A version of the Sub-Riemannian geodesic approach is explained in Sect. 2 and leads to the minimization of the energy \(\int _{\gamma } (\kappa ^2+a^2)^{\frac{1}{2}}\) in \({\mathbb {R}}^2\). Thus, in Sect. 3, we focus on the variational problem for the energy

$$\begin{aligned} {\mathcal {F}}_a(\gamma ) =\int _{\gamma }\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}\, \hbox {d}s, \end{aligned}$$
(1)

where \(a\in {\mathbb {R}}\), s is the arc-length parameter and \( \kappa (s) \) is the geodesic curvature of the curve \( \gamma (s)\), acting on suitable spaces of immersed curves in the Euclidean space.

If \(a=0\), then \( {\mathcal {F}}_a\) is nothing but the total curvature functional which has been associated with certain models of massless particles with rigidity [20]. From the mathematical point of view, this is a trivial variational problem in \({\mathbb {R}} ^2\) (for closed curves this is due to the classical Whitney and Grauestein’s result). Moreover, as a consequence of another classical result due to Fenchel, the minimum of the total curvature action over simple closed curves in the Euclidean 3-space is \(2\pi \), and it is reached precisely on convex plane curves. Also, it can be seen that arbitrary plane curves are the critical curves of the total curvature energy acting on clamped curves of \({\mathbb {R}}^3\), [4, 5]. As in the elasticae case, one may study extremals of the total curvature among curves of the same length and/or same total torsion. Again, by a Lagrange multiplier argument, these may be treated as critical curves for \( \int _{\gamma }(m+n\kappa +p\tau )\), \(m,n,p\in {\mathbb {R}}\) and \(\tau \) representing the torsion of \(\gamma \). These curves have been used as models for relativistic particles in pseudo-Riemannian ambient spaces, and if \(p=0\), they were proposed as a variational model to described protein chains in [14]. In this case, the family of extremals is formed by Lancret helices.

Therefore, here we concentrate on the case \(a\ne 0\) and we consider the variational problem associated with (1), for \(a\ne 0\), when acting on spaces of curves of the Euclidean m-space \({\mathbb {R}}^m\) satisfying suitable boundary conditions. As it has been said before, if \(a\ne 0\), planar extremals are relevant in image restoring. This connection is described in Sect. 2. In Sect. 3, we first compute the first variation formula and the natural boundary conditions are derived. These will imply that \(m\le 3\). Then, we express the Euler–Lagrange equation for (1) in invariant form and use the symmetries of the variational problem to obtain Euler–Lagrange equation’s first integrals. Symmetries are also used to show that extremal curves can be determined from the first Frenet curvature after two quadratures. Moreover, in \({\mathbb {R}}^2\), the curvature can be solved explicitly. This gives a way of computing extremal curves which is different to that offered in [9]. In connection with this, we wish to mention also the work [12] where the authors examine a modification of the Helfrich Hamiltonian of the form \(\int (1\, \)+\(\, b H^2)^{1/2}\, dA\), within the context of gel-phase lipid membranes analysis (H being the mean curvature of the membrane surface, \(b\in {\mathbb {R}}\)). The axisymmetric geometries they study are described by and elastic bending type energy \(\int (1 + b\,\kappa ^2)^{1/2}\, \hbox {d}s\) acting on the profile curve, which differs from the model studied here only in that the length is fixed, whereas here it is not. There, first integrals are obtained differently by using stress conservation along the axis, and then, the solution membranes can be obtained by two quadratures from the profile tangent angle. Also within Sect. 3, it is shown that neither closed extremals nor extremals with constant curvature (other that geodesics) may exist; however, we see that cylinders and surfaces of revolution in \({\mathbb {R}}^3\) with constant positive curvature are foliated by closed critical curves of (1) with constant curvature (parallels).

Thus, while the theoretical problem is solved in \({\mathbb {R}}^2\), applications to real situation in vision reconstruction presents technical difficulties. For more details see [9] and Sect. 4, where these problems are overcome by using different numerical approaches. In the last section, we introduce a numerical method which is based on a gradient descent method. The method has been implemented in the computational platform XEL-3.0 and, although a short description is given here, full details can be found in [7]. As we notice in Sect. 4, if Sub-Riemannian geodesics of the unit tangent bundle \({\mathbb {R}}^2\times {\mathbb {S}}^1\) are used as models, our findings are very close to those of [9]. However, one of the advantages of our method is that it can be adapted not only to the Sub-Riemannian geodesic problem, but also to numerically study extremal curves of Frenet–Serret curvatures’ dependent energies, defined on spaces of curves of the unit tangent bundle \({\mathbb {R}}^2\times {\mathbb {S}}^1\), and their projected planar trajectories. Here, the analysis is performed for the three actions, length, total squared curvature (elastic energy) and total squared torsion, by using the XEL-platform implemented in [7] under different constraints, although it can be extended to a combination of these three basic actions and to many other similar functionals.

We remark that elasticae in the unit tangent bundle \({\mathbb {R}}^2\times {\mathbb {S}}^1\) and implications in computer vision have been treated in [10]. But, the “elastic” energy used in [10] differs from the standard definition of the bending energy in a Riemannian manifold that we use here. Also, a part of our results has been announced without proof in [6].

2 Sub-Riemannian geodesics in \({\mathbb {R}}^2\times {\mathbb {S}}^1\)

Neurobiological research over the past few decades has greatly clarified the functional mechanisms of the first layer V1 of the visual cortex (primary visual cortex). Such layer contains a variety of types of cells, including the so-called simple cells. Researchers found that V1 constitutes of orientation selective cells at all orientations for all retinal positions, so simple cells are sensitive to orientation-specific brightness gradients (for details see [9, 13]).

Recently, this structure of the primary visual cortex has been modeled using Sub-Riemannian geometry, [19]. In particular, the unit tangent bundle of the plane can be used as an abstraction to study the organization and mechanisms of V1.

According to this model, in the space \({\mathbb {R}} ^2 \times {\mathbb {S}} ^1\), each point \((x, y, \theta )\) represents a column of cells associated with a point of retinal data \((x, y) \in {\mathbb {R}} ^2\), all of which are adjusted to the orientation given by the angle \(\theta \in {\mathbb {S}}^1\). In other words, the vector \((\cos \theta , \sin \theta )\) is the direction of maximal rate of change of brightness at point (xy) of the picture seen by the eye. Such vector can be seen as the normal to the boundary of the picture. Thus, when the cortex cells are stimulated by an image, the border of the image gives a curve inside the 3D space \({\mathbb {R}} ^2 \times {\mathbb {S}} ^1\), but such curves are restricted to be tangent to the distribution spanned by the vector fields

$$\begin{aligned} \mathbf {X}_1 = \cos \theta \, \frac{\partial }{\partial \mathbf {x}} + \sin \theta \,\frac{\partial }{ \partial \mathbf {y}}, \quad \mathbf {X}_2 = \frac{\partial }{\partial \mathbf {\theta }}. \end{aligned}$$
(2)

It is believed that if a piece of the contour of a picture is missing to the eye vision (or maybe it is covered by an object), then the brain tends to “complete” the curve by minimizing some kind of energy, being length the simplest (but not the only) of such. In short, there is some Sub-Riemannian structure on the space of visual cells and the brain considers a Sub-Riemannian geodesic between the endpoints of the missing data.

Let \(M^n\) be a smooth n-manifold. A sub-bundle of the tangent bundle \(TM^n\) is called distribution D on \(M^n\). Once we have chosen D, a D-curve on \(M^n\) is a smooth immersed curve \(\gamma : [a, b]\rightarrow M^n\) which is always tangent to D; that is, \(\mathbf {\gamma } ' (t) \in D_{\gamma (t)}\) for all \(t \in [a, b]\). A distribution D is said to be bracket-generating if for every \(p\in M^n\) the sections of D near p together with all their commutators span the tangent space of \(M^n\) at p, \(T_pM^n\). By a well-known theorem of Chow, there is a D-curve joining any two points of \(M^n\) if D is bracket generating (check [10] for the smooth version of this theorem). A Sub-Riemannian metric is a smoothly varying positive definite inner product \(\langle , \rangle \) on D. Thus, if D were equal to the whole tangent bundle, \(\langle , \rangle \) would give a Riemannian metric on \(M^n\). A Sub-Riemannian manifold, \((M^n,D, \langle , \rangle )\), is a smooth n-dimensional manifold \(M^n\) equipped with a Sub-Riemannian metric \(\langle , \rangle \) on a bracket generating distribution D of rank \(m> 0\). In this case, the length of a D-curve \(\gamma : [a, b]\rightarrow M\) is defined to be \(L(\gamma ) =\int ^b_a \langle \gamma ' (t),\gamma ' (t) \rangle ^{\frac{1}{2}}\, \hbox {d}t\). Since D is bracket-generating, it is possible to endow \(M^n\) with a distance d. The distance d(pq) between any two points p and q of \(M^n\) is defined by \(d(p, q) = inf_\gamma \{L(\gamma ) / \gamma \) \(\, \mathrm{is\, a}\, D-\mathrm{curve\, joining}\, p\, \mathrm{to}\, q\}.\)

To construct a Sub-Riemannian structure on \(M^3={\mathbb {R}}^2 \times {\mathbb {S}}^1\), we take the distribution \(D = ker(\sin \theta \, \hbox {d}x - \cos \theta \, \hbox {d}y)\), where x and y are the coordinates on \({\mathbb {R}}^2\) and \(\theta \) is the coordinate on \({\mathbb {S}}^1\). This distribution is spanned by the vector fields described in (2). Consider on D, the inner product \(\langle , \rangle \) for which the two vectors (2) are everywhere orthonormal. Every D-curve \(\gamma (t) = (x(t), y(t),\) \(\theta (t))\) with \(\gamma ^*(\cos \theta \, \hbox {d}x +\sin \theta \, \hbox {d}y)\ne 0\) is the lift of a regular curve \(\alpha (t) = (x(t), y(t))\) in the plane whose tangent vector \(\alpha ' (t)\) forms the angle \(\theta (t)\) with the x-axis, i.e.,

$$\begin{aligned} \alpha ' (t) = v(t)\, \cos \theta \, \frac{\partial }{\partial \mathbf {x}} + v(t)\, \sin \theta \,\frac{\partial }{\partial \mathbf {y}}, \end{aligned}$$
(3)

where v(t) is the speed of \(\alpha (t)\). Conversely, every regular curve \(\alpha (t)\) in the plane may be lifted to a D-curve \(\gamma (t) = (x(t), y(t), \theta (t))\) by setting \(\theta (t)\) equal to the angle between \(\alpha '(t)\) and the x-axis. Now, the tangent vector \(\gamma '(t)\) of the D-curve \(\gamma (t) \) has squared length

$$\begin{aligned} \langle \gamma ' (t), \gamma ' (t)\rangle= & {} v^2(t)+\theta '^2(t) \nonumber \\= & {} v^2(t)\left( 1+\left( \frac{\theta '(t)}{v(t)}\right) ^2\right) \nonumber \\= & {} v^2(t)(1+\kappa ^2(t)), \end{aligned}$$
(4)

where \(\kappa (t)\) is the curvature of \(\alpha \), and so the length of \(\gamma (t)\) is equal to the integral of \(\sqrt{1+\kappa ^2(t)}v(t)\) along \(\alpha \). Thus, the D-curves with \(\gamma ^*(\cos \theta \, \hbox {d}x +\sin \theta \, \hbox {d}y) \ne 0\) that realize the distance between two points \((x_0, y_0, \theta _0)\) and \((x_1, y_1, \theta _1)\) of \(M^3\) are the lifts of curves \(\alpha \) in the plane joining \((x_0, y_0)\) to \((x_1, y_1)\) with initial angle \(\theta _0\) and final angle \(\theta _1\) that minimize the functional

$$\begin{aligned} \mathcal {F}(\alpha ) =\int \left( 1+\kappa ^2(s)\right) ^{\frac{1}{2}}\, \hbox {d}s, \end{aligned}$$
(5)

s being the arc-length parameter, among all such curves in the plane. In other words, geodesics in V1 are obtained by lifting to \(M^3={\mathbb {R}}^2 \times {\mathbb {S}}^1\) minimizers of (5) in \({\mathbb {R}}^2\).

Finally, as indicated in [9], the hypercolumnar organization of the visual cortex suggests that the cost of moving one orientation unit is not necessarily the same as to moving spacial units, then the curve completion problem should consider the functional \({\mathcal {F}}_a\) acting on planar curves instead. This motivates considering critical curves of \({\mathcal {F}}_a\) not only in the plane, but also in more general backgrounds.

3 Extremals in Euclidean space \({\mathbb {R}}^m\)

For finite m, consider \({\mathbb {R}}^m\) the m-dimensional Euclidean space with standard metric \(\langle ~,~\rangle \). Let \(\gamma (t)\), \(\gamma : [0,1]\rightarrow {\mathbb {R}}^m\) be a \(C^\infty \) immersed curve and denote by \(\gamma (s)\) its unit speed reparametrization; that is, it satisfies \(\langle \gamma '(s),\gamma '(s)\rangle \) \(\equiv 1\), where now \('\) denotes derivative with respect to the arc-length parameter \(s\in [s_0,s_1]\). If the successive covariant derivatives of the speed vector

$$\begin{aligned} \gamma '(s),~\gamma ''(s),~ \gamma ^{(3)}(s), \ldots ,\gamma ^{(n-1)}(s), \end{aligned}$$

are everywhere linearly independent, for \(1\le n\le m\), then we set \(\mathbf {e}_0:=\gamma '(s)\) and define the unit normal field \(\mathbf {e}_1\) to be the unit vector field along \(\gamma \) in the direction of \(\gamma ''(s)\). The first Frenet curvature is defined by

$$\begin{aligned} \kappa _1(s):=~\langle \mathbf {e}'_0(s),\mathbf {e}_1(s)\rangle . \end{aligned}$$

Unit normal vector fields \(\mathbf {e}_j\) (Frenet frame on \(\gamma \)) and Frenet curvatures \(\kappa _j\), for \(j=2,\ldots \), \(n-1\), are given inductively by Gramm–Schmidt orthogonalization, as follows. Let \(\hat{\mathbf {e}}_j(s)\) be the orthogonal projection of \( \mathbf {e}'_{j-1}\) onto the orthogonal complement of \(\{\mathbf {e}_0(s),\mathbf {e}_1(s),\) \(\mathbf {e}_2(s),\) \(\ldots ,\mathbf {e}_{j-1}(s)\}\). Set

$$\begin{aligned} \mathbf {e}_j(s)~:=~\frac{\hat{\mathbf {e}}_j(s)}{\Vert \hat{\mathbf {e}}_j(s)\Vert }, \end{aligned}$$

and \(\kappa _j(s):=\langle \mathbf {e}'_{j-1}(s),\mathbf {e}_j(s)\rangle \). Then, \(\kappa _j\) is never zero, and the Frenet–Serret formulae read as

$$\begin{aligned} \mathbf {e}'_{j-1}(s)= & {} \kappa _j(s)\mathbf {e}_j(s)-\kappa _{j-1}(s)\mathbf {e}_{j-2}(s), \nonumber \\ \mathbf {e}'_{n-1}(s)= & {} -\kappa _{n-1}(s)\mathbf {e}_{n-2}(s). \end{aligned}$$
(6)

We call rank of \(\gamma \) the maximum integer j for which the functions \(\kappa _j(s)\not = 0\) for some \(s\in [s_0,s_1]\), namely \(\mathrm{rank}(\gamma )=n-1\) where n is the maximum integer for which \(\gamma '(s),~\gamma ''(s),~ \gamma ^{(3)}(s),\ldots ,\gamma ^{(n-1)}(s), \) are linearly independent. So \(0\le \mathrm{rank}(\gamma )\le m-1\) and \(\gamma \) is a geodesic if and only if \(\mathrm{rank}(\gamma )=0\). When \(\gamma \) has constant curvatures \(\kappa _{l}\) for \(1\le l\le \mathrm{rank}(\gamma )\), it is called a helix of rank l.

Curves in \({\mathbb {R}}^m \) of any rank are determined by their curvatures up to isometries, and if the rank of \(\gamma \) is \(n-1\), with \(2\le n < m\), then \(\gamma \) is contained into an n-dimensional Euclidean subspace, \({\mathbb {R}}^n\), of \({\mathbb {R}}^m\).

Along this section, we will often resort to techniques inspired by arguments in [16] and [17]. Let us first consider the space \(\varOmega \) of immersed curves \(\gamma (t)\) in \({\mathbb {R}}^m \) with fixed endpoints \(p,q\in {\mathbb {R}}^m\): \( \varOmega = \{\gamma :[0,1] \rightarrow {\mathbb {R}}^m;\) \(\gamma \; \text {is a} \; C^\infty \text {-immersion}; \, \gamma (0)=p; \gamma (1)=q\} \). Let us define the following energy functional \({\mathcal {F}}_a :\varOmega \rightarrow {\mathbb {R}} \)

$$\begin{aligned} {\mathcal {F}}_a (\gamma )=\int _{\gamma }\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}\, \hbox {d}s, \end{aligned}$$
(7)

where \(a\in {\mathbb {R}}\), s is the arc-length parameter, and \( \kappa (s)\equiv \kappa _1 (s) \) is the first Frenet curvature of \(\gamma (s)\). Observe that geodesics (curves of rank 0) are minima of \({\mathcal {F}}_a \).

For a given \( \gamma \in \varOmega \), we consider a \(C^\infty \) variation by curves in \(\varOmega \); that is, a \(C^\infty \) function \(\varGamma :(-\epsilon ,\epsilon ) \times [0,1] \rightarrow {\mathbb {R}}^m\) such that \(\varGamma (0,t)=\gamma (t)\) and \(\varGamma (z,t)=\gamma _z(t) \in \varOmega \). We say that \( \gamma (t)\) is a critical curve or, simply, an extremal of \({\mathcal {F}}_a\) in \(\varOmega \), if \(\frac{\hbox {d} {\mathcal {F}}_a}{ \hbox {d}z }(0) =0\), for any variation of \(\gamma \). By using standard arguments, one can compute the first variation formula of \({\mathcal {F}}_a\)

$$\begin{aligned} \frac{ \hbox {d} {\mathcal {F}}_a}{ \hbox {d} z }(0) = \int _{\gamma } \langle \mathbf {\mathcal { E}}(\gamma ),\mathbf {W }\rangle \, \hbox {d}s + \mathcal {B}[\gamma ,W], \end{aligned}$$
(8)

where \(\mathbf {W }= \frac{\partial \, \varGamma }{\partial \, z}(0,t)\) is the variation field of \(\varGamma \) and \({\mathcal {E}}(\gamma )\) and \({\mathcal {B}}[\gamma ,\mathbf {W}]\) are the Euler–Lagrange and boundary operators, respectively. After a long computation, we obtain that the Euler–Lagrange operator is given by

$$\begin{aligned} \begin{aligned} {{\mathcal {E}}}(\gamma )&= \frac{1}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}{\mathbf {T}}^{(3)}+ 2\frac{\hbox {d}}{\hbox {d}s}\left( \frac{1}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) {\mathbf {T}}'' \\&\quad + \left( \frac{\hbox {d}^2}{\hbox {d}s^2}\left( \frac{1}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) + \frac{\kappa ^{2}-a^2}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}} \right) \mathbf {T}' \\&\quad + \frac{\hbox {d}}{\hbox {d}s}\left( \frac{\kappa ^{2}-a^2}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) \mathbf {T}, \end{aligned} \end{aligned}$$
(9)

\(\mathbf {T}=\mathbf {e}_0(s)=\frac{\hbox {d}\gamma }{\hbox {d}s}\) being the unit tangent vector to the arc-length reparametrization of \(\gamma \) (we may assume that \(s\in [0,1]\) is the arc-length parameter of \(\gamma \)), while the boundary operator \({\mathcal {B}}\) is given by

$$\begin{aligned} {\mathcal {B}}[\gamma ,\mathbf {W}] = \langle \mathbf { W}',\mathfrak {K}\rangle |_0^1 - \langle \mathbf {W}, \mathfrak {J} \rangle |_0^1, \end{aligned}$$
(10)

where we have set

$$\begin{aligned} \mathfrak {K} = \frac{1}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}} \mathbf {T}', \quad \mathfrak {J}= \mathfrak {K}'+\frac{\left( \kappa ^{2}-a^2\right) }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\mathbf { T }\,. \end{aligned}$$
(11)

If one additionally assumes that a curve \(\gamma \in \varOmega \) satisfies suitable first-order boundary conditions, for instance, setting the velocities at the endpoints to be fix \(v_1,v_2\in {\mathbb {R}}^3\), that is, \(\gamma \in \varOmega _{v_1,v_2}\), where \(\varOmega _{v_1,v_2}:=\{ \gamma \in \varOmega ; \,\gamma '(0)=v_1, \, \gamma '(1)=v_2\}\), then \(\gamma \) is a critical curve of \({\mathcal {F}}_a\), if and only if,

$$\begin{aligned} {{\mathcal {E}}}(\gamma ) = 0, \end{aligned}$$
(12)

since, in this case, (10) vanishes identically. In particular, from (8), straight segments are always extremals of \({\mathcal {F}}_a\) for suitable boundary conditions on \(\varOmega \).

Since geodesics are always critical for \({\mathcal {F}}_a\) (for suitable boundary conditions), in the following, we may assume, in addition, that \(\gamma \in \varOmega \) is a non-geodesic curve, namely that it is a curve of rank at least 1. Now, if \(\gamma \) is an extremal of \({\mathcal {F}}_a\), then \({{\mathcal {E}}}(\gamma )=0\), and then, if \(\mathrm{rank}(\gamma )=n\) and \(n>3\), one can combine (9) and Frenet formulae (6) to obtain a contradiction. Thus, we must have \(n\le 3\) and \(\gamma \) must lie in \({\mathbb {R}}^3\). In this case, we use the standard notation for the Frenet frame \(\{ \mathbf {e}_0(s)\equiv \mathbf {T}(s),\, \mathbf {e}_1(s)\equiv \mathbf {N}(s),\, \mathbf {e}_2(s)\equiv \mathbf {B}(s)\}\) (which will be referred to as unit tangent, unit normal and binormal vectors, respectively) and Frenet curvatures \(\{\kappa \equiv \kappa _1,\tau \equiv \kappa _2\}\) (which will be referred to as curvature and torsion, respectively). Using the Frenet formulas (6) and the linear independence of the Frenet frame, the Euler–Lagrange equations (9) reduce, after some straightforward computations, to

$$\begin{aligned}&\frac{\hbox {d}^2}{\hbox {d}s^2}\left( \frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) \nonumber \\&\quad +\frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\left( \kappa ^{2}-\tau ^2\right) - \kappa \left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}} = 0,\qquad \nonumber \\ \end{aligned}$$
(13)
$$\begin{aligned}&\frac{\hbox {d}}{\hbox {d}s}\left( \frac{\kappa ^2}{\left( \kappa ^{2}+a^2\right) }\tau \right) = 0 . \end{aligned}$$
(14)

Case \(a=0\) corresponds to the total curvature functional. In this case, if \(\gamma \in \varOmega \) is critical, then (13) and (14) imply that the torsion \(\tau =0\), and therefore, \(\gamma \) is a planar curve. Then,

$$\begin{aligned} \int _\gamma \kappa = \theta (1)-\theta (0)+ 2 \pi m, \end{aligned}$$
(15)

where \(\theta (i)\in [0,2\pi ), i=1,2,\) denotes the angle that \(v_i, i=1,2,\) makes with the line determined by p and q, and \(m\in {\mathbb {Z}}\) is integer, the number (taking orientation into account) of loops that the trace of \(\gamma \) has between p and q. Since (15) is constant within any homotopy class of \(\varOmega _{v_1,v_2}\), we see that the corresponding variational problem is trivial; that is, any \(\gamma \in \varOmega _{v_1,v_2}\) is critical for \({\mathcal {F}}_a \) when \(a=0\).

So we assume \(a\ne 0 \). Notice that above equations (13) and (14) imply that there are no helices (nor even Lancret helices) critical for \({\mathcal {F}}_a\). On the other hand, if \(\gamma \in \varOmega \) is critical for \({\mathcal {F}}_a\) under arbitrary boundary conditions, then standard arguments imply that it satisfies \({{\mathcal {E}}}(\gamma )=0\), and then, the first variation formula (8) gives

$$\begin{aligned} \delta {\mathcal {F}}_a(\gamma ,\mathbf {W})={\mathcal {B}}[\gamma ,\mathbf {W}] = \langle \mathbf { W}',\mathfrak {K}\rangle |_0^1 - \langle \mathbf {W}, \mathfrak {J} \rangle |_0^1 \end{aligned}$$
(16)

where \(\mathfrak {K}\) and \(\mathfrak {J}\) are obtained combining (11) and the Frenet equations

$$\begin{aligned} \mathfrak {K}= & {} \frac{1}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}} \kappa \mathbf {N},\end{aligned}$$
(17)
$$\begin{aligned} \mathfrak {J}= & {} \frac{-a^2}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\mathbf { T }+\frac{a^2\kappa '}{\left( \kappa ^{2}+a^2\right) ^{\frac{3}{2}}}\mathbf { N }\nonumber \\&+ \frac{\kappa \tau }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\, \mathbf {B}.\qquad \end{aligned}$$
(18)

Now, (16), (17) and (18) allow us to use Noether’s argument to relate symmetries of \({\mathcal {F}}_a\) to constants of motion along \(\gamma \).

For translational symmetries, we take \(\mathbf{W}\), its infinitesimal generator, to be a constant vector field. Hence, for any variation in the direction of \(\mathbf{W}\), \(\delta {\mathcal {F}}_a(\gamma ,\mathbf {W})=0\) and (16) gives \(\langle \mathbf {W}, \mathfrak {J} \rangle |_0^1=0\). Since \(\langle \mathbf {W}, \mathfrak {J} \rangle |_0^s=0\) holds also for any \(s\in [0,1]\) and \(\mathbf{W}\) is an arbitrary constant vector field, we conclude that \(\mathfrak {J}\) is a constant vector field along \(\gamma \). Thus, (18) gives

$$\begin{aligned}&\left( \frac{\hbox {d}\kappa }{\hbox {d}s}\right) ^2=\left( \frac{a^2+\kappa ^2}{a^2}\right) ^2 \nonumber \\&\quad \times \left( \kappa ^2\left( d-\tau ^2\right) +a^2\left( d-a^2\right) \right) , \end{aligned}$$
(19)

where d is a constant.

For rotational symmetries we use again \(\mathbf{W}\) to denote its infinitesimal generator. Any rotational vector field can be written as \(\mathbf{W}=x\times \mathbf{V}\), where x is the position vector and \(\mathbf{V}\) is a constant vector field. Again, for any variation in the direction of \(\mathbf{W}\), \(\delta {\mathcal {F}}_a(\gamma ,\mathbf {W})=0\) and (16) give \(\langle \mathbf { W}',\mathfrak {K}\rangle |_0^1 - \langle \mathbf {W}, \mathfrak {J} \rangle |_0^1=0\), which, by the same argument as before, holds also for any \(s\in [0,1]\). Hence, using (17) and (18), we obtain after some manipulations that the vector field

$$\begin{aligned} \gamma \times \mathfrak {J}-\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf {B} \end{aligned}$$
(20)

is constant along \(\gamma \). Therefore, there exists a constant vector field \(\mathbf{V}_o\) such that

$$\begin{aligned} \frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf { B}= \gamma \times \mathfrak {J}+ \mathbf{V}_o \end{aligned}$$
(21)

along \(\gamma \). Thus, the vector field \(\mathfrak {H}:=\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf { B}\) is the restriction of a Killing field of \({\mathbb {R}}^3\) to \(\gamma \). Translating the origin of \({\mathbb {R}}^3\) if needed, we may assume that \(\mathbf{V}_o=\eta \,\mathfrak {J}\) for some constant \(\eta \in {\mathbb {R}}\), and therefore,

$$\begin{aligned} \mathfrak {H}=\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf { B}= \gamma \times \mathfrak {J}+ \eta \, \mathfrak {J} \end{aligned}$$
(22)

is the restriction to \(\gamma \) of a helicoidal Killing vector field of \({\mathbb {R}}^3\).

Now, let us call \(\mathbf{W}\) the extension of \(\mathfrak {H}\) to \({\mathbb {R}}^3\). We may apply again Noether’s argument in combination with equations (17) and (18) to obtain

$$\begin{aligned} \tau = e\left( \frac{\kappa ^2+a^2}{\kappa ^2}\right) , \end{aligned}$$
(23)

with \(e\in {\mathbb {R}}\), and we may conclude from (19) and (23) that

$$\begin{aligned}&\left( \frac{\hbox {d}\kappa }{\hbox {d}s}\right) ^2=\left( \frac{a^2+\kappa ^2}{a^2\kappa }\right) ^2\end{aligned}$$
(24)
$$\begin{aligned}&\quad \times \left( \left( \kappa ^2+a^2\right) ({d}\kappa ^2-e^2(\kappa ^2+a^2))- \kappa ^2\, a^4\right) , \nonumber \\&\tau = e\left( \frac{\kappa ^2+a^2}{\kappa ^2}\right) , \end{aligned}$$
(25)

\(d,e\in {\mathbb {R}}\), are first integrals of the Euler–Lagrange equations (13) and (14).

On the other hand, as we have shown before, we know that if \(\gamma \in \varOmega \) is critical for \({\mathcal {F}}_a\), then

$$\begin{aligned} \mathfrak {H}=\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf { B}\, \end{aligned}$$
(26)

is the restriction of a Killing vector field of \({\mathbb {R}}^3\) to \(\gamma \). Actually, this fact characterizes critical curves for \({\mathcal {F}}_a\) (up to a penalty on the length). In fact, assume that \(\mathfrak {H}=\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf { B}\) is the restriction of a Killing field to a curve \(\gamma \). The following variational formulas for the three fundamental geometric curve invariants, speed, \(v(u)=|\alpha '(u)|\), curvature \(\kappa (u)\) and torsion \(\tau (u)\), were computed in [17]

$$\begin{aligned} \mathbf{W}(v)= & {} \langle \mathbf{W}',\mathbf{T}\rangle \,v, \end{aligned}$$
(27)
$$\begin{aligned} \mathbf{W}(\kappa )= & {} \langle \mathbf{W}'',\mathbf{N}\rangle -2\langle \mathbf{W}',\mathbf{T}\rangle \,\kappa , \end{aligned}$$
(28)
$$\begin{aligned} \mathbf{W}(\tau )= & {} \left( \frac{1}{\kappa }\langle \mathbf{W}'',\mathbf{B}\rangle \right) '+\langle \mathbf{W}', \kappa \mathbf{B}-\tau \mathbf{T} \rangle , \end{aligned}$$
(29)

for any variation of \(\gamma \) with variation field \(\mathbf{W}\). Now, if \(\mathbf{W}\) happens to be the restriction of a Killing field, then \(v(u), \kappa (u)\) and \(\tau (u)\) are constant along the curves of the variation and then

$$\begin{aligned} \mathbf{W}(v)=\mathbf{W}(\kappa )=\mathbf{W}(\tau )=0. \end{aligned}$$
(30)

Thus, if \(\mathfrak {H}=\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf { B}\) is the restriction to \(\gamma \) of a Killing field, we could apply previous formulae (27), (28), (29) and (30) to \(\mathbf{W}\). We see first that \(\mathbf{W}(v)=0\) impose no condition on \(\gamma \), since (27) is trivial. On the other hand, \(\mathbf{W}(\kappa ) =0\) and (28) imply

$$\begin{aligned} \frac{\hbox {d}}{\hbox {d}s}\left( \frac{\kappa ^2}{\left( \kappa ^{2}+a^2\right) }\tau \right) = 0 \end{aligned}$$
(31)

along \(\gamma \). Finally, after some manipulations, one can see that \(W(\tau ) =0\) and (29) give

$$\begin{aligned}&\frac{\hbox {d}^2}{\hbox {d}s^2}\left( \frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) \nonumber \\&\quad +\frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\left( \kappa ^{2}-\tau ^2\right) -\kappa \left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}} = \mu \kappa ,\nonumber \\ \end{aligned}$$
(32)

for some \(\mu \in {\mathbb {R}}\). Comparing (31) and (32) with (13) and (14), it is not difficult to see that then, \(\gamma \) satisfies the Euler–Lagrange equations for \({\mathcal {F}}_a +\mu \int _\gamma \hbox {d}s\), i.e., \(\gamma \) would be critical (under certain boundary conditions) of \({\mathcal {F}}_a \) for variations with constant length.

In consequence, we see that congruence solutions, \(\gamma (s,t)\), of the following geometric evolution equation (geometric binormal flow solutions)

$$\begin{aligned} \frac{\partial \gamma }{\partial t}(s,t)=\frac{\kappa }{\left( \kappa ^2+a^2\right) ^\frac{1}{2}}\, \mathbf {B}(s,t)\, \end{aligned}$$
(33)

are, precisely, the critical curves of \({\mathcal {F}}_a \).

Moreover, by using the symmetries of \({\mathcal {F}}_a \), also the coordinates of a critical curve \(\gamma \) can be obtained by quadratures. In fact, \(\gamma \) being critical means that

$$\begin{aligned} \mathfrak {J}= & {} \mathbf{V}_o, \end{aligned}$$
(34)
$$\begin{aligned} \mathfrak {H}= & {} \gamma \times \mathfrak {J}+ \eta \, \mathfrak {J}\, \end{aligned}$$
(35)

are Killing fields, where \(\mathbf{V}_0\) is constant and \(\mathfrak {H}\) comes from a one parameter group of helicoidal motions. Then, choosing \(\partial z\) as the axis of the helicoidal motion, introducing cylindrical coordinates \(r,\theta , z\), and taking into account the first integrals of the Euler–Lagrange equations given before, (24) and (25), we get

$$\begin{aligned} \mathfrak {J}= & {} \sqrt{d} \, \partial _z, \end{aligned}$$
(36)
$$\begin{aligned} \mathfrak {H}= & {} \gamma \times \mathfrak {J}+\frac{e}{d}\, \mathfrak {J}\, =\, e/\sqrt{d} \partial _{z}-\sqrt{d}\partial _{\theta }, \end{aligned}$$
(37)

where \(e,d\in {\mathbb {R}} \) are the constants appearing in (24) and (25). Since \(\mid \partial _\theta \mid ^2=r^2(s)\), then (26) and (37) give

$$\begin{aligned} r^2(s)=\frac{\kappa ^2}{d(\kappa ^2+a^2)}-\frac{e^2}{d^2}. \end{aligned}$$
(38)

Moreover, \(\mathbf{T}(s)=r'\partial _r+\theta ' \partial _\theta + z' \partial _z \) so (18) and (36) imply

$$\begin{aligned} z'(s)=\frac{-a^2}{\left( \hbox {d}(\kappa ^2+a^2)\right) ^\frac{1}{2}}. \end{aligned}$$
(39)

Finally, combining \(\langle \mathbf{T}, \mathfrak {H}\rangle =0\) and (37), we obtain

$$\begin{aligned} \theta '(s)=\frac{e}{d}\frac{z'}{r^2}. \end{aligned}$$
(40)

Therefore, from (38), (39) and (40), we see that once the curvature of the critical curve is known (for which we need to solve (24)), the coordinates can be obtained by quadratures. Notice also that (39) implies that z(s) is monotonic; thus, there are no periodic solutions of the Euler–Lagrange equations (13) and (14), so that we cannot have closed critical curves.

Extremals in \({\mathbb {R}}^2\) are totally determined by their curvature, \(\kappa ,\) which, in our case, can be obtained explicitly. In fact, making \(\tau =0\) in the Euler–Lagrange equation (13), we get

$$\begin{aligned} \frac{\hbox {d}^2}{\hbox {d}s^2}\left( \frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) - \frac{a^2\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}} =0, \end{aligned}$$

from which we have

$$\begin{aligned} \frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}(s) = c_1 \mathrm{e}^{a\, s}+c_2 \mathrm{e}^{-a\, s}, \end{aligned}$$

for some integration constants \(c_1,c_2\). Then, solving for \(\kappa \), one obtains

$$\begin{aligned} \kappa (s)=\frac{a (c_1 \mathrm{e}^{a\, s}+c_2 \mathrm{e}^{-a\, s})}{\left( 1-\left( c_1 \mathrm{e}^{a\, s}+c_2 \mathrm{e}^{-a\, s}\right) ^2\right) ^{\frac{1}{2}}}. \end{aligned}$$
(41)

From this equation, we see that there is at most one point where the curvature may change sign, so the curvature is always positive (or negative) except for at most one inflection point. Moreover, \(\kappa ' (s)\) has at most one zero (a vertex); hence, either the curvature is monotonic, or it monotonically decreases up to reaching the vertex where it starts to monotonically increase (or vice versa). This means that planar critical curves are a family of spirals in the plane.

This is a case relevant in image restoration as we mentioned at the beginning and a parametrization of extremal curves, using as parameter, \(\theta \), the angle which the curve makes with a fixed line was given in [9], under the assumption that the curves have no inflection points. But, as we have just noticed, these extremals have at most one vertex; hence, the argument of [9] applies and an explicit parametrization of extremals for this variational problem can be obtained in terms of elliptic integrals of the first and second kind. Alternatively, one may use our previous computations to get different parametrizations of extremals, at least, by quadratures. In fact, as it is very well known, a parametrization in terms of the curvature and arc-length parameter of a planar curve is given by \(\left( \int \cos \int \kappa ,\right. \) \(\left. \int \sin \int \kappa \right) \); then, using (41), we can also get a parametrization of the \({\mathcal {F}}_a\)-extremals in \({\mathbb {R}}^2\) in terms of the arc-length parameter after two quadratures. Observe that another parametrization can also been explicitly obtained from (38), (39) in terms of Elliptic functions.

However, for any possible choice of a parametrization method, a specific determination of the solution curves implies that the integration constants must be determined. This can be tried by imposing the solutions to satisfy the given boundary conditions, but this requires, at the best, solving a highly nonlinear system for which an explicit parameters expression seems unlikely. Hence, a numerical approach seems to be a reasonable strategy. Our numerical treatment will be developed in next section.

To finish this section, recall that we have discovered that there are neither critical curves with constant curvature, nor closed critical curves of \({\mathcal {F}}_a\) in \({\mathbb {R}}^2\). This fact does not hold in other surfaces of \({\mathbb {R}}^3\). Actually, there are surfaces containing curves being both types of extremals at the same time. In fact, consider \({\mathcal {F}}_a(\gamma )=\int _{\gamma }\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}\, \hbox {d}s\) acting on a space of curves of a surface \(S\subset {\mathbb {R}}^3\), where \(\kappa \) denotes the geodesic curvature of a curve in the surface. Then, with a little extra effort, it can be seen that a closed curve in a surface, S, is an extremal for \({\mathcal {F}}_a \), if and only if, satisfies

$$\begin{aligned} \frac{\hbox {d}^2}{\hbox {d}s^2}\left( \frac{\kappa }{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}}\right) + \frac{\kappa (K_{S}-a^2)}{\left( \kappa ^{2}+a^2\right) ^{\frac{1}{2}}} =0 , \end{aligned}$$
(42)

where \(K_{S } \) represents the Gaussian curvature of S. Now, if S happens to be a surface of revolution, \(S_{\alpha }\), with profile curve \(\alpha (t)=(f(t),h(t)), \, t\in (-\varepsilon ,\varepsilon )\), then, since the geodesic curvature is constant on parallels, we can use (42) to see that all of parallels of a surface of revolution are extremals for \({\mathcal {F}}_a\), if and only if,

$$\begin{aligned} \kappa (t)(K_{S_{\alpha }}-a^2)(t)=0, t\in (-\varepsilon ,\varepsilon ). \end{aligned}$$
(43)

Then, either all parallels are geodesics and, therefore, our surface is a cylinder, or else the Gaussian curvature is a positive constant on \(K_{S_{\gamma }}=a^2\). In other words, rotation surfaces of \({\mathbb {R}}^3\) with constant Gaussian curvature \(a^2\) are foliated by closed extremals of \({\mathcal {F}}_a\). This fact can be extended to equivariant surfaces of a real space form \(M^3(c)\), [6].

4 Numerical approach

In [7], we have developed a gradient descent-based method (which we call XEL-platform) to localize minima of an ample family of functionals defined on certain spaces of curves satisfying both affine and isoperimetric constraints. We first describe the formalism which serves as base for the numerical treatment.

4.1 Lagrangians and metrics

More concretely, let \(H_0(I,{\mathbb {R}}^m)=L^2(I,{\mathbb {R}}^m)\) be the set of square integrable functions from I to \({\mathbb {R}}^m\), where I is an interval [ab]. Let \(H_1(I,{\mathbb {R}}^m)\) denote the set of absolutely continuous maps \(x: I\rightarrow {\mathbb {R}}^m\) such that \(x^{(1)}\in H_0(I,{\mathbb {R}}^m)\), where \(x^{(1)}\) stands for the first derivative of the function. Finally, denote by \(H_n(I,{\mathbb {R}}^m)\) the set of maps \(x: I\rightarrow {\mathbb {R}}^m\) such that \(x^{(k)}\in H_1(I,{\mathbb {R}}^m)\), \(k\in \{0,\ldots ,n-1\}\), where \(x^{(k)}\) denotes the kth derivative of x. Then, \(H_n(I,{\mathbb {R}}^m)\) is a Hilbert space with the following family of inner products [7]

$$\begin{aligned} \langle x(t),y(t)\rangle _{n,a,b}:= & {} \sum _{k=0}^{n-1}\eta _a^k\langle x^{(k)}(a),y^{(k)}(a)\rangle \nonumber \\&+ \sum _{k=0}^{n-1}\eta _b^k\langle x^{(k)}(b),y^{(k)}(b)\rangle \nonumber \\&+ \int _a^b\langle x^{(n)}(t),y^{(n)}(t)\rangle \hbox {d}t, \end{aligned}$$
(44)

where \(\langle ,\rangle \) is the standard inner product in \({\mathbb {R}}^m\) and \(\eta _a^k,\eta _b^k\in {\mathbb {R}}\). To simplify the notation, from now on, the above inner product (44) and the space \(H_{n}(I,{\mathbb {R}}^{m})\) will be denoted simply by \(\langle ,\rangle _n \) and \(X^n=H_{n}(I,{\mathbb {R}}^{m})\), respectively.

We want to analyze the variational problem associated with a certain family of energy functionals \({\mathcal {F}}:X^n\rightarrow {\mathbb {R}}\) defined on \(X^n\) or on suitable subspaces of curves in \(X^n\). We consider functionals of the form

$$\begin{aligned} {\mathcal {F}}\left( x\right)= & {} \int _{a}^{b}f\left( t,\ldots ,x_{i},\ldots , x_{i}^{\left( 1\right) },\ldots ,x_{i}^{\left( n\right) },\dots \right) \hbox {d}t\nonumber \\&+A\left( a,\ldots ,x_{i}\left( a\right) ,\ldots ,x_{i}^{\left( n-1\right) }\left( a\right) ,\dots \right) \nonumber \\&+B\left( b,\ldots ,x_{i}\left( b\right) ,\ldots ,x_{i}^{\left( n-1\right) }\left( b\right) ,\dots \right) , \nonumber \\ \end{aligned}$$
(45)

where \(x=(x_j(t))\in X^n\), \(j=1,\ldots ,m\) and \(f:W\subset {\mathbb {R}}^{m(n+1)+1}\rightarrow {\mathbb {R}}\) \(A,B:\widetilde{W}\subset {\mathbb {R}}^{mn+1}\rightarrow {\mathbb {R}}\) are continuously differentiable functions defined on a sufficiently large domains W, \(\widetilde{W}\). We also assume that fAB satisfy suitable additional conditions which guarantee the Fréchet differentiability of \({\mathcal {F}}\) and the (local) convergence of the gradient steepest descent method.

As usual, one may consider \({\mathcal {F}}\) acting on subspaces of functions \(x=(x_{1},\ldots ,x_{m})\in X^n\) satisfying along with their derivatives \(x^{\left( i\right) }=(x_{1}^{\left( i\right) },\ldots ,x_{m}^{\left( i\right) })\) given boundary conditions at the endpoints of the interval (they will be referred to as affine constraints). For instance, for a given \(i\in \{0,1,\ldots \), \(n-1\}\), fix \(p^{i}=\left( p_{1}^{i},\ldots ,p_{m}^{i}\right) \) and \(q^{i}=\left( q_{1}^{i},\ldots ,q_{m}^{i}\right) \), points in \({\mathbb {R}}^{m}\). Then, for any arbitrary choice of a finite number of indexes \(i\in \{0,1,\ldots ,n-1\}\) and \(j\in \{1,2,\ldots ,m\}\), the intersection of the following family of subspaces

$$\begin{aligned} X_{a,b,j}^{(i)}= & {} \Bigg \{ y:\left[ a,b\right] \longrightarrow {\mathbb {R}}^{m}; y_{j}^{\left( i\right) }\left( a\right) \\= & {} p_{j}^{i}, y_{j}^{\left( i\right) }\left( b\right) =q_{j}^{i}\Bigg \}, \end{aligned}$$

is an affine subspace of \(X^n\). So endpoint constraints lead to spaces of functions which are not linear but they are affine spaces instead which causes minor computational additional difficulties.

In contrast, suppose that we are seeking functions which not only satisfy affine constraints, but also verify extra restrictions of the form (which will be called isoperimetric restrictions )

$$\begin{aligned} {\mathcal {G}}\left( x\right)= & {} \int _{a}^{b}g\left( t,\ldots ,x_{i},\dots x_{i}^{\left( 1\right) },\ldots ,x_{i}^{\left( n\right) },\dots \right) \hbox {d}t\nonumber \\&+ A^{{\mathcal {G}}}\left( a,\ldots ,x_{i}\left( a\right) ,\ldots ,x_{i}^{\left( n-1\right) }\left( a\right) ,\dots \right) \nonumber \\&+ B^{{\mathcal {G}}}\left( b,\ldots ,x_{i}\left( b\right) ,\ldots ,x_{i}^{\left( n-1\right) }\left( b\right) ,\dots \right) \nonumber \\= & {} c, \end{aligned}$$
(46)

where \(g,A^{{\mathcal {G}}},B^{{\mathcal {G}}}\) are, at least, continuously differentiable functions and \(c\in {\mathbb {R}}\). Now, any candidate to be a solution must lie in the hypersurface \(X^n_{{\mathcal {G}}}={\mathcal {G}}^{-1}\left( c\right) \subseteq X^n\), which is not an affine subspace. Of course, more that one isoperimetric restriction may appear at the same time, and then, any solution to the variational problem must lie in \(X^n_{{\mathcal {G}}}=X^n_{{\mathcal {G}}_{1}}\cap \dots \cap X^n_{{\mathcal {G}}_{h}}\).

For simplicity, in the rest of this section, we focus on the unconstrained problem. Thus, we assume that the above functional (45) is defined on \(X^n\). The gradient of \({\mathcal {F}}\) at x is defined to be the unique \(\nabla {\mathcal {F}}_x\in X^n\) that satisfies \(\langle \nabla {\mathcal {F}}_x, w \rangle _n\) \(= D{\mathcal {F}}_x (w)\), for all \(w\in X^n\). The existence and uniqueness of \(\nabla {\mathcal {F}}_x\) is guaranteed by the Riesz representation theorem. Actually, as it has been proved in [7], for a functional \({\mathcal {F}}:X^{n}\longrightarrow {\mathbb {R}}\) of the type (45) (satisfying suitable conditions as those mentioned before), the gradient is given by

$$\begin{aligned} \nabla {\mathcal {F}}_x =\int _{a}^{t}\overset{n}{\cdots }\int _{a}^{t} E_{x,n}^{f}\hbox {d}t+P_{2n-1}\left( t\right) , \end{aligned}$$
(47)

where \(E_{x,n}^{f}\) are defined recursively as

$$\begin{aligned} E_{x,0}^{f}= & {} \frac{\partial f}{\partial x}=f_{x}, \nonumber \\ E_{x,i}^{f}= & {} f_{x^{\left( i\right) }}-\int _{a}^{t}E_{x,i-1}^{f}\hbox {d}s \nonumber \\= & {} \sum _{j=0}^{i}\left( -1\right) ^{i-j}\int _{a}^{t}\overset{{i-j}}{\cdots }\int _{a}^{t}f_{x^{\left( j\right) }}\hbox {d}s. \end{aligned}$$
(48)

and \(P_{2n-1}\left( t\right) =\sum _{i=0}^{2n-1}c_{i}t^{i}\) is a polynomial of degree \(2n-1\), whose coefficients \(c_{i}\) are fully determined as the solutions of the \(2n\times 2n\) linear system which depends on the concrete choice of the metric \(\langle , \rangle _n\). Notice then that, while an extremal is a zero of the gradient for any choice of the metric (44), the gradient itself depends on the metric, and therefore, the metric choice is crucial in our computation.

If \({\mathcal {F}}\) is considered acting on a subspace satisfying additional constraints \(X^n_{{\mathcal {G}}}\), the gradient \(\nabla _*{\mathcal {F}}_x \) is the orthogonal projection of \(\nabla {\mathcal {F}}_x\) onto the corresponding tangent space and computation of the gradient requires a more elaborated process.

On the other hand, one of the most common methods for minimization of \({\mathcal {F}}\) is the gradient steepest descent method. Basically, the essence of this method is to analyze the behavior of the sequence \(\{x_{k},\, k\in \mathbb {N}\}\) of successive approximations for the local minimum points of \({\mathcal {F}}\) given by the formula

$$\begin{aligned} x_{k+1}=x_{k}+t_k h_{k},\, k\in \mathbb {N}, \end{aligned}$$

where \(t_{k}\) is a sequence of positive numbers, the so-called control parameters, which lie in a closed interval of the real line. In order to construct the sequence \(\{x_{k},\, k\in \mathbb {N}\}\), start with an arbitrary point \(x_{o}\in X^n\) (where of course, \(\nabla {\mathcal {F}}_{x_{o}}\) \(\ne 0\)); then, assuming that \(x_{o},x_{1},\ldots ,x_{k}\) have already been constructed, proceed by choosing a sequence \(h_{k}\in X^n\) such that \(\langle \nabla {\mathcal {F}}_{x_{k}}, h_k\rangle < 0\) (usually, \(h_k=-\nabla {\mathcal {F}}_{x_{k}}\)) and then take \(x_{k+1}=x_{k}+t_k h_{k}\).

Then, a numerical method to locate minimizers of this general class of variational problems under both affine and isoperimetric constraints is implemented in [7] (see also, www.ikergeometry.org). The method is suitable for application to the energy functionals described previously; in particular, it will be applicable to Frenet–Serret actions after some convenient adjustments.

4.2 Minimizing length

As explained in Sect. 2, the problem of minimizing the functional (5) acting on the space of plane curves joining two given points of \({\mathbb {R}}^{2}\) with prescribed initial and final angles is equivalent to that of finding D-curves minimizing the Sub-Riemannian length. Even better adapted to the curve completion demands is the variational problem associated with the functional \({\mathcal {F}}_a\), which has been discussed in the previous section. Thus, once we translate it to the language of the unit tangent bundle, we are led to the following variational problem.

Denote by \(\mathfrak {X}\) the space of curves

$$\begin{aligned} \beta :\left[ a,b\right] \longrightarrow {\mathbb {R}}^{2}\times {\mathbb {S}}^{1}; \quad \beta \left( t\right) \!=\!\left( x\left( t\right) ,y\left( t\right) ,\theta \left( t\right) \right) , \end{aligned}$$

joining two given points \(\left( x_{a},y_{a},\theta _{a}\right) \) and \(\left( x_{b},y_{b},\theta _{b}\right) \) of \({\mathbb {R}}^2\times {\mathbb {S}}^1\), that is

$$\begin{aligned} \left( x\left( a\right) ,y\left( a\right) ,\theta \left( a\right) \right)&=\left( x_{a},y_{a},\theta _{a}\right) , \\ \left( x\left( b\right) ,y\left( b\right) ,\theta \left( b\right) \right)&=\left( x_{b},y_{b},\theta _{b}\right) , \end{aligned}$$

and satisfying the following admissibility condition

$$\begin{aligned} y^{\prime }(t)=x^{\prime }(t)\tan \theta (t),\quad t\in \left[ a,b\right] , \end{aligned}$$
(49)

where \('\) denotes derivative with respect to the curve parameter \(t\in [a,b]\) hereafter. On \(\mathfrak {X}\), we consider the functional \({\mathcal {L}}\) defined by

$$\begin{aligned} {\mathcal {L}}\left( \beta \right) =\int _{a}^{b}\sqrt{\left( x^{\prime }\right) ^{2} +\left( y^{\prime }\right) ^{2}+h^{2}\left( \theta ^{\prime }\right) ^{2}}\hbox {d}t, \end{aligned}$$
(50)

where \(h\in {\mathbb {R}}\) is a proportionality constant introduced by accuracy of the physical model [9]. Then, our problem is to find the minimizers or, more generally, extremals of \({\mathcal {L}}:\mathfrak {X}\rightarrow \mathbb {R }\).

We first translate the problem to our settings. The Sub-Riemannian metric defined on \({\mathbb {R}}^2\times {\mathbb {S}}^1\) in Sect. 2 is extended to the whole space by considering the vector field

$$\begin{aligned} \mathbf {X}_3 = -\sin \theta \, \frac{\partial }{\partial \mathbf {x}} +\cos \theta \,\frac{\partial }{ \partial \mathbf {y}}, \end{aligned}$$
(51)

and declaring orthonormal the family \(\{\mathbf {X}_1,\mathbf {X}_2,\mathbf {X}_3\}\), where \(\mathbf {X}_1,\mathbf {X}_2\) are given in (2). It is easy to check that the induced metric in nothing but the standard product metric in \({\mathbb {R}}^2\times {\mathbb {S}}^1\).

Now, consider the exponential map

$$\begin{aligned} \exp :{\mathbb {R}}\rightarrow {\mathbb {S}}^1,\, \exp (t)=(\cos t,\sin t). \end{aligned}$$

Then, \(\pi :=Id\times \exp :{\mathbb {R}}^3\rightarrow {\mathbb {R}}^2\times {\mathbb {S}}^1,\, \pi (x,y,z)=(x,y,\exp z)\) is a Riemannian covering map with respect to the product metrics in both spaces, and in particular, it is a local isometry. For any \(\beta \in \mathfrak {X}\), choose a point \((x_{a},y_{a},\widetilde{\theta }_{a})\in {\mathbb {R}}^3\) such that \(\pi ((x_{a},y_{a},\widetilde{\theta }_{a}))= (x_{a},y_{a},\theta _{a})\) and take the unique lifting \(\widetilde{\beta }:\left[ a,b\right] \longrightarrow {\mathbb {R}}^{3}\) of \(\beta \) to \({\mathbb {R}}^{3}\) with \(\widetilde{\beta }(a)=(x_{a},y_{a},\widetilde{\theta }_{a})\). Define \((x_{b},y_{b},\widetilde{\theta }_{b})=\widetilde{\beta }(b)\). Then, any variation of \(\beta \) within \(\mathfrak {X}\) can be uniquely lifted to a variation of \(\widetilde{\beta }\) with endpoints \((x_{a},y_{a},\widetilde{\theta }_{a})\) and \((x_{b},y_{b},\) \(\widetilde{\theta }_{b})\) satisfying the constraint \(y^{\prime }(t)=x^{\prime }(t)\tan \widetilde{\theta }(t),\, t\in \left[ a,b\right] \).

Thus, on the space of curves \(\widetilde{\mathfrak {X}}\)

$$\begin{aligned} \widetilde{\beta }:\left[ a,b\right] \longrightarrow {\mathbb {R}}^{3}; \quad \widetilde{\beta }\left( t\right) =(x\left( t\right) , y\left( t\right) ,\widetilde{\theta }\left( t\right) ), \end{aligned}$$

joining the two points \((x_{a},y_{a},\widetilde{\theta }_{a})\), \((x_{b},y_{b},\widetilde{\theta }_{b})\) of \({\mathbb {R}}^3\),

$$\begin{aligned} \left( x\left( a\right) ,y\left( a\right) ,\widetilde{\theta }\left( a\right) \right)&=\left( x_{a},y_{a},\widetilde{\theta _{a}}\right) , \\ \left( x\left( b\right) ,y\left( b\right) ,\widetilde{\theta }\left( b\right) \right)&=\left( x_{b},y_{b},\widetilde{\theta _{b}}\right) , \end{aligned}$$

and satisfying the admissibility condition

$$\begin{aligned} y^{\prime }(t)=x^{\prime }(t)\tan \widetilde{\theta }(t),\quad t\in \left[ a,b\right] , \end{aligned}$$
(52)

we can define the functional

$$\begin{aligned} \widetilde{{\mathcal {L}}}\left( \widetilde{\beta }\right) =\int _{a}^{b} \sqrt{\left( x^{'}\right) ^{2} +\left( y^{\prime }\right) ^{2}+h^{2}\left( \widetilde{\theta }^{\prime }\right) ^{2}}\hbox {d}t. \end{aligned}$$
(53)

Then, \(\widetilde{{\mathcal {L}}}(\widetilde{\beta })={\mathcal {L}}\left( \beta \right) ,\) and therefore, \(\beta \) is critical for \({\mathcal {L}}\), if and only if, \(\widetilde{\beta }\) is critical for \(\widetilde{{\mathcal {L}}}\). Observe also that regular curves in \({\mathbb {R}}^2\times {\mathbb {S}}^1\) are lifted to regular curves in \({\mathbb {R}}^3\) with the same curvature and torsion, and that they have the same projection, \(\alpha (t)=(x(t), y(t))\), on \({\mathbb {R}}^2\).

Therefore, the original problem boils down to study extremals for \(\widetilde{{\mathcal {L}}}\) in \(\widetilde{\mathfrak {X}}\), and we are in position to apply our algorithm (with \(m=3,\, n=1,\ A=B=0\)) to the functional \(\widetilde{{\mathcal {L}}}\) acting on \(\widetilde{\mathfrak {X}}\) (however, by abuse of notation, we are going to denote both, the functional and the space of curves, without the tilde  \(\widetilde{}\) ). Moreover, for computational simplicity, it is better to work with plane curves \(\alpha (t)=(v(t),\theta (t))\), which are parametrized by using its speed \(v\left( t\right) \), and the angle that its tangent makes with the x-axis direction, \(\theta \left( t\right) \). Hence, our energy functional becomes

$$\begin{aligned} {\mathcal {L}}\left( \beta \right) =\int _{a}^{b}\sqrt{v^{2}\left( t\right) +h^{2}\left( \theta ^{\prime }\right) ^{2}}\hbox {d}t, \end{aligned}$$

and will be considered acting on the space \(\widehat{\mathfrak {X}}\) formed by curves (we are abusing again of the notation by using the same letter \(\beta \) as before)

$$\begin{aligned}&\beta :\left[ a,b\right] \longrightarrow {\mathbb {R}}^{2}, \quad \beta \left( t\right) =(v\left( t\right) ,\theta \left( t\right) ), \end{aligned}$$

satisfying the affine conditions

$$\begin{aligned} \theta \left( a\right) =\theta _{a},\quad&\theta \left( b\right) =\theta _{b}, \end{aligned}$$

along with the following isoperimetric conditions

$$\begin{aligned} x_{b}-x_{a}=\int _{a}^{b}v\cos \theta \hbox {d}t,&\quad y_{b}-y_{a}=\int _{a}^{b}v\sin \theta \hbox {d}t. \end{aligned}$$

Observe that the relations

$$\begin{aligned} x^{\prime }\left( t\right) =v\left( t\right) \cos \theta \left( t\right) ,&\quad y^{\prime }\left( t\right) =v\left( t\right) \sin \theta \left( t\right) , \end{aligned}$$

enable us to recover the original minimizing curve \(\beta \). Finally, the choice of our metric will be

$$\begin{aligned} \langle \beta (t),\bar{\beta }(t)\rangle= & {} \langle \beta (a),\bar{\beta }(a)\rangle \nonumber \\&+ \int _a^b\langle \beta '(t),\bar{\beta }'(t)\rangle \hbox {d}t, \end{aligned}$$
(54)

for curves \(\beta , \bar{\beta }\in \widehat{\mathfrak {X}}\).

In order to make the XEL-platform [7] to work on the functional \({\mathcal {L}}:\widehat{\mathfrak {X}}\rightarrow \mathbb {R }\) just defined, we can take, without loss of generality, our curves defined in the unit interval, i.e., \(a=0, b=1\), and assume also that the ends of the curves are chosen to be

$$\begin{aligned} p_{0}=\left( 0,0,\theta _{0}\right) ,\quad p_{1}=\left( 1,0,\theta _{1}\right) ,\quad \theta _{0},\theta _{1}\in {\mathbb {R}}. \end{aligned}$$

As a strategy to speed up the convergence of the algorithm, we will restrict our analysis to curves \(\beta \) satisfying additionally \(\theta \left( t\right) =\theta _{0}+t\left( \theta _{1}-\theta _{0}\right) \), \(t\in \left[ 0,1\right] \). Notice that, this is a quite reasonable assumption in image reconstruction, since we do not expect our image filling curves to have loops and its inclusion does not alter the conclusions. Rewriting our functional in this context, we have

$$\begin{aligned} {\mathcal {L}}\left( \beta \right) =\int _{0}^{1}\sqrt{v^{2} \left( t\right) +h^{2}\left( \theta _{1}-\theta _{0}\right) ^{2}}\hbox {d}t, \end{aligned}$$

with

$$\begin{aligned} \theta \left( 0\right)= & {} \theta _{0},\quad \theta \left( 1\right) =\theta _{1},\\ x_{1}-x_{0}= & {} \int _{0}^{1}v\cos \theta \hbox {d}t, \quad y_{1}-y_{0}=\int _{0}^{1}v\sin \theta \hbox {d}t.\\ x^{\prime }\left( t\right)= & {} v\left( t\right) \cos \theta \left( t\right) , \quad y^{\prime }\left( t\right) =v\left( t\right) \sin \theta \left( t\right) . \end{aligned}$$

To start with the gradient descent process, we need to choose an initial curve \(\alpha _o\) in the above space of functions. For \(a=0\), \(b=1\), we determine \(\alpha _o\) by selecting functions

$$\begin{aligned} \theta \left( t\right)= & {} \left( \theta _{1}-\theta _{0}\right) t+\theta _{0}, \end{aligned}$$
(55)
$$\begin{aligned} v\left( t\right)= & {} \lambda +\eta t, \end{aligned}$$
(56)

where the parameters \(\lambda \) and \(\eta \) are obtained by using the isoperimetric constraints, that is

$$\begin{aligned} 1&=\int _{0}^{1}v\left( t\right) \cos \theta \left( t\right) \hbox {d}t,\\ 0&=\int _{0}^{1}v\left( t\right) \sin \theta \left( t\right) \hbox {d}t. \end{aligned}$$

In other words, denoting by \(\Delta \theta =\theta _{1}-\theta _{0}\), we have

$$\begin{aligned} 1&=\frac{\lambda }{\Delta \theta }\left[ \sin \left( \theta \left( t\right) \right) \right] _{0}^{1}\\&\quad +\eta \left[ \frac{t}{\Delta \theta }\sin \left( \theta \left( t\right) \right) +\frac{\cos \theta \left( t\right) }{\left( \Delta \theta \right) ^{2}}\right] , \end{aligned}$$

and

$$\begin{aligned} 0&=\frac{\lambda }{\Delta \theta }\left[ -\cos \left( \theta \left( t\right) \right) \right] _{0}^{1}\\&\quad +\eta \left[ -\frac{t}{\Delta \theta }\cos \left( \theta \left( t\right) \right) +\frac{\sin \theta \left( t\right) }{\left( \Delta \theta \right) ^{2}}\right] . \end{aligned}$$

This gives a linear system \(\mathbf {A}\left( \begin{array}{c} \lambda \\ \eta \end{array}\right) =\left( \begin{array}{c} 1\\ 0 \end{array}\right) \), with associated matrix

$$\begin{aligned} \mathbf {A}=\left( \begin{array}{rr} {\displaystyle \frac{\sin \theta _{1}-\sin \theta _{0}}{\Delta \theta }} &{} {\displaystyle \frac{\sin \theta _{1}}{\Delta \theta }+\frac{\cos \theta _{1}-\cos \theta _{0}}{\left( \Delta \theta \right) ^{2}}}\\ {\displaystyle \frac{\cos \theta _{0}-\cos \theta _{1}}{\Delta \theta }} &{} {\displaystyle \frac{\sin \theta _{1}-\sin \theta _{0}}{\left( \Delta \theta \right) ^{2}}-\frac{\cos \theta _{1}}{\Delta \theta }} \end{array}\right) \end{aligned}$$

whose solutions are

$$\begin{aligned} \lambda&=\frac{1}{\det \left( \mathbf {A}\right) }{\displaystyle \left\{ \frac{\sin \theta _{1}-\sin \theta _{0}}{\left( \Delta \theta \right) ^{2}}-\frac{\cos \theta _{1}}{\Delta \theta }\right\} ,}\\ \eta&=\frac{1}{\det \left( \mathbf {A}\right) }\left\{ {\displaystyle \frac{\cos \theta _{1}-\cos \theta _{0}}{\Delta \theta }}\right\} . \end{aligned}$$

Now, substitution of these values in (56) gives us the curve \(\alpha _o\) to start with the method. Of course, this can be done for any choice of initial conditions \(\theta _0, \theta _1\). Figure 1 shows a family of minimizers which have been obtained via the XEL-platform for different choices of end angles \(\theta _0, \theta _1\) detailed in Table 1.

One may wish to compare extremals obtained by our method with those obtained in [9], where the authors used a different numeric approach. For example, Table 1 also shows the length of the extremal curves obtained with both methods for identical initial data. Thus, although both numeric approaches are conceptually very different, it is remarkable that the results obtained by either method are very close concerning both shape and length of the extremals.

Fig. 1
figure 1

Minimizers of (53) obtained via XEL

Table 1 Length of the curve \(\beta \left( s\right) \) in \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\)

4.3 Minimizing elastic energy

One advantage of our XEL-platform is that it is easily adaptable to a huge family of functionals satisfying the required conditions. For instance, it has been pointed out in [9] that investigation of extremals for the elastic energy in the unit normal bundle might be important for examining combinations of image plane properties. The elastic or bending energy is defined by

$$\begin{aligned} \hat{{\mathcal {F}}}:\mathfrak {X}\rightarrow {\mathbb {R}},\quad \hat{{\mathcal {F}}}(\beta )=\int _{\beta }\kappa _\beta ^{2}\, du\, , \end{aligned}$$
(57)

where \(\mathfrak {X}\) has been previously defined in Sect. 4.2, \(\kappa _{\beta }\) denotes the geodesic curvatures of \(\beta \), and u is the arc-length parameter of the curve.

Now, by using the universal Riemannian covering as we did in 4.1, the problem can be “lifted” from \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\) to \({\mathbb {R}}^3\). So, assume that

$$\begin{aligned} \alpha =\alpha \left( s\right) =\left( x(s),y(s)\right) \end{aligned}$$

is an arc-length parametrized plane curve with Frenet frame \(\left\{ \mathbf {T}\left( s\right) ,\mathbf {N}\left( s\right) ,\mathbf {B} \left( s\right) =\left( 0,0,1\right) \right\} \), and denote by \(\beta \) its lift to \(\widetilde{\mathfrak {X}}\) (with slope \(h\in {\mathbb {R}}\)). Then, \(\beta \left( s\right) =\alpha \left( s\right) +\theta \left( s\right) h\mathbf {B}\), with \(\theta ^{\prime }=\kappa _{\alpha }\left( s\right) \) and, since the curvature of \(\beta \) is given by \(\kappa _{\beta }=\frac{\mid \beta '\times \beta ''\mid }{\mid \beta '\mid ^3}\), we obtain that \(\kappa _{\beta }\) and \(\kappa _{\alpha }\), the curvatures of \(\beta \) and \(\alpha \), respectively, are related by

$$\begin{aligned} \kappa _{\beta }^{2}\left( s\right)&=\frac{\kappa _{\alpha }^{2}\left( s\right) +h^{2}\kappa _{\alpha }^{4} \left( s\right) +h^{2}\left( \kappa _{\alpha }^{\prime }\left( s\right) \right) ^{2}}{\left( 1+h^{2}\kappa _{\alpha }^{2}\right) ^{3}} \nonumber \\&=\frac{\kappa _{\alpha }^{2}\left( s\right) }{\left( 1+h^{2} \kappa _{\alpha }^{2}\right) ^{2}}+\frac{h^{2}\left( \kappa _{\alpha }^{\prime } \left( s\right) \right) ^{2}}{\left( 1+h^{2}\kappa _{\alpha }^{2}\right) ^{3}}\, . \end{aligned}$$
(58)

Moreover, since the speed of \(\beta \) can be expressed as

$$\begin{aligned} v_{\beta }\left( s\right) =\sqrt{1+h^{2}\kappa _{\alpha }^{2}}\left( s\right) \, , \end{aligned}$$
(59)

then the elastic energy in \({\mathbb {R}}^{3}\) of \(\beta \) is given by

$$\begin{aligned} \hat{{\mathcal {F}}}(\beta )&= \int _{0}^{l}\kappa _{\beta }^{2}v_{\beta }\hbox {d}s =\int _{0}^{l}\frac{\kappa _{\alpha }^{2}\left( s\right) }{\left( 1+h^{2}\kappa _{\alpha }^{2}\right) ^{3/2}}\hbox {d}s \nonumber \\&\quad +h^{2}\int _{0}^{l}\frac{\left( \kappa _{\alpha }^{\prime } \left( s\right) \right) ^{2}}{\left( 1+h^{2}\kappa _{\alpha }^{2}\right) ^{5/2}}\hbox {d}s, \end{aligned}$$
(60)

where l stands for the length of \(\alpha \).

Again, for computational simplicity, it is better to work with \(\widehat{\mathfrak {X}}\), the space of plane curves \(\alpha (t)=(v(t),\theta (t))\) parametrized by using its velocity, \(v\left( t\right) \), and the angle that its tangent makes with the x-axis direction, \(\theta \left( t\right) \). Also, we will consider on \(\widehat{\mathfrak {X}}\) the same metric (54) as before in Sect. 4.2. In this case, we have

$$\begin{aligned}&\kappa _{\alpha }\left( t\right) =\frac{\theta ^{\prime }}{v_{\alpha }}, \nonumber \\&\frac{\hbox {d}\kappa _{\alpha }}{\hbox {d}s}\left( t\right) = \frac{\theta ^{\prime \prime }}{v_{\alpha }^{2}}-\frac{\theta ^{\prime }v_{\alpha }^{\prime }}{v_{\alpha }^{3}}, \nonumber \\&\frac{\hbox {d}^{2}\kappa _{\alpha }}{\hbox {d}s^{2}}\left( t\right) =\frac{\theta ^{\prime \prime \prime }}{v_{\alpha }^{3}}-3\theta ^{\prime \prime } \frac{v_{\alpha }^{\prime }}{v_{\alpha }^{4}}-\theta ^{\prime } \frac{v_{\alpha }v_{\alpha }^{\prime \prime }-3\left( v_{\alpha }^{\prime }\right) ^{2}}{v_{\alpha }^{5}}, \end{aligned}$$
(61)

\(v_{\alpha }\) denoting in these formulae the speed of \(\alpha \). Therefore, by substitution in (60), we obtain

$$\begin{aligned} \int _{0}^{l}\frac{\kappa _{\alpha }^{2}\left( s\right) \hbox {d}s}{\left( 1+h^{2}\kappa _{\alpha }^{2}\right) ^{3/2}}&=\int _{a}^{b}\frac{\left( \frac{\theta ^{\prime }\left( t\right) }{v_{\alpha }\left( t\right) }\right) ^{2}v_{\alpha }\, \hbox {d}t}{\left( 1+h^{2}\left( \frac{\theta ^{\prime }\left( t\right) }{v_{\alpha }\left( t\right) }\right) ^{2}\right) ^{3/2}} \nonumber \\&=\int _{a}^{b}\frac{\left( \theta ^{\prime }\left( t\right) v_{\alpha }\left( t\right) \right) ^{2}\hbox {d}t}{\left( v_{\alpha }^{2}\left( t\right) +h^{2}\left( \theta ^{\prime }\left( t\right) \right) ^{2}\right) ^{3/2}}, \end{aligned}$$
(62)
$$\begin{aligned} \int _{0}^{l}\frac{\left( \kappa _{\alpha }^{\prime }\left( s\right) \right) ^{2}\hbox {d}s}{\left( 1+h^{2}\kappa _{\alpha }^{2}\right) ^{5/2}}&=\int _{a}^{b}\frac{\left( \frac{\theta ^{\prime \prime }\left( t\right) }{v_{\alpha }^{2}\left( t\right) }-\frac{\theta ^{\prime }\left( t\right) v_{\alpha }^{\prime }\left( t\right) }{v_{\alpha }^{3}\left( t\right) }\right) ^{2}v_{\alpha }}{\left( 1+h^{2}\left( \frac{\theta ^{\prime }\left( t\right) }{v_{\alpha }\left( t\right) }\right) ^{2}\right) ^{5/2}}\, \hbox {d}t \nonumber \\&=\int _{a}^{b}\frac{\left( \theta ^{\prime \prime }\left( t\right) v_{\alpha }-\theta ^{\prime }v_{\alpha }^{\prime }\right) ^{2}\hbox {d}t}{\left( v_{\alpha }^{2}\left( t\right) +h^{2}\left( \theta ^{\prime }\left( t\right) \right) ^{2}\right) ^{5/2}}. \end{aligned}$$
(63)

which allows \(\hat{{\mathcal {F}}}\) to be written more efficiently for our numerical experiments with the XEL-platform.

However, as in previous case Sect. 4.2, in order to speed up the convergence of the procedure, we can restrict our analysis to curves of the type \(\theta \left( t\right) =\theta _{0}+\Delta \theta t\), with \(\Delta \theta := \theta _{1}-\theta _{0}\), \(t\in \left[ 0,1\right] \). Now, formulae in (61) change to

$$\begin{aligned}&\kappa _{\alpha }\left( t\right) =\left( \Delta \theta \right) \frac{1}{v}, \nonumber \\&\frac{\hbox {d}\kappa _{\alpha }}{\hbox {d}s}\left( t\right) =-\left( \Delta \theta \right) \frac{v^{\prime }}{v^{3}}, \nonumber \\&\frac{\hbox {d}^{2}\kappa _{\alpha }}{\hbox {d}s^{2}}\left( t\right) =-\left( \Delta \theta \right) \frac{vv^{\prime \prime }-3\left( v^{\prime }\right) ^{2}}{v^{5}}, \end{aligned}$$
(64)

and (62) and (63) are transformed into

$$\begin{aligned} \int _{0}^{1}\frac{\left( v\Delta \theta \right) ^{2}}{\left( v^{2} +h^{2}\left( \Delta \theta \right) ^{2}\right) ^{2}}\sqrt{v^{2} +h^{2}\left( \Delta \theta \right) ^{2}}\hbox {d}t,\\ \int _{0}^{1}\frac{\left( v^{\prime }\Delta \theta \right) ^{2}}{\left( v^{2}+h^{2}\left( \Delta \theta \right) ^{2}\right) ^{3}}\sqrt{v^{2}+h^{2}\left( \Delta \theta \right) ^{2}}\hbox {d}t. \end{aligned}$$

A combination of these formulae and (60) allows us to express \(\widehat{\mathcal {F}}\) in manner suitable for the work of the XEL-platform.

Once more, to start computations with the XEL-platform, we need an initial curve \(\alpha _0 (t)=(v(t),\theta (t))\) in \(\widehat{\mathfrak {X}}\) satisfying the required conditions. Since this choice is arbitrary, we can choose the same curve as the one we used previously in (55) for fixed values \(\theta _{0}, \theta _{1}\in {\mathbb {R}}\). Then, the process can be initiated with these data obtaining, by following the gradient descent, extremals for the elastic energy in \({\mathbb {R}}^2\times {\mathbb {S}}^1\), whose planar projection are shown in Fig. 2 for different choices of the values \(\theta _{0}, \theta _{1}\in {\mathbb {R}}\).

By using and combining different additional constraints, many different experiments can be performed with the elastic energy functional \(\hat{{\mathcal {F}}}\) in \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\). For example, choosing again \(p_{0}=\left( 0,0,\theta _{0}\right) \), \(p_{1}=\left( 1,0,\theta _{1}\right) \) as end points for our curves, and several ending angles, \(\theta _{0}, \theta _{1}\), one may wish to find extremals of the elastic energy for, say, variations with (or without) the same length and/or with (or without) prescribed ending curvatures.

Fig. 2
figure 2

Minimizing the elastic energy

Table 2 Elastic energy in \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\)

Thus, when there is no penalty on the length, Fig. 2 shows extremals obtained under both assumptions, prescribed or unprescribed ending curvatures, and Table 2 shows initial data and the corresponding value of the elastic energy in both situations.

4.4 Minimizing total squared torsion

Another possibility in image reconstruction is to choose, as filling curves in the plane, projections of minimizers of the total squared torsion in the unit tangent bundle \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\), [9]. This time, the energy we are going to consider on curves of the unit normal bundle will be

$$\begin{aligned} \overline{{\mathcal {F}}}:\mathfrak {X}\rightarrow {\mathbb {R}},\quad \overline{{\mathcal {F}}}(\beta )=\int _{\beta }\tau _\beta ^{2}\,\hbox {d}s, \end{aligned}$$
(65)

where \(\mathfrak {X}\) plays the same role as in the two previous cases, \(\tau _{\beta }\) denotes the torsion of \(\beta \) in \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\), and s stands for the arc-length parameter of \(\beta \).

Again, the strategy is to lift the problem from \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\) to \({\mathbb {R}}^3\) by using the universal Riemannian covering as we did in Sects. 4.2 and 4.3. So, following the same procedure, assume that

$$\begin{aligned} \alpha =\alpha \left( s\right) =\left( x(s),y(s)\right) \end{aligned}$$

is an arc-length parametrized plane curve with Frenet frame \(\left\{ \mathbf {T}\left( s\right) ,\mathbf {N}\left( s\right) ,\mathbf {B}\left( s\right) =\left( 0,0,1\right) \right\} \), and denote by \(\beta \) its lift to \(\widetilde{\mathfrak {X}}\) (with slope \(h\in {\mathbb {R}}\)). Then, \(\beta \left( s\right) =\alpha \left( s\right) +\theta \left( s\right) h\,\mathbf {B}\), with \(\theta ^{\prime }=\kappa _{\alpha }\left( s\right) \). Hence, if \(\kappa _{\beta }\) and \(\kappa _{\alpha }\) denote, respectively, the geodesic curvatures of \(\beta \) in \({\mathbb {R}}^{3}\) and of \(\alpha \) in \({\mathbb {R}}^{2}\), we have

$$\begin{aligned} \beta ^{\prime }\left( s\right)&=\mathbf {T}\left( s\right) +\kappa _{\alpha }\left( s\right) h\,\mathbf {B}\left( s\right) , \end{aligned}$$
(66)
$$\begin{aligned} \beta ^{\prime \prime }\left( s\right)&=\kappa _{\alpha }\left( s\right) \mathbf {N}\left( s\right) +\kappa _{\alpha }^{\prime }\left( s\right) \, h\, \mathbf {B}\left( s\right) . \end{aligned}$$
(67)

Therefore,

$$\begin{aligned}&\beta ^{\prime }\times \beta ^{\prime \prime } \left( s\right) = \kappa _{\alpha }\left( s\right) \mathbf {B} \left( s\right) \nonumber \\&\quad -\,\kappa _{\alpha }^{\prime } \left( s\right) h\, \mathbf {N}\left( s\right) -\kappa _{\alpha }^{2}\left( s\right) h\, \mathbf {T}\left( s\right) , \end{aligned}$$
(68)

and

$$\begin{aligned} \left\| \beta ^{\prime }\times \beta ^{\prime \prime }\right\| ^{2}\left( s\right) =\kappa _{\alpha }^{2}\left( s\right) +h^{2}\kappa _{\alpha }^{4}\left( s\right) +h^{2}\left( \kappa _{\alpha }^{\prime }\left( s\right) \right) ^{2}. \end{aligned}$$
(69)

We need to compute also

$$\begin{aligned} \beta ^{\prime \prime \prime }&=-\kappa _{\alpha }^{2}\mathbf {T}+\kappa _{\alpha }^{\prime }\mathbf {N}+\kappa _{\alpha }^{\prime \prime }h\,\mathbf {B}, \end{aligned}$$
(70)

since the torsion of \(\alpha \) is \(\tau _\alpha =0\). Hence,

$$\begin{aligned} \left[ \beta ^{\prime },\beta ^{\prime \prime },\beta ^{\prime \prime \prime }\right]&=\kappa _{\alpha }\kappa _{\alpha }^{\prime \prime }h-\left( \kappa _{\alpha }^{\prime }\right) ^{2}h+\kappa _{\alpha }^{4}h. \end{aligned}$$
(71)

Thus, combining (58), (59), (66)-(71) and the standard formula for computing the torsion in \({\mathbb {R}}^3\), one gets that the torsion of \(\beta \) is

$$\begin{aligned} \tau _{\beta }\left( s\right) =\frac{h\left( \kappa _{\alpha }\kappa _{\alpha }^{\prime \prime }- \left( \kappa _{\alpha }^{\prime }\right) ^{2}+\kappa _{\alpha }^{4}\right) }{\kappa _{\alpha }^{2}\left( 1+h^{2}\kappa _{\alpha }^{2}\right) +h^{2}\left( \kappa _{\alpha }^{\prime }\right) ^{2}}. \end{aligned}$$
(72)

Again, we want to express this with respect to the parametrization of \(\alpha (t)=\left( v\left( t\right) ,\theta \left( t\right) \right) \). This time, the choice of our metric on \(\widehat{\mathfrak {X}}\) will be

$$\begin{aligned} \langle \beta (t),\bar{\beta }(t)\rangle= & {} \langle \beta (a),\bar{\beta }(a)\rangle + \langle \beta '(a),\bar{\beta }'(a)\rangle \nonumber \\&+ \int _a^b\langle \beta ''(t),\bar{\beta }''(t)\rangle \, \hbox {d}t, \end{aligned}$$
(73)

for curves \(\beta , \bar{\beta }\in \widehat{\mathfrak {X}}\). After some computations, one can check that

$$\begin{aligned} \tau _{\beta }\left( t\right) =h\frac{\tau _{1}}{\tau _{2}}\left( t\right) , \end{aligned}$$

where

$$\begin{aligned} \tau _{1}&=v^{2}\left( \theta ^{\prime }\theta ^{\prime \prime \prime }-\left( \theta ^{\prime \prime }\right) ^{2}+\left( \theta ^{\prime }\right) ^{4}\right) -vv^{\prime }\theta ^{\prime }\theta ^{\prime \prime }\\&\quad +\left( \theta ^{\prime }\right) ^{2}\left( 2\left( v^{\prime }\right) ^{2}-vv^{\prime \prime }\right) ,\\ \tau _{2}&=v^{2}\left( \theta ^{\prime }\right) ^{2}\left( v^{2}+h^{2}\left( \theta ^{\prime }\right) ^{2}\right) +h^{2}\left( \theta ^{\prime \prime }v-\theta ^{\prime }v^{\prime }\right) ^{2}. \end{aligned}$$

Observe that s is not the arc-length parameter of \(\beta \), so the total squared torsion energy of \(\beta \), (65), is given by

$$\begin{aligned} \int _{0}^{l}\left( \tau _{\beta }\right) ^{2}v_{\beta }\hbox {d}s =h^{2}\int _{a}^{b}\left( \frac{\tau _{1}}{\tau _{2}}\right) ^{2}\sqrt{v^{2}+h^{2}\left( \theta ^{\prime }\right) ^{2}}\hbox {d}t. \end{aligned}$$
(74)

As before, for computational ease, we restrict our attention to the space of curves of the type \(\left( v\left( t\right) ,\theta \left( t\right) \right. =\) \(\left. \theta _{0}+\Delta \theta \, t\right) \), with \(\Delta \theta \) denoting \(\Delta \theta =\theta _{1}-\theta _{0}\) for fixed given values \(\theta _{0}, \theta _{1}\in {\mathbb {R}}\). After some lengthly but straightforward computations with the aid of (64), we obtain

$$\begin{aligned} \tau _{1}&=\left( \Delta \theta \right) ^{4}v^{2}+2\left( \Delta \theta \right) ^{2}\left( v^{\prime }\right) ^{2}-\left( \Delta \theta \right) ^{2}vv^{\prime \prime },\\ \tau _{2}&=\left( \Delta \theta \right) ^{2}v^{2}\left( v^{2}+\left( \Delta \theta \right) ^{2} h^{2}\right) +\left( \Delta \theta \right) ^{2}h^{2}\left( v^{\prime }\right) ^{2}, \end{aligned}$$

and factoring \(\left( \Delta \theta \right) ^{2}\), we finally have

$$\begin{aligned} \tau _{1}&= \left( \left( \Delta \theta \right) ^{2}v^{2}+2\left( v^{\prime }\right) ^{2}-vv^{\prime \prime }\right) \left( \Delta \theta \right) ^{2}. \end{aligned}$$
(75)
$$\begin{aligned} \tau _{2}&= \left( v^{2} \left( v^{2}+h^{2}\right) +h^{2}\left( v^{\prime }\right) ^{2}\right) \left( \Delta \theta \right) ^{2}. \end{aligned}$$
(76)

Substitution in (74) finally gives

$$\begin{aligned} \overline{{\mathcal {F}}}(\beta )= & {} \int _{0}^{l}\left( \tau _{\beta }\right) ^{2}v_{\beta }\hbox {d}s \nonumber \\= & {} h^{2}\int _{a}^{b}\left( \frac{\tau _{1}}{\tau _{2}}\right) ^{2}\sqrt{v^{2}+\left( \Delta \theta \right) ^{2} h^{2}}\hbox {d}t, \end{aligned}$$
(77)

where \(\tau _1\) and \(\tau _2\) are given in (75) and (76), respectively. Once more, to initialize the gradient descent process with the XEL-platform, we select as initial curve \(\alpha _0 (t)=(v(t),\theta (t))\) in \(\widehat{\mathfrak {X}}\) the one obtained in (55) for given values \(\theta _{0}, \theta _{1}\in {\mathbb {R}}\). Following the gradient descent pathway, extremals for the total squared torsion energy (65) in \({\mathbb {R}}^2\times {\mathbb {S}}^1\) project down to planar curves shown in Fig. 3 (under prescribed or unprescribed curvature values at the endpoints) for the same choices of the angles \(\theta _{0}, \theta _{1}\in {\mathbb {R}}\) as those made in Tables 1 and 2.

Fig. 3
figure 3

Projected extremals of the total squared torsion in \({\mathbb {R}}^2\times {\mathbb {S}}^1\)

Curves so obtained are critical for the total squared torsion functional, but they are not, necessarily, minima. On the other hand, absolute minimum for this energy is obviously reached at curves \(\beta \) with torsion \(\tau _{\beta }=0\). By (72), we know these curves must satisfy the differential equation

$$\begin{aligned} \kappa _{\alpha }\left( s\right) \kappa _{\alpha }^{\prime \prime }\left( s\right) -\left( \kappa _{\alpha }^{\prime }\left( s\right) \right) ^{2}+\kappa _{\alpha }^{4}\left( s\right) =0, \end{aligned}$$
(78)

that is solved by the curvature functions

$$\begin{aligned} \kappa \left( s\right) =\frac{C_{1}}{\cosh \left( C_{0}\pm C_{1}s\right) }. \end{aligned}$$

Then, the angular function \(\theta \left( s\right) \) is obtained by integrating \(\kappa \left( s\right) \)

$$\begin{aligned} \theta \left( s\right) =\frac{1}{C_{1}}\arctan \left( \sinh \left( C_{0}\pm C_{1}s\right) \right) +\frac{C_{2}}{C_{1}}, \end{aligned}$$

with \(C_{0}\), \(C_{1}\) and \(C_{2}\) integration constants which can be determined by using the boundary constraints.

Once more, for computational purposes, we restrict our attention to the space of curves \(\alpha (t)=(v(t),\theta (t))\) parametrized by using velocity, \(v\left( t\right) \), and the angle that its tangent makes with the x-axis direction. We additionally assume that \(\theta \left( t\right) =\theta _{0}+t\left( \theta _{1}-\theta _{0}\right) \) with \(t\in \left[ 0,1\right] \). Then, since \(\tau _{\beta }=0\) equation (78) becomes

$$\begin{aligned} vv^{\prime \prime }-2\left( v^{\prime }\right) ^{2}-\left( \theta _{1}-\theta _{0}\right) ^{2}v^{2}=0 , \end{aligned}$$

that is solved by the speed \(v\left( t\right) \) given by

$$\begin{aligned} v\left( t\right) =\frac{C_{1}}{\cos \left( \left( \theta _{1}-\theta _{0}\right) t+\theta _{0}-C_{0}\right) }, \end{aligned}$$
(79)

with \(C_{0}\) and \(C_{1}\) integration constants.

As in the experiments previously seen in Sects. 4.2 and 4.3, in order to make easier the work of the XEL-platform on the functional \(\mathcal {\overline{{\mathcal {F}}}}:\widehat{\mathfrak {X}}\rightarrow {\mathbb {R}}\), we suppose, without loss of generality, that the ends of the curves are chosen to be

$$\begin{aligned} p_{0}=\left( 0,0,\theta _{0}\right) ,\quad p_{1}=\left( 1,0,\theta _{1}\right) . \end{aligned}$$

Then, the integration constants \(C_{0}\) and \(C_{1}\) are determined by the boundary constraints

$$\begin{aligned} C_{1}\int _{0}^{1}\frac{\cos \left( \left( \theta _{1}-\theta _{0}\right) t+\theta _{0}\right) }{\cos \left( \left( \theta _{1}-\theta _{0}\right) t+\theta _{0}-C_{0}\right) }\hbox {d}t&=1, \end{aligned}$$
(80)
$$\begin{aligned} C_{1}\int _{0}^{1}\frac{\sin \left( \left( \theta _{1}-\theta _{0}\right) t+\theta _{0}\right) }{\cos \left( \left( \theta _{1}-\theta _{0}\right) t+\theta _{0}-C_{0}\right) }\hbox {d}t&=0. \end{aligned}$$
(81)

With a little of trigonometry, one can see that the second equation (81) is equivalent to

$$\begin{aligned} \ln \left( \frac{\cos \left( \theta _{1}-C_{0}\right) }{\cos \left( \theta _{0}-C_{0}\right) }\right) =\left( \theta _{1}-\theta _{0}\right) \tan \left( C_{0}\right) , \end{aligned}$$

which reduces to

$$\begin{aligned} C_{1}=\cos \left( C_{0}\right) . \end{aligned}$$

Now, the relations

$$\begin{aligned} x^{\prime }\left( t\right) =v\left( t\right) \cos \theta \left( t\right) , \quad y^{\prime }\left( t\right) =v\left( t\right) \sin \theta \left( t\right) , \end{aligned}$$

allow us to recover the planar curves obtained by projection of the absolute minima of (65).

Fig. 4
figure 4

Projections of minimal curves for total squared torsion (red and orange); elastic energy (green); and length (geodesic in blue). While the curve in red comes from a global minimum for the total squared torsion functional, the orange colored curves come from local minima. (Color figure online)

For instance, in Fig. 4 five curves joining the points \(p_0\) and \(p_1\) with respective angles at endpoints \(\theta _{0}=70^{\circ }\) and \(\theta _{1}=-40^{\circ }\) are depicted: the absolute minimum of the total squared torsion (just described) and another four curves obtained by gradient descent of different energies with XEL. The curve in red is the projection of the absolute minimum, \(\mathcal {\overline{{\mathcal {F}}}} \left( \beta \right) =0\), of the total squared torsion functional, while the orange ones are the projections of local minima for the same functional obtained in similar manner to those of Fig. 3 with \(\mathcal {\overline{{\mathcal {F}}}}\left( \beta \right) =1.8567\) and \(\mathcal {\overline{{\mathcal {F}}}}\left( \beta \right) =3.4543\) respectively. Finally, the curve in green is the projection of an elastica, local minimum for the elastic energy functional in \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\) (obtained as described in Sect. 4.3) and the curve in blue is the projection of a geodesic curve \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\) (a local minimum of the length obtained as described in Sect. 4.2).

Even more, last curve, the planar projection of a geodesic in \({\mathbb {R}}^{2}\times {\mathbb {S}}^{1}\) is also obtained by XEL if one starts the curve descent evolution for the length (Sect. 4.2) taking as initial curve the absolute minimum of the torsion functional (red curve), Fig. 5.

Fig. 5
figure 5

Projected minimum of the total squared torsion functional (79) (curve in red) evolves under the XEL-platform to the projection of a local minimum for the length (projected geodesic in blue) following the gradient descent of the latter (Sect. 4.2). (Color figure online)

4.5 Comparing models

Figures 2, 3, 4 and 5 involve boundary conditions with relatively small acute angle on both ends, but it might be illustrative to compare different models under more demanding boundary conditions as, for instance, larger curvature values at the ends and/or obtuse angles in one or both ends. Thus, in Fig. 6, we consider planar projections of elastic energy minimizers between two given points \(p_o=(0,0)\) and \(p_1=(1,0)\), where we fix the angles \(\theta _o\), \(\theta _1\), and curvatures \(\kappa _o=1\), \(\kappa _1=2\), at both ends. While the angle at \(p_o=(0,0)\) is always kept to be \(\theta _o=120^{\circ }\), the final angle at \(p_1=(1,0)\), \(\theta _1\), is chosen to vary from \(-90^{\circ }\) to \(-270^{\circ }\) in amounts of \(-30^{\circ }\). Analogously, Fig. 7 shows planar projections of minimizers for the total squared torsion energy between the same points, \(p_o=(0,0)\) and \(p_1=(1,0)\), under similar boundary conditions. This time, we choose \(\kappa _o=1\), \(\kappa _1=2\) as curvature values at the ends and \(\theta _o=60^{\circ }\) for the angle at \(p_o=(0,0)\). Then we look for energy minimizers by fixing different values for the arrival angle at \(p_1=(1,0)\), \(\theta _1\). The choices for \(\theta _1\) form a variation with stepsize \(-30^{\circ }\) from the initial value \(60^{\circ }\) to \(-330^{\circ }\). Here, no constraint is assumed on the values of the curvature derivatives \(\kappa '_o,\kappa '_1\) at the endpoints, and, as a consequence, there are no substantial differences between the two models as long as boundary conditions are similar.

Fig. 6
figure 6

Planar projections of elastic energy minimizers between two inducers, \(p_o=(0,0)\), \(\theta _o=120^{\circ }\), \(\kappa _o=1\), and, \(p_1=(1,0)\), \(\kappa _1=2\) when the final angle \(\theta _1\) varies from the initial value \(-90^{\circ }\) to \(-270^{\circ }\) in amounts of \(-30^{\circ }\)

Fig. 7
figure 7

Planar projections of minimizers for the total squared torsion energy between the inducers, \(p_o=(0,0)\), \(\theta _o=60^{\circ }\), \(\kappa _o=1\), and, \(p_1=(1,0)\), \(\kappa _1=2\) for a final angle \(\theta _1\) variation with stepsize \(-30^{\circ }\) from the initial value \(60^{\circ }\) to \(-330^{\circ }\). Here, no constraint is assumed on the values of the curvature \((\kappa '_o,\kappa '_1)\) derivatives at the endpoints

Fig. 8
figure 8

Planar projection of an elastic energy minimizer in the unit tangent bundle joining the inducer points \(p_o=(0,0)\), \(\theta _o=60^{\circ }\), \(\kappa _o=1\), and, \(p_1=(1,0)\), \(\theta _1=-210^{\circ }\) \(\kappa _1=2\), is shown in black. Then, projections of four minimizers of the total squared torsion, joining the same endpoints, but under additional boundary conditions of the curvature derivatives, are given: no constraint on \((\kappa '_o,\kappa '_1)\) (blue); \((\kappa '_o,\kappa '_1)=(1,free)\) (green); \((\kappa '_o,\kappa '_1)=(free,1)\) (red); and \((\kappa '_o,\kappa '_1)=(1,1)\) (magenta). (Color figure online)

In order to find significant differences, constraints on the values of the curvature derivatives must be imposed at the endpoints. In fact, a more direct comparison between the elastic and total squared torsion models is given in Figs. 8 and 9. In Fig. 8, we choose again the above two points \(p_o,p_1\) and we fix the following boundary conditions at both ends: \(\theta _o=60^{\circ }\), \(\kappa _o=1\) for \(p_o=(0,0)\); and \(\theta _1=-210^{\circ }\), \(\kappa _1=2\), for \(p_1=(1,0)\). Then, the planar projection of an elastic energy minimizer in the unit tangent bundle joining these two inducer points is shown in black. Moreover, projections of four minimizers of the total squared torsion, joining the same end points with same boundary conditions for angles and curvature, but under additional boundary conditions for the curvature derivatives, are given (note that these latter constraints make no sense for the elastic energy): A minimizer with no constraints on curvature derivatives at the ends, \(\kappa '_o,\kappa '_1\), is shown in blue; the curve in green is a minimizer with constraints \((\kappa '_o,\kappa '_1)=(1,free)\); constraints \((\kappa '_o,\kappa '_1)=(free,1)\) give rise to the curve in red; and finally, the minimizer in magenta corresponds to the choice \((\kappa '_o,\kappa '_1)=(1,1)\). It follows that there are no significant differences between the two models unless constraints on the values of the curvature derivatives are imposed at the endpoints.

A similar experiment is performed in Fig. 9. This time, the fix boundary conditions are: \(\theta _o=60^{\circ }\), \(\kappa _o=1\) at \(p_o=(0,0)\); and \(\theta _1=-210^{\circ }\), \(\kappa _1=1\) at \(p_1=(1,0)\). The planar projection of an elastic energy minimizer in the unit tangent bundle joining the inducer points is shown in cyan. Then, additional constraints on the curvature derivatives at the ends are considered for the total squared torsion energy, and projections of four minimizers of this energy, under different boundary conditions of the curvature derivatives, are given: with no constraint on \((\kappa '_o,\kappa '_1)\) appears in red; \((\kappa '_o,\kappa '_1)=(0,free)\) (green); \((\kappa '_o,\kappa '_1)=(free,0)\) (blue); and \((\kappa '_o,\kappa '_1)=(0,0)\) (violet). Finally, for comparison, an elastica under the same constraints but free departing curvature at \(p_o\) is shown in black.

Fig. 9
figure 9

Planar projection of an elastic energy minimizer in the unit tangent bundle joining the inducer points \(p_o=(0,0)\), \(\theta _o=60^{\circ }\), \(\kappa _o=1\), and, \(p_1=(1,0)\), \(\theta _1=-210^{\circ }\), \(\kappa _1=1\), is shown in cyan. Then, projections of four minimizers of the total squared torsion, joining the same endpoints, but under additional boundary conditions of the curvature derivatives, are given: no constraint on \((\kappa '_o,\kappa '_1)\) (red); \((\kappa '_o,\kappa '_1)=(0,free)\) (green); \((\kappa '_o,\kappa '_1)=(free,0)\) (blue); and \((\kappa '_o,\kappa '_1)=(0,0)\) (violet). The curve in black corresponds to an elastica under the same constraints but free departing curvature at \(p_o\). (Color figure online)

Fig. 10
figure 10

Projected minimizers of the total squared torsion energy showing inflection points

Another relevant difference between models is shown in Fig. 10. As remarked in previous Sect. 3, planar projections of length minimizers in the unit tangent bundle are a kind of spirals and do not show up inflection points on their trace (this fact seems to be supported also by physiological evidence [9]). As far as elastic and total squared torsion energies are concerned, our experiments show a different behavior. In fact, while we are not able to obtain planar projections of elastic minimizers with inflection points (points where curvature sign changes), it is possible to get, under suitable boundary conditions, planar projections of total squared torsion minimizers having inflection points (see Fig. 10).

5 Conclusions

Frenet–Serret curvatures’ dependent energies acting on spaces of curves in the unit tangent bundle \({\mathbb {R}}^2\times {\mathbb {S}}^1\), for example, length, elastic energy, total squared torsion energies and their linear combinations, play an important role in recent models describing the functional mechanism of the primary visual cortex V1. In particular, it turns out that Sub-Riemannian geodesics have to be lifts to \({\mathbb {R}}^2\times {\mathbb {S}}^1\) of curves in \({\mathbb {R}}^2\) which are critical for an elastic energy type functional. More generally, the variational problem associated with the latter curvature energy is considered for curves in Euclidean m-space. In this case, we compute the first variation formula and then, using the symmetries of the problem and a Noether- type argument, we obtain first integrals of the corresponding Euler–Lagrange equations. Combining them with symmetries again, we are able to determine the extremal curves (up to quadratures) in terms of the curvature of the solution curves. These facts can be translated to the plane, which is the case of interest in vision reconstruction by curve completion, and show now that Euler–Lagrange equations can be integrated obtaining the curvature of the critical curves, what guarantees explicit parametrization of the extremals. At this point, we are short of finding the value of the parameters involved in the solutions. Trying to determine these constants by using the boundary conditions lead us to serious technical problems.

To overcome these difficulties, we propose a numerical approach and use a gradient descent-based method implemented by our group somewhere else [7], which can be adapted to a large family of functionals, including the above-mentioned Frenet–Serret curvatures’ dependent energies of curves in \({\mathbb {R}}^2\times {\mathbb {S}}^1\). For the first type of energy we consider here, Sub-Riemannian geodesics, our results are in close agreement with those obtained by other authors [9]. Then, we extend the scope of our method by considering applications to elastic and total squared torsion energies. We analyze minimizers of both energies under similar boundary constraints, and we find no significant differences in their behavior unless curvature derivative boundary conditions are imposed on the latter. Under this additional boundary constraints, total squared torsion minimizers also show inflection points which do not show up (numerically) for the elastic energy problem.

Applications can also be extended to linear combinations of the above energies at no extra computational charge in XEL. Under the XEL-platform, it is possible to linearly combine the above functionals to create new ones and even switching the roles played by them. Thus, as a consequence of a Lagrange multiplier version, a given energy can be treated as an objective energy to be minimized under certain constraints within a functional, or as an isoperimetric constraint for other energies within the same functional. For instance, with nearly the same amount of effort, XEL can search for elasticae (ie, minimizers of the elastic energy) among curves of fixed length and/or torsion, or search for curves that minimize torsion between those of prescribed length and/or elastic energy, etc.