1 Introduction

The \(\kappa \)-curve, proposed recently by [28], is an interpolating spline which is curvature-continuous almost everywhere and passes through input points at the local curvature extrema. It has been implemented as the curvature tool in Adobe Illustrator® and Photoshop® and is accepted as a favored curve design tool by many designers (see, e.g., [4, 6]).

We consider the reasons for the success of \(\kappa \)-curve to be:

  1. 1.

    Information along contours is concentrated at local maxima of curvature.

  2. 2.

    Curves of low degree have smooth distribution of curvature.

  3. 3.

    \(G^2\)-continuous curves tend to look fairer than only \(G^1\)-continuous ones.

Attneave [1] suggested, based on his empirical study, that information along contours is concentrated in regions of high magnitude of curvature, as opposed to being distributed uniformly along the contour, and it is further concentrated at local maxima of curvature (see also [33]). Although Attneave never published the details of his methods, [20] conducted a similar experiment and obtained the same results. Levien and Séquin [12] argue similarly and assert that points of maximal curvature are salient features.

The curvature of a polynomial curve is given by a relatively complicated rational function [7], and its distribution might not be globally smooth. However, if the curve is of a low degree, the curvature distribution is more uniform and the curve is fairer, thus more suitable for illustration. The quadratic polynomial curve has the nice property that its curvature has only one local maximum, and its location is easily computable [28], which makes the handling of curvature extrema much easier.

Graphic designers often accept \(G^1\) continuity as good enough for illustration. However, discontinuity remains; for example, if you join a straight line and a circular arc with \(G^1\) continuity, the rhythm of the curve will be broken at the joint. For this reason, we give preference to \(G^2\)-continuous curves.

Nonetheless, \(\kappa \)-curves are not perfect, and their further investigation is necessary [29]. The following are two important shortcomings of \(\kappa \)-curves:

  1. 1.

    They are not curvature-continuous everywhere: at inflection points only \(G^1\) continuity is guaranteed.

  2. 2.

    Since the degree of freedom (DoF) of the quadratic segments is limited, it is impossible to control the magnitudes of local maximum curvature at the input points.

For the first shortcoming, Wang et al. [26] provided a solution through the use of log-aesthetic curves [15, 17] instead of polynomial curves. Log-aesthetic curves have a shape parameter (\(\alpha \)), which can be utilized to control the curvature distribution as shown in Fig. 1. Their method guarantees \(G^2\) continuity everywhere, including inflection points, since log-aesthetic curves with negative \(\alpha \) values can represent S-shaped curves with \(G^2\) continuity. (Note that these cannot be represented by quadratic Bézier curves.)

These curves, however, are defined by a Cesàro equation and thus take extra time to evaluate, making the interpolation method impractical for real-time design purposes.

Because of the second shortcoming, if the designer wants to increase or decrease the magnitude of the curvature extremum, she needs to add extra input points, as shown in Fig. 2. Yan et al. [27] proposed a piecewise rational, quadratic, interpolatory curve that is able to reproduce circles and other elliptical or hyperbolic shapes. Although their main intention was to reproduce circles, their method could also control the magnitude of local maximum curvature. However, only rational quadratic curves are applicable, and it is not possible to extend their method for other types.

In this paper, we propose a new method to solve the second shortcoming by degree elevation of the Bernstein basis functions, giving an extra DoF to each quadratic curve segment, providing control over the magnitudes of local maximum curvature at input points as shown in Fig. 3. In order to increase the designers’ possible choices, we also introduce a new trigonometric basis for which we can perform degree elevation. In addition, we propose a general method for bases with extra shape parameters. By adding one more parameter to each of the curve segments, the designers obtain more expressive power for their illustration. The family of this new curve is denoted as \(\epsilon \kappa \)-curves.

Fig. 1
figure 1

Log-aesthetic curves with various \(\alpha \) values [26]. Input points are depicted by black boxes, and green points correspond to positions of local maximum curvature. The blue curves show the normal curvature. These curves are \(G^2\)-continuous everywhere

Fig. 2
figure 2

Addition of extra input points to control the magnitude of curvature extrema: b is the original \(\kappa \)-curve, a, c shows deformed curves with large and small curvature extrema by adding two extra input points

Fig. 3
figure 3

The left- and rightmost curves are \(\kappa \)-curves; the others are \(\epsilon \kappa \)-curves with gradual changes in the global shape parameter a. The face part (for \(a=0.95\) and \(a=2/3\)) is zoomed in for better comparison. When a=2/3, \(\kappa \)- and \(\epsilon \kappa \)-curves are identical

\(\epsilon \kappa \)-curves preserve all of the appealing properties of \(\kappa \)-curves, i.e., point interpolation, \(G^2\) continuity (except at inflection points), continuous modification (changes smoothly when the input points move), local influence, and real-time generation. With a small processing overhead, \(\epsilon \kappa \)-curves offer the ability to control the magnitude of local maximum curvature.

We have implemented \(\epsilon \kappa \)-curves in MATLAB® and Julia [11]. The source of the Julia code is available online [22].

The rest of this paper is organized as follows. Section 2 reviews the related work. Section 3 presents a method to control the magnitudes of local maximum curvature by degree elevation of the Bernstein basis functions. Section 4 introduces a new trigonometric basis and proposes a method with degree elevation similar to the one proposed in the previous section. Finally, we end with conclusions and discussion of future work.

2 Related work

In this section, we first review [28] and their underlying strategy developing \(\kappa \)-curves. Next, we discuss related researches on various kinds of basis function formulations for curve design.

2.1 \(\kappa \)-Curve

The basic framework of our method is adopted from [28], generating curves controlled by interpolation points. \(\kappa \)-curves have stimulated the field of interpolatory curve generation, resulting in works such as [5], which proposes a method for good control over the location and type of geometric feature points (e.g., cusps and loops).

Yan et al. [28] create a sequence of quadratic curves with \(G^2\) continuity almost everywhere. They derived explicit formulae for the point between two quadratic segments to guarantee \(G^2\) continuity and for the additional condition that input points should be interpolated at maximum curvature magnitude positions. \(\kappa \)-curves are determined by the locations of the middle control points of quadratic Bézier segments—the rest is easily derived from the continuity constraints. Hence, the variables are the locations of these middle control points.

Their basic strategy to determine these locations is to adopt a local/global approach [13, 23]: \(G^2\)-continuous connection is performed locally, while the interpolation at maximum curvature magnitude positions is done globally.

Regarding control of the magnitude of local curvature, the most common technique is to change the weight of a control point of a rational curve [7]. A larger weight attracts the curve to its control point, which makes local curvature larger. However, this technique is not applicable for interpolatory curves. Another technique is to introduce extra parameters called bias and tension to the B-spline formulation for controlling local curvature [2], but this is also not applicable to interpolatory curves.

2.2 Basis functions

As mentioned in [28], curve modeling has a long history, especially in computer-aided geometric design, as well as computer graphics. In CAGD and applied mathematics, to extend the expressive power of curves, many researchers have been trying to develop new bases with extra shape parameters. The following is a (nonexhaustive) list of such bases:

  1. 1.

    C-Bézier curve [31]

  2. 2.

    Cubic alternative curve [10]

  3. 3.

    Cubic trigonometric Bézier curve (T-Bézier basis) [8]

  4. 4.

    \(\alpha \beta \)-Bernstein-like basis [32]

  5. 5.

    Quasi-cubic trigonometric Bernstein basis [30]

  6. 6.

    Trigonometric cubic Bernstein-like basis [24]

Our method proposed in the next section can be applied for curves based not only on polynomials, but also other bases such as a trigonometric basis with degree elevation property which we will introduce in Sect. 4. All of the representations listed above have extra parameters for shape control, and we can utilize these parameters to control the magnitudes of local maximum curvature. (Not all curve types are applicable, however, as explained in Appendix C.)

It is interesting to note that most researchers to date have attempted to develop new bases using four control points, based on cubic polynomials or quadratic trigonometric functions. They prefer using four control points out of concern for connections at both ends of the curve. In order to control the magnitude of curvature at the two ends independently, at least two control points are necessary at each end. This differs fundamentally from Yan et al.’s (and our) approach, which uses only three control points.

The importance of [28] is their proposed paradigm shift for curve generation, by considering the local maximum curvature in the middle, instead of focusing on the endpoints. If we can assume that the curvature has just one local maximum in each segment, then only one extra parameter per segment is adequate to control the magnitude of its local maximum curvature.

To our best knowledge, no trigonometric basis family for arbitrary degree has been published yet. Our novel generalized trigonometric basis functions range from linear, using three control points, to any higher degree n, using \(2n+1\) control points. The curve can be evaluated by a recursive method , similar to de Casteljau’s algorithm, as explained in Appendix B. Since the curve uses trigonometric functions as blending functions, it can represent a circular arc exactly, without using a rational form.

3 Cubic Bernstein polynomials

In this section, we extend \(\kappa \)-curves in a direct manner, by elevating the degree of quadratic Bézier segments to cubic. \(\epsilon \kappa \)-curves retain the following properties of \(\kappa \)-curves:

  1. 1.

    Interpolate all input points (control points).

  2. 2.

    All local maximum curvature points are the same as the input points.

  3. 3.

    \(G^2\) continuity is guaranteed almost everywhere (except for inflection points).

In the following, we discuss only closed curves, but it is straightforward to extend our methods to open curves as has been demonstrated for \(\kappa \)-curves.

If we elevate the degree of a planar Bézier curve, we obtain an additional control point, which has two DoFs (the x and y coordinates). To reduce these to one, we add a geometric constraint on the location of the second and third control points of the cubic Bézier curve, as shown in Fig. 4. Here, a is an internal division ratio, where the larger a is, the closer the control points \(P_1\) and \(P_2\) are to the control point \(Q_1\). We make the restriction \(2/3 \le a < 1\) because the curve should not have a complicated curvature distribution. Using \(Q_i\), the curve \(C(t;a)\) is expressed by

$$\begin{aligned} C(t;a)&= (1-t)^3 Q_0 + 3(1-t)^2t \left[ (1-a)Q_0+a Q_1 \right] \nonumber \\&\qquad + 3(1-t)t^2 \left[ a Q_1+(1-a)Q_2 \right] + t^3 Q_2. \end{aligned}$$
(1)

Note that if \(a=2/3\), the curve degenerates to quadratic.

Fig. 4
figure 4

Constrained cubic Bézier curve. If \(a=2/3\), the curve becomes quadratic

We have proved that by constraining the construction of the cubic polynomial curve as in Eq. (1), using only three control points instead of four, the curvature in one curve segment has at most one local maximum for \(2/3 \le a < 1\); see details in [16], as well as Appendix A for a general discussion on the curvature extrema of cubic polynomial curves, and a high-level summary of the proof. In addition, we have made MATHEMATICA simulation available in [9] to compute the number of curvature extrema for this curve using both classical approach and Sturm’s theorem. Hence, we can safely assume that the curvature in one curve segment has at most one local maximum, and a single extra parameter for each segment is enough to control the magnitudes of local maximum curvature.

3.1 Geometric constraints

We assume that \(\epsilon \kappa \)-curves consist of a sequence of constrained cubic polynomial curves

$$\begin{aligned} c_i(t;a_i)&= (1-t)^3c_{i,0} + 3(1-t)^2t \left[ (1-a_i)c_{i,0}+a_ic_{i,1}\right] \nonumber \\&\quad + 3(1-t)t^2 \left[ a_ic_{i,1}+(1-a_i)c_{i,2}\right] + t^3c_{i,2}, \end{aligned}$$
(2)

parameterized by t and also \(a_i\), which is an extra shape parameter. The control points are given by \(c_{i,0}\), \(c_{i,1}\) and \(c_{i,2} \in {\mathbb {R}}^2\), corresponding to \(Q_i\), \(i=0,1,2\) in Fig. 4. The \(a_i\)’s are reserved for designers and can be manipulated independently.

The curvature of this curve \(c_i(t;a_i)\) is given by

$$\begin{aligned} \begin{aligned}&\kappa _i(t; a_i) = {\det \left( \frac{\partial c_{i}(t;a_i)}{\partial t}, \frac{\partial ^2 c_{i}(t;a_i)}{\partial t^2} \right) }\ \big /\ {\left\| \frac{\partial \,c_{i}(t;a_i)}{\partial t } \right\| ^3} \\&\quad = \frac{4}{3}\cdot \frac{\triangle (c_{i,0},c_{i,1},c_{i,2})\left[ a_i^2(1-t)t + a_i(1-a_i)\left( (1-t)^2+t^2\right) \right] }{\Vert (1-t)^2 a_i r_i +2(1-t)t(1-a_i)(r_i+s_i)+ t^2 a_i s_i \Vert ^3 },\nonumber \end{aligned}\\ \end{aligned}$$
(3)

where \(\triangle \) indicates the area of the triangle specified by its arguments, and \(r_i = c_{i,1}-c_{i,0}\), \( s_i = c_{i,2}-c_{i,1}\).

In the quadratic case (i.e., \(\kappa \)-curves), as the curvature has such a simple formula, we can express the parameter \(t_i\) at the point of maximal curvature explicitly, in terms of the Bézier coefficients of the \(i^\mathrm {th}\) quadratic Bézier curve as

$$\begin{aligned} t_i = \frac{\langle r_i,r_i-s_i\rangle }{\Vert r_i-s_i \Vert ^2}, \end{aligned}$$
(4)

where \(\langle a,b\rangle \) means the scalar product of vectors a and b. Then, we add the condition

$$\begin{aligned} c_i(t_i)=p_i, \end{aligned}$$
(5)

where \(p_i\) is the \(i^\mathrm {th}\) input point. Solving for \(c_{i,1}\) and substituting into Eq. (4), we get a cubic equation in \(t_i\) that depends only on the endpoints \(c_{i,0}\) and \(c_{i,2}\), and the input points \(p_i\).

Unfortunately, we cannot obtain an explicit formula like Eq. (4) for the parameter \(t_i\) in the cubic case, because of its high degree (see details in Appendix A.1), but this is not a problem. Solving Eq. (5) for \(c_{i,1}\), we arrive at

$$\begin{aligned} \begin{aligned} c_{i,1}&= \left[ p_i-(1-t_i)^3 c_{i,0}\right. \\&\quad -3(1-t_i)t_i(1-a_i)((1-t_i)c_{i,0}+t_ic_{i,2}) \\&\quad \left. -t_i^3 c_{i,2}\right] \big / (3 a_i (1-t_i) t_i). \end{aligned} \end{aligned}$$
(6)

Substituting this into the derivative of Eq. (3), and letting it equal 0, we obtain (after some simplification) a polynomial equation of degree 9 in \(t_i\). This equation can be derived by the Maxima [14] code in Fig. 13 (Appendix A). We solve this equation and select a real root in [0, 1]. Note that we have proved that there is one and only one solution for the polynomial equation of degree 9 in \(t_i \in [0,1]\) as in the case of \(\kappa \)-curves; see details in [16], as well as Appendix A.2.

However, when we use other types of curves with more complicated representations (see examples in Appendix C), this kind of formula may be hard to derive. In these cases, we can use the relaxed Newton’s method to compute the maximum curvature. For this, we need to be able to compute the curvature and its derivative; we do this using a quadratic Taylor series approximation around the last value of \(t_i\).

Fig. 5
figure 5

The leftmost curve is a \(\kappa \)-curve. The other curves are \(\epsilon \kappa \)-curves: the \(a_i\) values are equal to 2/3 except for one, two and three input points, respectively, where \(a_i=0.85\)

Fig. 6
figure 6

The a values of the two wing tips in the second figure from the left are 0.95, and those of the other input points are 2/3; note the sharpening of the wings. In the third figure, the roles are reversed. The left- and rightmost curves in red are \(\kappa \)-curves with the same input points

We introduce the constant \(\lambda _i\) (\(0< \lambda _i < 1\)) according to the construction method of \(\kappa \)-curves and set

$$\begin{aligned} c_{i,2} = c_{i+1,0} = (1-\lambda _i) c_{i,1} + \lambda _i c_{i+1,1}. \end{aligned}$$
(7)

Let the curvatures at the endpoints of the curve segment be denoted by \(\kappa _i(0;a_i)\) and \(\kappa _i(1;a_i)\), then from Eq. (3)

$$\begin{aligned} \kappa _i(1;a_i)&= \frac{4}{3}\cdot \frac{(1-a_i) \triangle ^+_i}{ a_i^2 \lambda _{i}^2\Vert c_{i+1,1} - c_{i,1} \Vert ^3},\nonumber \\ \kappa _{i+1}(0;a_{i+1})&= \frac{4}{3}\cdot \frac{(1-a_{i+1}) \triangle ^-_{i+1}}{ a_{i+1}^2 (1-\lambda _{i})^2\Vert c_{i+1,1} - c_{i,1} \Vert ^3}, \end{aligned}$$
(8)

introducing the notations \(\triangle ^+_i=\triangle (c_{i,0}, c_{i,1}, c_{i+1,1})\) and \(\triangle ^-_{i}=\triangle (c_{i-1,1}, c_{i,1}, c_{i,2})\).

Fig. 7
figure 7

The leftmost curve is a \(\kappa \)-curve; the other curves are \(\epsilon \kappa \)-curves: a is equal to 0.75, 0.85 and 0.95, respectively. Note the curvature at the inflection points

By adopting the local/global approach, we treat \(c_{i,0}\) as fixed for the computation of \(\kappa _i(1;a_i)\), although it depends on \(\lambda _{i-1}\) (similarly for \(c_{i+1,2}\)).

In order to guarantee \(G^2\) continuity at the joint of two consecutive segments, the following equations should be satisfied:

$$\begin{aligned} \kappa _i(1;a_i) = \kappa _{i+1}(0;a_{i+1}). \end{aligned}$$
(9)

Hence,

$$\begin{aligned} \lambda _i = \frac{\sqrt{(1-a_i)\triangle ^+_i}}{\sqrt{(1-a_i)\triangle ^+_i} + \frac{a_i}{a_{i+1}}\sqrt{(1-a_{i+1})\triangle ^-_{i+1}}}. \end{aligned}$$
(10)

Since \(0< a_i, a_{i+1} <1\), \(\lambda _i\) is real and \(0< \lambda _i <1\).

3.2 Optimization

In the global phase, we calculate the positions of the middle control points \(c_{i,1}\) by solving a linear system of equations. We treat the current values of \(\lambda _i\) (internal division ratios of \(c_{i,1}\) and \(c_{i+1,1}\)) and \(t_i\) (parameters of local maximum curvature) as fixed.

Substituting Eq. (7) into Eq. (5), we get

$$\begin{aligned} p_i&= (1-t_i)^3 \left[ (1-\lambda _{i-1}) c_{i-1,1} + \lambda _{i-1} c_{i,1} \right] \nonumber \\&\quad + 3 (1-t_i)^2 t_i \left[ (1-a_i) \left[ (1-\lambda _{i-1}) c_{i-1,1} + \lambda _{i-1} c_{i,1} \right] \right. \nonumber \\&\quad \left. + a_i c_{i,1} \right] \nonumber \\&\quad + 3 (1-t_i) t_i^2 \left[ (1-a_i) \left[ (1-\lambda _{i}) c_{i,1} + \lambda _i c_{i+1,1} \right] \right. \nonumber \\&\quad \left. + a_i c_{i,1}\right] \nonumber \\&\quad + t_i^3 \left[ (1-\lambda _{i}) c_{i,1} + \lambda _i c_{i+1,1} \right] , \end{aligned}$$
(11)

which can be solved for \(c_{i,1}\).

The optimization process is summarized in Algorithm 1.

figure i

3.3 Results

Figure 5 shows examples of closed \(\epsilon \kappa \)-curves along with the original \(\kappa \)-curve. The input points are located at the same positions. The \(a_i\) values of these curves are equal to 2/3, except for one, two and three input points, respectively, where \(a_i\) is set to 0.85. If the \(a_i\) of all input points are 2/3, the \(\kappa \)-curve on the left is generated. Since we specify a larger value for some input points, the magnitudes of the corresponding local maximum curvature increase, as we expected.

Figure 6 shows another example of local curvature control. From the left to right, the first drawing shows a bird using \(\kappa \)-curves. In the second, we set a at the wing tips to 0.95, while leaving all others at the default 2/3. This has the effect of sharpening the wing tips. In the third figure, we reversed the role of the input points, giving \(a=2/3\) to those at the wing tips and 0.95 to all other points. Here, the wings are rounded, while other parts of the bird get sharper.

Notice that the bird’s beak resembles a cusp, but is actually the start and end points of an open curve located at the same position. In our implementation, we limit \(2/3 \le a \le 1\) to make a curve with smooth curvature distribution, which disallows the generation of a cusp even at \(a=1\). In cases where the designer wants to use a cusp, the curve should be cut in two, or the input points should be relocated to form a cusp as explained in [28].

Figure 7 shows examples of global curvature control. There are three \(\epsilon \kappa \)-curves, with a set to 0.75, 0.85 and 0.95, respectively, along with the original \(\kappa \)-curve (\(a=2/3\)) for comparison. By increasing a, the magnitudes of local maximum curvature increase. As the close-up windows indicate, at the inflection point \(G^2\) continuity is violated for \(\kappa \)-curves, and only \(G^1\) continuity is guaranteed. However, for \(\epsilon \kappa \)-curves with a larger a, the magnitude of curvature at inflection points, and consequently the \(G^2\) error, becomes smaller. Note that although these curves are almost \(G^2\)-continuous everywhere, they are quite different from those in Fig. 1 (generated using the same input points).

Figures 3, 8 and 9 show the effect of changes of the global shape parameter a on various designs. As discussed above, larger a values generally induce larger local curvature extrema and steeper curvature variation. The resulting curves look more sharp at the input points and more flat between them.

Fig. 8
figure 8

Changing the global shape parameter in the bear model

Fig. 9
figure 9

Changing the global shape parameter in the elephant model

4 Generalized trigonometric basis

In this section, we describe our new generalized trigonometric basis. This is based on the trigonometric cubic Bernstein-like basis [24], which we are going to review first.

The trigonometric cubic Bernstein-like basis functions have an extra shape parameter \(\alpha \) and are defined by

$$\begin{aligned} f_0&= \alpha S^2 - \alpha S + C^2 = 1 + (\alpha -1) S^2 - \alpha S, \nonumber \\ f_1&= \alpha S(1-S), \nonumber \\ f_2&= \alpha (S^2+C-1) = \alpha C(1 - C), \nonumber \\ f_3&= (1-\alpha ) S^2 - \alpha C + \alpha = 1 +(\alpha -1) C^2-\alpha C, \end{aligned}$$
(12)

where \(S=\sin \frac{\pi t}{2}\), \(C=\cos \frac{\pi t}{2}\), for \(\alpha \in (0,2)\), \(t \in [0,1]\). Note that these functions satisfy partition of unity, i.e., \(\sum _{i=0}^3 f_i(t) = 1\) for any \(\alpha \). When \(\alpha =1\), the above functions are simplified to

$$\begin{aligned} f_0&= 1 - S, \nonumber \\ f_1&= S(1-S), \nonumber \\ f_2&= C(1-C), \nonumber \\ f_3&= 1 - C. \end{aligned}$$
(13)

If we add the second and third functions together and rename them to u, v and w, we obtain blending functions \(\{ u, v, w \}\) as follows:

$$\begin{aligned} \begin{aligned}&u = 1-S, \\&v = S(1-S) + C(1-C) = S+C-1, \\&w = 1 - C. \end{aligned} \end{aligned}$$
(14)

It is straightforward to define a curve by these blending functions with three control points, which we can regard as a “linear” trigonometric curve since the highest degree the trigonometric functions are in is one.

One interesting relationship among these functions is

$$\begin{aligned} v^2 = 2 u w, \end{aligned}$$
(15)

which enables

$$\begin{aligned} (u+v+w)^2 = u^2 + 2 u v + 4 u w + 2 v w + w^2, \end{aligned}$$
(16)

and yields the five blending functions \(\{u^2\), 2uv, 4uw, 2vw, \(w^2 \}\), associated with five control points. We can define a curve using these blending functions and regard it as a “quadratic” trigonometric curve since the highest power of each blending function is now degree two.

In a similar way, we can extend blending functions of “degree” n with \(2n+1\) control points. As explained in Appendix B, we can perform a recursive procedure to evaluate a curve of any degree similar to de Casteljau’s algorithm avoiding the overhead of trigonometric function evaluation. This means that it is not necessary to calculate the coefficients of blending functions, or keep a coefficient table.

We formulate the \(\epsilon \kappa \)-curve in this basis using a strategy similar to that in the previous section, i.e., using a sequence of quadratic trigonometric curves with a constraint on the positions of their control points, as shown in Fig. 10. Note the location of the control point \(P_2=\left[ (1-a)Q_0+2 a Q_1+(1-a) Q_2\right] /2\). The curve \(c(t;a)\) is defined by

$$\begin{aligned} \begin{aligned} c(t;a) =&\;u^2 Q_0 + 2 u v \left[ (1-a) Q_0+a Q_1 \right] \\&+ 2 u w \left[ (1-a)(Q_0+Q_2)+2 a Q_1 \right] \\&+ 2 v w \left[ a Q_1+ (1-a) Q_2 \right] + w^2 Q_2. \end{aligned} \end{aligned}$$
(17)

When a is equal to 1/2, the curve degenerates to a linear trigonometric curve.

Fig. 10
figure 10

Constrained quadratic trigonometric curve. When \(a=1/2\) (bottom), the curve becomes linear

4.1 Geometric constraints and optimization

First, we analyze the linear trigonometric curve since it corresponds to the original \(\kappa \)-curve. Let \(c_i(t)\) be a linear trigonometric curve with control points \(c_{i,0}\), \(c_{i,1}\) and \(c_{i,2}\) and defined by

$$\begin{aligned} c_i (t) = (1 - S) c_{i,0} + (S+C-1) c_{i,1} + (1-C) c_{i,2}, \end{aligned}$$
(18)

where \(S=\sin \frac{\pi t}{2}\), \(C=\cos \frac{\pi t}{2}\) and \(t \in [0,1]\). Its curvature is given by

$$\begin{aligned} \kappa _i(t) = \frac{2 \Delta (c_{i,0}, c_{i,1}, c_{i,2})}{ \left( C^2 \Vert r_i \Vert ^2 + 2 C S \langle r_i, s_i\rangle + S^2 \Vert s_i \Vert ^2 \right) ^\frac{3}{2} }, \end{aligned}$$
(19)

where \(r_i = c_{i,1}-c_{i,0}\) and \( s_i = c_{i,2}-c_{i,1}\). The numerator of the above formula does not depend on t, so the extrema of the following \(f_i(t)\) corresponds to those of \(\kappa _i(t)\):

$$\begin{aligned} f_i(t) = C^2 \Vert r_i \Vert ^2 + 2 C S \langle r_i, s_i\rangle + S^2 \Vert s_i \Vert ^2, \end{aligned}$$
(20)

and its derivative with respect to t is given by

$$\begin{aligned} \begin{aligned} \frac{d f_i(t)}{d t} =&\;{\pi }(-CS \Vert r_i \Vert ^2+(-S^2+C^2)\langle r_i, s_i\rangle \\&+ SC \Vert s_i \Vert ^2 ). \end{aligned} \end{aligned}$$
(21)

By assuming \({d f_i(t)}/{d t}=0\) with \(S, C \ne 0\), we obtain

$$\begin{aligned} S^2 - \gamma SC - C^2=0, \end{aligned}$$
(22)

where \(\gamma =( \Vert s_i \Vert ^2-\Vert r_i \Vert ^2)/\langle r_i, s_i\rangle \). We can solve the above equation and obtain

$$\begin{aligned} C = \frac{-\gamma + \sqrt{\gamma ^2+4}}{2} S = \beta S. \end{aligned}$$
(23)

Since \(0 \le S, C \le 1\), we have the unique solution

$$\begin{aligned} S = \frac{1}{\sqrt{\beta ^2+1}}. \end{aligned}$$
(24)

Hence,

$$\begin{aligned} t = \frac{2}{\pi } \arcsin \frac{1}{\beta ^2+1}. \end{aligned}$$
(25)

Note that when \(r_i\) and \(s_i\) are perpendicular to each other, if \(\Vert r_i\Vert = \Vert s_i \Vert \), then the curve becomes a circular arc, and no local maximum curvature exists. If \(\Vert r_i \Vert > \Vert s_i \Vert \), then the curvature at \(t=1\) will be maximum, and if \(\Vert r_i \Vert < \Vert s_i \Vert \), the curvature at \(t=0\) will be maximum in this curve segment.

Fig. 11
figure 11

The two curves on the top left (red) are \(\kappa \)-curves; the two on the top right (brown) are \(\epsilon \kappa \)-curves using cubic Bernstein basis functions with \(a=0.75\) and 0.9. The bottom row shows \(\epsilon \kappa \)-curves using quadratic trigonometric basis functions with \(a=0.55\), 0.6, 0.75 and 0.9

Fig. 12
figure 12

A Christmas tree drawn with \(\epsilon \kappa \)-curves using the cubic Bernstein basis functions (left) and the quadratic trigonometric basis functions (right). Note that the latter has more rounded forms and—in this case—preferable

For a quadratic trigonometric curve, the curvatures \(\kappa _i(1;a_i)\) and \(\kappa _{i+1}(0;a_i)\) at the endpoints of the constrained quadratic trigonometric curve \(c_i\) are given by

$$\begin{aligned} \kappa _i (1;a_i)&= \frac{1-a_i}{a_i^2}\cdot \frac{ \triangle ^+_i}{ \lambda _i^2 \Vert c_{i+1,1}-c_{i,1} \Vert ^3}, \nonumber \\ \kappa _{i+1} (0;a_{i+1})&= \frac{1-a_{i+1}}{a_{i+1}^2}\cdot \frac{\triangle ^-_{i+1}}{(1-\lambda _i)^2 \Vert c_{i+1,1}-c_{i,1} \Vert ^3}. \end{aligned}$$
(26)

We can calculate \(\lambda _i\) by guaranteeing \(G^2\) continuity at the joint of \(c_i(1;a_i)\) and \(c_{i+1}(0;a_{i+1})\):

$$\begin{aligned} \lambda _i = \frac{\sqrt{(1-a_i)\triangle ^-_i}}{\sqrt{(1-a_i)\triangle ^-_i} + \frac{a_i}{a_{i+1}}\sqrt{(1-a_{i+1})\triangle ^+_{i+1}}}. \end{aligned}$$
(27)

As before, we get a linear system of equations for \(c_{i,1}\):

$$\begin{aligned} p_i&= u_i^2 ( (1-\lambda _{i-1}) c_{i-1,1} + \lambda _{i-1} c_{i,1} ) \nonumber \\&\quad + 2 u_i v_i ( (1-a_i)(1-\lambda _{i-1}) c_{i-1,1}\nonumber \\&\quad + ((1-a_i)\lambda _{i-1} + a_i )c_{i,1} ) \nonumber \\&\quad +2 u_i w_i ( (1-a_i) (1-\lambda _{i-1}) c_{i-1,1} +((1-a_i)\lambda _{i-1} \nonumber \\&\quad +2 a_i+(1-a_i)(1-\lambda _{i}) ) c_{i,1} + (1-a_i) \lambda _{i} c_{i+1,1} ) \nonumber \\&\quad + 2 v_i w_i ( (a_i+(1-a_i)(1-\lambda _{i}) ) c_{i,1}\nonumber \\&\quad + (1-a_i) \lambda _{i} c_{i+1,1} ) \nonumber \\&\quad + w_i^2 ( (1-\lambda _{i}) c_{i,1} + \lambda _{i} c_{i+1,1}), \end{aligned}$$
(28)

where \(u_i=1-\sin \frac{\pi t_i}{2}\), \(v_i=\sin \frac{\pi t_i}{2} + \cos \frac{\pi t_i}{2} -1\) and \(w_i = 1-\cos \frac{\pi t_i}{2}\).

4.2 Results

Figures 11 and 12 show examples of \(\epsilon \kappa \)-curves using the quadratic trigonometric basis functions explained in this section. In the first figure, the top left two curves (red) are \(\kappa \)-curves. The top right two curves (brown) are \(\epsilon \kappa \)-curves, using cubic Bernstein basis functions with \(a=0.75\) and 0.9. The bottom row (green) shows \(\epsilon \kappa \)-curves using quadratic trigonometric basis functions with \(a=0.55\), 0.6, 0.75 and 0.9. The curves in the bottom row are more rounded than those of the Bernstein basis. By increasing a, the differences between the two types of curves become smaller as they approach a polyline generated by connecting the input points.

The second figure shows a case where these more rounded forms are clearly preferable.

4.3 Use of built-in shape parameters

So far our strategy made use of degree elevation—from quadratic to cubic in the polynomial case, and from linear to quadratic in the trigonometric case. Yet another strategy is to use extra shape parameters built into the basis functions.

As an illustrative example, take the trigonometric cubic Bernstein-like basis functions reviewed in the previous section. In the framework of \(\epsilon \kappa \)-curves, we have to degenerate the curve by relocating the positions of its control points, essentially reducing its degree.

The trigonometric cubic Bernstein-like basis functions need four control points to define a curve. To construct “quadratic” curves corresponding to the quadratic Bézier segments of \(\kappa \)-curves, we make the second and third control points collocate. Hence, the blending functions become

$$\begin{aligned} b_0(t;\alpha )&= 1+(\alpha -1)S^2-\alpha S,\nonumber \\ b_1(t;\alpha )&= \alpha (S+C-1),\nonumber \\ b_2(t;\alpha )&= 1+(\alpha -1)C^2-\alpha C, \end{aligned}$$
(29)

where \(S=\sin \frac{\pi t}{2}\), \(C=\cos \frac{\pi t}{2}\), for \(\alpha \in (0,2)\), \(t \in [0,1]\). Incidentally, this will result in the same curve as Eq. (17), if we substitute 2a for \(\alpha \).

Note that several curve types—such as the cubic alternative curve and the \(\alpha \beta \)-Bernstein-like basis functions, for specific extra parameters—have zero curvature at the endpoints, so we cannot obtain the internal division ratio \(\lambda _i\). For these curves, the method shown in this section cannot be applied. See details in Appendix C.

5 Conclusions and future work

We have proposed two types of \(\epsilon \kappa \)-curves as extensions of \(\kappa \)-curves, for controlling the magnitudes of local maximum curvature. Our methods use degree elevation of the Bernstein basis functions and a new family of trigonometric basis functions.

In line with Yan et al.’s paradigm shift for curve generation, we consider the local maximum curvature in the middle, instead of focusing on the endpoints. The new curves preserve all of the nice properties of \(\kappa \)-curves, i.e., point interpolation, \(G^2\) continuity (except at inflection points), continuous modification (changes smoothly when the input points move) and local influence. Computing \(\epsilon \kappa \)-curves is quite fast, and designers can manipulate them interactively, acquiring much more expressive power for curve design, as illustrated by our examples. The processing time for generating \(\epsilon \kappa \)-curves is similar to that of \(\kappa \)-curves, especially for \(\epsilon \kappa \)-curves with cubic Bernstein basis. For example, \(\kappa \)-curves consume 0.07 sec to draw Fig. 8 (bear). Under similar conditions, cubic Bézier \(\epsilon \kappa \)-curves consume 0.08 sec and generalized trigonometric \(\epsilon \kappa \)-curves takes 0.37 sec on average.

Future work includes the development of \(\epsilon \kappa \)-curve plug-ins for Adobe Illustrator® and Photoshop®. Another possible research direction is to apply the proposed method to different types of aesthetic curves, e.g., log-aesthetic curves [26], \(\sigma \)-curves [18] or \(\tau \)-curves [19].