A constructive theory of shape

We formulate a theory of shape valid for objects of arbitrary dimension whose contours are path connected. We apply this theory to the design and modeling of viable trajectories of complex dynamical systems. Infinite families of qualitatively similar shapes are constructed giving as input a finite ordered set of characteristic points (landmarks) and the value of a continuous parameter $\kappa \in (0,\infty)$. We prove that all shapes belonging to the same family are located within the convex hull of the landmarks. The theory is constructive in the sense that it provides a systematic means to build a mathematical model for any shape taken from the physical world. We illustrate this with a variety of examples: (chaotic) time series, plane curves, space filling curves, knots and strange attractors.


I. INTRODUCTION
A fact that has captivated the human mind since ancient times is the diversity of shapes found in nature [1]. It is, however, only in the last half-century that mathematical theories have been developed to study shape more rigorously and systematically, from topological [2,3] and statistical [4][5][6] points of view. The great scientific interest of shape is that it is a unifying concept [7]. Besides being a property of all living systems [8], shape is of crucial importance in architecture [9] and art [7,10,11]. Physical explanations for the origin of shape in non-equilibrium systems have been proposed [12] that are of great interest in engineering and optimization problems. Quantitative analysis of the shapes of biological organs is often necessary in agronomy, medicine, genetics, ecology, and taxonomy [13][14][15].
Shapes and images are essentially sets [16]. Therefore, the analysis, processing, evolution, regulation and control of shape require the consideration of setvalued maps. Viability theory [17,18] and the study and reconstruction of invariant sets [19][20][21][22] provide pathways to address this problem. Here, we present an alternative approach linking it to a nonlinear dynamical systems perspective. Although our theory is general in scope, it is able to provide specific mathematical models of shapes and their viable trajectories. We say that a trajectory is viable in a set S if, for an initial condition in S, the trajectory remains in S in any future time.
Spline approximation, Fourier analysis [23] and wavelet transforms [24,25] are popular methods for * Electronic address: garmovla@uv.es analyzing shape. The two general approaches to shape are: region-based (the region in the image corresponding to the analyzed object is considered); and boundary-based (shape is characterized in terms of its silhouette) [24,26]. Although we shall focus in this article in the second approach, representing shape as a parametric contour and endowing this representation with 'nice' properties, the first approach is also possible with help of the concept of κ-families of scenes introduced in this article. Besides generality of the method, a most desirable property that is sought is ease: once the contour of the shape is traced and a finite sequence of points in this contour (the landmarks) is selected, a mathematical model for the specific shape and for an infinite family of qualitatively related shapes can be immediately written down. There is no need of calculating any coefficients. This requirement is, clearly, not satisfied by any of the above methods. It is this property of the theory here presented what makes it constructive. The theory is intended to be used as a mathematical tool for scientists to provide quick and handy mathematical models of complex shapes. The theory is also parsimonious because a minimal amount of information suffices to generate an infinite family of qualitatively related shapes. Most remarkably, all shapes belonging to the family are located within the set constituted by the convex hull of the landmarks. Thus, if the landmarks are meant to be points on the trajectory of a complex dynamical system (possibly subject to perturbations) an infinite number of viable trajectories for the dynamical system can be obtained, all contained in the convex hull of the landmarks.
Our theory of shape is based in nonlinear B κembeddings, a mathematical structure that has been recently introduced by the author [27,28] and applied to the problem of finding all the roots of a polynomial arXiv:2106.13709v2 [math.NA] 8 Oct 2021 in the complex plane [27]. The theory is able to represent any path-connected shape and to resolve details of the shape at different scales as a continuous smoothing parameter κ is varied. This work is motivated by the following general problem, to which we give a general solution: For a given finite sequence of data (points) in R n find a mathematical model for the shape of the data that: a) can fit the given data to any degree of accuracy; b) the interpolation between the data is a non-oscillating, non-piecewise, infinitely differentiable function of its variable ('time') argument t; c) relates each individual shape to closely related shapes (deformations) obtained by varying the continuous parameter κ; d) places any κ-deformed shape within the convex hull of the original data.
The outline of this article is as follows. In Section II we present our definitions of shape and κfamily of shapes preceded by all the concepts necessary to understand the definitions. Nonlinear embeddings are introduced and the properties of interest here are worked out to make the theory self-contained. In Section III we prove that the κ-family of shapes is contained within the convex hull of the landmarks. Then, in Section IV this general result is applied to different classes of dynamical systems and it is established how viable trajectories can be constructed for them. In Section V we give examples of application of the theory to curves in 1D, periodic shapes (waveforms), curves in 2D (including fractal space-filling curves [29]), curves in 3D (e.g. knots [30] and strange attractors). The impatient reader can directly jump to this section going back to Section II when needed. In Section VI we present some conclusions and discussion of the theory and sketch some directions for possible future work.

II. NONLINEAR EMBEDDINGS AND THE DEFINITION OF SHAPE
We consider N points in D-dimensional Euclidean space extracted from a contour. We shall call these points characteristic points or landmarks of the shape. We choose a labeling for these landmarks so that they are ordered one after the other in succession starting with point 0 up to point N − 1. These landmarks can be obtained directly from the boundary by judicious, intuitive or automated choice. Neither a chain code [31,32] nor tracing the whole contour is needed (as it is the case with Fourier methods as [23]). The labeling of the landmarks is important because, as we shall see, it is related to time. In the case of closed contours any cyclic permutation of the landmarks is equivalent. The points are thus, specified by vectors r 0 , r 1 , . . . , r N −1 . By introducing a Kronecker delta convolution, we can rewrite the n-th point (0 ≤ n ≤ N − 1) as where δ nj = 1 if n = j and δ nj = 0 otherwise, is the Kronecker delta. We note that, indeed, we can write, equivalently, since N −1 j=0 δ jn = 1 because 0 ≤ n ≤ N − 1. The construction of a nonlinear embedding begins by noting that the Kronecker delta admits the following simple representation [28] is the B-function [28,33,34], with x, y ∈ R. We can thus use Eq. (3) to replace the Kronecker deltas entering in Eq. (2). We obtain We can now 'fuzzify' this expression by means of the approach sketched in [28,35]. First, we replace the discrete variable n ∈ Z by a continuous time variable t ∈ R. We then define Obviously, at times t = n + δ, where −1/2 < δ < 1/2 The fuzzification approach is completed by replacing all B-functions in Eq. (6) by the B κ -function [35] given by This is the so-called replacement mode I in [28]. We then define the nonlinear embedding We observe, that in the limit κ → 0, Eq. (9) becomes Eq. (6) lim κ→0 r κ (t) = r(t) Because of Eqs. (7) and (10), Eq. (9) is, in turn, equal to Eq. (2) in the limit where we have introduced the centroid ('center of masses') r * of the distribution of landmarks. We note that, since [28,36] we can write Eq. (9) as This equation defines open shapes. We shall also consider closed shapes. In the letter, although they are still specified by a finite set of landmarks, these return periodically as t is varied from −∞ to ∞. We have so that landmark r 0 is the successor of landmark r N −1 . In this case, instead of Eq. (9), we shall consider the following expression where is the periodic B κ -function introduced in [35]. From this equation, we note that When κ → ∞, Eq. (15) reduces to i.e. the shape collapses to centroid. Eqs. (13) and (15) are the main equations of our approach. We now formally define shape. Let r 0 , r 1 , . . ., r N −1 be a sequence of N points in D-dimensional Euclidean space R D . These points may be repeated in the collection. We call these points characteristic points of the shape or, equivalently, landmarks. Over these landmarks, we define a κ-family of open shapes by Eq. (13) and a κ-family of closed shapes by Eq. (15). For each specific value of κ ∈ (0, ∞) we say that the latter equations define an open (resp. closed) shape. We say that a κ-family of shapes is equal to another if both have exactly the same landmarks in the same order.
We define the -shape of a given κ-family as the resulting shape r (t) when κ = is nonzero but vanishingly small. In all examples in Section V the -shape is visually indistinguishable of the shapes obtained for κ = 0.01. We say that the -shape is a faithful representation of the shape to be modelled if, to sufficient degree of accuracy, fits the original shape (note that from the original shape we are only taking a finite set of N landmarks). All -shapes in the examples are faithful. A faithful representation can always be obtained by taking a sufficient number N of landmarks that are representative of its contour.
Eqs. (13) and (15) constitute parametric equations of the shapes and it is useful to see parameter t as time. Although in this work we shall focus on landmarks in R D , other vector spaces are possible as well. Any landmark n, n = 0, 1, . . . , N − 1, can be recovered from Eqs. (13) and (15) by putting t = n in these equations and taking the limit κ → 0 The process of obtaining a particular shape begins by specifying a finite suitable set of landmarks. We discuss a variety of examples on how to construct mathematical models for κ-families of shapes. In general the landmarks can be specified in a wide variety of methods. For example, they can be obtained: (1) from experimentally measured data or model; (2) randomly (according to a probability distribution) or at will; (3) by reading them directly from a pre-existing figure; (4) recursively. The κ-family constitutes a mathematical model in which shapes are parametrized by means of a 'time' real parameter t (a larger number of parameters is possible) and a smoothing real parameter κ. The shapes within the family are controlled by means of κ and are located between the interpolated landmarks (the -shape) and the centroid of the landmarks.
It is possible to hierarchically embed families of shapes in more complex structures that we shall call scenes. A scene is any disconnected set of shapes and can be expressed as a direct product of them. Let r κ0 (t, 0), r κ1 (t, 2), . . ., r κ M −1 (t, M − 1) be a different κ-family of shapes given either by Eq. (13) or by Eq. (15) each. We can construct a type-I η-family of scenes S η (t) as and a type-II η-family of scenes as We see that shapes play within a scene an analogous role to landmarks within a shape. In the limit η → 0 all shapes within the scene are disconnected. In the limit η → ∞ the shapes within the scene mix with each other and collapse to the average shape Each shape m within a κ-family of scenes can be recovered from Eq. (20) and (21) by putting q = m ∈ [0, M − 1] and taking the limit η → 0.
Scenes can be hierarchically embedded in increasingly complex structures in a similar way as landmarks are embedded in shapes and the latter are embedded in scenes. Every element in the complex structure, landmark, shape, or scene, can thus be recovered as sketched above. We find that our theory thus satisfies Leyton's criteria for a successful theory of shape: 1) maximization of transfer and 2) maximization of recoverability [7]. The first criterion is satisfied because complex structures in our theory can always be seen as the result of the transfer of simpler structures since these are embedded in the former. The second criterion is also satisfied because all elements that are being transferred can be recovered out of simple operations (taking limits) on the superior structures. Leyton's generative theory of shape is abstract and makes use of group theoretical notions (the wreath product being at its core) [7]. We believe than our theory of shape is simpler because, being general, it is also specific in the following sense: a mathematical model can always be fully worked out explicitly and systematically for any shape taken as example (and this is why we call it a constructive theory).

III. CONVEXITY AND TRANSFORMATIONS
The κ-families of shapes obtained from Eqs. (13) and (15) have several important mathematical properties that we now discuss. We have the following result.
The importance of the above theorem lies in that all deformed shapes within the same κ-family are easily located in Euclidean space R D : they are all found within the convex hull of the landmarks. As we shall see in Sec. IV, Theorem III.1 finds an important application in finding viable trajectories of complex dynamical systems and in designing invariant sets.
The κ-families of shapes in Eqs. (13) and (15) are nonlinear in t and κ but are linear functions (combinations) of the landmarks. This has the following important implication: if T is any transformation (matrix) sending each landmark r j to T · r j (with · denoting the inner product), then the κ family of shapes transforms as r κ (t) → T · r κ (t). Thus, if, for example, T is an isometry transformation, the shapes r κ (t) and T · r κ (t) for a fixed κ are congruent.

IV. APPLICATION TO DYNAMICAL SYSTEMS
A smooth dynamical systeṁ can be discretized in time as In general, we have, from this latter equation Therefore, starting from t = 0 and ending in time t = N δ, we can obtain N suitable landmarks for the trajectory of the dynamical system up to resolution δ as (r 0 , r 1 , r 2 , . . . , r N −1 ) := (y(0), y(δ), y(2δ), . . . , y((N − 1)δ)) and the trajectory can be embedded in a κ-family of open shapes by means of Eq. (13) where the r j 's are iteratively obtained from Eq. (29) as starting from an initial condition r 0 . We can also obtain periodic, closed shapes, over these same N landmarks from Eq. (15). Any trajectory of the smooth dynamical system can thus be embedded in a κ-family of shapes by taking δ sufficiently small so that the landmarks obtained constitute a faithful representation of the trajectory up to precision δ. As an example, in Sec. V E we construct κ-families of shapes for the Lorenz attractor. If the dynamical system is a discrete map, instead of Eq. (27) we have that the dynamics is governed at discrete times t = j by A set of N iterations starting from an initial condition y 0 can be made with this map so that N landmarks r j = y j are generated, which exactly coincide with the trajectory of the discrete map. The trajectory jumps discontinuously at discrete times, but can be embedded in a continuous trajectory by means of an appropriate κ-family of shapes (type I) or (type II) by using Eqs. (13) and (15) above. In Sec. V A we show, as example, open κ-families of shapes for the logistic map. By using the concept of η-family of scenes defined by Eqs. (20) and (21), it is possible to generalize the above costructions to spatially extended systems as partial differential equations, coupled map lattices and cellular automata.
The extension of the above embeddings to nonautonomous dynamical systems is straigthforward. Of major interest in those complex systems (in the presence of controls and perturbations) is the notion of positive invariance [19][20][21]. A set S is said to be positively invariant with respect to a dynamical system if any trajectory y(t) of the dynamical system that is well defined for any t > 0 and that starts with initial condition y 0 ∈ S satisfies y(t) ∈ S for t > 0. A set that contains a stable limit cycle (closed periodic orbit) or a stable fixed point that attract all initial conditions in S, is clearly positively invariant.
A broader notion of positive invariance is crucial in so-called viability theory [17,18]. Many complex natural and artificial systems, organizations, and networks do not evolve deterministically nor stochastically [17,18]. These systems are approached in a general way considering the trajectories r(t) (system states) to be constrained to belong to a set S instead of being governed by systems of differential or stochastic equations. Indeed, the main requirement is positive invariance for the trajectories defined analytically or experimentally, so that one has An important consequence of Theorem III.1 in this context is that if S is convex then we can always augment such a complex system given by Eq. (32) with a control parameter κ so that for all κ > 0 we have, as well, with y κ (t) being given by Eq. (13) or Eq. (15). Indeed, as a direct corollary of Theorem III.1 applied to dynamical systems and positively invariant sets, we have the following.
Theorem IV.1. Let S be any convex set that is positively invariant with respect to a dynamical system with globally defined trajectories y(t) ∈ S (∀t > 0) starting from initial conditions y 0 ∈ S. Let r j , j = 0, . . . , N − 1 be N points taken on any of these trajectories. Then, all points in the curve r κ (t) obtained from Eq. (13) satisfy r κ (t) ∈ S, ∀κ > 0 and ∀t ∈ [0, N − 1].
Any convex set S includes as a subset the convex hull conv r of any set of points {r j ; j = 0, . . . , N − 1} ⊂ S. Then, another direct application of Theorem III.1 to closed trajectories of any dynamical system (continuous or discrete) is the following.
Theorem IV.2. Let y(t) = y(t + T ) denote a closed periodic orbit of a dynamical system with period T and let r j , j = 0, . . . , N −1 be N points taken on the orbit. Then r κ (t) given by Eq. (15) is a closed curve with period T and is contained in the convex hull conv r of the points taken on the trajectory of the dynamical system, i.e. r κ (t) ∈ conv r , ∀κ > 0 and ∀t > 0.

A. 1D shapes: time series
In one dimension, the landmarks r 0 , r 1 , . . ., r N −1 become just a collection of real scalars X 0 , X 1 , . . ., X N −1 . It is straightforward to obtain from these landmarks and Eqs. (13) and (15) and for periodic time series As an example we consider the logistic map as a model providing the landmarks. We put X j = y j where y j is given by starting from a given y 0 . If we perform 149 iterations of this map, we obtain a sequence of 150 landmarks and we can directly construct a κ-family of open shapes from these landmarks, using Eq. (13) t ∈ [0, 149], t ∈ R.
In Fig. 1, r κ (t) obtained from Eq. (37) is plotted for different values of κ, an the parameters µ = 3.5 and y 0 = 0.3 selected to be in the chaotic regime. The landmarks (characteristic points) are also shown.
In every case, the shapes r κ (t) obtained are smooth and infinitely differentiable. For κ sufficiently low, the shapes interpolate the landmarks through theshape with growing precision as κ → 0. For κ large, details within a scale s = 2κ are averaged out and the resulting shapes have broader variations (the curve being always smooth). As κ → ∞, the shape collapses on the average value of the landmarks for every t.
A possible use of the shape theory in 1D above sketched is the synthesis of sound. Complex periodic waveforms can be simply designed by giving the landmarks as input (these can also be read from recorded waveforms). No Fourier decomposition is necessary to select the right harmonics. Then, by using Eq. (15), an infinite family of periodic signals with the same frequency can be constructed from the input landmarks.
An example of an invented periodic signal is shown in Fig. 2. By choosing the five landmarks (X 0 , X 1 , . . . , X 4 ) = (1, 4, 2, 2, 1) we can calculate any shape within the κ-family by replacing them in Eq. (35) and putting N = 5. In Fig. 2 the shapes with κ = 0.01, 0.1 and 0.3 are shown together with the landmarks. We observe that five points together with the parameter κ is enough to specify an infinite family of qualitatively related waveforms. Note that, because for κ = 0.01 the shapes tend to change more abruptly between the different landmarks, a huge number of Fourier modes would be needed to reproduce such periodic signals, the Gibbs phenomenon also playing an important role. No Gibbs or Runge phenomena are present in the interpolation provided by the -shape in our theory because there are no oscillations of the -shape between the landmark points under interpolation. We remark that this interpolation is not piecewise: the shapes are all infinitely differentiable functions of both t and κ.

B. 2D shapes: planar curves
In two dimensions we have the vector r κ (t) = (x κ (t), y κ (t)) that yields a plane curve in parametric form and Eq. (13) for open shapes reduces to where (X j , Y j ) = r j specifies the j-th landmark. For closed shapes in the plane Eq. (15) is equivalent to where (X j , Y j ) = r j specifies the j-th landmark and we have (x κ (t), y κ (t)) = r κ (t), as before. An example of a κ-family of open shapes described by Eqs. (38) and (39) is shown in Fig. 3 in which 50 landmarks are chosen randomly within the unit square from the uniform distribution. For κ = 0.01, the shape interpolates among all the landmarks but, as κ is increased, the shapes within the family tend to shrink to the centroid of the landmarks. The convex hull of the landmarks is shown in orange shadow and it is observed that for all κ > 0, the shapes are contained within the convex hull, as predicted by Theorem III.1. If the shape is regarded as a trajectory of a complex dynamical system, an infinite number of viable trajectories in the same set can be generated by means of the above method, selecting appropriate subsets of landmarks. As κ is increased, the finest details are gradually averaged out and, as a result, the shapes are smoothened, but they still constitute different deformations that look qualitatively similar.
We now discuss closed shapes in 2D. John von Neumann's joke "With four parameters I can fit an elephant, and with five I can make him wiggle his trunk" [38] has motivated some work on how experimental data on the plane can be fitted by parametric equations of planar curves [39][40][41]. A most popular method is provided by expanding the x(t) and y(t) coordinates of a closed contour (in this work x κ (t) and y κ (t)) in Fourier series [23] x where the coefficients A n , B n , C n and D n are related to x(t) and y(t) by the integrals A calculation of these integrals can be done by assuming N distinct landmarks piecewisely joined by rectilinear segments by means of a chain code [23].
Smooth shapes are then obtained by truncating the sums in Eqs. (42) and (43) [23]. In this way, any closed shape in 2D can be described. This popular method [42] has been applied to biological shapes in animals [43][44][45][46] and plants [47][48][49][50][51] and has been extended to open shapes in 3D by means of the discrete cosine transform [52]. It is interesting to compare the Fourier method of [23] with ours (embodied in Eqs. (40) and (41)) since: 1) our method does not require the evaluation of any coefficient since these are the landmarks themselves and x κ (t) and y κ (t) are linear functions of them; 2) the expansions in our method are always finite and equal to the finite number of landmarks also for shapes with vertices and sharp edges; 3) between landmarks the interpolation is always smooth and there are no oscillations; 4) no chain code [31,32] is needed as in [23] but merely the coordinates of the landmarks in successive order; 5) the method is completely straightforward and an infinite family of qualitatively related shapes is obtained by continuously varying κ between 0 and ∞.
We note that only one parameter κ is necessary to fit the data in our method, the -shape being this fitting. It has been suggested that, indeed only one parameter is necessary to fit any arbitrary collection of data [41]. However, the fitting in [41] is extremely sensitive to the value of the parameter. The shapes obtained with our method have not this sensitivity: varying κ continuously produces a set of qualitatively related shapes and if changes in κ are small, the changes in shape also are.
In Fig. 4 we show a fitting of Eqs. (40) and (41)) to the shape of an elephant. The 160 landmark points (X j , Y j ), j = 0, . . . 159 are chosen in the contour of the elephant. Sufficiently small κ values produce an excellent fit of the elephant. As κ is increased, the closed shape gradually shrinks to the centroid of the landmarks. This centroid coincides with the zero Fourier mode in the Fourier expansion method of [23]. It is, however, to be noted that to apply the Fourier method first the shape must be traced with rectilinear segments [23] connecting landmarks by a chain code [31,32]. After that, Fourier coefficients need to be calculated up to a certain number and inserted in the Fourier expansions to yield the parametric equations of the shape. Our method only needs the landmarks directly extracted from the contour and these lead directly to the parametric equations of the shape thanks to the corresponding nonlinear B κ -embeddings.
In the following we shall write the landmarks (X 0 , Y 0 ), (X 1 , Y 1 ), . . ., (X N −1 , Y N −1 ) more compactly in a rectangular matrix as The order of the landmarks and whether these are repeated or not is a defining property of the resulting κ-family of shapes. In Fig. 5A we show four shapes of the κ-family obtained from the landmarks 0 4 7 0 3 1 (49) and for the values κ = 0.01 (black curve), κ = 0.3 (blue curve), κ = 0.5 (red curve) and κ = 1 (green curve). By introducing the landmarks in Eqs. (40) and (41)) we obtain the mathematical model in terms of parametric curves for the whole κ-family We see that the -shape is a triangle whose vertices are the landmarks. As κ is increased, shapes with broader round edges appear and gradually shrink to the barycenter of the triangle as κ is continuously increased to infinity. Since Eqs. (50) and (51) the landmark (0, 0) has thrice the weight of the other landmarks. Furthermore, the connection between landmarks (4, 3) and (7, 1) dissappears. From Eqs. (40) and (41)), the mathematical model of the resulting κ-family is, In Fig. 5B the curves obtained from Eqs. (54) and (55) are plotted for κ = 0.01 (black curve), κ = 0.3 (blue curve), κ = 0.5 (red curve) and κ = 1 (green curve). It is observed that the -shape in this case is no longer a triangle because the connection between the points (4, 3) and (7, 1) is missing. Because of the higher weight of the origin, the shapes shrink to a point that is closer to the origin than the barycenter of the triangle in Fig 5A. Any regular polygon defines a shape in which the vertices can be taken as landmarks of a κ-family of shapes. Therefore, a polygon of P sides has landmarks and Eqs. (40) and (41) become In Fig. 5C the curves obtained from these equations are plotted for P = 6, κ = 0.01 (black curve), κ = 0.3 (blue curve), κ = 0.5 (red curve) and κ = 1 (green curve). It is observed that as κ is increased, the shapes approach circumferences. This is obvious: the regularity of the polygon obtained in the limit κ → 0 (the -shape), shrinks to the center of the polygon and, as κ is increased the shape becomes uniformized because the details of the vertices are lost. We see that in increasing κ more symmetric shapes are generally obtained since one passes from objects with discrete symmetries described by dihedral groups to the continuous symmetry of the circumference. If we join each vertex of the polygon to the center we also construct shapes involving the same symmetry groups but with the appearance of stars. The landmarks are now Eqs. (40) and (41) now become In Fig. 5D the curves obtained from these equations are plotted for P = 6, κ = 0.01 (black curve), κ = 0.3 (blue curve), κ = 0.5 (red curve) and κ = 1 (green curve). It is observed that as κ is increased, the shapes approach again circumferences. However, for κ sufficiently small, the shapes are not convex and their starry appearance resemble the one of certain species of Echinoderma. The shapes found within the κ-families and their deformations can be controlled by means of appropriately selected and weighted landmarks. Repeating a landmark after itself does not change the contour of the -shape but has the effect, as κ is increased, of drawing the shapes to a point nearer to the repeated landmark: the direction and amount of deformation within the shapes of a κ-family as κ is increased can thus be absolutely controlled.
Any connected planar graph can be used as a structure of landmarks or -shape. In Fig. 5E the same landmarks as in C and D are used but repeated and connected diferently, as the -shape reveals. The and Eqs. (40) and (41) yield shapes as those in Fig.  5E. Let us assume that we do not know the parametric equations of a Bernoulli lemniscate and we find a plot of such a curve and want a mathematical model for it. Because of its symmetry we place its centroid at the origin. We can then roughly select the vertices of a square as landmarks whose center of mass is the origin and such that the periodic -shape crosses the origin two times through the diagonals of the square These crossings occur in going from landmark (−1, −1) to (1, 1) and in going from (1, −1) to (−1, 1). The landmarks given by Eq. (63) can be replaced in Eqs. (40) and (41)) yielding a mathematical model for the entire κ-family of shapes corresponding to these landmarks. In Fig. 6A we plot y κ (t) vs. x κ (t) obtained from these equations for several κ values. We observe that the κ = 1 curve (green) reasonably approximates a lemniscate. Equal -shapes may belong to different κ-families. If we now consider the landmarks the -shape is identical as with the landmarks in Eq. (63) but as κ is varied, the shapes are different because they do not longer contain the origin: the latter is not a point where the shape crosses itself. This is shown in Fig. 6B: the -shape is the same as in Fig. 6A but the κ-family is different, as it is revealed when κ is increased.
A famous example of a fractal curve in the plane is Hilbert's curve [29]. This curve, which constitutes an open shape, can be regarded as a substitution system. Starting with the landmark X 0 = 0, Y 0 = 0, we iteratively replace each previous landmark by four new landmarks following the transformation For Q = 2 we have 4 2 = 16 landmarks which are obtained replacing in order each of these landmarks following the prescription in Eq. (65). For Q = n we obtain by this process, 4 n landmarks. Hilbert's curve is obtained by joining these landmarks by straight line segments.
By using Eqs. (38) and (39) we can now construct a κ-family of fractal curves having Hilbert's curve as -shape. In Fig. 7 we represent the curves calculated from Eqs. (38) and (39) for the 1024 landmarks obtained after Q = 5 iterations and the values of κ indicated on the panels. When κ is vanishingly small, the -shape (Hilbert's curve after Q = 5 iterations) is approached. When κ increases, the smallest details are averaged out and all straight edges and vertices become replaced by curved contours. As κ increases further, we observe the shapes that we would have obtained with Q = 3 iterations. Increasing κ further then seems like 'going backwards in the iterative process'. In the limit κ → ∞ the shape collapses to its centroid, which corresponds to Q = 0 iterations.
In Fig. 8 we better illustrate this phenomenon. We observe that the curves are self-similar for any value of κ: By multiplying κ by 4 we move backwards in the iteration process, obtaining the same shapes as if they were zoomed in, or as if they were obtained by the landmarks after Q = 5, Q = 4, Q = 3 and Q = 2 iterations (looking at the panels from left to right and top to bottom). We note that the B κ function has a scaling property This property is responsible for the phenomenon observed. We thus note that the smoothing parameter κ is really a scale parameter: as it is increased it captures the features of a shape in a more broader scale.
Since the curves are self-similar we observe the same kind of structures as κ is increased.

D. 3D shapes
In three dimensions we have the vector r κ (t) = (x κ (t), y κ (t), z κ (t)) that yields a plane curve in para-metric form and Eq. (13) for open shapes reduces to where (X j , Y j , Z j ) = r j specifies the j-th landmark.
For closed shapes in the plane Eq. (15) is equivalent to The landmarks (X 0 , Y 0 , Z 0 ), (X 1 , Y 1 , Z 1 ), . . ., (X N −1 , Y N −1 , Z N −1 ) can be written more compactly in a rectangular matrix as As an example of 3D curve, we provide a mathematical model for a trefoil knot, a closed curve which features prominently in the Lorenz attractor [30]. The landmarks of any knot can be found from its planar representation by selecting points on its contour. If a point lags at the bottom (resp. at the front) in the planar representation, a value of Z = 0 (resp. Z = 1) is adjoined to the coordinates X and Y read from the planar representation. We can pick, e.g. N = 9 landmarks in this way, outlining the periodic contour of the shape Eqs. (71) to (73) automatically provide a model for the κ-family of closed shapes derived from these landmarks. In Fig. 9 we plot several shapes that are members of this family. The shape of the trefoil knot shrinks towards its centroid. At κ > 0.55 aprox. the knot undoes and, therefore a knot/unknot transition is observed. Complemented with structural, biological information, the mathematical methods here presented may thus be of interest in the modelling of knot/unknot transitions found in macromolecules and DNA [61,62].

E. κ-family of shapes from Lorenz' attractor
The celebrated Lorenz systeṁ can be embedded in a κ-family of shapes as described in Sec. IV. The landmarks r j := (X j , Y j , Z j ) can be iteratively obtained from Eq. (30) as starting from an initial condition (X 0 , Y 0 , Z 0 ). In Fig.  10 z κ (t) is shown together with y κ (t) and x κ (t) obtained from Eqs. (68) to (70) and the landmarks given by Eqs. (79) to (81) for the initial condition (X 0 , Y 0 , Z 0 ) = (2.5704, 3.6945, 16.4286), N = 1000, δ = 0.01, ρ = 28, σ = 10, β = 8/3 and the values of κ indicated over the panels. It is observed that as κ is decreased to 0, the -shape approaches that of the Lorenz attractor. When κ is increased, deformed complex attractors are obtained. The latter shrink to a point as κ → ∞. The resulting, deformed attractors, for κ > 0 finite are always found within the convex hull of the landmarks obtained from the Lorenz system.

VI. CONCLUSIONS
In this article, a general theory of shape has been presented and illustrated with examples. The theory provides mathematical models for any shape that can be found in the physical world and requires the specification of a finite set of landmarks that fully characterize entire families of qualitatively related shapes. The theory addresses all shapes that are path connected (all shapes of interest in physics, engineering and the life sciences) although it may be extended (by introducing additional parameters) to other topologically interesting curves that are not path connected (as e.g. the Warsaw circle). Disconnected shapes that are composed of path connected pieces can be treated within the theory as scenes (compound shapes).
The theory of shape developed in this article has been linked to viability theory [16][17][18] and invariant sets of dynamical systems [19,20]. When a shape is looked upon as a trajectory of a complex dynamical system (possibly under the influence of unpredictable perturbations) infinite families of viable trajectories can be constructed for the dynamical system, from the knowledge of a finite number of points (landmarks) on a measured trajectory. All viable trajectories generated as κ-families of shapes are found in any convex set of the landmarks and, specifically, in the convex hull of the latter (the convex set of minimal size).
The mathematical models for the shapes correspond to nonlinear B κ -embeddings [28]. The latter structures are nonlinear functions of the time t and deformation κ parameters, but are linear functions of the landmarks. This makes straightforward the application of transformations to the shapes (e.g. translations, rotations, rescalings). Specifically, procrustean analysis can easily be carried on the κ-families of shapes, after displacing the centroid to the origin and rescaling the shapes appropriately [4,5]. The former operation is carried out subtracting the coordinates of the centroid to each of the landmarks. The second operation proceeds by multiplying all the landmarks by a suitable scalar to carry the shape to the confines of the unit interval, square or box. It is not necessary to rotate the shapes within the same κ-family to compare them because all of them share the same orientation.
The theory explains how shapes can be hierarchically integrated in increasingly complex structures (scenes) so that shape is transferred to more encom- passing entities. The time unfolding that characterizes the shape is entirely transferred. The theory also explains how structural information can be retrieved at any level (the -shapes or -scenes, that contain this information, are included as particular cases within the κ-families derived from them). In this sense the theory satisfies Leyton's criteria for a succesful theory of shape [7]. Furthermore, within a same κ-family, shapes with larger κ values are generally more symmetrical that shapes with lower κ, the -shape being the least symmetrical shape within a κ-family. This allows to describe within our theory Leyton's processes in which symmetry-breaking serves as memory storage. These processes are found in Leyton's application of its theory of shape to painting [10] and architecture [11]. Although a previous version of Leyton's theory [63] has been strongly criticized on mathematical grounds and vagueness of the ideas [64] that critique did not incorporate the wreath product con-struction in [7], which in, our view, constitutes a sound mathematical basis for Leyton's theory of shape. Our theory of shape presented in this manuscript yields independent support to Leyton's main basic idea that perception is nothing but the recovery of causal history [7]. Indeed if the parameter κ in our theory is viewed as a time variable, all shapes within a κ-family are causally related, as they are perceptually, to the -shape.
We can mention some interesting directions for further research. First of all, we have described κ-families of shapes in Euclidean spaces but we can also be interested in constraining the shapes so as to lie on a manifold [65,66]. Another interesting direction is investigating the relationship between our theory and Leyton's wreath product in [7] and the relationships of κ-families with group actions, in general. Finally, a very challenging but interesting problem, is to investigate the connection of κ-families to continuous walks through Kendall shape spaces [4,5,67].