1 Introduction

In computer vision, it is common to extract salient curves in flat images via data-driven minimal paths or geodesics [1,2,3,4,5]. The minimizing geodesic is defined as the curve that minimizes the length functional, which is typically weighted by a cost function with high values at image locations with high curve saliency.

Another set of geodesic methods, partially inspired by the psychology of vision, was developed in [13, 14]. In these articles, sub-Riemannian (SR) geodesics in respectively the Heisenberg \({\text {H(3)}}\) and the Euclidean motion group \({\text {SE(2)}}\) are proposed as a model for contour perception and contour integration.

The combination of such contour perception models with data-driven geodesic methods has been presented in [40]. There, a computational framework for tracking of lines via globally optimal data-driven sub-Riemannian geodesics on the Euclidean motion group \({\text {SE(2)}}\) has been presented with comparisons to exact solutions [28].

In this work, we extend this framework for tracking of lines in spherical images (e.g., images of the retina, cf. Fig. 1). This requires a sub-Riemannian manifold structure in a different Lie group, namely the group \({\text {SO(3)}}\) (consisting of 3D rotations) acting transitively on the 2-sphere \(S^2\).

Fig. 1
figure 1

Photography of the retina. A part of the retina is projected onto the image plane. The camera coordinates are denoted by (XY), and object coordinates are denoted by \(({\bar{x}},{\bar{y}})\)

Here we study the problem \(\mathbf{P_{curve}}(\mathbf{S^2})\) of finding a smooth curve \(\mathbf {n}(\cdot )\) on a unit sphere \(S^2\) that satisfies given boundary conditions (both positions and velocities)

$$\begin{aligned} \mathbf {n}(0) = \mathbf {n}_0, \, \, \mathbf {n}(l) = \mathbf {n}_{1}, \quad \mathbf {n}'(0) = \mathbf {n}_0', \, \, \mathbf {n}'(l) = \mathbf {n}_1' \end{aligned}$$

and minimizes the functional

$$\begin{aligned} \int _0^l \mathfrak {C}(\mathbf {n}(s))\sqrt{\xi ^2 + k_g^2(s)} \, \mathrm{d} s, \end{aligned}$$

where \(k_g(\cdot )\) denotes the geodesic curvature of \(\mathbf {n}(\cdot ), s\) denotes the spherical arclength, and total length l is free, see Fig. 2. Furthermore, we include a curve-stiffness parameter \(\xi >0\). In the optimization functional, we also include an external cost factor \(\mathfrak {C}: S^2 \rightarrow {{\mathbb {R}}}^+\) adding for adaptation to a given spherical image data. We state this problem \(\mathbf{P_{curve}}(\mathbf{S^2})\) more explicitly in Sect. 2.2.

The problem \(\mathbf{P_{curve}}(\mathbf{S^2})\) is a spherical analog of a well-known problem \(\mathbf{P_{curve}}({{\mathbb {R}}}^2)\) [30, 31] (cf. Fig. 2) of finding a smooth curve \(\mathbf {x}(\cdot )\) on a plane \({{\mathbb {R}}}^2\) that satisfies given boundary conditions

$$\begin{aligned} \begin{array}{c c} \mathbf {x}(0) = \mathbf {x}_0 = (X_0,Y_0), \, \, &{} \, \, \mathbf {x}'(0) = \mathbf {x}_0'= (\cos {\varTheta }_0, \sin {\varTheta }_0), \\ \mathbf {x}(l) = \mathbf {x}_{1}= (X_1,Y_1), \, \, &{} \, \, \mathbf {x}'(l) = \mathbf {x}_1'= (\cos {\varTheta }_1, \sin {\varTheta }_1), \end{array} \end{aligned}$$

and minimizes the functional

$$\begin{aligned} \int _0^l \mathfrak {c}(\mathbf {x}(s))\sqrt{\xi ^2 + k^2(s)} \, \mathrm{d} s, \end{aligned}$$

where k(s) denotes the curvature, l denotes the total length, and curve stiffness is regulated by \(\xi >0\). The external cost factor \(\mathfrak {c}: {{\mathbb {R}}}^2 \rightarrow {{\mathbb {R}}}^+\) is added for adaptation to a given flat image data (see [40]).

Fig. 2
figure 2

Left: problem \(\mathbf{P_{curve}}(\mathbf{S^2})\): for given boundary conditions on a 2D sphere (both positions and velocities), we aim to find a curve minimizing the functional compromising length and geodesic curvature. In the optimization functional, we also include an external cost induced by spherical image data. Right: problem \(\mathbf{P_{curve}}({{\mathbb {R}}}^2)\) [30, 31]: for given boundary conditions on a 2D plane, to find a curve minimizing the compromise between length and curvature. The external cost factor is added for adaptation to flat image data (see [40]).

There are three motivations for our study. The first motivation comes from a medical image analysis application, where automatic extraction of the vascular retinal tree on images is helpful for early detection of many diseases, such as diabetic retinopathy, glaucoma, atherosclerosis, and others (see, e.g., [6, 18]). Optical retinal images are mostly acquired by flat cameras, and as a result, distortion appears. Such distortion could lead to questionable (distorted) geometrical features (vessel curvature, thickness, etc.) that are used as biomarkers [6, 10, 11] for different diseases. We will show that the distortion that appears near the boundary of a flat image can play a significant role in the quantitative analysis of the vascular structure and its curvature. As the retina itself is not flat, we should include the spherical geometry both in image processing and in image representation in order to avoid distortion. Such distortion comes from the central projection of the physical retinal surface to the image plane. It is illustrated in Fig. 1, where (XY) denote Cartesian camera coordinates and \(({\bar{x}},{\bar{y}})\) denote spherical object coordinates. This motivates us to study data-driven SR geodesics on the rigid body rotation group \({\text {SO(3)}}\) and their spherical projections; likewise, it was done (see [39, 40]) for flat images and lifting to the roto-translation group \({\text {SE(2)}}\).

The second motivation comes from models of the visual system of mammals. As mentioned by Boscain and  Rossi [15], the problem \(\mathbf{P_{curve}}(\mathbf{S^2})\) can be considered as a spherical extension of a (flat) cortical-based model \(\mathbf{P_{curve}}({{\mathbb {R}}}^2)\) for perceptual completion, proposed by Citti and Sarti [14], and Petitot [13]. Such a spherical extension is again motivated by the fact that the retina is not flat. By the same argument, cuspless SR geodesics in \({\text {SO(3)}}\) could provide a model of association fields in the psychology of vision (see [31]). Note that nonuniform distribution of photoreceptors on the retina can be included in our model by putting an external cost \(\mathfrak {C}\) on a hemisphere.

The third motivation for this study is that in geometric control theory optimal synthesis for the SR problem in \({\text {SO(3)}}\) has not been achieved in the general case (not even for the case of uniform cost \(\mathfrak {C}=1\)), despite many strong efforts in this direction [15, 19,20,21,22,23, 44, 45]. In this paper, we will not provide optimal synthesis analytically, but instead we do provide a HJB theory for computing globally optimal (data-driven) geodesics. In previous works [39, 40], we achieved this for SR geodesics in \({\text {SE(2)}}\), used for tracking of blood vessels in flat 2D images.

In view of these three motivations, we lift the problem \(\mathbf{P_{curve}}\) on the set \(S^2\) to a SR problem on the group \({\text {SO(3)}}\), which we will call \(\mathbf{P_{mec}}\), and we provide explicit formulas for SR geodesics. This allows us to describe the set of endpoints in \({\text {SO(3)}}\) reachable by geodesics whose spherical projections do not contain cusps. Furthermore, we present a Hamilton–Jacobi–Bellman PDE theory that allows us to numerically compute the SR distance map, from which a steepest descent backtracking (via the Pontryagin maximum principle) provides only the globally optimal geodesics for general external cost and general \(\xi >0\). We verify our numerical solution, by comparison with exact geodesics in the case \(\mathfrak {C}=1\). Finally, we use these results in a vessel tracking algorithm in spherical images of the retina, without central projection distortion.

The main contributions of this article are:

  • New formulas for the geodesics of \(\mathbf{P_{curve}}(\mathbf{S^2})\) for the uniform cost case \(\mathfrak {C}=1\).

  • Analysis and parametrization of cusp points arising in spherical projections of geodesics of \(\mathbf{P_{mec}}({\text {SO(3)}})\).

  • A new HJB-PDE theory for the numeric computation of globally optimal geodesics of \(\mathbf{P_{curve}}(\mathbf{S^2})\) and \(\mathbf{P_{mec}}({\text {SO(3)}})\) for the general external cost case, with verification for \(\mathfrak {C}=1\).

  • Tracking of lines in spherical image data (e.g., retinal images) without central projection distortion, with comparison to tracking of lines in flat image data.

1.1 Vessel Tracking in Spherical Images of the Retina

In this subsection, we first describe the mapping from object coordinates on the retina to camera coordinates, and then we discuss the relevance of considering spherical images of the retina rather than flat images, which are commonly used in the medical application (see Fig. 1). We show that distortion appears inevitably on flat images, with a significant relative error (up to 7%) in length measures. Even larger relative errors (over 20%) appear in the application of differential operators (used for vessel detection).

We base our computations on the reduced schematic eye model (see Fig. 3), which is commonly used in clinical ophthalmology (see, e.g., [42]). Let R be the radius of an eyeball, a be the distance from the nodal point N to the center C, and \(\psi \) be the angle between visual axis and a light ray passing through N. Here we consider a simplified model, where the optical axis (the best approximation of a line passing through the optical center of the cornea, lens, and fovea) coincides with the visual axis (the line connecting fixation point and the fovea).Footnote 1 The average radius of a human eye is \(R \approx 10.5\) mm, and the maximum distance between nodal point N and the central point C is \(a_\mathrm{max} = 17\, \text {mm} - 10.5\,\text {mm} = 6.5\,\text {mm}\).

Fig. 3
figure 3

Top: schematic eye [42] and central projection of images onto the retina. Here \(R \approx 10.5\)mm. Bottom: schematic eye, enlarged to support Eq. (1)

Now we switch to mathematical object coordinates of the retina where we use the eyeball radius to express lengths, i.e., we have \(R=1\) and \(a_\mathrm{max} = \frac{6.5\, \text {mm}}{10.5 \,\text {mm}}\cdot R = \frac{13}{21}\) in dimensionless coordinates.

In order to compute the maximum absolute angle \({\bar{y}}_\mathrm{max}\), let us express the angle \(|{\bar{y}}|\) with respect to center of the eyeball (see right Fig. 3). Expressing the squared length of segment NQ yields

$$\begin{aligned} (a+R \cos |{\bar{y}}|)^2 \cos ^{-2}\psi = (a+R\cos |{\bar{y}}|)^2 + R^2 \sin ^2 |{\bar{y}}|. \end{aligned}$$

Solving this equation with respect to \(\cos |{\bar{y}}|\), we obtain unique nonnegative solution:

(1)

A standard fundus camera used for producing of the retinal images has the angular range \(\psi \in [-\frac{\pi }{8}, \frac{\pi }{8}]\). Thus, substitution \(R = 1, a = \frac{13}{21}\), and \(\psi = \frac{\pi }{8}\) in Eq. (1) gives the maximum angle

$$\begin{aligned} {\bar{y}}_\mathrm{max} \approx 0.63 \text {rad} \approx 36^{\circ }. \end{aligned}$$
(2)

We rely on the following parameterization of the image sphere \(S^2\) and the retinal sphere \({\bar{S}}^2\) (see Fig. 4):

$$\begin{aligned} \begin{array}{l} S^2 \ni \mathbf {n}(x,y) = \left( \cos x \cos y, \, \cos x \sin y, \, \sin x \right) ^T,\\ {\bar{S}}^2 \ni \left( -2 a, 0,0\right) ^T-\left( \cos {\bar{x}} \cos {\bar{y}}, \, \cos {\bar{x}} \sin {\bar{y}}, \, \sin {\bar{x}} \right) ^T,\\ \end{array} \end{aligned}$$

with \(x, {\bar{x}} \in [-\frac{\pi }{2}, \frac{\pi }{2}]\) and \(y, {\bar{y}} \in [-\pi , \pi ]\).

Next we present the explicit relation between the object coordinates \(({\bar{x}},{\bar{y}})\)—spherical coordinates on a unit sphere \({\bar{S}}^2\) representing the surface of the eyeball; flat photo coordinates (XY)—Cartesian coordinates on the image plane and the spherical coordinates (xy) on the image sphere, see Figs. 1 and 4.

To take into account the distance from the eyeball to the camera in our model, we introduce a parameter \(\eta >0\). In Fig. 4, by setting \(\eta =1\) we fix the distance equal to \((a + c)\) radiuses of the eyeball. This corresponds to the case when the image sphere \(S^2\) is obtained by reflection of the physical retinal sphere \({\bar{S}}^2\) through the point \((-a,0,0)^T \in {{\mathbb {R}}}^3\). In this case, we have

$$\begin{aligned} (x,y) = ({\bar{x}},{\bar{y}}), \end{aligned}$$
(3)

and we will always rely on this identification in the sequel. The general case \(\eta >0\) can be taken into account by congruency and scaling \(X \mapsto \eta R X, Y \mapsto \eta R Y\).

Fig. 4
figure 4

Spherical object coordinates \(({\bar{x}},{\bar{y}})\) on a retina, Cartesian camera coordinates (XY) on a flat image of the retina, and spherical camera coordinates (xy) on a spherical image of the retina

The central projection \({\varPi }\) (cf. Fig. 1) from (xy) to (XY) including the scaling factor \(\eta >0\) (with physical dimension length in units of R) is given by

$$\begin{aligned} X = \frac{(a+c)\sin x}{a+ \cos {x} \cos {y}} \eta , \quad Y = \frac{(a+c)\cos x \sin y}{a+\cos x \cos y} \eta . \end{aligned}$$
(4)

The inverse mapping \({\varPi }^{-1}\) from (XY) to (xy) for \(\eta =1\) is given by

$$\begin{aligned} \begin{array}{l} x = \arcsin (X {\bar{p}}(X,Y)), \\ y = \arg (p_1(X,Y) + \mathrm {i}\; Y {\bar{p}}(X,Y)), \end{array} \end{aligned}$$
(5)

where

$$\begin{aligned} {\bar{p}}(X,Y)= & {} \frac{a(a+c) +{\varXi }_{a,c}(X,Y)}{(X^2+Y^2) + (a+c)^2}, \\ p_1(X,Y)= & {} \frac{(a+c){\varXi }_{a,c}(X,Y)-a(X^2+Y^2)}{(X^2+Y^2)+(a+c)^2}, \end{aligned}$$

with \({\varXi }_{a,c}(X,Y) = \sqrt{(X^2+Y^2)(1-a^2) + (a+c)^2}\).

In these formulas, we need to substitute \(a = a_\mathrm{max} = \frac{13}{21}\) and \(c=\frac{4}{5}<R=1\), depicted in Fig. 4, where we work in dimensionless coordinates.

1.1.1 Quantification of Local and Global Deformation

The local deformation from spherical photo coordinates (xy) to planar photo coordinates (XY) is now given by the Jacobian

$$\begin{aligned} \begin{array}{l l} J(x,y) &{} = \det \left( \begin{array}{c c} \frac{\partial {X}}{\partial x}(x,y) &{} \frac{\partial {X}}{\partial y}(x,y) \\ \frac{\partial {Y}}{\partial x}(x,y) &{} \frac{\partial {Y}}{\partial y}(x,y) \end{array} \right) \\ &{} = \displaystyle \frac{(a + c)^2 \cos x (1 + a \cos x \cos y)}{(a + \cos x \cos y)^3} \eta ^2. \end{array} \end{aligned}$$

In mathematical analysis, we can set \(\eta =1\); however, in experiments \(\eta \) is to be taken into consideration. Note that for \(\eta =1\) we have

$$\begin{aligned} 0.77 \approx J(0,0) \le J(x,y) \le J(y_\mathrm{max},y_\mathrm{max}) \approx 1.1, \end{aligned}$$

showing that local deformation plays a considerable role and varies in (xy).

Next we consider the global distortion along the line \(x=0\). It is defined as \({\mathcal {GD}}(y) = \frac{|y-Y(0,y)|}{|y|}\), and it has a maximum when \(y = y_\mathrm{max}\). We have

$$\begin{aligned} 0\le {\mathcal {GD}}(y) \le {\mathcal {GD}}(y_\mathrm{max}) \approx 0.07, \end{aligned}$$

and we see the distortion up to 7% along the line \(x=0\). The same holds along the line \(y=0\).

We conclude that it makes a considerable difference to study \(\mathbf{P_{curve}}(\mathbf{S^2})\) or \(\mathbf{P_{curve}}({{\mathbb {R}}}^2)\) in the retinal imaging application. In the sequel, we will write \(\mathbf{P_{curve}}\) instead of \(\mathbf{P_{curve}}(\mathbf{S^2})\) as we will always be concerned with the case where the base manifold equals \(S^2\).

2 Problem \(\mathbf{P_{curve}}\) on \(S^2\) and \(\mathbf{P_{mec}}\) in \({\text {SO(3)}}\)

In this section, we first provide preliminaries on group theoretical tools and notation, and then we show that the spherical projection of certain SR geodesics \(\gamma (\cdot )\) on the Lie group \({\text {SO(3)}}\) provides solution curves to the problem \(\mathbf{P_{curve}}\) on \(S^2\), which we formulate next.

2.1 Mathematical Foundation and Notations

The Lie group \({\text {SO(3)}}\) is the group of all rotations about the origin in \({{\mathbb {R}}}^3\). We shall denote a counterclockwise rotation around axis \(\mathbf {a} \in S^{2}\) with angle \(\varphi \) via \(R_{\mathbf {a},\varphi }\), in particular for rotations around standard axes

$$\begin{aligned} \mathbf {e}_{1}=(1,0,0)^{T},\quad \mathbf {e}_{2}=(0,1,0)^T,\quad \mathbf {e}_{3}=(0,0,1)^T. \end{aligned}$$

We use representation of \({\text {SO(3)}}\) by \(3 \times 3\) matrices

(6)

where we denote \(cx = \cos x, cy = \cos y, c{\theta }= \cos {\theta }, sx = \sin x, sy = \sin y, {{\text {s}}\theta }= \sin {\theta }\), and where

$$\begin{aligned} (x,y,\theta ) \in \left[ -\frac{\pi }{2}, \frac{\pi }{2}\right] \times {{\mathbb {R}}}/\{2 \pi {{\mathbb {Z}}}\} \times {{\mathbb {R}}}/\{2 \pi {{\mathbb {Z}}}\}. \end{aligned}$$
(7)

The Lie group \({\text {SO(3)}}\) defines an associated Lie algebra

where \(T_{{\text {Id}}}({\text {SO(3)}})\) denotes the tangent space at the unity element \(e \in {\text {SO(3)}}\), represented by identity matrix \({\text {Id}}\), which corresponds to the origin in the parameter space

$$\begin{aligned} e \, \, \sim \, \, {\text {Id}}\, \, \sim \, \, \{(x,y,\theta ) = (0,0,0)\}. \end{aligned}$$

Remark 1

The formula for \(A_i\) follows by

The nonzero Lie brackets are given by

$$\begin{aligned}{}[A_1, A_2] = A_3, \quad [A_1, A_3] = -A_2, \quad [A_2, A_3] = A_1. \end{aligned}$$
(8)

There is a natural isomorphism between \({\text {so(3)}}\) and the Lie algebra \({\text {L}}\) of left-invariant vector fields in \({\text {SO(3)}}\), where commutators of the vector fields in \({\text {L}}\) correspond to the matrix commutators in \({\text {so(3)}}\)

$$\begin{aligned}{}[R A, R B] = R [A,B], \quad A,B \in {\text {so(3)}}, \, R \in {\text {SO(3)}}. \end{aligned}$$
(9)

We express \({\text {L}}\) in matrix form as

(10)

Remark 2

Note that at the unity one has

The formulas for \(X_i\) in (10) follow by (cf. Remark 1)

We also use the isomorphism between \({\text {so(3)}}\) and \({{\mathbb {R}}}^3\)

$$\begin{aligned} A_i \sim \mathbf {e}_i,\quad R A_i R^{-1} \sim R \mathbf {e}_i, \end{aligned}$$
(11)

where \(A_i \in {\text {so(3)}}, R \in {\text {SO(3)}}, \mathbf {e}_i \in {{\mathbb {R}}}^3, \, i = 1,2,3.\)

Note that (6) is a product of matrix exponentials:

$$\begin{aligned} R(x,y,\theta ) = {\text {e}}^{y A_3} {\text {e}}^{-x A_2} {\text {e}}^{\theta A_1}. \end{aligned}$$
(12)

We choose to rely on this parameterization to keep the analogy with previous \({\text {SE(2)}}\) models [28, 31, 40] mentioned in introduction.

2.2 Statement of the Problem \(\mathbf{P_{curve}}\)

Let \(S^{2} = \{\mathbf {n} \in {{\mathbb {R}}}^3 \, \big | \, \Vert \mathbf {n}\Vert = 1\}\) be a sphere of unit radius. We consider the problem \(\mathbf{P_{curve}}\) (see Fig. 2), which is for given boundary points \(\mathbf {n}_0, \mathbf {n}_1 \in S^2\) and directions \(\mathbf {n}_0' \in T_{\mathbf {n}_0}(S^2), \mathbf {n}_1' \in T_{\mathbf {n}_1}(S^2), \Vert \mathbf {n}_0'\Vert = \Vert \mathbf {n}_1'\Vert =1\) to find a smooth curve \(\mathbf {n}(\cdot ):[0,l]\rightarrow S^2\) that satisfies the boundary conditions

$$\begin{aligned} \mathbf {n}(0) = \mathbf {n}_0, \ \mathbf {n}(l) = \mathbf {n}_{1}, \quad \mathbf {n}'(0) = \mathbf {n}_0', \ \mathbf {n}'(l) = \mathbf {n}_1', \end{aligned}$$
(13)

and for given \(\xi >0\) minimizes the functional

$$\begin{aligned} {\mathcal {L}}(\mathbf {n}(\cdot )) := \int _0^l \mathfrak {C}(\mathbf {n}(s))\sqrt{\xi ^2 + k_g^2(s)} \, \mathrm{d} s, \end{aligned}$$
(14)

where \(k_g(s)\) denotes the geodesic curvature on \(S^{2}\) of \(\mathbf {n}(\cdot )\) evaluated in time s, and \(\mathfrak {C}: S^2 \rightarrow [\delta ,+\infty ), \delta >0\), is a smooth function that we call “external cost.”

Here the total length l is free and \(s=\int _0^s 1 \, \mathrm{d} \sigma = \int _0^s \Vert \mathbf {n}'(\sigma )\Vert \, \mathrm{d} \sigma \) denotes the spherical arclength. Thus, we have \(\Vert \mathbf {n}'(s)\Vert =1\) and the Gauss–Bonnet formula

$$\begin{aligned} k_g(s) = \mathbf {n}''(s)\cdot (\mathbf {n}(s) \times \mathbf {n}'(s)). \end{aligned}$$
(15)

Remark 3

In introduction, we provided two motivations for this problem, where the external cost \(\mathfrak {C}\) plays a different role. Firstly, there is a motivation coming from retinal images, where \(\mathfrak {C}\) is adapted to spherical image data. Secondly, there is a motivation from the modeling of human vision, where the nonuniform distribution of photoreceptors can be modeled by the external cost.

Remark 4

Without loss of generality, we can fix the boundary conditions as

$$\begin{aligned} \mathbf {n}(0) = \mathbf {e}_1, \, \, \mathbf {n}(l) = \mathbf {n}_{1} , \quad \mathbf {n}'(0) = \mathbf {e}_3, \, \, \mathbf {n}'(l) = \mathbf {n}_1', \end{aligned}$$
(16)

since the problem is left-invariant w.r.t. the natural left action of \({\text {SO(3)}}\) onto \(S^{2}\) for \(\mathfrak {C}=1\). But also for \(\mathfrak {C}\ne 1\) we can fix these boundary conditions by shifting the external cost. This boundary value convention is used throughout this article for \(\mathbf{P_{curve}}\).

Remark 5

Following the previous works [30, 31] in \({\text {SE(2)}}\) group, we do not expect existence of minimizers for the problem \(\mathbf{P_{curve}}(\mathbf{S^2})\) in general.

2.3 Statement of \(\mathbf{P_{mec}}\) Problem in \({\text {SO(3)}}\)

We call \(\mathbf{P_{mec}}\) the following SR problem in \({\text {SO(3)}}\):

$$\begin{aligned} \dot{R}= & {} - u_1 R A_2 + u_2 R A_1, \end{aligned}$$
(17)
$$\begin{aligned} R(0)= & {} {\text {Id}}, \qquad R(T) = R_{fin}, \end{aligned}$$
(18)
$$\begin{aligned} {\mathcal {L}}(R(\cdot )):= & {} \int \limits _{0}^{T} C(R(t))\sqrt{\xi ^2 u_1^2(t) + u_2^2(t)}\, \mathrm{d} t \rightarrow \min , \end{aligned}$$
(19)
$$\begin{aligned} R\in & {} {\text {SO(3)}}, \quad (u_1, u_2) \in {{\mathbb {R}}}^2, \quad \xi >0, \end{aligned}$$
(20)

with \(T>0\) free.

The external cost \(C:{\text {SO(3)}}\rightarrow [\delta , +\infty ), \delta >0\), is a smooth function that is typically obtained by lifting the external cost \(\mathfrak {C}\) from the sphere \(S^2\) to the group \({\text {SO(3)}}\), i.e., \(C(R) = \mathfrak {C}(R \, \mathbf {e}_1)\).

We study the problem \(\mathbf{P_{mec}}\) for \(C=1\) (case of uniform external cost) in Sect. 3, but let us first consider some preliminaries.

Remark 6

In \(\mathbf{P_{mec}}\), we only have two velocity controls \(u_1\) and \(u_2\) in a 3D tangent space \(T_{R(t)}({\text {SO(3)}})\) (cf. Fig. 5).

Remark 7

The existence of minimizers for the problem \(\mathbf{P_{mec}}\) is guaranteed by Chow-Rashevskii and Filippov theorems on sub-Riemannian manifolds [37]. Moreover, the geodesics of \(\mathbf{P_{mec}}\) are smooth, since there are no abnormal extremals (see Example 1.3.13 in [49]).

Remark 8

Sub-Riemannian manifolds are commonly defined by a triplet \(({\mathcal {M}}, {\varDelta }, {\mathcal {G}})\), with manifold \({\mathcal {M}}\), distribution \({\varDelta } \subset T({\mathcal {M}})\) and metric tensor \({\mathcal {G}}\). In our case

$$\begin{aligned} \begin{array}{c} {\mathcal {M}}= {\text {SO(3)}},\quad {\varDelta } = {\text {span}}\{R A_1, R A_2\}, \\ {\mathcal {G}}({\dot{R}}, {\dot{R}}) = C^2(\cdot )\left( \xi ^2 u_1^2 + u_2^2\right) , \end{array} \end{aligned}$$
(21)

where the controls \(u_1\) and \(u_2\) are components of velocity vector w.r.t. moving frame of reference, see (17). The choice of the sub-Riemannian structure (21) is determined by the initial conditions \(n(0) = e_1\) and \(n'(0) = e_3\) in (16).

Remark 9

By virtue of Cauchy–Schwarz inequality, the problem of minimizing the sub-Riemannian length \({\mathcal {L}}\) is equivalent to the problem of minimizing the action functional

$$\begin{aligned} {\mathcal {E}}(R(\cdot ))= \int _{0}^{T} C^2(R(t)) \frac{\xi ^2 u_1^2(t) + u_2^2(t)}{2}\, dt \rightarrow \min , \end{aligned}$$
(22)

with T fixed (see, e.g., [33]).

Remark 10

In analogy with the SR problem \(\mathbf{P_{mec}}\) in \({\text {SE(2)}}\), cf. [30, 31], we sometimes call \(X_{1}=-R A_{2}\) the “spatial generator” and \(X_{2}=R A_{1}\) the “angular generator”, despite the fact that \(X_{1}\) and \(X_{2}\) are both angular generators on \(S^{2}\). The problem \(\mathbf{P_{mec}}({\text {SO(3)}})\) can be seen as a model of the Reeds-Shepp car on a sphere. The Reeds-Shepp car can move forward and backward and rotate on a place. The input \(u_1\) controls the motion along \(X_1\), and the input \(u_2\) controls the motion along \(X_2\), see Fig. 5.

Fig. 5
figure 5

The controls \(u_1\) and \(u_2\) along the “spatial generator” \(X_1\) and the “angular generator” \(X_2\) (cf. Remark 10)

2.4 Relation Between the Problems \(\mathbf{P_{curve}}\) and \(\mathbf{P_{mec}}\)

We call a spherical projection the following projection map from \({\text {SO(3)}}\) onto \(S^{2}\) (see Fig. 6):

$$\begin{aligned} {\text {SO(3)}}\ni R \mapsto R \, \mathbf {e}_{1} \in S^2. \end{aligned}$$
(23)

In coordinates \((x,y,\theta )\) defined by (6), we have

$$\begin{aligned} R(x,y,\theta ) \, \mathbf {e}_{1}= \left( \begin{array}{c} \cos x \cos y \\ \cos x \sin y \\ \sin x \end{array} \right) = \mathbf {n}(x, y) \in S^2. \end{aligned}$$
(24)

So we see that (xy) are spherical coordinates on \(S^2\).

Fig. 6
figure 6

Left: illustration of the parameterizations used in \(\mathbf{P_{mec}}\) and \(\mathbf{P_{curve}}\). The rotations are parameterized by (12), i.e., by angles xy, and \(\theta \) of rotation about basis axes, see (6). Right: illustration of the Hopf fibration [45]—circle bundle with the base \(S^2\)

In problem \(\mathbf{P_{curve}}\), one is interested in a curve \(\mathbf {n}(s) = R(t(s)) \, \mathbf {e}_1\), which satisfies (13) and minimizes (14). Here \(R(t) = R(x(t),y(t),\theta (t))\), and

$$\begin{aligned} t(s) = \int _0^s \mathfrak {C}(\mathbf {n}(\sigma ))\sqrt{\xi ^2 + k_g^2(\sigma )} \mathrm{d} \, \sigma . \end{aligned}$$
(25)

Next we show that the spherical projection (23) of certain minimizers of \(\mathbf{P_{mec}}\) provides solution of problem \(\mathbf{P_{curve}}\). More precisely, this only holds for the minimizers whose spherical projection does not have a cusp.

Definition 1

The spherical projection of a minimizer of \(\mathbf{P_{mec}}\) is said to have a cusp at \(t=t^n_\mathrm{cusp}\) if there exists \(\epsilon >0\), s.t. \(u_{1}(a) u_{1}(b)<0\) for all \(a \in (t^n_\mathrm{cusp}-\epsilon , t^n_\mathrm{cusp})\) and \(b \in (t^n_\mathrm{cusp},t^n_\mathrm{cusp}+\epsilon )\). That is, if the control in front of the “spatial” generator \(X_{1}\) switches sign locally. We are interested in the first cusp time \(t_\mathrm{cusp} = \min \limits _{n \in {{\mathbb {N}}}} \{t^n_\mathrm{cusp}>0\}\), and we call \(s_\mathrm{max}\) the corresponding value of spherical arclength, s.t. \(t_\mathrm{cusp} = t(s_\mathrm{max})\) via (25).

Notice that if \(u_1 \equiv 0\) then the trajectory of \(\mathbf{P_{mec}}\) is projected at a single point on \(S^2\) which does not provide a solution to \(\mathbf{P_{curve}}\). This allows us to define \(s_\mathrm{max}\) as

$$\begin{aligned} s_\mathrm{max}= \inf \{s>0\, \big | \, u_1(t(s)) = 0\}, \end{aligned}$$
(26)

so that \(t_\mathrm{cusp}=t(s_\mathrm{max})\).

The following theorem states that minimizers \(\mathbf {n}(s)\) of \(\mathbf{P_{curve}}\) for \(s\in [0,s_\mathrm{max})\) are given by spherical projection of the minimizers R(t) of \(\mathbf{P_{mec}}\) for \(t \in [0, t_{cusp})\). Here s denotes the spherical arclength parameter, defined by \(\Vert \frac{\hbox {d}}{{\hbox {d}} s} \mathbf {n}(s)\Vert \equiv 1\), and t denotes the SR arclength, defined by \(C(R(t))\sqrt{\xi ^2 u_1^2(t) + u_2^2(t)} \equiv 1\).

Theorem 1

Let \(R(t), t \in [0,T]\) be a minimizer of \(\mathbf{P_{mec}}\) parameterized by SR arclength, and let the corresponding optimal control \((u_1(t),u_2(t))\) satisfy the inequality \(u_1(t)>0\) for all \(t\in [0,T]\). Set

$$\begin{aligned} {\left\{ \begin{array}{ll} \mathbf {n}_0 = \mathbf {e}_1, \qquad \mathbf {n}_1 = R(T)\, \mathbf {e}_1,\\ \mathbf {n}_0' = \mathbf {e}_3, \qquad \mathbf {n}_1' = R(T)\, \mathbf {e}_3. \end{array}\right. } \end{aligned}$$
(27)

Then for such boundary conditions, \(\mathbf{P_{curve}}\) has a minimizer \(\mathbf {n}(s)\), along which we have

$$\begin{aligned}&\mathbf {n}(s) = R(t(s)) \, \mathbf {e}_1, \quad {\left\{ \begin{array}{ll} u_1(t)= \frac{{\hbox {d}} s}{\mathrm{d} t}(t),\\ u_2(t)= k_g(s(t)) \frac{{\hbox {d}} s}{\mathrm{d} t}(t) , \end{array}\right. } \end{aligned}$$
(28)
$$\begin{aligned}&t(s) = \int _0^s \mathfrak {C}(\mathbf {n}(\sigma )) \sqrt{\xi ^2 + k_g^2(\sigma )} \, \mathrm{d} \, \sigma , \end{aligned}$$
(29)

for \(0\le s\le l< s_\mathrm{max}\), and \(T = t(l)\).

Proof

See Appendix 1. \(\square \)

3 The Sub-Riemannian Problem \(\mathbf{P^{1}_{mec}}\) in \({\text {SO(3)}}\)

In this section, we study the problem \(\mathbf{P_{mec}}\) in the special case of uniform external cost \(C=1\), which we call \(\mathbf{P_{mec}^1}\). This problem can be seen as a left-invariant SR problem in Lie group \({\text {SO(3)}}\), and it was tackled by many authors (see [15, 20,21,22,23, 44, 45]) in different contexts. It is remarkable that the statement of the problem is very simple, but due to the high complexity of the formulas describing geodesics, the minimizers are still unknown for general \(\xi >0\). The case \(\xi =1\) corresponds to a symmetric SR structure in \({\text {SO(3)}}\), and it was completely solved in [15, 20, 30, 44, 45]. In this section, we consider the general case \(\xi >0\) and derive analytic formulas for the geodesics using the parametrization (6) for \({\text {SO(3)}}\). Further, in Sect. 5 these formulas allow us to verify our numerical approach to compute the global minimizers of \(\mathbf{P_{mec}}\), presented for the first time by knowledge of the authors.

In our analytical study, first we introduce a coordinate chart in \({\text {SO(3)}}\) and write the optimal control problem \(\mathbf{P_{mec}^1}\) in this chart. Then we apply Pontryagin maximum principle (PMP), which is the first-order necessary condition for optimality [37], and we derive the explicit formulas for the sub-Riemannian geodesics. Afterward we explain the notion of sub-Riemannian wavefront and sphere. Finally, we discuss what is known about optimality of the geodesics.

3.1 \(\mathbf{P_{mec}^1}\) as Optimal Control Problem on \(S^2 \times S^1\)

In this section, we introduce the chart in \({\text {SO(3)}}\) and formulate problem \(\mathbf{P_{mec}^1}\) given by (17)–(20), see Sect. 2.3, as an optimal control problem on \({\mathcal {M}}=S^2_{x,y}\times S^1_{\theta }\), where \((x,y) \in [-\frac{\pi }{2},\frac{\pi }{2}] \times {{\mathbb {R}}}/\{2 \pi {{\mathbb {Z}}}\}\) are the spherical coordinates, cf. (24), and \(\theta \in {{\mathbb {R}}}/\{2 \pi {{\mathbb {Z}}}\}\). We use this specific chart to stress the analogy with the closely related problem in \({\text {SE(2)}}\) group (see [30, 31]).

Consider a smooth curve \(\gamma (\cdot ) = (x (\cdot ),y (\cdot ),\theta (\cdot )) \in C^{\infty }({{\mathbb {R}}}, S^2_{x,y} \times S^1_{\theta })\) departing from the origin, i.e., \(\gamma (0) = e= (0,0,0)\). In Sect. 2.1, we parameterized the group \({\text {SO(3)}}\) by the angles \(x, y, \theta \), recall (6). A smooth curve \(\gamma (\cdot )\) corresponds to a smooth curve \(R(\cdot )\) in \({\text {SO(3)}}\) defined by the one-parameter family of matrices

$$\begin{aligned} R(t) = R(x(t),y(t),\theta (t))\in {\text {SO(3)}}, \end{aligned}$$
(30)

depending smoothly on the parameter \(t\in {{\mathbb {R}}}\) and satisfying the initial condition \(R(0) = {\text {Id}}\). A tangent vector of \(R(t) = R(x(t),y(t),\theta (t))\) is expressed as

$$\begin{aligned} {\dot{R}} = \frac{\partial R}{\partial x} \dot{x} + \frac{\partial R}{\partial y} \dot{y} + \frac{\partial R}{\partial \theta } {\dot{\theta }}. \end{aligned}$$

Therefore, the control system (17) can be rewritten as

$$\begin{aligned} \dot{\gamma }= \left( \begin{array}{c} {\dot{x}}\\ {\dot{y}}\\ \dot{\theta } \end{array}\right) =\left( \begin{array}{c} \cos \theta \\ -\sec x \sin \theta \\ \tan x \sin \theta \end{array}\right) u_{1}+\left( \begin{array}{c} 0\\ 0\\ 1 \end{array}\right) u_{2}. \end{aligned}$$
(31)

Vector fields near the controls \(u_i\) are two of three of the basis left-invariant vector fields in \({\text {SO(3)}}\) expressed in our chart. We denote them by \(X_1, X_2\), and the third basis left-invariant vector field is given by their commutator \(X_3 = [X_1,X_2]\). Thus we have

(32)

Then problem \(\mathbf{P_{mec}^1}\) given by (17)–(20) for \(C=1\), taking into account Remark 9, is equivalent to the following optimal control problem:

$$\begin{aligned} {\dot{\gamma }}= & {} u_1 X_1 + u_2 X_2, \quad (u_1, u_2) \in {{\mathbb {R}}}^2 \end{aligned}$$
(33)
$$\begin{aligned} \gamma (0)= & {} e,\quad \gamma (T) = \nu _{fin} = (x_1, y_1,\theta _1) \in S^2 \times S^1, \end{aligned}$$
(34)
$$\begin{aligned} {\mathcal {E}}= & {} \frac{1}{2} \int _{0}^{T}\left( \xi ^2 u_1^2 + u_2^2\right) \, \mathrm{d} \,t \rightarrow \min , \quad \xi >0. \end{aligned}$$
(35)

Remark 11

A projective version of problem \(\mathbf{P^1_{mec}}\) with \(\xi =1\) is studied in [16]. It is obtained by identification of antipodal directions \(\theta \) and \(\theta + \pi \); thus, its solution is given by minimum between two geodesics with terminal configurations \(h = (x_1,y_1,\theta _1)\) and \({\bar{h}} = (x_1,y_1,\theta _1 +\pi )\). The associated SR distance is given by

$$\begin{aligned} d^P(g,h) = \min \limits _{ \begin{array}{c} \gamma (\cdot )\in {\text {Lip}}([0,T],{\text {SO(3)}}),\\ \gamma (0)=g, \gamma (T) \in \{h,{\bar{h}}\},\\ \dot{\gamma }(\cdot ) \in {\varDelta } \end{array}} {\mathcal {L}}(\gamma (\cdot )). \end{aligned}$$

The model in [16] is connected to problem \(\mathbf{P_{mec}^1}\) via right shift \(g \mapsto g\cdot e^{\pi A_3}e^{-\frac{\pi }{2} A_2}\). The local chart is obtained by linear transformation \(a = \frac{\pi }{2} - x, b = y, \theta = \xi + \pi \). The existence of optimal trajectories whose spherical projection contains a cusp is mentioned in [16].

3.2 Application of the Pontryagin Maximum Principle

In this subsection, we apply the Pontryagin maximum principle (PMP) to problem \(\mathbf{P_{mec}^1}\) given by (33)–(35) and derive the Hamiltonian system of PMP. Here we follow standard geometric control theory (see, e.g., [37]).

Due to the absence of abnormal extremals (see Remark 7), we consider only the normal case, where the control-dependent Hamiltonian of PMP reads as

$$\begin{aligned} \begin{array}{l} H_u(\lambda ,\nu ) = \langle \lambda , u_1 X_1 + u_2 X_2 \rangle -\frac{\xi ^2 u_1^2 + u_2^2}{2}, \\ \left. \qquad \qquad \qquad \qquad \qquad \text { with } \lambda = \sum \limits _{k=1}^{3} \lambda _k \mathrm{d} \, \nu ^k \in T^{*}_\nu {\mathcal {M}}. \right. \end{array} \end{aligned}$$

Here \(\nu = (x,y,\theta ), X_i\) are given by (32), \(\langle \cdot ,\cdot \rangle \) denotes the action of a covector on a vector, and \((\mathrm{d} \, \nu ^1, \mathrm{d} \, \nu ^2, \mathrm{d} \, \nu ^3) = (\mathrm{d} \, x, \mathrm{d} \, y, \mathrm{d} \, \theta )\) are basis one forms.

The maximization condition of PMP reads as

where u(t) denotes an extremal control and \((\lambda (t),\gamma (t))\) is an extremal.

Introduce left-invariant Hamiltonians \(h_i = \langle \lambda ,X_i \rangle , i = 1,2,3\). The maximization condition gives the expression for the extremal controls

$$\begin{aligned} u_1 = \frac{h_1}{\xi ^2},\qquad u_2 = h_2. \end{aligned}$$
(36)

Then the maximized Hamiltonian, which we call “the Hamiltonian”, reads as

$$\begin{aligned} H = \frac{1}{2} \left( \frac{h_1^2}{\xi ^2} +h_2^2 \right) . \end{aligned}$$
(37)

The vertical part (for momentum components \(h_i\)) of the Hamiltonian system of PMP is given by

$$\begin{aligned} {\dot{h}}_i = \left\{ H,h_i\right\} = \sum _{j=1}^3 \left( \frac{\partial H}{\partial \nu _j} \frac{\partial h_i}{\partial \lambda _j} - \frac{\partial h_i}{\partial \nu _j} \frac{\partial H}{\partial \lambda _j }\right) , \end{aligned}$$
(38)

where \(\{\cdot ,\cdot \}\) denotes the Poisson bracket (see [37]).

Using the standard relation between Poisson and Lie brackets \(\{h_i,h_j\} = \langle \lambda ,[X_i,X_j]\rangle \), we get

$$\begin{aligned} \left\{ H,h_1\right\}= & {} h_2 \left\{ h_2,h_1\right\} = - h_2 h_3, \\ \left\{ H, h_2\right\}= & {} \frac{1}{\xi ^2}\, h_1 \left\{ h_1,h_2\right\} = \frac{1}{\xi ^2}\, h_1 h_3,\\ \left\{ H,h_3\right\}= & {} \frac{1}{\xi ^2}h_1 \left\{ h_1,h_3\right\} + h_2 \left\{ h_2,h_3\right\} = \left( 1-\frac{1}{\xi ^2}\right) h_1 h_2. \end{aligned}$$

Thus the Hamiltonian system with the Hamiltonian H follows by the last three identities and (38):

(39)

with the boundary conditions

$$\begin{aligned} \begin{array}{l l l} h_1(0) = h_1^0, \,&{} \,h_2(0) = h_2^0, \, &{} \, h_3(0) = h_3^0, \\ x(0) = 0, \,&{}\, y(0) = 0, \,&{}\, \theta (0) = 0. \end{array} \end{aligned}$$
(40)

In (39), the horizontal part follows from (36) and (31).

It is known that the Hamiltonian system (39) is Liouville integrable [25, 27], and it was explicitly integrated in [19, 22]. In the next subsections, we classify the possible solutions by values of the parameter \(\xi \), and we adapt the explicit solution to our coordinate chart \((x,y,\theta ) \in {\mathcal {M}}\), where we follow the analogy to the closely related problem in \({\text {SE(2)}}\). This allows us to obtain simpler formulas than in [19, 22].

3.3 Classification of Different Types of Solutions

Here we describe the domains of parameter \(\xi >0\), which correspond to different dynamics of the Hamiltonian system (39). It is well known (see, e.g., [22]) that this system has two integrals of motion that depend only on momentum components \(h_i\) (see illustration in Fig. 7)

$$\begin{aligned} 2 H= & {} \frac{h_1^2}{\xi ^2} + h_2^2 = 1 \text { - the Hamiltonian, } \end{aligned}$$
(41)
$$\begin{aligned} M^2= & {} h_1^2 + h_2^2 + h_3^2 \text { - Casimir function.} \end{aligned}$$
(42)

Different values of the Hamiltonian H correspond to different speed along extremal trajectories \(\gamma (\cdot )\). By fixing the value \(H = \frac{1}{2}\) in (41), we use SR arclength parameter

$$\begin{aligned} t = \int _0^t \sqrt{{\mathcal {G}}|_{\gamma (\tau )}(\dot{\gamma }(\tau ),\dot{\gamma }(\tau ))}\, \mathrm{d} \,\tau = \int _0^t 1 \, \mathrm{d} \,\tau \end{aligned}$$

along extremal trajectories. The momentum trajectory h(t) can be seen as the curve formed by intersection of the cylinder \(H=\frac{1}{2}\) and the sphere \(M = \text {const}\) (see the yellow line in Fig. 7).

Fig. 7
figure 7

Top: integral manifolds of the vertical part of (39). The red sphere is a coadjoint orbit \(M^2=h^2_1+h^2_2+h^2_3\), and the green cylinder is the Hamiltonian \(2 H= \frac{h^2_1}{\xi ^2} + h^2_2 = 1\). Bottom: vector field plot on the \((h_2,h_3)\) plane (Color figure online)

Elimination of \(h_1\) from (41) and (42) yields

$$\begin{aligned} h_2^2(1 - \xi ^2) + h_3^2 = M^2-\xi ^2. \end{aligned}$$

Since \(h^2_2\le 1\), there exist the following types of solution of the vertical part of (39):

  1. 1)

    Elliptic for \(\xi <1, M^2>\xi ^2\);

  2. 2)

    Linear for \(\xi =1, M^2>\xi ^2\);

  3. 3)

    Hyperbolic for \(\xi>1, M^2\ne \xi ^2, M>1\);

  4. 4)

    A point (0,0) for \(\xi <1, M^2=\xi ^2\);

  5. 5)

    A segment of a straight line for \(\xi = 1, M=1\);

  6. 6)

    Two crossing segments of straight lines for \(\xi >1, M^2=\xi ^2\);

  7. 7)

    No solution otherwise.

According to this classification, we will refer to the case \(\xi <1\) as the elliptic case, \(\xi =1\) as the linear case, and \(\xi >1\) as the hyperbolic case.

3.4 Geodesics in SR Arclength Parametrization

In this subsection, we provide explicit formulas for the SR geodesics, where we reexamine results from [19, 22].

In the coordinates \((\beta , c) \in {{\mathbb {R}}}/\{4\pi {{\mathbb {Z}}}\} \times {{\mathbb {R}}}\), defined by

$$\begin{aligned} h_1 = \xi \cos \frac{\beta }{2}, \; \; h_2 = \sin \frac{\beta }{2}, \; \; h_3 = \frac{\xi c}{2}, \end{aligned}$$
(43)

the vertical part of (39) becomes a system of mathematical pendulum

$$\begin{aligned} {\left\{ \begin{array}{ll} \dot{\beta } = c, &{} \beta (0) = 2 \arg \left( \frac{h_1^0}{\xi } + \mathrm {i}h_2^0\right) ,\\ {\dot{c}} = -r \sin \beta , &{} c(0) = \frac{2 h_3^0}{\xi }, \end{array}\right. } \end{aligned}$$
(44)

where \(r = \frac{1}{\xi ^2} -1 \in (-1, +\infty )\). Thus \(r \in (-1, 0)\) corresponds to the elliptic, \(r = 0\) to the linear, and \(r \in (0,+\infty )\) to the hyperbolic case.

The system (44) has a symmetry \((\tilde{\beta }(t) = \beta (t) + \pi , \; {\tilde{r}} = -r)\), which allows us to study the elliptic case and obtain the hyperbolic case by symmetry observations. Note also that the linear case should be treated separately, but the equations in this case are much simpler. Therefore, in the remainder of this manuscript we restrict ourselves to the case \(r\ge 0 \Leftrightarrow 0<\xi \le 1\).

In the following theorem, we provide explicit formulas for SR geodesics in SR arclength parametrization.

Theorem 2

A solution of the system (39) reads as

(45)

where \((\beta (t), c(t))\) is a trajectory of (44), and

(46)

Proof

See Appendix 2. \(\square \)

Note that \((\beta (t), c(t))\), and \({\tilde{y}}(t)\) admit explicit expression in Jacobi elliptic functions and elliptic integrals of the first, second, and third kind [19]. We present plots of spherical projections (23) of extremal trajectories in Fig. 8. Here it is remarkable that the spherical projections of SR geodesics in \({\text {SO(3)}}\) can represent cusps, which can be undesirable for image analysis applications. This motivates us to study SR geodesics before the first cusp in their spherical projections. For short, we call such curves “cuspless geodesics.” In Sect. 4, we describe the possible end conditions, which can be connected by a cuspless geodesic, and in Sect. 5, we provide PDE-based approach for solving the boundary value problem (BVP) for data-driven SR geodesics, where we reformulate the problem as a solution to the SR-eikonal equation.

Fig. 8
figure 8

Spherical projection of various sub-Riemannian geodesics in \({\text {SO(3)}}\)

3.5 Sub-Riemannian Wavefronts and Spheres

A useful tool for studying geodesics in left-invariant optimal control problems is the exponential map Footnote 2 that maps an initial momentum h(0) and a time t to the endpoint of corresponding geodesic \(\gamma (\cdot )\) [i.e., the exponential map integrates the Hamiltonian system (39)]:

$$\begin{aligned} {{\mathrm{Exp}}}: \begin{array}{r l} T^*_e ({\text {SO(3)}}) \times {{\mathbb {R}}}&{} \rightarrow {\text {SO(3)}}, \\ (h(0),t) &{} \mapsto \gamma (t). \end{array} \end{aligned}$$
(47)

Now we explain the notion of wavefront. By definition, the wavefront consists of endpoints of all the geodesics of the same length T:

$$\begin{aligned} {{\mathrm{WF}}}(T) = \bigg \{ {{\mathrm{Exp}}}(h(0),T)\, \bigg | \, \begin{array}{l} h(0) \in T^{*}_{e} ({\text {SO(3)}}), \\ H(h(0))=\frac{1}{2} \end{array} \bigg \}. \end{aligned}$$
(48)

The outer surface of a wavefront forms a sub-Riemannian sphere, which is a set of endpoints equidistant from e:

$$\begin{aligned} {\mathcal {S}}(T)= & {} \big \{ {{\mathrm{Exp}}}(h(0),T) \, | \, h(0) \in T^{*}_{e} ({\text {SO(3)}}), \\ H(h(0))= & {} \frac{1}{2}, \, t_{cut}(h(0))\ge T\big \} \\= & {} \left\{ g \in {\text {SO(3)}}\, | \, d(e,g) = T\right\} , \end{aligned}$$

where \(d(q_1,q_2)\) denotes the sub-Riemannian distance between \(q_1\) and \(q_2\) and \(t_{cut}\) denotes the cut time, i.e., an instance of time, when a geodesic loses its optimality.

3.5.1 What Is Known About Optimality?

In the previous subsection, we computed SR geodesics or in other words extremal trajectories. It is known (see, e.g., [33, 37]) that sufficiently short arcs of SR geodesics are SR length minimizers (optimal trajectories). It is also known that in general a geodesic loses its optimality after a cut point. The corresponding instance of time is called cut time, and the set of all cut points in configuration space forms the so-called cut locus. In general, it is complicated to derive cut loci [37].

Remark 12

There are two reasons for a geodesic to lose optimality:

  1. 1)

    Local optimality is lost at a conjugate point (critical point of exponential map that integrates the Hamiltonian system);

  2. 2)

    Global optimality is lost at a first Maxwell point (when two geodesics meet with the same length for the first time).

In problem \(\mathbf{P_{mec}^1}\), both the Maxwell set and the conjugate locus are not known. The estimation of the first Maxwell time was given in [19], but still neither the cut locus, nor the SR length minimizers are known yet for general \(\xi >0\). The cut locus in a special case of the bi-invariant metric (for \(\xi =1\)) was obtained in [15]. In [22], conjugate locus in the Riemannian case was constructed, and by considering a SR metric as a limiting case of the Riemannian metric, the corresponding formulas for the conjugate locus in SR case could be obtained.

Here we do not provide such a limiting procedure. Instead, motivated by applications, in Sect. 5 we propose a numerical solution to compute the SR length minimizers and spheres. In Sect. 4, motivated by the study [31], we also give some statements on optimality of cuspless geodesics. We show that in contrast to \({\text {SE(2)}}\) case [30, 31] there exist nonoptimal cuspless SR geodesics.

4 Sub-Riemannian Geodesics in \({\text {SO(3)}}\) with Cuspless Spherical Projection

In this section, we study cuspless SR geodesics. Such geodesics allow parametrization by spherical arclength, which leads to simpler formulas than using SR arclength parametrization (see Sect. 3). Spherical arclength parameterization breaks down, when the spherical projection of a geodesic exhibits a cusp for the first time. So a natural question arises to characterize the set of end conditions \({\mathcal {R}} \subset {\text {SO(3)}}\) reachable by cuspless geodesics, similar to the \({\text {SE(2)}}\) case studied in [31].

The cuspless SR geodesics are projections in \({\text {SO(3)}}\) of the trajectories of the Hamiltonian system (39) that are going in positive direction of \(X_1\) (i.e., \(u_1(t)>0\)) before the first cusp time \(t<t_\mathrm{cusp}\). Thus, by virtue of (36) the cuspless constraint is given by

$$\begin{aligned} h_1(t)>0, \text { for all } t \in [0,T]. \end{aligned}$$

We shall often rely on short notation \(h_{i}(s):=h_{i}(t(s))\), where we stress our notations

$$\begin{aligned} h'_{i}= \frac{{\hbox {d}}}{{\hbox {d}}s}h_{i} \text { and } {\dot{h}}_{i}=\frac{{\hbox {d}}}{{\hbox {d}}t}h_i \end{aligned}$$

in order to avoid confusion with the chain law for differentiation. Recall (26) and note that \(s_\mathrm{max}\) for a given geodesics is determined by its initial momentum. We write \(s_\mathrm{max}(h(0))\) when we want to stress this dependence. We derive an explicit formula for \(s_\mathrm{max}(h(0))\) in Sect. 4.1.

Theorem 3

For any \(s \in [0,s_\mathrm{max}(h(0))), h_1(0)>0\) the system (39) is equivalent to the following system (see corresponding vector flow in Fig. 7):

(49)

with the boundary conditions

$$\begin{aligned} \begin{array}{l} h_2(0) = h_2^0, \qquad h_3(0) = h_3^0, \\ x(0) = 0, \,\, y(0) = 0, \,\, \theta (0) = 0. \end{array} \end{aligned}$$
(50)

Proof

Express the dynamics (39) in the spherical arclength parameter s. We have

Here we recall that \(u_{1} = \frac{{\hbox {d}} s}{{\hbox {d}} t}\), see (28), and \(h_1 = \xi ^2 u_1\), see (36). Thus we obtained the vertical part of (49). Doing the same for the horizontal part in (39), we obtain the full system (49), where the Hamiltonian \(H(s) = \frac{\xi ^{-2}h_1^2(s) + h_2^2(s)}{2} = \frac{1}{2}\) together with the cuspless constraint \(h_1(s)>0\) allows us to write \(h_1(s) = \xi \sqrt{1- h_2^2(s)}\).

Finally, the boundary conditions (50) follow from (40), since \(t = 0 \Leftrightarrow s =0\). \(\square \)

Note that in contrast to the mathematical pendulum ODEs (44) expressed in SR arclength t, where the Jacobi elliptic functions appear, the vertical part in s parameterization now is a simple linear system of ODEs integrated in elementary functions. To obtain simpler formulas, we define the parameter \(\chi \in {{\mathbb {C}}}\) (where one should take principal square root):

$$\begin{aligned} \chi =\sqrt{\xi ^2-1} = {\left\{ \begin{array}{ll} \sqrt{1-\xi ^2} \, \mathrm {i}, \text { for } 0<\xi <1,\\ \sqrt{\xi ^2-1} , \text { for } \xi \ge 1. \end{array}\right. } \end{aligned}$$
(51)

Theorem 4

The general solution of the vertical part in (49) for all \(\xi \ne 1\) is given by

$$\begin{aligned} {\left\{ \begin{array}{ll} h_2(s) = h_2^0 \cosh s \chi + \frac{h_3^0}{\chi } \sinh s \chi ,\\ h_3(s) = h_3^0 \cosh s \chi + \chi h_2^0 \sinh s \chi ,\\ h_1(s) = \xi \sqrt{1- h_2^2(s)}, \end{array}\right. } \end{aligned}$$
(52)

and for the case \(\xi =1\), we find straight lines parallel to \(h_2\) axis in the \((h_2,h_3)\)-phase portrait:

$$\begin{aligned} {\left\{ \begin{array}{ll} h_2(s) = h_2^0+h_3^0\, s, \\ h_3(s) = h_3^0, \\ h_1(s) = \sqrt{1- h_2^2(s)}. \end{array}\right. } \end{aligned}$$
(53)

Proof

The solution to the system of ODEs is unique and it is readily checked (52) is a solution of the vertical part of (49) for all \(\xi \ne 1\). For \(\xi <1\), we take main values for the complex square root and complex \(\sinh \) and \(\cosh \). For both \(\xi =1\) and \(\xi \downarrow 1\) and \(\xi \uparrow 1\), we have \(h_2(s) = h_2^0+h_3^0 s\) and \(h_3(s) = h_3^0\). \(\square \)

4.1 Computation of the First Cusp Time

To analyze the cusp points in problem \(\mathbf{P_{curve}}\), we need to determine \(s_\mathrm{max}(h(0))\). It is given, recall (26) and (36), by the minimal positive root of equation \(h_1(s) = 0\):

$$\begin{aligned} s_\mathrm{max}(h(0)) = \min \{s>0\,|\, h_1(s) = 0\}. \end{aligned}$$

Theorem 5

When moving along a SR geodesic \(t \mapsto \gamma (t)\), the first cusp time is computed as \(t_{cusp}(h(0)) = t(s_\mathrm{max}(h(0))\), recall (25), where

(54)

with \(s_1 = {\text {sgn}}\left( {\text {Re}}\left( h_2^0 \chi +h_3^0\right) \right) \) and \(\kappa = (h_3^0)^2+\left( 1-(h_2^0)^2\right) \chi ^2 \in {{\mathbb {R}}}.\)

As a result, in the SR manifold \(({\text {SO(3)}}, {\varDelta }, {\mathcal {G}})\), recall (21), there do exist nonoptimal cuspless geodesics.

Proof

See Appendix 3. \(\square \)

The presence of nonoptimal cuspless geodesics is remarkable, as in the \({\text {SE(2)}}\) group every cuspless geodesic is globally optimal [31].

4.2 Geodesics in Spherical Arclength Parametrization

In this subsection, we derive the formulas for cuspless SR geodesics in s parameterization.

Theorem 6

The unique solution of  (49) is defined for \(s \in [0, s_\mathrm{max}(h(0))]\), where \(s_\mathrm{max}(h(0))\) is given by (54). The solution to the vertical part is given by Theorem 4, and the solution to the horizontal part is given by

$$\begin{aligned} \begin{array}{l} x(s) = \arg (\sqrt{R_{11}^2(s) + R_{21}^2(s)} + \mathrm {i}R_{31}(s)), \\ y(s) = \arg (R_{11}(s) + \mathrm {i}R_{21}(s)), \\ \theta (s) = \arg (R_{33}(s) + \mathrm {i}R_{32}(s)), \end{array} \end{aligned}$$
(55)

where

Proof

It follows from Theoremes 23, and 4. Momentum component \(h_{1}\) is expressed in \(h_{2}\) via the Hamiltonian (37) which equals to \(\frac{1}{2}\) along SR geodesics. The sign of \(h_{1}(0)\) is equal to the sign of \(u_{1}(0)=\frac{ds}{dt}(0)\) and therefore nonnegative.

Regarding the integration constraints, we note that \(M^2=h^2_{1}+h^2_{2}+h^2_{3}\) and \(0\le h_{1}=\xi \sqrt{1-h^2_{2}}\) and

$$\begin{aligned} \frac{{\hbox {d}} {\tilde{y}}}{{\hbox {d}}s}= \frac{\xi ^2}{h_{1}} \frac{{\hbox {d}} {\tilde{y}}}{{\hbox {d}}t}= M^2 \left( \frac{h_{1}}{M^2- h^2_{2}}\right) = \xi M^2 \frac{\sqrt{1-h^2_2}}{M^{2}-h^2_{2}} \end{aligned}$$

from which the result follows. \(\square \)

Remark 13

In contrast to general SR geodesics in \({\text {SO(3)}}\) given in t parameterization, where Jacobi elliptic functions appear, the cuspless SR geodesics in \({\text {SO(3)}}\) given in s parameterization involve only a single elliptic integral \(\int \limits _{0}^{s} \frac{\sqrt{1- h^2_{2}(\sigma )}}{M^{2}-h^2_{2}(\sigma )}\mathrm{d}\sigma \). This integral can be expressed in terms of standard elliptic integrals. For example, in the elliptic case \(\xi <1, M^2>\xi ^2\) we have

$$\begin{aligned} h_2(s) = \rho \sin {\varPsi }(s), \end{aligned}$$

where \(\rho =\sqrt{\frac{M^{2}-\xi ^2}{1-\xi ^2}}, {\varPsi }(s)= s\sqrt{1-\xi ^2} + {\varPsi }_0\), with \({\varPsi }_0=\arg ( \frac{h_{3}(0)}{\sqrt{1-\xi ^2}} + \mathrm {i}\,h_{2}(0))\), which yields

$$\begin{aligned} \begin{array}{ll} {\tilde{y}}(s) &{} =M \,\int \limits _{0}^{s} \frac{\sqrt{1-\rho ^{2}\sin ^{2}({\varPsi }(\sigma ))}}{M^2-\rho ^{2} \sin ^{2}({\varPsi }(\sigma ))} \mathrm{d}\sigma \\ &{}= \frac{M}{\sqrt{1-\xi ^2}} \int \limits _{{\varPsi }_0}^{{\varPsi }(s)} \frac{\sqrt{1-\rho ^{2} \sin ^{2}({\varPsi })}}{M^2-\rho ^{2} \sin ^{2}({\varPsi })} \mathrm{d}{\varPsi } \\ &{}= \frac{M}{\sqrt{1-\xi ^2}}\Bigg (F\left( {\varPsi }(s),\rho ^2\right) - F({\varPsi }_0,\rho ^2) -\left( 1-\frac{1}{M^{2}}\right) \\ &{}\quad \times \left( {\varPi } \left( \frac{\rho ^2}{M^2},{\varPsi }(s),\rho ^2\right) -{\varPi } \left( \frac{\rho ^2}{M^2},{\varPsi }_0,\rho ^2 \right) \right) \Bigg ), \end{array} \end{aligned}$$

where F denotes an elliptic integral of the first kind and \({\varPi }\) denotes an elliptic integral of the third kind.

See plots of projected cuspless geodesics \(\mathbf {n}(s) = R(s)\, \mathbf {e}_1\) for \(s \in (0,s_\mathrm{max})\) in Fig. 9.

Fig. 9
figure 9

Spherical projection of cuspless SR geodesics in \({\text {SO(3)}}\) in elliptic, linear, and hyperbolic cases

5 PDE Approach for Data-Driven SR Geodesics in \({\text {SO(3)}}\)

In this section, we adapt the PDE approach for data-driven SR geodesics in \({\text {SE(2)}}\) [39, 40] to the \({\text {SO(3)}}\) group. Here we consider the basis left-invariant vector fields \(X_i\) as differential operators of the first order, and we write \(X_i({\mathcal {W}})\) for the derivative of a function \({\mathcal {W}}:{\text {SO(3)}}\rightarrow {{\mathbb {R}}}\) along \(X_i\).

We aim to solve the following optimal control problem:

$$\begin{aligned}&{\dot{\gamma }}(t) = \sum \limits _{i=1}^{2} u_i X_i|_{\gamma (t)}, \text { for } t \in [0,T], \\&\gamma (t) \in {\text {SO(3)}}, \quad \gamma (0) = e, \ \gamma (T) = g_1, \quad (u_1, u_2) \in {{\mathbb {R}}}^2,\\&l(\gamma (\cdot )) = \int _0^{T} C(\gamma (t))\sqrt{\xi ^2 u_1^2(t) + u_2^2(t)} \, {\hbox {d}}t \rightarrow \min . \end{aligned}$$

Here the terminal time T is free; and \(C : {\text {SO(3)}}\rightarrow [\delta , +\infty ), \delta > 0\) is the external cost.

By rescaling of time \(\tau = \frac{t}{T} \in [0,1]\) simultaneously with controls \({\bar{u}}_i(\tau ) = T u_i(T \tau )\), we write down the explicit solutions as

$$\begin{aligned} \begin{array}{l} d_{{\text {SO(3)}}}^0(g,e)\\ := \inf \limits _{ {\begin{array}{c} \gamma (0)=e, \gamma (1)=g, \\ \dot{\gamma }(\cdot ) \in \left. {\varDelta }\right| _{\gamma (\cdot )}, \\ \gamma \in \text {Lip}([0,1],{\text {SO(3)}}) \end{array} } } \int \limits _{0}^{1} \sqrt{\left. {\mathcal {G}}\right| _{\gamma (\tau )}(\dot{\gamma }(\tau ),\dot{\gamma }(\tau ))} \, \mathrm{d}\tau . \end{array} \end{aligned}$$
(56)

Here the sub-Riemannian metric tensor

$$\begin{aligned} {\mathcal {G}} = C^2(\cdot )\left( \xi ^2 \omega ^1\otimes \omega ^1 + \omega ^2\otimes \omega ^2\right) \end{aligned}$$
(57)

is defined only on the distribution \({\varDelta }\), recall Remark 8.

5.1 Sub-Riemannian Fast Marching in \({\text {SO(3)}}\)

Here we propose a SR-FM method (sub-Riemannian fast marching) for the computation of data-driven SR length minimizers (not necessarily cuspless) in \({\text {SO(3)}}\) group, as a solution to the SR-eikonal system (62). This method was successfully used in [41] for the computation of data-driven SR length minimizers in \({\text {SE(2)}}\) group. The method is based on a Riemannian approximation of sub-Riemannian manifold, and computing Riemannian geodesics in highly anisotropic space, which becomes the SR manifold in the limiting case as anisotropy tends to infinity.

Here we follow the explanation in [41], where we work now in new settings of the \({\text {SO(3)}}\) group and use the coordinate chart \((x,y,\theta )\) defined in Sect. 3.1. Recall that the basis left-invariant vector fieldsFootnote 3 \(X_i\) in \({\text {SO(3)}}\) are given by the following differential operators:

$$\begin{aligned} X_1= & {} \cos \theta \, \partial _x - \sec x \sin \theta \, \partial _y + \tan x \sin \theta \, \partial _\theta ,\\ X_2= & {} \partial _\theta ,\\ X_3= & {} \sin \theta \, \partial _x + \sec x \cos \theta \, \partial _y - \tan x \cos \theta \, \partial _\theta , \end{aligned}$$

and corresponding basis left-invariant one forms \(\omega ^i\), satisfying \(\langle \omega ^i, X_j \rangle = \delta _i^j\), are expressed as

$$\begin{aligned} \begin{array}{l} \omega ^1 = \cos \theta \, \mathrm{d} x - \cos x \sin \theta \, \mathrm{d} y,\\ \omega ^2 = \sin x \, \mathrm{d} y + \mathrm{d}\theta ,\\ \omega ^3 = \sin \theta \, \mathrm{d} x + \cos x \cos \theta \, \mathrm{d} y. \end{array} \end{aligned}$$
(58)

We approximate the sub-Riemannian manifold by a Riemannian manifold by fixing a small \(\varepsilon > 0\). Moreover, the SR-eikonal equation (62) is well defined and it can be derived as a limiting case of the eikonal equation on a Riemannian manifold via the inverse metric tensor, see Appendix 4. Let us denote the Riemannian distance as follows:

$$\begin{aligned} \begin{array}{l} d_{{\text {SO(3)}}}^\varepsilon (g,e)\\ := \inf \limits _{ {\begin{array}{c} \gamma (0)=e, \gamma (1)=g, \\ \gamma \in \text {Lip}([0,1],{\text {SO(3)}}) \end{array} } }\int \limits _{0}^{1} \sqrt{\left. {\mathcal {G}}_{\varepsilon }\right| _{\gamma (\tau )}(\dot{\gamma }(\tau ),\dot{\gamma }(\tau ))}\, \mathrm{d}\tau . \end{array} \end{aligned}$$
(59)

with Riemannian metric tensor \({\mathcal {G}}_{\varepsilon }\) given by

(60)

Remark 14

In our approach, we shall rely on standard notion of viscosity solution [7, 8, 12] of the Riemannian eikonal equation, which admits a generalization to the sub-Riemannian case. See details in Appendix 4.

The following theorem summarizes our approach for the computation of data-driven sub-Riemannian length minimizers in \({\text {SO(3)}}\).

Theorem 7

Let \(g \ne e \in {\text {SO(3)}}\) be chosen such that there exists a unique minimizer \(\gamma _{\varepsilon }^*:[0,1] \rightarrow {\text {SO(3)}}\) of \(d_{{\text {SO(3)}}}^{\varepsilon }(g,e)\) such that \(\gamma _{\varepsilon }^*(\tau )\) is not a conjugate point for all \(\tau \in [0,1]\) and all \(\varepsilon \ge 0\) sufficiently small.

Then \(\tau \mapsto d_{{\text {SO(3)}}}^{0}(e,\gamma ^*_0(\tau ))\) is smooth and the minimizer \(\gamma _{0}^*(\tau )\) is given by \(\gamma _{0}^*(\tau )=\gamma _{b}^*(1-\tau )\), with

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{array}{l} \dot{\gamma }_b(\tau )=-{\bar{u}}_1(\tau ) \left. X_{1}\right| _{\gamma _b(\tau )}- {\bar{u}}_2(\tau ) \left. X_{2}\right| _{\gamma _b(\tau )}, \\ \gamma _{b}(0)=g, \end{array} \end{array}\right. } \end{aligned}$$
(61)

with

and with \({\mathcal {W}}(g)\) denoting the viscosity solution of the following boundary value problem:

$$\begin{aligned} \left\{ \begin{array}{l} \sqrt{ \frac{\left( X_{1}|_g({\mathcal {W}})\right) ^2}{\xi ^{2}} + \left( X_{2}|_g({\mathcal {W}})\right) ^2}=C(g), \text { for }g\ne e, \\ {\mathcal {W}}(e)=0. \end{array} \right. \end{aligned}$$
(62)

For an outline of the proof, see Appendix 4, where we rely on a similar approximation approach as in [48, ch. 5, app. A] for an elastica functional and in [36, Thm. 2, Cor. 2, app. A] for a SR problem on SE(2).

Remark 15

The approach in Theorem 7 can be adapted for producing only the cuspless minimizers. See Appendix 4.

Remark 16

The SR spheres of radius t centered at e are given by \({\mathcal {S}}_{t}= \{g \in {\text {SO(3)}}\,|\, {\mathcal {W}}(g)=t \}\).

Remark 17

Recall that conjugate points are points where local optimality is lost. For a formal definition and characterization, see [35, def. 8.4.3, cor. 8.4.5]. We would conjecture that the assumption on the conjugate points in the above theorem is not really needed, as even the conjugate points that are limits of first Maxwell points do not seem to cause problems in the backtracking procedure, akin to the SE(2) case [40, App. D], but nevertheless our proof in Appendix 4 does rely on this assumption.

From the derivations above Theorem 7, we see that the fast marching approach for computing SR geodesics in \({\text {SE(2)}}\), cf. [41], is easily generalized to the \({\text {SO(3)}}\) case. To this end, we replace the matrix representation for \({\mathcal {G}}_{\varepsilon }\) expressed in the fixed \((x,y,\theta )\) Cartesian coordinate frame. In the \({\text {SO(3)}}\) case, it equals

$$\begin{aligned} M_{\varepsilon }= \mathfrak {R} \left( \begin{array}{ccc} C^2(\cdot )\, \xi ^2 &{} 0 &{} 0 \\ 0 &{} C^2(\cdot ) &{}0 \\ 0&{} 0&{} C^2(\cdot )\, \xi ^2\, \varepsilon ^{-2} \end{array} \right) \mathfrak {R}^T, \end{aligned}$$

with

$$\begin{aligned} \mathfrak {R} = \left( \begin{array}{c c c} \cos \theta &{} \ 0 \ &{} \sin \theta \\ -\cos x\, \sin \theta &{} \ \sin x \ &{} \cos x \, \cos \theta \\ 0&{} \ 1 \ &{} 0 \end{array} \right) \ . \end{aligned}$$

Here the diagonal matrix in the middle encodes the anisotropy between the \(X_i\) directions, while the matrix \(\mathfrak {R}\) is the basis transformation from the moving coframe \(\{\omega ^1,\, \omega ^2,\, \omega ^3\}\) to the fixed coframe \(\{\mathrm{d} x,\, \mathrm{d} y,\, \mathrm{d} \theta \}\), recall (58), in which the fast marching implementation via special anisotropic stencils [5] is used.

In Sect. 6.1, we will show that the thereby obtained fast marching approach already presents reasonable precision for \(\varepsilon =0.1\). Experiments in Sect. 6.3 show the application of the method (with data-adaptive nonuniform cost) to tracking of blood vessels in retinal images.

6 Experiments

In Sect. 6.1, we verify the SR-FM method by comparison of SR length minimizers/spheres obtained via SR-FM with the exact SR geodesics/wavefronts (cf. Sect. 3) for the case of uniform external cost (i.e., \(C=1\)). In Sect. 6.2, we compare SR geodesics and wavefronts in the groups \({\text {SE(2)}}\) and \({\text {SO(3)}}\) (Sect. 6.2.1) for the uniform external cost case. In Sect. 6.3, we provide experiments of vessel tracking by SR geodesics in \({\text {SO(3)}}\) when the external cost C is induced by spherical data, and compare them to the result of vessel tracking on the corresponding flat image by SR geodesics in \({\text {SE(2)}}\).

6.1 Verification of the Fast Marching Method in the Case of Uniform External Cost

In this subsection, we perform the experiments to validate the SR Fast Marching (SR-FM) method proposed in Sect. 5.1. The goal of the experiments is to check that the method produces an accurate approximate solution to the SR problem in \({\text {SO(3)}}\) group in the case of uniform external cost \(C = 1\). In all the experiments, we fixed the anisotropy parameter of the Riemannian approximation as \(\varepsilon = 0.1\).

In the first experiment, we compare the geodesics \(\gamma ^{FM}(\cdot )\) obtained via SR-FM with the exact cuspless geodesics \(\gamma (\cdot )\) computed via analytic formulas in Theorem 6. We perform the comparison as follows:

  1. 1)

    Fix \(\xi >0\) and the initial momenta h(0).

  2. 2)

    Compute the first cusp time \(s_{max}(h(0))\) corresponding to h(0), and set \(s_\mathrm{end} = \min \{s_{max}(h(0)),\frac{\pi }{2}\}\).

  3. 3)

    Compute the geodesic \(\gamma (s), s\in [0,s_\mathrm{end}]\) via Thm. 6.

  4. 4)

    Compute the distance function \({\mathcal {W}}(g)\) in the domain \(g = (x,y,\theta ) \in [-\frac{\pi }{2},\frac{\pi }{2}]\times [-\pi ,\pi ]\times [-\pi ,\pi ]\) via SR-FM. Here we compute the distance function in the grid of \(201 \times 401 \times 401\) points and then interpolate it using third-order Hermite interpolation.

  5. 5)

    Compute the geodesic \(\gamma ^{FM}(t), t \in [0,{\mathcal {W}}(g_\mathrm{end})]\) via backtracking (61) from the endpoint \(g_{1} = \gamma (s_\mathrm{end})\).

  6. 6)

    Plot the spherical projections of \(\gamma (s)\) and \(\gamma ^{FM}(t)\) and compare them.

A typical result of the comparison is shown in Fig. 10, where we set \(\xi = 1.5, h_3(0) = 0\) for all the curves and varied initial momentum \(h_2(0) \in \{-0.99, -0.81, -0.63, -0.45, -0.27, -0.09, 0.09, 0.27, 0.45, 0.63, 0.81, 0.99\}\). As a result, we see that the geodesics computed numerically via SR-FM accurately follow the exact geodesics.

Fig. 10
figure 10

Top: the spherical projection of cuspless SR geodesics in \({\text {SO(3)}}\) computed by exact formulas in Theorem 6 (green dashed lines) and our numerical fast marching approximations (red lines). Bottom: example of nonoptimal cuspless geodesics (Color figure online)

We have performed a series of such experiments and always obtained similar results when the geodesics \(\gamma ^i(s)\) were optimal for \(s \in [0, s^i_\mathrm{end}]\). It was also remarkable that SR-FM resulted into different curves (length minimizers) when the geodesic \(\gamma ^i(s)\) was not optimal for \(s \in [0, s^i_\mathrm{end}]\). Such an example is illustrated in Fig. 10 (bottom). The question of optimality of SR geodesics in \({\text {SO(3)}}\) in the general case \(\xi >0\) is an open important problem, recall Sect. 3.5. Here we provide a numerical SR-FM method for computing only the optimal geodesics. In analogy with how it was done in [40], it is possible to compute Maxwell sets numerically. We have a strong conjecture that optimality is lost at the first Maxwell point induced by reflectional symmetries along the geodesic. We leave the computation of Maxwell points and analysis of optimality of the geodesics as a direction for future work.

To verify the SR-FM method we also perform experiments with comparison of the geodesics obtained via SR-FM and the general geodesics (not necessarily cuspless) given by Theorem 2. A typical result is presented in Fig. 11 (top). Here we again observe an accurate result of SR-FM, but now for the geodesics whose spherical projections have cusps.

Fig. 11
figure 11

Top: comparison of exact SR geodesics in \({\text {SO(3)}}\) (green dashed lines) obtained via analytic formulas (Theorem 2) and SR geodesics computed numerically via SR-FM (red lines). Here \(\xi =4.5, t_{end} = \frac{3\pi }{2}\), and initial momenta \((h^i_2(0),h^i_3(0)) = \{(-5,-0.99),(-5,0.99),(5,-0.99),(5,0.99)\}\). Bottom: Comparison for \(\xi =1\) of wavefront in \({\text {SO(3)}}\) (green transparent surface) obtained via the analytic formulas of Theorem 2 for \(T = \frac{15}{32}\pi \) and the SR sphere (orange solid surface) for the same T, obtained via SR-FM (Color figure online)

To conclude this section, we provide one more experiment, where we compare the exact sub-Riemannian wavefronts and SR spheres computed via SR-FM. We show that the SR-FM method provides a distance function \({\mathcal {W}}(g)\) that closely approximates the SR distance \(d(e,g)\approx {\mathcal {W}}(g)\). In Fig. 11, we show the comparison of the exact wavefront \({{\mathrm{WF}}}(\frac{15}{32}\pi )\) and isosurface \({\mathcal {S}}^{FM}(\frac{15}{32}\pi ) = \{g \in {\text {SO(3)}}|{\mathcal {W}}(g) = \frac{15}{32}\pi \}\). Here we see that the isosurface computed via SR-FM accurately follows the outer surface of the exact wavefront (i.e., exact SR sphere). A similar picture was obtained for different radii T.

6.2 Comparison of SR Geodesics and Wavefronts in \({\text {SE(2)}}\) and \({\text {SO(3)}}\) for \(C=1\)

In this subsection, we compare SR geodesics and wavefronts in \({\text {SE(2)}}\) and \({\text {SO(3)}}\) and analyze their applicability in image processing. We also include a short discussion about optimality of geodesics, which is closely related to the analysis of self-intersections of wavefronts and the study of cut loci. To this end, we provide accurate plot of the wavefronts near their singularities.

6.2.1 Comparison of SR Wavefronts in \({\text {SO(3)}}\) and \({\text {SE(2)}}\) for \(C=1\)

In this subsection, we show a comparison of the SR wavefronts in \({\text {SO(3)}}\) and \({\text {SE(2)}}\) in the case of uniform external cost \(C=1\). Here we employ the fact that the coordinate chart \((x,y,\theta )\) in \(S^2_{x,y} \times S^1_{\theta }\) was chosen in the way to obtain the analogy with \((X,Y,{\varTheta }) \in {{\mathbb {R}}}^2 \times S^1\). This allows us to plot SR wavefronts of \({\text {SO(3)}}\) and \({\text {SE(2)}}\) in the same 3D plot.

In this comparison, we use the SR arclength parameterization t, where the geodesic \(\gamma ^{{\text {SO(3)}}}(\cdot )\) is given by exponential map \({{\mathrm{Exp}}}(h^0,\cdot )\), recall (47), i.e., by the projection in \({\text {SO(3)}}\) of the solution of the Hamiltonian system (39), with initial condition \(h(0) = h^0, \gamma ^{{\text {SO(3)}}}(0) = e = (0,0,0)\). To establish the comparison of wavefronts we switch to polar coordinates \((\beta , c)\), recall (43), where the Hamiltonian system in \({\text {SO(3)}}\) reads as:

A solution to this system is given by Theorem 2.

The Hamiltonian system for SR geodesics in \({\text {SE(2)}}\) (see, e.g., [29] ) reads as:

A solution to this system is given in [29]. Indeed, we observe a clear similarity between the \({\text {SO(3)}}\) and \({\text {SE(2)}}\) case, when using parametrization (6).

In Fig. 12, we plot the SR wavefronts in \({\text {SO(3)}}\) and \({\text {SE(2)}}\) for several values of end time T. In these plots, we identify \((x,y,\theta )\) and \((X,Y,{\varTheta })\), so that the red surfaces \({{\mathrm{WF}}}^{{\text {SE(2)}}}\) are the SR wavefronts of \({\text {SE(2)}}\) and the green surfaces \({{\mathrm{WF}}}^{{\text {SO(3)}}}\) are the SR wavefronts of \({\text {SO(3)}}\). We see a very similar shape of \({{\mathrm{WF}}}^{{\text {SO(3)}}}\) and \({{\mathrm{WF}}}^{{\text {SE(2)}}}\) for small radii T, but the difference increases when T increases. Thus, we conclude that the SR geodesics in \({\text {SO(3)}}\) can be locally approximated by the SR geodesics in \({\text {SE(2)}}\), but globally they are considerably different.

One can also observe that the singular pointsFootnote 4 of \({{\mathrm{WF}}}^{{\text {SO(3)}}}\) are located near singular points of \({{\mathrm{WF}}}^{{\text {SE(2)}}}\). This leads us to a conjecture that the location of conjugate points (open problem) can be estimated by the location of conjugate points of \({{\mathrm{WF}}}^{{\text {SE(2)}}}\). Note also that in the general case \(\xi >0\) the set of singular points has a complicated shape. In Fig. 13, we present more detailed plot of the singularities, with the depicted Maxwell set and special cases of conjugate points, which are limit points of the Maxwell set on SR sphere (outer part of wavefront).

Fig. 12
figure 12

Comparison of SR wavefronts in \({\text {SE(2)}}\) (red) and \({\text {SO(3)}}\) (green) for \(T=0.5, \xi = 1, \eta = 1\). A zoomed in picture for the blue square is provided in Fig. 13 (Color figure online)

Fig. 13
figure 13

Comparison of self-intersections of SR wavefronts in \({\text {SE(2)}}\) (red) and \({\text {SO(3)}}\) (green) for \(\xi =1\) (linear case) and \(\xi = 0.5\) (elliptic case). Here \(T = 0.5\) and \(\eta = 1\). The viewpoint is taken from the inside of the SR sphere. In this figure, we plot the part of wavefront depicted by the blue square in Fig. 12. If \(\xi \ne 1\) both the wavefronts in \({\text {SE(2)}}\) and in \({\text {SO(3)}}\) do not intersect at a single point. The first Maxwell sets are depicted by dashed violet lines. The first conjugate points on the SR sphere are depicted by yellow dots (Color figure online)

In Fig. 13, we observe that the wavefront in \({\text {SO(3)}}\) has a very special symmetry when \(\xi =1\). This is not present for \(\xi \ne 1\), and this never happens in the \({\text {SE(2)}}\) group. The case \(\xi = 1\) for SR manifold in \({\text {SO(3)}}\) was completely examined in [15], where it was shown that locally the conjugate locus is an interval, and globally it is a circle without a point. Changing \(\xi \) destroys the symmetry, conjugate and Maxwell points are getting separated, and the conjugate locus has an astroidal shape [34].

6.2.2 Comparison of SR Geodesics in \({\text {SO(3)}}\) and \({\text {SE(2)}}\) for \(C=1\)

In this subsection, we again consider the case \(C=1\) and compare SR geodesics \(\gamma ^{{\text {SO(3)}}}(\cdot ) = (x(\cdot ),y(\cdot ), \theta (\cdot ))\) and \(\gamma ^{{\text {SE(2)}}}(\cdot ) = (X(\cdot ),Y(\cdot ), {\varTheta }(\cdot ))\) in the image plane. The SR-FM method is used for computation of the geodesics parameterized by SR arclength. Here we prepare background for comparison of the geodesics in retinal images via the schematic eye model, recall Sect. 1.1, where as a departure point we use an image (white for \(C=1\)) on a plane \(O_{XY}\), recall Fig. 4.

See Fig. 14, where we compare \({\text {SE(2)}}\) and \({\text {SO(3)}}\) SR geodesics projected on the plane and on the sphere (via mappings \({\varPi }\) and \({\varPi }^{-1}\)). For details, see Appendix 5.

6.3 Vessel Analysis via \({\text {SO(3)}}\) SR Geometry and \({\text {SE(2)}}\) SR Geometry

As explained in introduction in Sect. 1.1, we need to include the spherical geometry of the retina rather than the flat geometry of the flat image. This spherical geometry is encoded in our spherical image model, see Fig. 4. Next we will analyze the effect of including this geometry in the SR-FM vessel tracking method along data-driven SR geodesics in \({\text {SO(3)}}\).

More precisely, we propose vessel tracking in object coordinates (or spherical image coordinates) via SR geometry in \({\text {SO(3)}}\) as an extension of vessel tracking in flat images [39, 40] along SR geodesics in \({\text {SE(2)}}\). Therefore, we want to investigate whether including the correct spherical geometry makes a difference in the vessel tracking in practice. Although a complete detailed comparison on large data sets is left for future work, we present preliminary experiments which indeed indicate considerable differences in both tractography and curvature measurements. These experiments are shown in Figs. 15 and 16 and next we explain them.

We apply the same scheme as in Sect. 6.2.2, but now we compute data-driven geodesics, where the external cost is induced by image data. Next we explain the construction of the external cost that is applied in all experiments. For the sake of simple comparison, we restrict ourselves to a cost depending on the spherical coordinates only, and we set

$$\begin{aligned} \mathfrak {G}(x,y) = \left( 1+ \frac{VF({\varPi }(x,y))}{\lambda \Vert VF\Vert ^{2}_{\infty }}\right) ^{-1}, \end{aligned}$$
(63)

where we use standard multiscale vesselness [50]

$$\begin{aligned}&(VF)(X,Y) \\&\quad = e^{-\frac{\lambda _1^2(X,Y)}{2 \beta ^2 \lambda _2^2(X,Y)}} \left( 1 - e^{-\frac{\lambda _1^2(X,Y) + \lambda _2^2(X,Y)}{2 c^2}} \right) U(\lambda _2(X,Y)), \end{aligned}$$

with \(\lambda _i(X,Y)\) eigenvalues of the Gaussian Hessian of image \(F:{{\mathbb {R}}}^2 \rightarrow {{\mathbb {R}}}\) (maximized over scales) ordered by \(|\lambda _1(X,Y)|<|\lambda _2(X,Y)|\), with \(\beta = c = 0.3\), and with unit step function \(U(\lambda ) = {\left\{ \begin{array}{ll}1, \text { for } \lambda \ge 0,\\ 0, \text { otherwise.} \end{array}\right. }\)

Here we note that the Gaussian Hessian is given by \({\mathcal {H}}(G_s *F)\) and computed by Gaussian derivatives [51] at multiscales \(s = \frac{1}{2} \sigma ^2 \in \{2,3,4,5\}\) in term of pixel sizes.

Fig. 14
figure 14

Comparison of an \({\text {SE(2)}}\) SR geodesic (blue) and an \({\text {SO(3)}}\) SR geodesic (red), from left to rightin (xy) spherical image coordinates, (XY) flat image coordinates, and plotted on the sphere \(S^2\) (Color figure online)

Fig. 15
figure 15

Comparison of vessel tracking via \(\gamma ^{{\text {SO(3)}}}\) SR geodesics in \({\text {SO(3)}}\) (green solid lines) in object coordinates and via \(\gamma ^{{\text {SE(2)}}}\) SR geodesics in \({\text {SE(2)}}\) (red dashed lines) in the planar camera coordinates. Here the planar projection \({\varGamma }^{{\text {SO(3)}}}\) of \(\gamma ^{{\text {SO(3)}}}\) and spatial projection \({\varGamma }^{{\text {SE(2)}}}\) of \(\gamma ^{{\text {SE(2)}}}\) are depicted in the same flat image (Color figure online)

In the experiment in Figure 15, we show that there is a considerable difference between \({\text {SE(2)}}\) SR geodesics and \({\text {SO(3)}}\) SR geodesics. We see that when internal geometry is dominant over the external cost (\(\lambda \) small) the SR geodesics in \({\text {SO(3)}}\) are more stiff than SR geodesics in \({\text {SE(2)}}\), and therefore in the boundary value problem they are less eager to take shortcuts and better follow the vessel structure. In case \(\lambda \) is large (external cost is dominant than the internal geometry), we see only small differences in the overall locations of the \({\text {SE(2)}}\) curves and \({\text {SO(3)}}\) curves. The results are stable w.r.t. choice of \(1\le \eta \le 2\) (which controls the distance from the camera to the eye ball, relative to eye ball radius, recall Fig. 4).

Fig. 16
figure 16

Left: two curves from the experiment in Fig. 15 (right-bottom figure) are depicted with slight shift. The upper curve is a spatial projection \({\varGamma }^{{\text {SE(2)}}}\) of the data-driven SR geodesic \(\gamma ^{{\text {SE(2)}}}\) with depicted (in color) planar curvature \(\kappa ^{{\text {SE(2)}}}\) on top of the curve. The lower curve \({\varGamma }^{{\text {SO(3)}}}\) is the planar projection of the SR geodesic \(\gamma ^{{\text {SO(3)}}}\) with depicted geodesic curvature \(\kappa ^{{\text {SO(3)}}}_g\) on top of it. Right: three graphs are shown in the same plot: planar curvature \(\kappa ^{{\text {SE(2)}}}\) of \({\varGamma }^{{\text {SE(2)}}}\); geodesic curvature \(\kappa _g^{{\text {SO(3)}}}\) of spherical projection of \(\gamma ^{{\text {SO(3)}}}\); planar curvature \(\kappa ^{{\text {SO(3)}}}\) of \({\varGamma }^{{\text {SO(3)}}}\). The effect of considering geodesic curvature \(\kappa _g^{{\text {SO(3)}}}\) in object coordinates on \(S^2\) rather than planar curvature \(\kappa ^{{\text {SO(3)}}}\) in photo coordinates on projection on \({{\mathbb {R}}}^2\) is visible (compare the green solid and dashed graphs). A bigger difference comes from using \({\text {SO(3)}}\) SR geometry than \({\text {SE(2)}}\) SR geometry (compare red and green graphs) (Color figure online)

In the next experiment, we measure the curvature of the curves obtained by the vessel tracking method via \({\text {SE(2)}}\) geometry and via \({\text {SO(3)}}\) geometry. For this experiment, we used the values \(\xi =3, \lambda = 50\) and \(\eta =2\). Although in this case the result of tractography is very similar for the \({\text {SE(2)}}\) and \({\text {SO(3)}}\) curves, we show that there is a considerable difference in their curvature.

Corollary 1

(from Theorem 1) The geodesic curvature of a spherical projection of data-driven geodesic \(\gamma ^{{\text {SO(3)}}}(\cdot )\) satisfies

$$\begin{aligned} \kappa _g^{{\text {SO(3)}}}(\cdot ) = \xi ^2 \frac{X_2|_{\gamma ^{{\text {SO(3)}}}(\cdot )}\left( \mathcal {W^{{\text {SO(3)}}}}\right) }{X_1|_{\gamma ^{{\text {SO(3)}}}(\cdot )}\left( \mathcal {W^{{\text {SO(3)}}}}\right) }. \end{aligned}$$

Proof

The first equality in the chain

$$\begin{aligned} \kappa _g^{{\text {SO(3)}}}(\cdot ) = \frac{u_2(\cdot )}{u_1(\cdot )} = \xi ^2\frac{h_2(\cdot )}{h_1(\cdot )} = \xi ^2 \frac{X_2|_{\gamma (\cdot )}({\mathcal {W}})}{X_1|_{\gamma (\cdot )}\left( {\mathcal {W}}\right) } \end{aligned}$$

is implied by Eq. (28). The second equality follows from application of PMP to problem \(\mathbf{P_{mec}}\), which gives \(u_1 = \frac{h_1}{ \xi ^2 C^2}\) and \(u_2 = \frac{h_2}{C^2}\). The third equality follows from the fact that in the points where the Bellman function \({\mathcal {W}}\) is differentiable (almost everywhere in our case) its derivatives are given by components of momentum covector \(h_1 = X_1({\mathcal {W}}), h_2 = X_2({\mathcal {W}})\), see [37]. \(\square \)

By the same argument, it can be checked (see [31] and [40]) that the planar curvature of spatial projections of SR geodesics in \({\text {SE(2)}}\) satisfies

$$\begin{aligned} \kappa ^{{\text {SE(2)}}}(\cdot ) = \xi ^2 \frac{{\mathcal {A}}_2|_{\gamma ^{{\text {SE(2)}}}(\cdot )}\left( \mathcal {W^{{\text {SE(2)}}}}\right) }{{\mathcal {A}}_1|_{\gamma ^{{\text {SE(2)}}}(\cdot )}\left( \mathcal {W^{{\text {SE(2)}}}}\right) }, \end{aligned}$$

with \({\mathcal {A}}_1 = \cos {\varTheta } \partial _X + \sin {\varTheta } \partial _Y, {\mathcal {A}}_2 = \partial _{\varTheta }\) basis left-invariant vector fields \({\text {SE(2)}}\).

Thus the curvature analysis can be simply done based on vessel tracking, and this shows the benefit of our algorithm. In Fig. 16, we show an experiment of vessel curvature measurement based on tracking via \({\text {SO(3)}}\) geometry and via \({\text {SE(2)}}\) geometry. For completeness, we added also a comparison with a planar curvature \(\kappa ^{{\text {SO(3)}}}(\cdot )\) of a planar projection \({\varGamma }^{{\text {SO(3)}}}(\cdot ) := {\varPi }(x(\cdot ), y(\cdot ))\) of \(\gamma ^{{\text {SO(3)}}}(\cdot ) = (x(\cdot ),y(\cdot ),\theta (\cdot ))\).

We can see a considerable difference in curvature measurement via \({\text {SO(3)}}\) geometry and \({\text {SE(2)}}\) geometry. It is also seen that the difference between \(\kappa ^{{\text {SO(3)}}}\) and \(\kappa _g^{{\text {SO(3)}}}\) is not very significant. Thus we see the importance of including correct spherical geometry in vessel tracking algorithm in retinal images.

6.4 Vessel Analysis via \({\text {SO(3)}}\) SR Geometry and \({\text {SO(3)}}\) Riemannian Geometry

Next we address the general benefit of using SR geodesics rather than (isotropic) Riemannian geodesics in the tracking of salient lines (blood vessels) in spherical images. To this end, we show a typical example where the tracking induced by a sub-Riemannian geodesic gives better result than the tracking induced by a Riemannian geodesic. The experiment in Fig. 17 is performed similar to Sect. 6.3, but now we compare the result of vessel tracking via SR geodesics (obtained by SR-FM) and Riemannian geodesics (isotropic metric with \(\varepsilon = 1\)). From this experiment, we see that similarly to the \({\text {SE(2)}}\) case [40] the tracking via Riemannian geometry suffers from incorrect jumps toward nearly parallel neighboring vessels and yields nonsmooth curves, the tracking via SR geometry gives the desirable result.

Fig. 17
figure 17

Comparison of vessel tracking in a spherical image of the retina via SR geodesic (green solid line) and Riemannian geodesic (red dashed line) in \({\text {SO(3)}}\) (Color figure online)

7 Conclusion

Data-driven sub-Riemannian geodesics in 3D Lie groups are a suitable tool for tractography of blood vessels in retinal imaging. In previous works on the \({\text {SE(2)}}\) case [40, 41], practical advantages have been shown in comparison with the (isotropic) Riemannian case, and geodesic methods in the image domain. However, these models included a SR geometry on \({\text {SE(2)}}\equiv {{\mathbb {R}}}^{2}\rtimes S^{1}\) based on lifts of flat images, which does not match the actual object geometry: The retina is spherical rather than planar, cf. Fig. 1, Fig. 3, and Fig. 4. A similar observation holds for models in the psychology of contour perception in human vision [30].

Therefore, for geometric tracking we propose a frame bundle above \(S^{2}\), cf. Fig. 6, instead of a frame bundle above \({{\mathbb {R}}}^{2}\). Geometric tracking of geodesics is done along globally optimal data-driven SR geodesics in \({\text {SO(3)}}\) (and their spherical projections) by our new numerical wavefront propagation method. The method was validated for the uniform cost case by comparisons with exact geodesics which we derived in Sect. 3, cf. Figs. 10 and 11. Here, in contrast to the \({\text {SE(2)}}\) case [31], we do not have a scaling homothety. As a result, the parameter \(\xi \) has a considerable effect on the geometry, and for \(\xi =1\) we identify the linear case, for \(\xi >1\) we identify the hyperbolic case, and for \(\xi <1\) we identify the elliptic case, cf. Figs. 7 and 9.

For all of these cases, we have computed the first cusp time in Theorem 5 (the first time where the spherical projection of a SR geodesic exhibits a cusp). Also, we have presented new formulas for such “cuspless” SR geodesics in Theorem 6. These formulas only involve a single elliptic integral thanks to spherical arclength parametrization, and for \(\xi \ne 1\) our formulas are simpler than the general formulas for SR geodesics in \({\text {SO(3)}}\).

Furthermore, we used a specific parametrization of Lie group \({\text {SO(3)}}\) that allowed us to compare between SR geodesics / wavefronts in \({\text {SO(3)}}\) to SR geodesics / wavefronts in \({\text {SE(2)}}\), cf. Figs. 12 and 13. In our comparison we took into account a standard optical model for the mapping between object coordinates on the retina and camera coordinates in the acquired planar retinal image. In our experiments, the differences between the \({\text {SO(3)}}\) case and the \({\text {SE(2)}}\) case are considerable, both for the case of uniform cost, cf. Fig. 14, and for the data-driven case in the retinal image analysis application, cf. Fig. 15. In general, we see that for realistic parameter settings (in optics) the \({\text {SO(3)}}\) geodesics have a slower variation in curvature and are less eager to take shortcuts, see, e.g., Fig. 15 and 16. Furthermore, there are visible differences between geodesic curvature of data-driven SR geodesics on the sphere and the curvature of their planar projections. As in retinal imaging applications, curvature is considered as a relevant biomarker [9,10,11] for detection of diabetic retinopathy and other systemic diseases, the data-driven SR geodesic model in \({\text {SO(3)}}\) is a relevant extension of our data-driven geodesic model in \({\text {SE(2)}}\). Here we restricted ourselves to feasibility studies. More extensive comparisons between \({\text {SO(3)}}\) geodesics and \({\text {SE(2)}}\) geodesics on large retinal imaging benchmark sequences are beyond the scope of this article and are left for future work.

Finally, we note that the computation time for data-driven SR geodesics in \({\text {SO(3)}}\) is exactly the same as for the \({\text {SE(2)}}\) case. Our specific choice of coordinates of \({\text {SO(3)}}\) allowed us to modify the very efficient fast marching approach [41], with a simple replacement of the metric tensor matrix.