2.1 Introduction

The medial axis (or skeleton) of a shape is the set of centers of discs of maximal radii inscribed in the shape. It provides a skeleton-like structure, which, when the associated maximal radii are also stored (providing the medial axis transform [37]) uniquely encodes the shape geometry .

To be specific, represent a shape by an open connected bounded set in the plane, denoted \(\varOmega \). Let B(pr) denote the open disc of center \(p\in {\mathbb {R}}^2\) and radius \(r>0\). One says that such a disc is maximal in \(\varOmega \) if and only if it is included in \(\varOmega \), and no disc in which it is (strictly) contained is included in \(\varOmega \). The skeleton of \(\varOmega \), denoted \(\varSigma (\varOmega )\), is the set of all p such that B(pr) is maximal in \(\varOmega \) for some \(r>0\), i.e., \(\varSigma (\varOmega )\) is the set of loci of the centers of maximal discs. We shall also denote by \(\varSigma ^*(\varOmega )\) the set of pairs (pr) such that B(pr) is maximal. This is the medial axis transform (MAT). We have the following proposition.

Proposition 2.1

The medial axis transform, \(\varSigma ^*(\varOmega )\), uniquely characterizes \(\varOmega \).

Proof

Let

$$ \tilde{\varOmega } = \bigcup _{(p, r)\in \varSigma ^*(\varOmega )} B(p, r). $$

By definition of \(\varSigma ^*\), we have \(\tilde{\varOmega } \subset \varOmega \) and we want to prove the reverse inclusion (therefore proving that \(\varSigma ^*(\varOmega )\) characterizes \(\varOmega \)).

For \(x\in \varOmega \), let

$$ r_x = \mathrm {dist}(x, \varOmega ^c) = \min \{d(x, y), y\not \in \varOmega \}. $$

One has \(B(x, r_x)\subset \varOmega \). Define

$$ G_x = \left\{ y\in \varOmega : B(y, r_y) \supset B(x, r_x) \right\} . $$

Let \(r_x^* = \sup \{r_y: y\in G_x\}\). By definition, there exists a sequence \((y_n)\) such that \(r_{y_n} \rightarrow r_x^*\), and, because \(\varOmega \) is bounded, we can assume (replacing \(y_n\) by a subsequence if needed) that \(y_n \rightarrow y^* \in {\overline{\varOmega }}\). Obviously, \(y^*\) cannot belong to \(\partial \varOmega \) because this would imply \(r_{y_n}\rightarrow 0\) while \(r^*_x \ge r_x >0\) (since \(x\in G_x\)). Also, because \(B(y_n, r_{y_n}) \subset \varOmega \), we have at the limit \(B(y^*, r_x^*)\subset {\overline{\varOmega }}\), which implies \(B(y^*, r_x^*)\subset \varOmega \) because \(\varOmega \) is open. Similarly, passing to the limit in the inclusion \(B(x, r_x) \subset B(y_n, r_{y_n})\) implies \(B(x, r_x) \subset B(y^*, r_x^*)\).

We now show that \(B(y^*, r_x^*)\) is maximal. If \(B(y^*, r_x^*)\) is included in some ball \(B(y, r)\in \varOmega \), it will be a fortiori  included in \(B(y, r_y)\) and since \(B(x, r_x) \subset B(y^*, r_x^*)\), we see that y must be in \(G_x\) with \(r_y > r_x^*\), which is a contradiction.

We have therefore proved that every \(x\in \varOmega \) belongs to a maximal disk, therefore proving that \(\varOmega \subset \tilde{\varOmega }\).

2.2 The Structure of the Medial Axis

We assume that \(\varOmega \) is the interior of a piecewise smooth Jordan curve. Some structural properties of the skeleton can be obtained under some assumptions on the regularity of the curve [65]. The assumption is that the smooth arcs are analyticFootnote 1 everywhere except at a finite number of points; for these exceptional points, it is required that m has both left and right tangents. The simplest example of a curve satisfying this assumption is a polygon.

For such a curve, it can be shown that all but a finite number of points in the skeleton are such that the maximal disc B(pr) meets the curve m at exactly two points. Such points on the skeleton are called regular. Non-regular points separate into three categories.

The first one is when the maximal disc, B(mr), meets the curve in more than two connected regions. Such points are bifurcation points of the skeleton. The second possibility is when there is only one connected component; then, there are two possibilities: either m is the center of an osculating circle to the curve, or there exists a concave angle at the intersection of the curve and the maximal disc. The third possibility is when there are two connected components, but one of them is a sub-arc of the curve. This happens only when the curve has circular arcs.

The skeleton itself is connected, and it is composed of a finite number of smooth curves.

2.3 The Skeleton of a Polygon

Consider a closed polygon, without self-intersections. Denote its vertices by \(m_1, \ldots , m_N, m_{N+1} = m_1\). Let \(s_i\) denote the ith edge, represented by the open line segment \((m_i, m_{i+1})\), with \(i=1, \ldots , N\). A maximal disc B(mr) within the polygon has to meet the boundary at at least two points. We separate the cases depending on whether these points are on edges or vertices.

Assume that B(mr) is tangent to \(s_i\) at some point \(p\in s_i\). Let \(T_i = (m_{i+1} - m_i)/|m_{i+1}-m_i|\) be the unit tangent to \(s_i\) and \(N_i\) the unit normal. We assume that the orientation is such that \(N_i\) points inward. We must have

$$ p = m - rN_i \text { and } p = m_i + t T_i $$

for some \(t\in (0, |m_{i+1} - m_i|)\). Taking the dot product of both equations with \(T_i\) and computing the difference yields

$$ t = (m-m_i)^TT_i. $$

We therefore obtain the fact that B(mr) is tangent to \(s_i\) if and only if

$$\begin{aligned} m - r N_i = m_i + ((m-m_i)^TT_i)T_i \\ \text { with }&0 \le (m-m_i)^TT_i \le |m_{i+1}-m_i|. \end{aligned}$$

We can distinguish three types of maximal discs:

  1. 1.

    Bitangents: there exists \(i\ne j\) with

    $$\begin{aligned} m= & {} m_i + ((m-m_i)^TT_i)T_i + rN_i = m_j + ((m-m_j)^TT_j)T_j + rN_j \text { and}\\ 0\le & {} (m-m_i)^TT_i \le |m_{i+1}-m_i|, 0 \le (m-m_j)^TT_j \le |m_{j+1}-m_j|. \end{aligned}$$
  2. 2.

    Discs that meet the boundary at exactly one edge and one vertex: there exists \(i\ne j\) such that

    $$\begin{aligned} m\quad =&\quad m_i + ((m-m_i)^TT_i)T_i + rN_i,\\&\quad 0 \le ((m-m_i)^T)T_i \le |m_{i+1}-m_i|\\ \text {and }&\quad |m- m_j| = r. \end{aligned}$$
  3. 3.

    Discs that meet the boundary at two vertices: there exists \(i\ne j\) such that \(|m- m_i| = |m- m_j| = r\).

Note that a maximal ball can meet a vertex only if this vertex points inward (concave vertex). In particular, with convex polygons, only the first case can happen.

An interesting consequence of this result is that the skeleton of a polygon is the union of line segments and parabolic arcs. To see this, consider the equations for the three previous cases. For bitangents, we have

$$ r = (m-m_i)^TN_i = (m-m_j)^TN_j $$

which implies

$$ (m-m_i)^T(N_j - N_i) = (m_j-m_i)^TN_j. $$

If \(N_i\ne N_j\), this is the equation of a line orthogonal to \(N_i- N_j\). The case \(N_i = N_j\) can never occur because the normals have to point to the interior of maximal balls and therefore coincide only if \(s_i=s_j\).

For the second case, we have

$$ m - m_i = ((m-m_i)^T)T_iT_i + |m-m_j| N_i, $$

which yields

$$ (m-m_i)^TN_i = |m-m_j|. $$

This is the equation of a parabola. To see why, express m as \(m = m_i + \alpha T_i+\beta N_i\). The previous equations yield \(\beta \ge 0\) and

$$ \beta ^2 = (\alpha - (m_j-m_i)^TT_i)^2 + (\beta -(m_j-m_i)^TN_i)^2 $$

or

$$ 2(m_j-m_i)^TN_i \beta = (\alpha -(m_j-m_i)^TT_i)^2 + ((m_j-m_i)^TN_i)^2. $$

Finally, in the last case, the skeleton coincides with the line of points which are equidistant from the two vertices. We have therefore proved the following fact (which comes in addition to the properties discussed in Sect. 2.2).

Proposition 2.2

The skeleton of a polygonal curve is a union of line segments and parabolic arcs. For a convex polygon, the skeleton only contains line segments.

2.4 Voronoï Diagrams

2.4.1 Voronoï Diagrams of Families of Closed Sets

The previous computation and the most efficient algorithms to compute skeletons are related by the theory of Voronoï diagrams. We start with their definition:

Definition 2.3

Let \(F_1, \ldots F_N\) be closed subsets of \({\mathbb {R}}^2\). The associated Voronoï cells are the sets \(\varOmega _1, \ldots , \varOmega _N\) defined by

$$ x \in \varOmega _i \Leftrightarrow d(x, F_i) < \min _{j\ne i} d(x, F_j). $$

The union of the boundaries, \(\bigcup _{i=1}^N\partial \varOmega _i\), forms the Voronoï diagram associated to \(F_1, \ldots , F_N\).

In the case of a polygonal curve, the skeleton is included in the Voronoï diagram of the closed line segments that form the curve. Indeed, a maximal disc has to meet at least two segments (sometimes at their common vertices), and is at a strictly larger distance from the segments it does not intersect. It therefore belongs to the boundary of the cells. The converse is false: a point from the diagram is not necessarily in the skeleton (some points may correspond to external disks).

There exist very efficient algorithms to compute these diagrams. We shall not detail them here, but references can be found in [222, 233].

The notion of Voronoï diagrams for a polygon can be extended to a general curve. The question is to find sub-arcs \(F_1, \ldots , F_N\) of the curve with the property that their diagram contains the curve’s skeleton. What we have said concerning polygons applies, except in one case: when a maximal disc meets an arc at two distinct points. This could not happen with straight lines, and a condition ensuring that this does not happen for a given arc is as follows [170]. Recall that a vertex of a smooth curve m is a local extremum of the curvature.

Theorem 2.4

A sub-arc of a \(C^2\) closed curve which has two points belonging to a maximal disc necessarily contains a vertex.

Therefore, it suffices to cut the curve at vertices to be sure that the obtained arcs cannot hold two contacts with maximal discs.

2.4.2 Voronoï Diagrams of Discretized Boundaries

The medial axis can, in some sense, also be understood as deriving from the Voronoï diagram of the infinite family of points in the boundary of \(\varOmega \). The Voronoï cell associated to a point \(x \in \partial \varOmega \) is the set

$$ V_x = \left\{ y \in \varOmega : |x-y| < |x'-y| \text { for all } x'\in \partial \varOmega \setminus \{x\} \right\} . $$

(The set of points y such that x is closer to y than any other point on the boundary.) When the boundary is smooth, \(V_x\) is normal to the boundary and extends to a point \(y_0\) that belongs to the medial axis.

Consider now a finite family of points sampling the boundary, i.e., a finite subset \(F \subset \partial \varOmega \). Let \(d = \max (d(x, F), x\in \partial \varOmega )\) measure the density of F in \(\partial \varOmega \). The cells of the Voronoï diagram of \(\{\{x\}, x\in F\}\) are possibly unbounded polygonal domains, and those among their edges (boundaries) that are included in \(\varOmega \) will provide a good approximation of the skeleton of \(\varOmega \) (see Fig. 2.1). One way to understand this is through the relationship between Voronoï diagrams and Delaunay triangulations. A triangulation of the finite set F is a family of triangles with vertices in F covering the convex hull of F (the smallest convex set containing F) such that the intersection of any two triangles is either empty, or a common vertex, or a common edge to the two triangles. Such a triangulation is a Delaunay triangulation if in addition, the circumcenters of any triangle contain no other point in F. Because of this property, these circumcenters, which are equidistant to three vertices, and closer to them than to any other, form vertices of the Voronoï diagram of F. Line segments joining the circumcenters of two adjacent triangles (sharing an edge) form the edges of the diagram. For the same reason, assuming that d is small enough, the circumcircles can be seen as approximations of maximal balls with three contact points in \(\varOmega \), and those of them that belong to \(\varOmega \) therefore provide approximations of vertices of the medial axis, the edges that connect them in the Voronoï diagram providing approximate lines in the skeleton. Note that some of the circumcenters may fall outside of \(\varOmega \) (and must therefore be excluded from the medial axis) and that the Voronoï diagram of F contains, in addition, half-lines stemming from centers of boundary triangles and through midpoints of segments of the boundary, which must also be excluded. There is an extensive literature on the computation of Delaunay triangulation and Voronoï diagrams, which constitute fundamental algorithms in computational geometry [39, 226, 233], and numerous implementations in various softwares.

Fig. 2.1
figure 1

Comparison of medial axes computed using Voronoï diagrams with different degrees of discretization

2.5 Thinning

There exist other approaches aiming at defining skeletal structures, which slightly differ from the medial axis that we have described so far (sometimes called the Blum medial axis, because it was introduced by Blum in [37]). Thinning algorithms, in particular, create their own kind of skeleton which does not necessarily correspond to centers of maximal discs. They are, however, quite efficient and generally easy to implement. The principle is to progressively “peel off” the boundary of the region until only a skeletal structure remains. One of the first methods, defined for discrete binary images, is the Hilditch algorithm [147], in which a sequence of simple tests are performed to decide whether a pixel must be removed or not from the region. A more formal definition of thinning, which is briefly described below, can be based on the erosion operation in mathematical morphology [254].

Define a structuring element B to be a symmetric subset of \({\mathbb {R}}^2\) (for example a small disc centered at 0). Using B, we define a sequence of operators that apply to a set X and create a new set:

$$\begin{aligned} E_B(X)= & {} \left\{ x:x+B\subset X \right\} \text { (erosion)},\\ D_B(X)= & {} \left\{ x: (x+B)\cap X \ne \emptyset \right\} \text { (dilation)},\\ O_B(X)= & {} D_B\circ E_B(X) \text { (opening)},\\ L_B(X)= & {} X\setminus O_B(X). \end{aligned}$$

Erosion is like peeling X with a knife shaped like B. Dilation spreads matter around X, adding around each point some material once again shaped like B. Opening is an erosion followed by a dilation, which essentially puts back what the erosion has removed, except the small structures that have completely been removed and cannot be recovered (since there is nothing left to spread on). The last operation, \(L_B\), precisely collects these lost structures (called linear parts), and is the basic operator for the morphological skeleton which is defined by

$$ S(X) = \bigcup _{n=1}^\infty L_B(E_{nB}(X)). $$

This is the union of the linear parts of X after successive erosions. Note that, for bounded X, this union is actually finite since \(E_{nB}(X)=\emptyset \) for large enough n.

Fig. 2.2
figure 2

Effect of a small shape change in the boundary on the skeleton of a rectangular shape

2.6 Sensitivity to Noise

One of the main issues with the medial axis transform is its lack of robustness to noise. Figure 2.2 provides an example of how small variations at the boundary of a shape can result in dramatic changes in the skeleton. In fact, we have seen in our discussion of polygons that the addition of a convex vertex automatically results in a branch of the skeleton reaching it.

Because of this, many skeletonization algorithms come with a way to prune the skeleton of spurious branches. There are two ways to do this.

  • Prior smoothing of the curve. One can apply curve smoothing algorithms (which will be described in Chap. 5). For polygons, smoothing can be done by removing small structures or flattening vague angles. It is interesting to note that smoothing curves does not always result in simplifying the skeleton (see [25] for a discussion).

  • Pruning. Branches can be removed after the computation of the skeleton. This can be based on several principles using the fact that skeleton branches resulting from small incidents at the boundary can be characterized. We refer to [124] for more details.

2.7 Recovering the Initial Curve from the MAT

Given a parametrized sub-arc of the medial axis transform, one can explicitly reconstruct the part of the boundary \(\partial \varOmega \) which is associated with it (the contact points on \(\partial \varOmega \) of the maximal balls centered on the subarc). Let \(\gamma \) be such a parametrization, defined on \((a, b)\subset {\mathbb {R}}\), with values in \(\varSigma ^*(\varOmega )\), so that \(\gamma (u) = (m(u), r(u))\) for some functions m and r that we will assume to be at least \(C^2\).

Without loss of generality, assume that \(u\mapsto m(u)\) is an arc length parametrization (\(|\dot{m}_u| = 1\)). Assume also that B(m(u), r(u)) has exactly two contacts with \(\partial \varOmega \) (this is typically true on all \(\varSigma ^*(\varOmega )\) except at a finite number of points). If \(x\in \partial \varOmega \cap B(m(u), r(u))\), then \(|x-m(u)| = r(u)\) and, for all \(\varepsilon \ne 0\), \(|x - m(u+\varepsilon )| \ge r(u+\varepsilon )\) (because \(B(m(u+\varepsilon ), r(u+\varepsilon ))\subset \varOmega \)). Thus, letting \(f(\varepsilon ) = |x-m(u+\varepsilon )|^2 - r(u+\varepsilon )^2\), we have, because \(\varepsilon =0\) is a minimizer: \(f(0) = \dot{f}(0) = 0\), with

$$ \dot{f}(0) = -2{\big \langle {x-m(u)}\, , \, {\dot{m}(u)}\big \rangle } + 2r(u)\dot{r}(u). $$

Solving this equation in x, we obtain two solutions given by

$$\begin{aligned} x_+(u)= & {} m(u) + r(u) \left[ - \dot{r}(u)\dot{m}(u) + \sqrt{1 - \dot{r}(u)^2} q(u)\right] , \\ x_-(u)= & {} m(u) + r(u) \left[ - \dot{r}(u)\dot{m}(u) - \sqrt{1 - \dot{r}(u)^2} q(u)\right] , \end{aligned}$$

with \(q(u) \perp \dot{m}(u)\), \(|q(u)|=1\). Note that \(|\dot{r}| < 1\) is a necessary condition for the existence of two distinct solutions.

The curvature of the boundary can also be related to the medial axis via an explicit formula. Let \(\rho _+\) (resp. \(\rho _-\)) be the vector \(- \dot{r}\dot{m} + \sqrt{1 - \dot{r}^2}\, q\) (resp. \(- \dot{r}\dot{m} - \sqrt{1 - \dot{r}^2}\, q\)) so that \(x_+ = m + r\rho _+\) and \(x_- = m+ r\rho _-\). The following discussion holds for both arcs and we temporarily drop the \(+\) and − indices in the notation.

We have \(x = m+r\rho \); \(\rho \) is a unit vector, and since the maximum disc is tangent to the curve at x, \(\rho \) is normal to the curve. Since r is positive and \(\rho \) is a radial vector for a maximal disc, \(\rho \) points outward from the curve at x and therefore is oriented in the opposite direction to the normal (assuming that the boundary is positively oriented). Introduce the vector \(h = \dot{m} + \dot{r} \rho \). We have \(h^T\rho = - \dot{r}+\dot{r} = 0\) so that h is orthogonal to \(\rho \). Since \(|\rho |=1\), \(\dot{\rho }\) is also orthogonal to \(\rho \) and there exists a number c such that \(\dot{\rho }= - c h\) (we have \(|h|^2 = 1 - \dot{r}^2 >0\) so that \(h\ne 0\)). Since \(\rho = - N\), we also have

$$ \dot{\rho }= \partial _s \rho \frac{d {s}}{d{u}} = \kappa \frac{d {s}}{d{u}} T, $$

where \(\kappa \) is the curvature of the considered arc of curve. Likewise, \(\dot{x} = (ds/du) T\) so that \(\dot{\rho }= \kappa \dot{x}\). We now use these identities to compute \(\kappa \): we have \(\dot{x} = \dot{m} + \dot{r} \rho + r \dot{\rho }= (1 - cr) h\). This implies

$$ \kappa = -c/(1-cr),$$

which provides a very simple relation between c and the curvature.

To be complete, it remains to compute c. From \(\dot{\rho }= -c(\dot{m} + \dot{r} \rho )\), we get

$$ \dot{\rho }^T\dot{m} = -c(1 + \dot{r} \rho ^T\dot{m}) = -c(1- \dot{r}^2). $$

We also have

$$ - \ddot{r} = \partial (\rho ^T\dot{m}) = \dot{\rho }^T\dot{m}+ \rho ^T \ddot{m} = \dot{\rho }^T \dot{m} + K \rho ^T q, $$

where K is the curvature of the skeleton. Writing \(\rho ^Tq = \varepsilon \sqrt{1- \dot{r}^2}\) with \(\varepsilon = \pm 1\), we get the equation:

$$ \dot{\rho }^T\dot{m} = -\ddot{r} - \varepsilon K \sqrt{1- \dot{r}^2}, $$

which yields (reintroducing the \(+\) and − subscripts for each contact) \(c_+ = \ddot{r}/(1- \dot{r}^2) + K / \sqrt{1- \dot{r}^2}\) and \(c_- = \ddot{r}/(1- \dot{r}^2) - K / \sqrt{1- \dot{r}^2}\).

2.8 Generating Curves from Medial and Skeletal Structures

The previous section described how to retrieve a curve once its medial axis transform has been computed. Here we want to discuss the issue of using the medial axis transform as a modeling tool, i.e., of specifying a curve by starting from a medial axis transform.

This is a more difficult problem, because not any combination of curves and radii is a valid medial axis. Even when the skeleton consists of only one curve, we have already seen conditions in the above section, like \(|\dot{r}_u| < 1\) at all points in the interior of the medial curve, that are required in the skeletal representation. We must also ensure that the specified curve is regular on both sides of the axis, which, since \(\dot{x} = (1-cr)h\), must ensure that \(1-cr\) does not vanish along the curve. In fact, \(1-cr\) must be positive. To see this, note that we have proved that \(1-cr = (1-r\kappa )^{-1}\). At a convex point (\(\kappa > 0\)), r must be smaller than the radius of curvature \(1/\kappa \) so that \(1-r\kappa > 0\). Since points of positive curvature always exist, we see that \(1-cr\) must remain positive along the curve in order to never be zero. Using the expression for c found in the previous section, this provides a rather complex condition:

$$\begin{aligned} 1- \frac{r\ddot{r}}{1-\dot{r}^2} > \frac{|K|r}{\sqrt{1-\dot{r}^2}}. \end{aligned}$$
(2.1)

To ensure continuity of the reconstructed curve when boundary branches meet, we need \(|\dot{r}| = 1\) at terminal points of the medial axis. Also, if the medial axis has multiple branches, the corresponding parts of the curve must have the same limits on both sides. More conditions are needed to ensure that the contacts at these points are smooth. This provides a rather complicated set of constraints that must be satisfied by a generative medial axis model. This can be made feasible, however, in some simple cases, as shown in the following examples.

2.8.1 Skeletons with Linear Branches

Let us consider the situation in which each branch of the medial axis is a line segment, i.e., \(K=0\). The constraints on r are then \(r>0\), \(\dot{r}^2 < 1\) and \( r \ddot{r} + \dot{r}^2 < 1\). The last inequality comes from the fact that \(cr< 1 \Leftrightarrow r\ddot{r} < 1-\dot{r}^2\). Introducing \(z = r^2/2\), this can also be written \(\ddot{z} < 1\). Assume that \(\ddot{z} = -f\) with \(f > -1\). Integrating twice, we find

$$\begin{aligned} \nonumber \dot{z}(u)= & {} \dot{z}(0) - \int _0^u f(t) dt \\ z(u)= & {} z(0) + u\dot{z}(0) - \int _0^u (u-t) f(t) dt. \end{aligned}$$
(2.2)

We now analyze the other conditions in some special cases.

Shapes with a Single Linear Branch

We start with the simplest situation in which the medial axis is composed of a single segment, say \(m(u) = (u, 0)\), \(u\in [0,1]\). Since \(|\dot{r}|=1\) at the extremities and the medial axis cannot cross the boundary curve, we need \(\dot{r}(0) = 1\) and \(\dot{r}(1) = -1\). Define

$$\begin{aligned} M_0(u)= & {} \int _0^u f(t) dt \\ M_1(u)= & {} \int _0^u tf(t) dt. \end{aligned}$$

Using the identities \(\dot{z}(0) = r(0)\), \(\dot{z}(1) = -r(1)\), \(z(0) = r(0)^2/2\) and \(z(1) = r(1)^2/2\), we can solve (2.2) with respect to r(0) and r(1) to obtain:

$$\begin{aligned} r(0)= & {} \frac{M_0(1) + M_0(1)^2/2 - M_1(1)}{1+M_0(1)}\\ r(1)= & {} M_0(1) - r(0) = \frac{M_0(1)^2/2 + M_1(1)}{1+M_0(1)}. \end{aligned}$$

These quantities must be positive, and we will assume that f is chosen with this property (note that the denominator is always positive since \(f>-1\)). These equations imply that z, and therefore m, are uniquely determined by f.

Consider now the remaining constraints, which are (in terms of z) \(z > 0\) and \(\dot{z}^2 < 2z\) on (0, 1). Since the latter implies the former, we can concentrate on it, and introduce the function \(h(u) = 2z(u) - \dot{z}(u)^2\). We have \(h(0) = r(0)^2\) and \(h(1) = r(1)^2\). Moreover,

$$ \dot{h} = 2\dot{z}(1-\ddot{z}) = 2\dot{z}(1+f). $$

Since \(1+f > 0\), \(\dot{h}\) vanishes for \(\dot{z}=0\), or \(M_0(u) = r(0)\). Note that \(\dot{h}(0) = 2r(0)(1+f) > 0\) and \(\dot{h}(1) = - 2r(1) (1+f) <0\) so \(\dot{h}\) changes signs over (0, 1).

Also, since the extrema of h only occur when \(\dot{z}=0\) (and \(h=2z\) at these points), h will be positive under any condition that ensures that \(z > 0\) when \(\dot{z}=0\), which reduces to \(r(0)^2/2 + M_1(u) >0\) whenever \(M_0(u) = r(0)\).

There is an easy case: if \(f >0\), then \(M_1(u) > 0\) and the condition is satisfied. Moreover, if \(f >0\), then \(M_1(1) \le M_0(1)\) so that r(0) and r(1) are positive. However, as Fig. 2.3 shows, interesting shapes are obtained when \(f<0\) is allowed.

Fig. 2.3
figure 3

Shapes with horizontal medial axes. The shapes (right column) are obtained with \(\partial ^2_{uu}(r^2) = - 2f\); f is shown in the left column

Shapes with Three Intersecting Linear Branches

Let’s now consider a slightly more complex example with one multiple point and three linear branches. So we have three lines, \(\ell _1, \ell _2, \ell _3\), starting from a single point \(p_0\). Let \(\ell _i = \left\{ p_0 + u w_i, u\in [0, s_i] \right\} \), where \(w_1, w_2, w_3\) are unit vectors. Let \(q_i\) be a unit vector completing \(w_i\) in a positively oriented orthonormal frame. Finally, let \(r^{(1)}, r^{(2)}\) and \(r^{(3)}\) be the radii along each of these lines and \(z^{(i)} = (r^{(i)})^2/2\). Assume that \(\ddot{z}^{(i)} = -f^{(i)}(u/s_i)\) for \(u\in (0,s_i)\), where \(f^{(i)} > -1\) as before, and is defined over [0, 1].

We need to work out the compatibility conditions for the \(r^{(i)}\) at the intersection point, \(u=0\). Assume that the branches are ordered so that \((w_1,w_2), (w_2, w_3)\) and \((w_3, w_1)\) are positively oriented. The compatibility conditions are

$$ x^{(1)}_+(0) = x^{(2)}_-(0),\ x^{(2)}_+(0) = x^{(3)}_-(0),\ x^{(3)}_+(0) = x^{(1)}_-(0). $$

Identifying the norms, we see that the radii must coincide: \(r^{(1)}(0) = r^{(2)}(0) = r^{(3)}(0):=r_0\). So, defining \(h_1, h_2, h_3\) by

$$ h_1 = \rho ^{(1)}_+(0) = \rho ^{(2)}_-(0), h_3 = \rho ^{(2)}_+(0) = \rho ^{(3)}_-(0), h_2 = \rho ^{(3)}_+(0) = \rho ^{(1)}_-(0), $$

we see that the triangle \((p_0+h_1, p_0+h_2, p_0+h_3)\) has \(p_0\) as circumcenter, and the lines defining the axis are the perpendicular bisectors of its edges.

Given the above, it is easier to organize the construction by first specifying \(p_0\) and the three directions \(h_1, h_2, h_3\). This specifies the vectors \(w_1, w_2, w_3\): given \(i\in \{1,2,3\}\), denote the other two indices by j and \(j'\) . Then

$$ w_i = (h_j+h_{j'})/|h_j+h_{j'}| $$

and, from the expression of \(\rho \), we see that this also specifies \(\dot{r}^{(i)}(0)\), with

$$ \dot{r}^{(i)}(0) = - z_i^Th_j = -\frac{1}{\sqrt{2}} \sqrt{1+h_j^Th_{j'}} = -\cos (\theta _i/2), $$

where \(\theta _i\) is the angle between \(h_j\) and \(h_j'\).

This gives, for \(u\in [0,s_i]\)

$$ \dot{z}^{(i)}(u) = \dot{z}^{(i)}(0) - \int _0^{u} f^{(i)}(t/s_i) dt = -r_0\cos \frac{\theta _i}{2} - s_i M_0^{(i)} (u/s_i) $$

and

$$ z^{(i)}(u) = \frac{r_0^2}{2} - r_0 u \cos \frac{\theta _i}{2} - s_i u M_0^{(i)}(u/s_i) + s_i^2 M_1^{(i)} (u/s_i). $$

Since we need \(\dot{r}^{(i)}(s_i) = -1\), we have \(z^{(i)}(s_i) = r^{(i)}(1)^2/2\) and \(\dot{z}^{(i)}(s_i) = -r^{(i)}(1)\). Identifying \(r^{(i)}(1)^2\) in the two equations above yields

$$\begin{aligned} r_0^2\cos ^2 \frac{\theta _i}{2} + 2 r_0 s_i \cos \frac{\theta _i}{2} M_0^{(i)} (1) +&s_i^2 M_0^{(i)} (1)^2 \\ = r_0^2&- 2r_0 s_i \cos \frac{\theta _i}{2} - s_i^2 M_0^{(i)}(1) + s_i^2 M_1^{(i)} (1) \end{aligned}$$

or

$$\begin{aligned} \Big (M_0^{(i)} (1)^2 + 2 M_0^{(i)} (1)&- 2M_1^{(i)} (1)\Big )\frac{s_i^2}{r_0^2}\nonumber \\&+ 2 \cos \frac{\theta _i}{2} \big (1 + M_0^{(i)} (1)\big ) \frac{s_i}{r_0} -\left( 1-\cos ^2\frac{\theta _i}{2}\right) = 0. \end{aligned}$$
(2.3)

Assuming that \(f^{(i)}\) satisfies

$$ M_0^{(i)} (1)^2/2 + M_0^{(i)} (1) - M_1^{(i)} (1) > 0, $$

which is a condition already encountered in the previous case, this equation has a unique solution, specifying \(s_i\). The curve is then uniquely defined by \(p_0, h_1, h_2, h_3, f^{(1)}, f^{(2)}, f^{(3)}\), with constraints on the \(f^{(i)}\)’s similar to those obtained in the one-branch case. Examples are provided in Fig. 2.4.

Note that this construction does not freely specify the medial axis, but only the orientation of its branches (since the \(s_i\)’s are constrained by the rest of the parameters). One possibility to deal with this is to relax the specification of the \(f_i's\) by adding a factor \(\alpha _i\), using

$$\ddot{z}^{(i)} = - \alpha _i f^{(i)}.$$

This implies that \(M_0^{(i)}\) and \(M_1^{(i)}\) must be replaced by \(\alpha _iM_0^{(i)}\) and \(\alpha _iM_1^{(i)}\) in the computation above, and Eq. (2.3), with fixed \(s_i\), becomes a second-degree equation in \(\alpha _i\). The consistency conditions (existence of a solution to this equation, requirement that \(\alpha _i f^{(i)} > -1\), etc.) are, however, harder to work out in this case.

Fig. 2.4
figure 4

Shapes generated from a medial axis with three linear branches

Shapes with Generic Linear Branches

Conceptually, the above construction can be generalized to any skeleton with a ternary tree structure and linear branches. Indeed, the derivative \(\dot{r}\) is uniquely specified at the extremities of any branch: it is \(-1\) if the branch ends and \(-\cos \theta /2\) at an intersection, where \(\theta \) is specified by the branch geometry as above. Also, the radii at all branching points are uniquely specified as soon as one of them is (the constraint propagates along the tree). Of course, as before, the fact that the solution is uniquely defined does not guarantee consistency, which become harder to specify when the medial axis gets more complex. Finally, it is important to note that, for all the previous methods, even if the consistency conditions are satisfied, there is still a possibility for the shape to self-intersect non-locally (without singularity).

2.8.2 Skeletal Structures

One way to simplify the construction of a shape from a skeleton is to relax some of the conditions that are associated with medial axes. Skeletal structures, which we briefly describe now, have been introduced by J. Damon in [76–78] with this idea in mind.

There are two parts in Damon’s skeletal structure. The first one is the skeletal set (the skeleton), which is a union of smooth open curves that meet at singular points (branching points or end-points) with well-defined tangents at their extremities.

The second part of the skeletal structure is formed by the vectors that correspond to \(r\rho \) in our previous notation, with some smoothness and consistency conditions; referring to [76] for details, here are the most important ones. Like with the medial axis, each point in the smooth curves of the skeletal set carries two of these vectors (one on each side of the curve), and singular points can carry one vector (at end-points) or more than two (at branching points). When one continuously follows one of these vectors along a smooth branch until a branching point, it must have a limit within the set of vectors at this point, and all vectors at this point can be obtained by such a process. At end-points, there is a unique vector which is tangent to the skeletal curve.

To summarize, a skeletal structure requires a skeletal set, say S, and, at each point p in the skeletal set, a set U(p) of vectors that point to the generated curve, subject to the previous conditions. The generated curve itself is simply

$$ C = \left\{ p + U(p), p\in S \right\} . $$

The medial axis transform does induce a skeletal structure, but has additional properties, including the facts that, at each p, all vectors in U(p) must have the same norm, and if p is on a smooth curve, the difference between the two vectors in U(p) must be perpendicular to the curve. These properties are not required for skeletal structures.

Most of the analysis done in the previous section on the regularity of the generated curve with the medial axis transform can be carried over to skeletal structures. Along any smooth curve in the skeletal structure, one can follow a smooth portion of the generated curve, writing

$$ x(u) = m(u) + r(u) \rho (u) $$

and assuming an arc-length parametrization in m(u). Letting \(c = - \dot{m}^T\dot{\rho }\), one can write, for some \(\alpha \in {\mathbb {R}}\),

$$ \dot{\rho }= - c \dot{m} + \alpha \rho $$

because \(\rho \) is assumed to be non-tangent to the skeletal set (except at its end-points). This definition of c generalizes the one given for the medial axis, in which we had \(\dot{\rho }= -ch = -c \dot{m} + c\dot{\rho }\rho \). Since we have \(\dot{x} = (1-cr)\dot{m} + (\alpha +\dot{r})\rho \), we see that \(cr < 1\) is here also a sufficient condition for the regularity of the curve.

We need to check that different pieces of curves connect smoothly at branching points. With the medial axis, a first-order contact (same tangents) was guaranteed by the fact that the generated curve was everywhere perpendicular to \(\rho \). With skeletal structures, we have (since \(\dot{\rho }^T\rho =0\))

$$ \dot{x}^T\rho = \dot{m}^T\rho +\dot{r}. $$

So, a sufficient condition for smooth contacts at branching points and at end-points is that \(\dot{r} + \dot{m}^T\rho \) vanishes at the extremities of the smooth curves that form S (while this quantity vanishes everywhere with the medial axis transform).

Obviously, these conditions are much less constraining than those associated with the medial axis transform. One can start fixing \(\rho \), which defines c, then r such that \(rc <1\), with a few end-point conditions that must be satisfied. The simplification that is brought to curve generation, however, comes at a price, which is that a skeletal structure is not uniquely specified by a given curve, as the medial axis transform was. It is not a one-to-one curve representation.