# Stretching of Dynamic Mathematical Symbols Taking Care of Similarity and Geometric Characterization

Authors: Abdelouahad Bayar; Khalid Sami
Journal: Mathematical Problems in Engineering
 (2017)

---

## Abstract

The scientific document industry has undergone an important progress in all steps especially in processing and presentation. However, it is still confronted with major obstacles when it has to manipulate documents containing mathematical formulas which are based on dynamic or variable-sized mathematical symbols and taking care of optical scaling. Normally, in processing documents, the composition of mathematical formulas is based on static fonts. The support ofdynamic mathematical symbols requires, in addition to the choice of adequate type of fonts and text formatting tools, the development of amathematical model allowing parametrizing the symbols to support optical scaling. In this paper, we present a method to supply stretching of Bézier curves representing symbols without losing the aspect of similarity and the geometric characteristics of the concerned symbols. The curves of dynamic symbols to be parametrized are designed on the basis of a new method that allows measuring similarity. The model can be extended later for the development of dynamic fonts respecting the rules of Arabic calligraphy. The method to evaluate the similarity can also be easily adapted in other fields such as image processing.


---

## Body

## 1. Overview

In the digital document industry, the presentation of some mathematical symbols, in terms of printing on papers or displaying on monitor screens, has not yet reached the quality offered by metal typesetting (old printing works). The problem relates exactly to symbols qualified to be dynamic. The latter change in size and/or shape depending on the context. Document processing relies on the text formatting (processing) tools and fonts encoding the characters. It is at the level of the fonts that the insufficiency of the support of the dynamic mathematical symbols resides. Precisely, what is missing is a mathematical model that supports this dynamism and thus allows improving the design (engineering) of dynamic fonts.In scientific documents, mathematical formulas are composed of static and/or dynamic symbols. Using a font in a given size, the dimensions and shape of a static symbol do not change throughout the document. The characterα and the operator + are some examples representing the static class of symbols. Adynamic orvariable-sized symbol varies in terms of size and/or sometimes shape depending on the context. As example of dynamic symbols, we can cite the hat diacritic modeling angles: A^ and AOB^ can be considered examples.The most interesting variable-sized symbols are thedelimiters such as parentheses and braces. These symbols’ sizes vary according to thetypesetting context to delimit a mathematical formula. In Figure 1, braces are used to delimit mathematical scripts in different contexts. Note that the braces are of different sizes without being bound by a linear magnification ratio. Indeed, in terms of height as well as in terms of thickness, the ratios are not the same. This concept is calledoptical scaling. It is used to apply scaling taking into account thesatisfaction of the reader’s eye. That is why it is called “optical.” The content of Figure 1 has been taken from an old book of mathematics [1], while the latter has been produced through printing based on metal typesetting.Figure 1
Braces in metal typesetting.The difference between linear scaling and optical scaling can be clearly seen when we consider examples of mathematical formulas with delimiters using computer fonts (instead of metal ones). Samples illustrating the two types of scaling are presented in Figures2 and 3.Figure 2
Linear scaling of brace symbol.Figure 3
Optical scaling of brace symbol.The support of optical scaling requires the development of a dynamic font. In [2, 3], the type of the font and the way to supply the concept of optical scaling are studied. Even, a PostScript Type 3 mini-font and a mini-package have been implemented and tested. In the present paper, the mathematical formalization supporting the work in [2, 3] is communicated. In reality, the support of the optical scaling and therefore the ability of processing scientific documents with good quality of typesetting are more a problem of finding asupporting mathematical model than of the choice of the type of fonts and the document processing tools. The author of [2, 3], in developing the package, obtained the support of the optical scaling on the basis of two tasks. The first one consists of linear scaling to determine the basic thickness of the mathematical symbol and the second one concerns scaling (a stretching) keeping the thickness previously obtained unchanged. The two tasks are illustrated in Figures 4 and 5. Figure 4 shows an abstract mathematical formula modeled by a simple gray rectangle. This mathematical formula is to be delimited by a left parenthesis. First, the parenthesis is set to the convenient dimensions of the body size fs. The font size has not been produced anyhow. It has been specifically calculated (see [2, 3] to get the idea on the way to calculate fs). Then, the size of the half of the parenthesis hfs is determined, which then makes it possible to deduce h, the necessary amount to extend the half of parenthesis.Figure 4
Linear scaling: size of font to supply basic thickness.Figure 5
Semioptical scaling: scaling keeping the same thickness.Figure5 highlights the following step to support the optical scaling. The parenthesis obtained previously is stretched vertically according to the amount h without acting on the thickness to cover all the abstract mathematical formula. The way to supply a nonlinear stretching model keeping the same thickness is the goal of the paper.Also, with reference to Figure5, in order to accomplish this extension, our model should ensure the conservation of some properties characterizing curves as the thickness, the geometric characteristics, and the similarity. We can verify visually these things by considering the parenthesis in Figures 4 and 5. Indeed, the PostScript font developed to be the base to handle dynamic symbols is parametrized according to a stretching model conserving these three properties.The curve matching deals with the study of similarity. The notion of similarity has been studied a great deal and applied in many fields such as computer vision [4, 5], pattern recognition [6], and speech recognition [7]. In computational geometry, the correspondence between curves has been often computed by considering the curves as polylines. This has a meaning, since any curve to be processed in a computer should ultimately be discretized into series of connected segments. However, techniques for studying the similarity of continuous curves have been developed. The Fréchet distance, by its definition [8], can be used as a discrete and continuous mean to study the similarity. Other techniques, originally created to be applied in the discrete domain as DTW (Data Time Warping), have undergone extensions to support the case of continuous curves [9].Our need is particular. The main concern consists of comparing two cubic Bézier curves. This comparison would provide a way to support a stretching model keeping similarity. Similarity constraints are not very strong in our case. Visually, the extended mathematical symbols shouldlookas they were in the initial state. We do not need a technique based on curvatures like the “Fast Marching Method” or other approaches based on the minimization of paths or parametrizing functions as in [8, 9]. We will develop a method for comparing cubic Bézier curves (parametric curves) and, in particular, curves that result from a transform of other curves by similitude or other transformations such as optical scaling (that is not a linear magnification). This method will help in evaluating the exact or approached similarity. Actually, when the curve is the transform of another one by similitude, the similarity equals zero (exact similarity); otherwise, the method gives an approximate value to compare with a threshold. Here, we can explain a detail that will help us to make the difference between linear scaling and optical one: a linear scaling occurs when a shape is scaled everywhere according to a given ratio, for example, when similitude of ratio λ is applied to a geometric shape. On the other hand, optical scaling occurs when the shape undergoes unbalanced homothety (dilation) or some transformations which are not affine mappings.The paper is organized as follows. The second section describes briefly some technical and aesthetic motivations to design a new font supporting dynamic mathematical symbols. In the third section, we define a way for comparing two curves linked by isometric or homothetic transformations. This method allows checking the similarity of two curves in an exact way. In the following section, we give a method to calculate the similarity between two curves which are not equal with respect to direct similitude. Then we present a method to study approximate similarity or similarity according to a given thresholdε. In the fifth section, a stretching model of cubic Bézier curves is defined. This model acts with conservation of the similarity, geometric characteristics, and the thickness between the curve and its stretched form. The paper ends with some conclusions and perspectives.


## 2. Some Technical and Aesthetic Motivations

The main goal of this paper consists in presenting a mathematical model that allows developing fonts of dynamic mathematical symbols. Let us consider the parenthesis as example of a dynamic symbol to introduce the motivations of such a project. We need first to recall in an abstract way how documents are printed through (LA)TEX systems. When printing a document formatted with (LA)TEX, the bitmaps of the characters are used instead of the METAFONT language encoding. It is well known that applying some scaling operations to bitmaps diminishes the quality of the images. Consequently, the support of dynamic fonts based directly on bitmaps is not a feasible way to print documents in good quality. The problem has already been solved otherwise by D. E. Knuth. The approach is presented considering the parenthesis. D. E. Knuth has designed stand-alone parentheses (not composed from other characters) of different sizes as shown in Figure6. When the height of a mathematical formula is less than the heights of these five parentheses (see Figure 6), the closest parenthesis in terms of size is used to delimit the formula.Figure 6
Stand-alone left parentheses.The previous idea cannot be used to solve entirely the problem, since it is necessary to give a large number of parentheses in different sizes to cover all the needs. In addition, we cannot predict in a meaningful way a maximum size of mathematical formulas. When a parenthesis of a height exceeding the highest stand-alone parenthesis is needed, (LA)TEX uses a compound parenthesis based on three characters: and ∣. The last one is repeated as many times as needed between the first and the second to optimally cover the formula to be delimited. A sample of a compound parenthesis is shown in Figure 7. Two important things are noted. The first one concerns the fact that the parenthesis used being stand-alone or compound will not be always exactly of the same height as the formula to delimit. The second one relates particularly to the compound parenthesis. In fact, the latter part differs from the first five ones in terms of shape. This leads therefore to a loss of uniformity. Let us notice that these are the symbols in Figure 6 which are true parentheses.Figure 7
A left compound parenthesis.DynMath, a package developed on the basis of the mathematical model presented in this article, allows managing parentheses in PostScript Type 3 of sizes satisfying exactly the needs of the formula. Even in the case of large formulas, the delimiter produced by DynMath retains the form of a parenthesis (see Figure5).It is very reasonable to consider motivations from an aesthetic point of view. First, we have to notice that the DynMath package comes to extend the formatting capabilities of (LA)TEX, concerning especially the aesthetic point of view. We can work with both in the same document. When it is to compare the mathematical delimiters of (LA)TEX and DynMath from the aesthetic point of view, people can have different opinions and this is natural. However, a kind of consecration of DynMath has already been done in the TUGboat 2016 conference held in Toronto, Canada [2, 3]. The work has been accepted and really appreciated.A no less aesthetic motivation of the project is that the approach presented can be used to model the calligraphic stretchings of the characters of the Arabic script. The stretching of some letters can be accompanied by large deviations from the rules of Arabic calligraphy. An unacceptable writing through stretching some letters can rapidly be produced. The model can therefore help to prevent such uncomfortable situations.


## 3. Comparison of Bézier CurvesExactly Similar

The comparison of curves to supply the optical scaling is not a new idea. Actually, a work in mathematical formalization has been done as a mandatory part toward elaborating a dynamic font respecting the Arabic calligraphy [10, 11]. In that work, the stretching concerns only one curve and, in addition, the transformers of curves to compare are simply shifts. The content of this section and so, our method to study similarity, is based on some concepts developed in works such as [10, 11].


### 3.1. Comparison of Isometric Bézier Curves (Equality of Curves)

Definition 1 (equality of curves in plane).
LetB1 and B2 be two cubic Bézier (parametrized) curves defined in R2. We define the equality relation:(1)B1=cB2⟺B1′×B1-G1=B2′×B2-G2on0,1,where G1 and G2 are centroids of control points of B1 and B2, respectively.Another way to write the equality of two curves is(2)B1=cB2⟺B1′×B1-G1=B2′×B2-G2on0,1,B1=cB2⟺B1′×B1-G1-B2′×B2-G2=0R3on0,1.Then, the equality formula will be (3)B1=cB2⟺B1′×B1-G1-B2′×B2-G2=0R3on0,1.The notion of direct orthogonal range is defined in [10]. Given a parametrized curve C, the direct orthogonal range on t∈0,1 with respect to a given vector u→ is the amount u→×Ct-O, where O=0,0,0R3. B′×B-G represents also a direct orthogonal range but relative to the vector B′ and the centroid G.LetB1 and B2 be two cubic Bézier curves. We realize that if B1=cB2, then B2 is the map of B1 by an affine isometry. From this point of view, we will talk about B1=cB2 or more precisely aboutisometric equality. We can say simply that the two curves areisometric.


### 3.2. Homothetic Based Comparison of Cubic Bézier Curves

In this part, we define an equality relation between curves with reference to homothetic transformations. This means that there is an isometric equality after applying homothety to one of the two curves.Let us consider two Bézier curvesB1 and B2.Definition 2 (homothetic equality).
B
1 and B2 are said to be in homothetic equality if and only if ∃μ∈R∗ such that B1 and μB2 are in isometric equality (B1=cμB2).Property 1.
LetB be a cubic Bézier (parametrized) curve; then the maps of B by direct similitude are homothetically equal to B.Proof.
By definition, a map ofB by an isometry is equal to B and so the property is verified with μ=1.
Also for homothety of ratioλ, we will take μ=1/λ.
Now, let us consider similitudeS.
Then,S=i∘h, where i is an isometry and h is homothety of ratio λ.(4)SB1=i∘hB1=B2.
It follows thatihB1=iλB1=λiB1=B2.
But we haveiB1=cB1.
We get thatλiB1=cλB1 and so B2=cλB1.
From what comes, we get thatB1=c(1/λ)B2.
So∃μ=1/λ such that B1=cμB2.Now, it is time to define the notion of exact similarity (nonapproximative). The last will be used as a reference to define the similarity in an approximating way.Definition 3 (exact similarity or 0-similarity).
B
1 and B2 are exactly similar or 0-similar if and only if ∃η∈R∗ such that B1=cηB2. In other words, ∃η∈R∗,B1′×B1-G1-η2B2′×B2-G2=0R3on0,1.


## 3.1. Comparison of Isometric Bézier Curves (Equality of Curves)

Definition 1 (equality of curves in plane).
LetB1 and B2 be two cubic Bézier (parametrized) curves defined in R2. We define the equality relation:(1)B1=cB2⟺B1′×B1-G1=B2′×B2-G2on0,1,where G1 and G2 are centroids of control points of B1 and B2, respectively.Another way to write the equality of two curves is(2)B1=cB2⟺B1′×B1-G1=B2′×B2-G2on0,1,B1=cB2⟺B1′×B1-G1-B2′×B2-G2=0R3on0,1.Then, the equality formula will be (3)B1=cB2⟺B1′×B1-G1-B2′×B2-G2=0R3on0,1.The notion of direct orthogonal range is defined in [10]. Given a parametrized curve C, the direct orthogonal range on t∈0,1 with respect to a given vector u→ is the amount u→×Ct-O, where O=0,0,0R3. B′×B-G represents also a direct orthogonal range but relative to the vector B′ and the centroid G.LetB1 and B2 be two cubic Bézier curves. We realize that if B1=cB2, then B2 is the map of B1 by an affine isometry. From this point of view, we will talk about B1=cB2 or more precisely aboutisometric equality. We can say simply that the two curves areisometric.


## 3.2. Homothetic Based Comparison of Cubic Bézier Curves

In this part, we define an equality relation between curves with reference to homothetic transformations. This means that there is an isometric equality after applying homothety to one of the two curves.Let us consider two Bézier curvesB1 and B2.Definition 2 (homothetic equality).
B
1 and B2 are said to be in homothetic equality if and only if ∃μ∈R∗ such that B1 and μB2 are in isometric equality (B1=cμB2).Property 1.
LetB be a cubic Bézier (parametrized) curve; then the maps of B by direct similitude are homothetically equal to B.Proof.
By definition, a map ofB by an isometry is equal to B and so the property is verified with μ=1.
Also for homothety of ratioλ, we will take μ=1/λ.
Now, let us consider similitudeS.
Then,S=i∘h, where i is an isometry and h is homothety of ratio λ.(4)SB1=i∘hB1=B2.
It follows thatihB1=iλB1=λiB1=B2.
But we haveiB1=cB1.
We get thatλiB1=cλB1 and so B2=cλB1.
From what comes, we get thatB1=c(1/λ)B2.
So∃μ=1/λ such that B1=cμB2.Now, it is time to define the notion of exact similarity (nonapproximative). The last will be used as a reference to define the similarity in an approximating way.Definition 3 (exact similarity or 0-similarity).
B
1 and B2 are exactly similar or 0-similar if and only if ∃η∈R∗ such that B1=cηB2. In other words, ∃η∈R∗,B1′×B1-G1-η2B2′×B2-G2=0R3on0,1.


## 4. Comparison of Cubic Bézier Curves Approximately Similar (ε-Similarity)

When two curvesB1 and B2 are to be compared, suppose that B2 is a map of B1 by direct similitude; then there is an exact similarity between B1 and B2, since we have ∃η∈R∗,B1=cηB2.We have the equality of the direct orthogonal range for anyt∈0,1. But, to get a similarity in the approximate sense, it is enough that the sum of modules of B1′×B1-G1-η2B2′×B2-G2 on 0,1 approaches the value 0 or is less than ε (where ε>0).In addition to the almost null sum, to get the similarity, we add the fact that the two curves have the same geometric characteristics.


### 4.1. Summation of Squares of Orthogonal Range Differences

Consider the two curvesB1 and B2 that are in Figures 8 and 9. B2 is not obtained from B1 by an affine mapping. There is no exact similarity between these two curves. However, they have the same geometric characteristics. Both are monotonic arches.Figure 8
CurveB1.Figure 9
CurveB2.We aim at calculating the amountφ defined in the following equation:(5)φB1,B2=∫01B1′×B1-G1-μ2B2′×B2-G22dtμ∈R∗.μ is a coefficient allowing determining from B2, by homothety, a curve μB2 close, in terms of similarity, to B1. Let B1 and B2 be two curves to be compared; an important step consists in providing a way to determine a value of μ. For this, we need to define the notion of associated circle to a Bézier curve (Cf. Definition 4).Definition 4 (associated circle).
Consider a Bézier curveB of control points P0, P1, P2, and P3. Let G be the centroid of the points P0, P1, P2, and P3. This means that G=(1/4)P0+P1+P2+P3. Then, the circle associated with B is the circle having G as center and r=maxi=03GPi as a radius.The two curvesB1 and B2 are retaken in Figures 10 and 11 considering their associated circles. We notice that the two associated circles are not of the same dimensions.Figure 10
CurveB1 with its associated circle.Figure 11
CurveB2 with its associated circle.Now, considerμ=r1/r2, where r1 and r2 are radii of circles associated, respectively, with B1 and B2. Then the circle associated with μB2 has r1 as radius. In other words, B1 and μB2 have isometric associated circles and so they can be compared in terms of similarity. The curve μB2 is shown in Figure 12.Figure 12
CurveμB2 with the associated circle: μ=0.846633.With a precisionε=9500 and the calculated μ=0.846633, the value of φB1,B2 defined in (5) is φ=7641.16. The sum of squares of direct orthogonal range differences is less than ε; let φ<ε. We will simply say that B1 and B2 are ε-similar. One can have some criticisms on ε. In fact, what is a precision with value around a few thousands? We will understand that in the following and we will define, by the way, a method to study the similarity with acceptable precision around values close to zero.Now, let one consider two curvesB3 and B4 to be compared in terms of similarity relative to the same precision ε. Suppose that B3 and B4 verify B3=λB1 and B4=λB2, where λ=1.3. Due to Definition 2, B1 and B3 are linked by an exact similarity. The same property is also satisfied between B2 and B4. From the above, B1 and B2 are ε-similar. We can check that φB3,B4=λ2φB1,B2=12913.6. We find that φB3,B4≥ε and then B3 and B4 are not ε-similar. So (5) does not allow the definition of an adequate method to study the similarity of curves.The problem can be solved by comparing curves with passing to unit dimensions. The approach is presented considering the previous curvesB1 and B2. In order to compare these two curves in terms of similarity, it will be enough to compare (1/r1)B1 and (1/r2)B2. We notice that the circles associated with these two curves have radii equal to 1. Then the value of the parameter μ will be one. Formula (5) becomes(6)ψB1,B2=∫011r12B1′×B1-G1-1r22B2′×B2-G22dt,where r1 and r2 are radii of the circles associated with curves B1 and B2, respectively.An important property of the functionψ can be stated.Property 2.
Consider two Bézier curvesB1 and B2. r1 and r2 are, respectively, radii of circles associated with B1 and B2. Let B3 and B4 be two curves such that B3=λB1 and B4=γB2. Then, we have(7)ψB1,B2=ψB3,B4.Proof.
Letr3 and r4 be radii of the circles associated with B3 and B4, respectively.
SinceB3=λB1 and B4=γB2, we have r3=λr1 and r4=γr2.
We get(8)ψB3,B4=∫011r32B3′×B3-G3-1r42B4′×B4-G42dt=∫011λ2r12λB1′×λB1-λG1-1γ2r22γB2′×γB2-γG22dt=∫011r12B1′×B1-G1-1r22B2′×B2-G22dt=ψB1,B2.With the comparison formula (6), we get ψB1,B2=ψB3,B4=0.0000467439.We notice that the value of similarity diminished comparatively to the obtained previously values.The functionψ can be written in another way that seems to be easier to link with φ defined in (5):(9)ψB1,B2=1r14∫01B1′×B1-G1-μ2B2′×B2-G22dt.Withμ=r1/r2, r1 and r2 are radii of circles associated with B1 and B2.The similarity measurement formula can be further improved by studying a set of properties to be verified by the sum of the squares of the orthogonal range differences when the curve is located in a given disc. This is the goal of the next section.


### 4.2. Some Properties on Discs (Unitary Discs) inR2 and R2→

We consider two setsDc,u and Du which are parts of the spaces R2 and R2→, respectively. Dc,u is the disc, in the plane R2, centered at c and is of radius u. Du is the disc in R2→ (centered in O). The latter is the set of vectors in R2→ having norms at most equal to u.In comprehension,Dc,u and Du are defined as follows:(10)Dc,u=M∈R2,M-c≤u,Du=V∈R2→,V≤u.Suppose thatc=cx,cy; then (11)Dc,u=x,y∈R2,x-cx2+y-cy2≤u,Du=x,y∈R2→,x2+y2≤u.Two pointsM1 and M2 in the affine plane R2 define a vector denoted as M1M2→ or simply M2-M1. We adopt the last notation.We can state a first property concerning the two parts.Property 3.
LetM1∈Dc,u and M2∈Dc,v. Then M1-M2∈Du+v.Proof.
LetM1∈Dc,u and M2∈Dc,v and W=M1-M2; let us show that W∈Du+v. (12)M2-M1=M1M2.We have (13)M1M2≤M1c+cM2.So M2-M1≤u+v.
Consequently,W∈Du+v.Consider a Bézier curveB of control points P0, P1, P2, and P3 such that Pi∈Dc,u. The curve B is of course a subset of Dc,u, since B is located into the convex hull defined by the four control points. This is one of the known properties of Bézier curves. Let us study the disc being able to contain the hodograph (the derivative of B). We can state the following property.Property 4.
LetB be a Bézier curve of control points P0, P1, P2, and P3 such that Pi∈Dc,u∀i=0,…,3. Then we have the following:(i)
Bt∈Dc,u∀t∈0,1.(ii)
B′t∈D6u∀t∈0,1.Proof.
LetH be the hodograph associated with B (H≡B′) of control points h0, h1, and h2.(14)h0=3P1-P0,h1=3P2-P1,h2=3P3-P2.
From Property3, hi∈D6u.
SoH⊂D6u (H is contained in the convex hull defined through the control points h0, h1, and h2).In the sequel, we state a property that relates to cross product of a vector in discDu and another in disc Dv.Property 5.
LetM1∈Du and M2∈Dv; then M1×M2∈Duv.Proof.
LetM1∈Du and M2∈Dv and W=M1×M2,W=M1·M2·sin⁡θ·k→, where θ=M1,M2^.
We have0≤M1≤u and 0≤M2≤v.
So0≤M1·M2≤uv.
We get that0≤M1·M2·sin⁡θ≤uv.
Consequently,W≤uv.
Finally, we haveW∈Duv.Property 6.
We consider two Bézier curvesB1 and B2 such that B1⊂Dc1,u and B2⊂Dc2,u. Let G1 and G2 be the centroids of control points of B1 and B2, respectively. Then we have(1)
B1′×B1-G1-B2′×B2-G2⊂D24u2(2)
B1′×B1-G1-B2′×B2-G22≤576u4(3)
∫01B1′×B1-G1-B2′×B2-G22dt≤576u4.Proof.
(1)
We haveB1⊂Dc1,u, G1∈Dc1,u, B2⊂Dc2,u, and G2∈Dc2,u.
SoB1-G1∈D2u and B2-G2∈D2u, got from Property 3.
Also, we haveB1′⊂D6u and B2′⊂D6u from Property 4.
It follows thatB1′×B1-G1∈D12u2 and B2′×B2-G2∈D12u2 according to Property 5.
Consequently, we will getB1′×B1-G1-B2′×B2-G2⊂D24u2.
(2)
This point is a direct result of the previous one.
(3)
This point is a direct result of the previous one.Property 7.
Consider two Bézier curvesB1 and B2. Let r1 and r2 be radii of the circles associated with B1 and B2. Then, we have(15)∫011r12B1′×B1-G1-1r22B2′×B2-G22dt<576.Proof.
We haveB1⊂DG1,r1 and B2⊂DG2,r2.
So(1/r1)B1⊂D(1/r1)G1,1 and (1/r2)B2⊂D(1/r2)G2,1.
Applying Property6-(3), we get (16)∫011r1B1′×1r1B1-1r1G1-1r2B2′×1r2B2-1r2G22dt<576×14u=1.Let (17)∫011r12B1′×B1-G1-1r22B2′×B2-G22dt<576.From this property, we notice that, for all Bézier curvesB1 and B2, the value ψB1,B2 would never exceed 576. This allows us to provide the final formula of the way to calculate the similarity between two curves relative to precision close to zero. We thus give the definition of the similarity with respect to a precision ε just after defining S such that(18)SB1,B2=1576∫011r12B1′×B1-G1×B1′-1r22B2′×B2-G22dt.Definition 5 (ε-similarity).
We consider two cubic Bézier curvesB1 and B2. The numbers r1 and r2 represent the radii of the circles associated with these curves. Let G1 and G2 be the centroids of control points of B1 and B2. Then B1 and B2 are ε-similar if and only if(1)
B1 and B2 have the same geometric characterization,(2)
SB1,B2<ε.


## 4.1. Summation of Squares of Orthogonal Range Differences

Consider the two curvesB1 and B2 that are in Figures 8 and 9. B2 is not obtained from B1 by an affine mapping. There is no exact similarity between these two curves. However, they have the same geometric characteristics. Both are monotonic arches.Figure 8
CurveB1.Figure 9
CurveB2.We aim at calculating the amountφ defined in the following equation:(5)φB1,B2=∫01B1′×B1-G1-μ2B2′×B2-G22dtμ∈R∗.μ is a coefficient allowing determining from B2, by homothety, a curve μB2 close, in terms of similarity, to B1. Let B1 and B2 be two curves to be compared; an important step consists in providing a way to determine a value of μ. For this, we need to define the notion of associated circle to a Bézier curve (Cf. Definition 4).Definition 4 (associated circle).
Consider a Bézier curveB of control points P0, P1, P2, and P3. Let G be the centroid of the points P0, P1, P2, and P3. This means that G=(1/4)P0+P1+P2+P3. Then, the circle associated with B is the circle having G as center and r=maxi=03GPi as a radius.The two curvesB1 and B2 are retaken in Figures 10 and 11 considering their associated circles. We notice that the two associated circles are not of the same dimensions.Figure 10
CurveB1 with its associated circle.Figure 11
CurveB2 with its associated circle.Now, considerμ=r1/r2, where r1 and r2 are radii of circles associated, respectively, with B1 and B2. Then the circle associated with μB2 has r1 as radius. In other words, B1 and μB2 have isometric associated circles and so they can be compared in terms of similarity. The curve μB2 is shown in Figure 12.Figure 12
CurveμB2 with the associated circle: μ=0.846633.With a precisionε=9500 and the calculated μ=0.846633, the value of φB1,B2 defined in (5) is φ=7641.16. The sum of squares of direct orthogonal range differences is less than ε; let φ<ε. We will simply say that B1 and B2 are ε-similar. One can have some criticisms on ε. In fact, what is a precision with value around a few thousands? We will understand that in the following and we will define, by the way, a method to study the similarity with acceptable precision around values close to zero.Now, let one consider two curvesB3 and B4 to be compared in terms of similarity relative to the same precision ε. Suppose that B3 and B4 verify B3=λB1 and B4=λB2, where λ=1.3. Due to Definition 2, B1 and B3 are linked by an exact similarity. The same property is also satisfied between B2 and B4. From the above, B1 and B2 are ε-similar. We can check that φB3,B4=λ2φB1,B2=12913.6. We find that φB3,B4≥ε and then B3 and B4 are not ε-similar. So (5) does not allow the definition of an adequate method to study the similarity of curves.The problem can be solved by comparing curves with passing to unit dimensions. The approach is presented considering the previous curvesB1 and B2. In order to compare these two curves in terms of similarity, it will be enough to compare (1/r1)B1 and (1/r2)B2. We notice that the circles associated with these two curves have radii equal to 1. Then the value of the parameter μ will be one. Formula (5) becomes(6)ψB1,B2=∫011r12B1′×B1-G1-1r22B2′×B2-G22dt,where r1 and r2 are radii of the circles associated with curves B1 and B2, respectively.An important property of the functionψ can be stated.Property 2.
Consider two Bézier curvesB1 and B2. r1 and r2 are, respectively, radii of circles associated with B1 and B2. Let B3 and B4 be two curves such that B3=λB1 and B4=γB2. Then, we have(7)ψB1,B2=ψB3,B4.Proof.
Letr3 and r4 be radii of the circles associated with B3 and B4, respectively.
SinceB3=λB1 and B4=γB2, we have r3=λr1 and r4=γr2.
We get(8)ψB3,B4=∫011r32B3′×B3-G3-1r42B4′×B4-G42dt=∫011λ2r12λB1′×λB1-λG1-1γ2r22γB2′×γB2-γG22dt=∫011r12B1′×B1-G1-1r22B2′×B2-G22dt=ψB1,B2.With the comparison formula (6), we get ψB1,B2=ψB3,B4=0.0000467439.We notice that the value of similarity diminished comparatively to the obtained previously values.The functionψ can be written in another way that seems to be easier to link with φ defined in (5):(9)ψB1,B2=1r14∫01B1′×B1-G1-μ2B2′×B2-G22dt.Withμ=r1/r2, r1 and r2 are radii of circles associated with B1 and B2.The similarity measurement formula can be further improved by studying a set of properties to be verified by the sum of the squares of the orthogonal range differences when the curve is located in a given disc. This is the goal of the next section.


## 4.2. Some Properties on Discs (Unitary Discs) inR2 and R2→

We consider two setsDc,u and Du which are parts of the spaces R2 and R2→, respectively. Dc,u is the disc, in the plane R2, centered at c and is of radius u. Du is the disc in R2→ (centered in O). The latter is the set of vectors in R2→ having norms at most equal to u.In comprehension,Dc,u and Du are defined as follows:(10)Dc,u=M∈R2,M-c≤u,Du=V∈R2→,V≤u.Suppose thatc=cx,cy; then (11)Dc,u=x,y∈R2,x-cx2+y-cy2≤u,Du=x,y∈R2→,x2+y2≤u.Two pointsM1 and M2 in the affine plane R2 define a vector denoted as M1M2→ or simply M2-M1. We adopt the last notation.We can state a first property concerning the two parts.Property 3.
LetM1∈Dc,u and M2∈Dc,v. Then M1-M2∈Du+v.Proof.
LetM1∈Dc,u and M2∈Dc,v and W=M1-M2; let us show that W∈Du+v. (12)M2-M1=M1M2.We have (13)M1M2≤M1c+cM2.So M2-M1≤u+v.
Consequently,W∈Du+v.Consider a Bézier curveB of control points P0, P1, P2, and P3 such that Pi∈Dc,u. The curve B is of course a subset of Dc,u, since B is located into the convex hull defined by the four control points. This is one of the known properties of Bézier curves. Let us study the disc being able to contain the hodograph (the derivative of B). We can state the following property.Property 4.
LetB be a Bézier curve of control points P0, P1, P2, and P3 such that Pi∈Dc,u∀i=0,…,3. Then we have the following:(i)
Bt∈Dc,u∀t∈0,1.(ii)
B′t∈D6u∀t∈0,1.Proof.
LetH be the hodograph associated with B (H≡B′) of control points h0, h1, and h2.(14)h0=3P1-P0,h1=3P2-P1,h2=3P3-P2.
From Property3, hi∈D6u.
SoH⊂D6u (H is contained in the convex hull defined through the control points h0, h1, and h2).In the sequel, we state a property that relates to cross product of a vector in discDu and another in disc Dv.Property 5.
LetM1∈Du and M2∈Dv; then M1×M2∈Duv.Proof.
LetM1∈Du and M2∈Dv and W=M1×M2,W=M1·M2·sin⁡θ·k→, where θ=M1,M2^.
We have0≤M1≤u and 0≤M2≤v.
So0≤M1·M2≤uv.
We get that0≤M1·M2·sin⁡θ≤uv.
Consequently,W≤uv.
Finally, we haveW∈Duv.Property 6.
We consider two Bézier curvesB1 and B2 such that B1⊂Dc1,u and B2⊂Dc2,u. Let G1 and G2 be the centroids of control points of B1 and B2, respectively. Then we have(1)
B1′×B1-G1-B2′×B2-G2⊂D24u2(2)
B1′×B1-G1-B2′×B2-G22≤576u4(3)
∫01B1′×B1-G1-B2′×B2-G22dt≤576u4.Proof.
(1)
We haveB1⊂Dc1,u, G1∈Dc1,u, B2⊂Dc2,u, and G2∈Dc2,u.
SoB1-G1∈D2u and B2-G2∈D2u, got from Property 3.
Also, we haveB1′⊂D6u and B2′⊂D6u from Property 4.
It follows thatB1′×B1-G1∈D12u2 and B2′×B2-G2∈D12u2 according to Property 5.
Consequently, we will getB1′×B1-G1-B2′×B2-G2⊂D24u2.
(2)
This point is a direct result of the previous one.
(3)
This point is a direct result of the previous one.Property 7.
Consider two Bézier curvesB1 and B2. Let r1 and r2 be radii of the circles associated with B1 and B2. Then, we have(15)∫011r12B1′×B1-G1-1r22B2′×B2-G22dt<576.Proof.
We haveB1⊂DG1,r1 and B2⊂DG2,r2.
So(1/r1)B1⊂D(1/r1)G1,1 and (1/r2)B2⊂D(1/r2)G2,1.
Applying Property6-(3), we get (16)∫011r1B1′×1r1B1-1r1G1-1r2B2′×1r2B2-1r2G22dt<576×14u=1.Let (17)∫011r12B1′×B1-G1-1r22B2′×B2-G22dt<576.From this property, we notice that, for all Bézier curvesB1 and B2, the value ψB1,B2 would never exceed 576. This allows us to provide the final formula of the way to calculate the similarity between two curves relative to precision close to zero. We thus give the definition of the similarity with respect to a precision ε just after defining S such that(18)SB1,B2=1576∫011r12B1′×B1-G1×B1′-1r22B2′×B2-G22dt.Definition 5 (ε-similarity).
We consider two cubic Bézier curvesB1 and B2. The numbers r1 and r2 represent the radii of the circles associated with these curves. Let G1 and G2 be the centroids of control points of B1 and B2. Then B1 and B2 are ε-similar if and only if(1)
B1 and B2 have the same geometric characterization,(2)
SB1,B2<ε.


## 5. A Nonlinear Stretching Model Respecting Similarity

In this section, we will show how to define a nonlinear model for stretching of cubic Bézier curves respecting similarity and geometric characterization properties. For simplicity, a Bézier curveB of control points P0, P1, P2, and P3 will be simply denoted as B=P0,P1,P2,P3 (in particular, if the Bézier curve is of the first degree, this notation coincides exactly with the one adopted for a line segment).


### 5.1. Stretching Transformation

LetB1=P10,P11,P12,P13 be a Bézier curve and B2 is the Bézier curve obtained from B1 via affine stretching (it can be linear). Then B2 has the form P20,P21,P22,P23 with the following constraints:(i)
P20=P10.(ii)
P23=P13+E:E=w,h; this is the stretching Vector. w and h are stretching amounts in horizontal and vertical directions, respectively.Let φ be an affine transformation such that φB1=B2. φ is built to be most of the time a nonbalanced homothety or dilation (see next) (otherwise, we will have linear scaling). The matrix M associated with φ and the map I of O are as follows: (19)M=λx00λy,φO=I=Ox,Oy.Under constraintsφP10=P10 and φP13=P13+w,h, knowing that P10=x10,y10 and P13=x13,y13, we will get(1)
λx=1+w/(x13-x10),(2)
λy=1+h/(y13-y10),(3)
Ox=-x10(w/(x13-x10)),(4)
Oy=-y10(h/(y13-y10)).Here, we notice that if λx≠λy, then we have an unbalanced dilation or homothety.φ is an affine mapping. We know that, for every Bézier curve B, B and φB have the same geometric characteristics. What remains is to study the similarity of a curve and its stretched curve by such a transformation.


### 5.2. The Similarity and the Stretching Vector

To study the relationship between the similarity and the stretching vectorw,h,  let us consider the case concerning the stretching of the parenthesis delimiting a mathematical formula. We present the concept for the top part of the left parenthesis only. It will be the same for the bottom part, since the parenthesis has a symmetric shape with respect to a horizontal axis. The study of the stretching of parenthesis reveals the following rule: to any vertical stretching amount h corresponds a horizontal amount w such that w∈0,h/3. To present the paragraph better, we will give details on the encoding of the top part of the parenthesis. This part of the parenthesis is encoded with two cubic Bézier curves L and R connected by two straight line segments at the top and bottom (see Figure 13). The parenthesis will be shown in 500 body size (half the effective encoding size in the font, 1000 body size). For the study of the relationship between the similarity and the stretching vector, we use only one of the curves, L or R. We choose L to be used. Concretely,(20)L=109.14813,250.00014,109.14813,437.86641,171.58542,625.45052,319.11168,740.27823.Figure 13
Top part of the left parenthesis.Some stretchings ofL, with h=1200 and w taking values in the set 0,100,200,300,400, are done. However, the display of that in figures is given only in 128 body size so that the illustrations can fit into the page (in body size 128, it is similar to stretch the top part with respect to h=1200(128/1000)=153.6 and w∈0,12.8,25.6,38.4,51.2). Three of these stretching operations are shown in Figure 14(b), where w=0, w=200, and w=400. The curve in its initial size is in Figure 14(a) to well situate the comparison states.Figure 14
Different extensions of left curve of the top part of left parenthesis.h is constant; w varies.
(a)
Left curve in initial size
(b)
Three different horizontal stretchings, 0, 200, 400, for the same vertical amount,h=1200We can notice that, for a constant amount of the vertical extensionh=1200, as the horizontal stretching w increases to h/3, the similarity between the curve and its stretched curve is more and more improved. Samples of this evolution are presented in Table 1.Table 1
Variation of the similarity according tow for h=1200.
h
1200
w
0
100
200
300
400
S
9.22
e
-
05
5.79
e
-
05
3.21
e
-
05
1.43
e
-
05
3.86
e
-
06As for horizontal variations, the similarity also loses its quality whenh increases. To give an illustration of this fact, some extracts of similarity values for h varying from 0 to 2000 are presented in Table 2. For all values of h, the considered amount of horizontal stretching is w=h/3. We can see that the similarity becomes bad more and more as the value of h increases.Table 2
Variation of the similarity according to variation ofh and w=h/3.
h
0
500
100
1500
2000
w
0
166.67
333.33
500
666.67
S
1.11
e
-
35
1.92
e
-
06
3.44
e
-
06
4.37
e
-
06
4.98e-06


### 5.3. Similarity and Bézier Curve Refinement

This section deals with the relationship between the similarity of curves and the decomposition of Bézier curves. Let us consider once again the two curves considered in the beginning (Figures8 and 9) to study the effect of Bézier decomposition on them. Concretely, B1 and B2 are as follows:(21)B1=50,30,57,73,72,110,106,142,B2=50,30,57,83,77,135,111,157.The value of similarity between these two curves is8.11526e-7. If we process a multiple Bézier’s decomposition of B1 and B2 and try to compare the similarity between the obtained subcurves of the same decomposition range, we can remark that the values of similarity diminish. Table 3 shows the values of similarity for the multiple decomposition of orders 0, 4, 9, 12, 13, and 19. Generally, from a decomposition of order n, we get n+1 subcurves. Beyond order 13, the similarity of the decomposition segments becomes better than the similarity of the two curves without decompositionTable 3
Similarity variation according to Bézier refinement.
n
0
4
9
12
13
19
S
8.12
e
-
7
1.64
e
-
8
8.22
e
-
9
5.63
e
-
9
5.02
e
-
9
2.79
e
-
9
7.24
e
-
10
9.67
e
-
10
1.37
e
-
9
1.41
e
-
9
1.27
e
-
9
1.73
e
-
8
4.11
e
-
11
9.31
e
-
11
1.57
e
-
10
4.37
e
-
10
6.18
e
-
7
6.06
e
-
11
4.15
e
-
11
1.59
e
-
11
8.40
e
-
11
4.01
e
-
6
1.04
e
-
9
3.19
e
-
11
4.95
e
-
11
1.86
e
-
12
1.71
e
-
8
2.01
e
-
10
1.60
e
-
11
1.74
e
-
11
8.66
e
-
8
3.43
e
-
9
1.05
e
-
9
1.90
e
-
11
2.81
e
-
7
1.72
e
-
8
6.83
e
-
9
4.13
e
-
13
6.99
e
-
7
5.49
e
-
8
2.44
e
-
8
1.18
e
-
10
1.42
e
-
6
1.37
e
-
7
6.52
e
-
8
7.89
e
-
10
2.91
e
-
7
1.45
e
-
7
2.78
e
-
9
5.43
e
-
7
2.84
e
-
7
7.27
e
-
9
9.04
e
-
7
4.97
e
-
7
1.59
e
-
8
7.93
e
-
7
3.10
e
-
8
5.53
e
-
8
9.20
e
-
8
1.44
e
-
7
2.15
e
-
7
3.05
e
-
7
4.14
e
-
7To show the role of Bézier’s decomposition in similarity and extension, let us consider the curves defining the upper part of the left parenthesis together. The extension values used to highlight the problems are very large.The height of the half-parenthesis is 490.27809 in the PostScript unit (see the concrete coordinates above). This height is given in 1000 body size (1000 is the base size for specifying a PostScript font). The notion of “body size” in PostScript is equivalent to “font size.” The height of paperA3 is 421. We want to write the half-parenthesis in body 96. What value of h must be used to stretch the half-parenthesis in 1000 body size so that it occupies the half of A3 paper in 96 body size? The value of h should be “3895.13857.” In fact:(i)
H: global height of the stretched half parenthesis in 96 body size. H=421.(ii)
b: height of half parenthesis in 1000 body size 1000. b=490.27809.(iii)
h: The stretching amount in 1000 body size (to determine).ThenH=b+h(96/1000) and so h=(1000×H)/96-b.Leth=3895.13857.The horizontal amount of stretching adopted to study the effect of decomposition isw=h/3.We saw in Section5.1 how to stretch a Bézier curve B with respect to an extension vector w,h. How do we proceed in terms of extension if we decompose the curve B into n Bézier subcurves? Let Bii=0n-1 be the sequence of the obtained curves by multidecomposition (the order of decomposition is n-1).Let us consider the following items:(i)
B=P0,I,J,Pn: the Bézier curve to decompose and stretch(ii)
Bi=Pi,Ii,Ji,Pi+1: the curve segment number i obtained by decomposition, i=0,…,n-1(iii)
Pi=xi,yi, i=0,…,n-1The curve Bi would be stretched with respect to vector wi,hi, where wi=((xi+1-xi)/(xn-x0))w and hi=((yi+1-yi)/(yn-y0))h. The transformation φi is defined by referring to Section 5.1. Some shift transformations are mandatory to connect the segments after the stretching operations.We chose to give a concrete example, the parenthesis symbol. We worked with the 96 body size so that the concepts to be highlighted are more clear. The shape is delimited by two curves to be extended, namely,L and R. In fact, we must stretch L and R of the same vector w,h. As we will see in the following, the simple stretching does not allow a global similarity of the parenthesis. This problem is solved by the Bézier multiple decomposition of the curves L and R. Suppose that we have to perform a decomposition of order n-1 in order to get n Bézier subcurves. Let us consider the following items:(i)
L=PL0,IL,JL,PLn.(ii)
Lii=0n-1 is the sequence obtained by the Bézier decomposition of L to order n-1.(iii)
R=PR0,IR,JR,PRn(iv)
Rii=0n-1 is the sequence obtained by the Bézier decomposition of R to order n-1.The stretching fractions wi,hi of decomposition segments are determined relative to the curve L and they are used also in the case of R (nothing prevents the reverse). The goal of this is to obtain after extension a parenthesis having the same thickness as the initial one. Let wi,hi=(xL,i+1-xLi/xLn-xL0)w,(yL,i+1-yLi/yLn-yL0)h.LetLie and Rie be the curves obtained by stretching of Li and Ri, respectively, according to vector wi,hi. The study of the relationship of Bézier decomposition and similarity is done by measuring the similarity values SLi,Lie and SRi,Rie. Some extracts are in Table 4.Table 4
Similarity variation of the shape of the left parenthesis according to Bézier refinement.
n
0
2
4
L
R
L
R
L
R
S
6.13
e
-
06
3.75
e
-
07
5.06
e
-
07
8.82
e
-
09
1.72
e
-
07
8.26
e
-
09
5.60
e
-
07
6.90
e
-
09
1.95
e
-
07
7.94
e
-
10
9.36
e
-
08
4.40
e
-
09
1.93
e
-
07
1.90
e
-
09
1.26
e
-
07
7.38
e
-
09
3.40
e
-
09
5.39
e
-
10
Moy
6.13
e
-
06
3.75
e
-
07
3.86
e
-
07
6.71
e
-
09
1.38
e
-
07
3.77
e
-
09The left half parenthesis (to stretch) is given in 96 body size in Figure15(a). In Figure 15(b), the graphical shape is stretched without any Bézier decomposition. We can notice that, in this case, the delimiting curves on the top part overlap a little bit and therefore the overall similarity is not good. This problem is partially removed in Figure 15(c) and is further improved in Figure 15(d).Figure 15
Improvement of the global shape similarity according to multirefinement and the same stretching vectorw,h=1298.37952,3895.13857.
(a)
Top part of left parenthesis in body size 96 without stretching
(b)
Top part of left parenthesis curves, in body size 96, stretched and not refined
(c)
Top part of left parenthesis curves, in body size 96, stretched and multirefined to order 2
(d)
Top part of left parenthesis curves, in body size 96, stretched and multirefined to order 4Table4 shows the evolution of the similarities of the curves obtained by decomposition for the case of the vertical stretching h=3895.13857 and the horizontal one w=1298.37952. For each case, the average of the similarities of the cubic Bézier segments obtained by decomposition is calculated. This average improves as the number of decompositions increases.As an application of the stretching model, a dynamic mini-font and a mini-package called DynMath were designed and presented at TUG 2016. The illustration is interesting when considering the dynamic symbols such as delimiters, namely, the parentheses and the braces. These two symbols represent very well the class of dynamic mathematical symbols. Indeed, the parenthesis contains curves (not lines) without inflection, while the braces present inflections. With this model, one can now compose, for example, large parentheses and braces like those of the metal age printing (what is not possible with (LA)TEX). In Figures16(a), 16(b), 17(a), and 17(b), a set of extensible symbols in normal (LA)TEX [12, 13] and their correspondents obtained when using DynMath are presented.Figure 16
Parentheses under normal (LA)TEX and under DynMath.
(a)
Big parenthesis in normal (LA)TEX
(b)
Big parentheses in DynMathFigure 17
Braces under normal (LA)TEX and under DynMath.
(a)
Big braces in normal (LA)TEX
(b)
Big braces in DynMath


## 5.1. Stretching Transformation

LetB1=P10,P11,P12,P13 be a Bézier curve and B2 is the Bézier curve obtained from B1 via affine stretching (it can be linear). Then B2 has the form P20,P21,P22,P23 with the following constraints:(i)
P20=P10.(ii)
P23=P13+E:E=w,h; this is the stretching Vector. w and h are stretching amounts in horizontal and vertical directions, respectively.Let φ be an affine transformation such that φB1=B2. φ is built to be most of the time a nonbalanced homothety or dilation (see next) (otherwise, we will have linear scaling). The matrix M associated with φ and the map I of O are as follows: (19)M=λx00λy,φO=I=Ox,Oy.Under constraintsφP10=P10 and φP13=P13+w,h, knowing that P10=x10,y10 and P13=x13,y13, we will get(1)
λx=1+w/(x13-x10),(2)
λy=1+h/(y13-y10),(3)
Ox=-x10(w/(x13-x10)),(4)
Oy=-y10(h/(y13-y10)).Here, we notice that if λx≠λy, then we have an unbalanced dilation or homothety.φ is an affine mapping. We know that, for every Bézier curve B, B and φB have the same geometric characteristics. What remains is to study the similarity of a curve and its stretched curve by such a transformation.


## 5.2. The Similarity and the Stretching Vector

To study the relationship between the similarity and the stretching vectorw,h,  let us consider the case concerning the stretching of the parenthesis delimiting a mathematical formula. We present the concept for the top part of the left parenthesis only. It will be the same for the bottom part, since the parenthesis has a symmetric shape with respect to a horizontal axis. The study of the stretching of parenthesis reveals the following rule: to any vertical stretching amount h corresponds a horizontal amount w such that w∈0,h/3. To present the paragraph better, we will give details on the encoding of the top part of the parenthesis. This part of the parenthesis is encoded with two cubic Bézier curves L and R connected by two straight line segments at the top and bottom (see Figure 13). The parenthesis will be shown in 500 body size (half the effective encoding size in the font, 1000 body size). For the study of the relationship between the similarity and the stretching vector, we use only one of the curves, L or R. We choose L to be used. Concretely,(20)L=109.14813,250.00014,109.14813,437.86641,171.58542,625.45052,319.11168,740.27823.Figure 13
Top part of the left parenthesis.Some stretchings ofL, with h=1200 and w taking values in the set 0,100,200,300,400, are done. However, the display of that in figures is given only in 128 body size so that the illustrations can fit into the page (in body size 128, it is similar to stretch the top part with respect to h=1200(128/1000)=153.6 and w∈0,12.8,25.6,38.4,51.2). Three of these stretching operations are shown in Figure 14(b), where w=0, w=200, and w=400. The curve in its initial size is in Figure 14(a) to well situate the comparison states.Figure 14
Different extensions of left curve of the top part of left parenthesis.h is constant; w varies.
(a)
Left curve in initial size
(b)
Three different horizontal stretchings, 0, 200, 400, for the same vertical amount,h=1200We can notice that, for a constant amount of the vertical extensionh=1200, as the horizontal stretching w increases to h/3, the similarity between the curve and its stretched curve is more and more improved. Samples of this evolution are presented in Table 1.Table 1
Variation of the similarity according tow for h=1200.
h
1200
w
0
100
200
300
400
S
9.22
e
-
05
5.79
e
-
05
3.21
e
-
05
1.43
e
-
05
3.86
e
-
06As for horizontal variations, the similarity also loses its quality whenh increases. To give an illustration of this fact, some extracts of similarity values for h varying from 0 to 2000 are presented in Table 2. For all values of h, the considered amount of horizontal stretching is w=h/3. We can see that the similarity becomes bad more and more as the value of h increases.Table 2
Variation of the similarity according to variation ofh and w=h/3.
h
0
500
100
1500
2000
w
0
166.67
333.33
500
666.67
S
1.11
e
-
35
1.92
e
-
06
3.44
e
-
06
4.37
e
-
06
4.98e-06


## 5.3. Similarity and Bézier Curve Refinement

This section deals with the relationship between the similarity of curves and the decomposition of Bézier curves. Let us consider once again the two curves considered in the beginning (Figures8 and 9) to study the effect of Bézier decomposition on them. Concretely, B1 and B2 are as follows:(21)B1=50,30,57,73,72,110,106,142,B2=50,30,57,83,77,135,111,157.The value of similarity between these two curves is8.11526e-7. If we process a multiple Bézier’s decomposition of B1 and B2 and try to compare the similarity between the obtained subcurves of the same decomposition range, we can remark that the values of similarity diminish. Table 3 shows the values of similarity for the multiple decomposition of orders 0, 4, 9, 12, 13, and 19. Generally, from a decomposition of order n, we get n+1 subcurves. Beyond order 13, the similarity of the decomposition segments becomes better than the similarity of the two curves without decompositionTable 3
Similarity variation according to Bézier refinement.
n
0
4
9
12
13
19
S
8.12
e
-
7
1.64
e
-
8
8.22
e
-
9
5.63
e
-
9
5.02
e
-
9
2.79
e
-
9
7.24
e
-
10
9.67
e
-
10
1.37
e
-
9
1.41
e
-
9
1.27
e
-
9
1.73
e
-
8
4.11
e
-
11
9.31
e
-
11
1.57
e
-
10
4.37
e
-
10
6.18
e
-
7
6.06
e
-
11
4.15
e
-
11
1.59
e
-
11
8.40
e
-
11
4.01
e
-
6
1.04
e
-
9
3.19
e
-
11
4.95
e
-
11
1.86
e
-
12
1.71
e
-
8
2.01
e
-
10
1.60
e
-
11
1.74
e
-
11
8.66
e
-
8
3.43
e
-
9
1.05
e
-
9
1.90
e
-
11
2.81
e
-
7
1.72
e
-
8
6.83
e
-
9
4.13
e
-
13
6.99
e
-
7
5.49
e
-
8
2.44
e
-
8
1.18
e
-
10
1.42
e
-
6
1.37
e
-
7
6.52
e
-
8
7.89
e
-
10
2.91
e
-
7
1.45
e
-
7
2.78
e
-
9
5.43
e
-
7
2.84
e
-
7
7.27
e
-
9
9.04
e
-
7
4.97
e
-
7
1.59
e
-
8
7.93
e
-
7
3.10
e
-
8
5.53
e
-
8
9.20
e
-
8
1.44
e
-
7
2.15
e
-
7
3.05
e
-
7
4.14
e
-
7To show the role of Bézier’s decomposition in similarity and extension, let us consider the curves defining the upper part of the left parenthesis together. The extension values used to highlight the problems are very large.The height of the half-parenthesis is 490.27809 in the PostScript unit (see the concrete coordinates above). This height is given in 1000 body size (1000 is the base size for specifying a PostScript font). The notion of “body size” in PostScript is equivalent to “font size.” The height of paperA3 is 421. We want to write the half-parenthesis in body 96. What value of h must be used to stretch the half-parenthesis in 1000 body size so that it occupies the half of A3 paper in 96 body size? The value of h should be “3895.13857.” In fact:(i)
H: global height of the stretched half parenthesis in 96 body size. H=421.(ii)
b: height of half parenthesis in 1000 body size 1000. b=490.27809.(iii)
h: The stretching amount in 1000 body size (to determine).ThenH=b+h(96/1000) and so h=(1000×H)/96-b.Leth=3895.13857.The horizontal amount of stretching adopted to study the effect of decomposition isw=h/3.We saw in Section5.1 how to stretch a Bézier curve B with respect to an extension vector w,h. How do we proceed in terms of extension if we decompose the curve B into n Bézier subcurves? Let Bii=0n-1 be the sequence of the obtained curves by multidecomposition (the order of decomposition is n-1).Let us consider the following items:(i)
B=P0,I,J,Pn: the Bézier curve to decompose and stretch(ii)
Bi=Pi,Ii,Ji,Pi+1: the curve segment number i obtained by decomposition, i=0,…,n-1(iii)
Pi=xi,yi, i=0,…,n-1The curve Bi would be stretched with respect to vector wi,hi, where wi=((xi+1-xi)/(xn-x0))w and hi=((yi+1-yi)/(yn-y0))h. The transformation φi is defined by referring to Section 5.1. Some shift transformations are mandatory to connect the segments after the stretching operations.We chose to give a concrete example, the parenthesis symbol. We worked with the 96 body size so that the concepts to be highlighted are more clear. The shape is delimited by two curves to be extended, namely,L and R. In fact, we must stretch L and R of the same vector w,h. As we will see in the following, the simple stretching does not allow a global similarity of the parenthesis. This problem is solved by the Bézier multiple decomposition of the curves L and R. Suppose that we have to perform a decomposition of order n-1 in order to get n Bézier subcurves. Let us consider the following items:(i)
L=PL0,IL,JL,PLn.(ii)
Lii=0n-1 is the sequence obtained by the Bézier decomposition of L to order n-1.(iii)
R=PR0,IR,JR,PRn(iv)
Rii=0n-1 is the sequence obtained by the Bézier decomposition of R to order n-1.The stretching fractions wi,hi of decomposition segments are determined relative to the curve L and they are used also in the case of R (nothing prevents the reverse). The goal of this is to obtain after extension a parenthesis having the same thickness as the initial one. Let wi,hi=(xL,i+1-xLi/xLn-xL0)w,(yL,i+1-yLi/yLn-yL0)h.LetLie and Rie be the curves obtained by stretching of Li and Ri, respectively, according to vector wi,hi. The study of the relationship of Bézier decomposition and similarity is done by measuring the similarity values SLi,Lie and SRi,Rie. Some extracts are in Table 4.Table 4
Similarity variation of the shape of the left parenthesis according to Bézier refinement.
n
0
2
4
L
R
L
R
L
R
S
6.13
e
-
06
3.75
e
-
07
5.06
e
-
07
8.82
e
-
09
1.72
e
-
07
8.26
e
-
09
5.60
e
-
07
6.90
e
-
09
1.95
e
-
07
7.94
e
-
10
9.36
e
-
08
4.40
e
-
09
1.93
e
-
07
1.90
e
-
09
1.26
e
-
07
7.38
e
-
09
3.40
e
-
09
5.39
e
-
10
Moy
6.13
e
-
06
3.75
e
-
07
3.86
e
-
07
6.71
e
-
09
1.38
e
-
07
3.77
e
-
09The left half parenthesis (to stretch) is given in 96 body size in Figure15(a). In Figure 15(b), the graphical shape is stretched without any Bézier decomposition. We can notice that, in this case, the delimiting curves on the top part overlap a little bit and therefore the overall similarity is not good. This problem is partially removed in Figure 15(c) and is further improved in Figure 15(d).Figure 15
Improvement of the global shape similarity according to multirefinement and the same stretching vectorw,h=1298.37952,3895.13857.
(a)
Top part of left parenthesis in body size 96 without stretching
(b)
Top part of left parenthesis curves, in body size 96, stretched and not refined
(c)
Top part of left parenthesis curves, in body size 96, stretched and multirefined to order 2
(d)
Top part of left parenthesis curves, in body size 96, stretched and multirefined to order 4Table4 shows the evolution of the similarities of the curves obtained by decomposition for the case of the vertical stretching h=3895.13857 and the horizontal one w=1298.37952. For each case, the average of the similarities of the cubic Bézier segments obtained by decomposition is calculated. This average improves as the number of decompositions increases.As an application of the stretching model, a dynamic mini-font and a mini-package called DynMath were designed and presented at TUG 2016. The illustration is interesting when considering the dynamic symbols such as delimiters, namely, the parentheses and the braces. These two symbols represent very well the class of dynamic mathematical symbols. Indeed, the parenthesis contains curves (not lines) without inflection, while the braces present inflections. With this model, one can now compose, for example, large parentheses and braces like those of the metal age printing (what is not possible with (LA)TEX). In Figures16(a), 16(b), 17(a), and 17(b), a set of extensible symbols in normal (LA)TEX [12, 13] and their correspondents obtained when using DynMath are presented.Figure 16
Parentheses under normal (LA)TEX and under DynMath.
(a)
Big parenthesis in normal (LA)TEX
(b)
Big parentheses in DynMathFigure 17
Braces under normal (LA)TEX and under DynMath.
(a)
Big braces in normal (LA)TEX
(b)
Big braces in DynMath


## 6. Conclusions

We have developed a basic formal approach to design a dynamic font that supports extensible mathematical symbols. This was used to develop a mini-font of four symbols, namely, parentheses and braces. The result is very satisfactory and ensures the good model for the development of other dynamic mathematical symbols. Our work will be extended in terms of the stretching model and the method to calculate the similarity in order to allow the development of dynamic fonts supporting the rules of Arabic calligraphy.



---

*Source: 5897892-2017-08-01.xml*