New shape control tools for rational Bézier curve design

Bézier curves are indispensable for geometric modelling and computer graphics. They have numerous favourable properties and provide the user with intuitive tools for editing the shape of a parametric polynomial curve. Even more control and ﬂexibility can be achieved by associating a shape parameter with each control point and considering rational Bézier curves, which comes with the additional advantage of being able to represent all conic sections exactly. In this paper, we explore the editing possibilities that arise from expressing a rational Bézier curve in barycentric form. In particular, we show how to convert back and forth between the Bézier and the barycentric form, we discuss the effects of modifying the constituents (nodes, interpolation points, weights) of the barycentric form, and we study the connection between point insertion in the barycentric form with degree elevation of the Bézier form. Moreover, we analyse the favourable performance of the barycentric form for evaluating the curve.


Introduction
A planar rational Bézier curve P : [0, 1] → 2 of degree n ∈ is defined by a set of control points P 0 , . . ., P n ∈ 2 and a set of weights α 0 , . . ., α n ∈ as where B n i (t ) = n i (1 − t ) n −i t i are the Bernstein polynomials.If α 0 = α n = 1, then the curve is said to be in standard form, which can always be achieved, if the given weights α 0 and α n are non-zero and have the same sign, by uniformly scaling all weights and applying a linear rational parameter transformation [13,9].The curve P can also be written in homogeneous form and understood as the (central) projection of the spatial polynomial Bézier curve P : [0, 1] → 3 , with homogeneous control points Pi = (α i P i , α i ) ∈ 3 into the ẑ = 1 plane, because x (t ) = x (t )/ ẑ (t ) and y (t ) = ŷ (t )/ ẑ (t ).If all weights α i are equal, then P reduces to a planar polynomial Bézier curve.Among the key properties that justify the popularity of rational Bézier curves for shape design, we recall that such a curve can be translated, scaled, or rotated by simply translating, scaling, or rotating its control polygon, and the same holds more generally for projective transformations [8].Moreover, the shape of the curve can be controlled intuitively by modifying the control points P i and the weights α i (see Figure 1), or by changing the Farin points F i = (α i P i + α i +1 P i +1 )/(α i + α i +1 ) ∈ 2 that can be associated with the i -th edge [P i , P i +1 ] of the control polygon for i = 0, . . ., n −1 [7].However, except at the endpoints, this control is indirect in the sense that it is difficult for the user to let the curve pass exactly through a specific point Q ∈ 2 .
To overcome this limitation, we propose to convert the curve P to barycentric form and express it as for certain distinct nodes t 0 , . . ., t n ∈ with corresponding interpolation points Q 0 , . . .,Q n ∈ 2 and non-zero weights β 0 , . . ., β n ∈ .Since P (t i ) = Q i , by construction [16], this representation allows for direct control, as we can force the curve to pass through some Q ∈ 2 by simply moving one of the Q i to Q .Moreover, the "flatness" of the curve at Q i can be controlled by modifying the weight β i (see Figure 2).(c) the effect of increasing the weight α 2 from 1 to 3. The dots visualize the curve points P (i /16) for i = 0, . . ., 16.To the best of our knowledge, the barycentric form has been studied only in the functional setting, so far.For polynomials, it can be traced back to Taylor [17] and Dupuy [6], and Berrut and Trefethen [4] provide a detailed summary of its favourable properties.For rational functions, Salzer [15] and Schneider and Werner [16] were the first to identify the advantages of the barycentric form, and Berrut and Mittelmann [3] show that every rational interpolant can be expressed in barycentric form for a suitable choice of weights.For very specific weights, barycentric rational interpolants are guaranteed to have no poles and a high approximation order [2,10], with slow-growing Lebesgue constants, in particular for equidistant nodes [5].The barycentric form is also a key ingredient of the AAA algorithm [12], which extends the work of Antoulas and Anderson [1] and uses an adaptive node selection scheme for efficiently computing robust rational approximations of real and complex functions.

Contributions
In contrast to this previous work, the aim of this paper is to explore the use of the barycentric form in the context of curve design.We first show that rational Bézier curves (1) and barycentric rational curves (3) are essentially equivalent (Section 2), in the sense that any rational Bézier curve can be expressed in barycentric form and vice versa.We then discuss the shape editing possibilities offered by the barycentric form (Section 3), we show how to raise the degree from n to n +1 without changing the curve (Section 4), and provide numerical evidence that the barycentric form is advantageous for curve evaluation (Section 5).

Equivalence of Bézier and barycentric form
Let us first recall how to derive the barycentric form for a polynomial p : → of degree n [4].Clearly, the Lagrange form of p is where p i = p (t i ), i = 0, . . ., n .Factoring out the polynomial (t ) = n j =0 (t − t j ), we get the first barycentric form with the Lagrange weights w i defined as Further dividing by the constant function 1, expressed in first barycentric form as 1 = (t ) t −t i , and cancelling the common factor (t ), then yields the second barycentric form To convert the rational Bézier curve in (1) to the barycentric form in (3), it remains to express the two components x (t ), ŷ (t ) in the numerator of P (t ) and its denominator ẑ (t ) in the first barycentric form.Proposition 1.For any nodes 0 ≤ t 0 < t 1 < • • • < t n ≤ 1, we can express the rational Bézier curve (1) with control points P i and weights α i in barycentric form (3) with interpolation points Q i = P (t i ) and weights β i = (−1) n +i w i z i , where z i = ẑ (t i ) and w i as in (4).
Proof.Let us first write the denominator of P (t ) in first barycentric form as Likewise, the numerator of P (t ) can be expressed in first barycentric form as The statement then follows after dividing (6) by ( 5), substituting P (t i ) = Q i and w i z i = (−1) n +i β i , and cancelling the common factor (−1) n (t ).
In principle, the nodes t i do not have to be ordered or restricted to the interval [0, 1], as long as they are distinct; however, in the context of interactive curve design, it seems natural to make these assumptions.Likewise, it is reasonable to set t 0 = 0 and t n = 1, so that Q 0 = P 0 and Q n = P n mark the endpoints of the curve.Under the usual assumption of positive weights α i , which guarantees that ẑ (t ) > 0 for all t ∈ [0, 1], so that the curve is non-singular 1 , we conclude that the weights β i are positive, too, because sign(w i ) = (−1) n −i , which follows from the observation that the factors of w i in (4) are negative, if and only if i < j ≤ n .This is in line with a result by Schneider and Werner [16, Proposition 8], which implies that the positivity of the β i is a necessary condition for the non-singularity of the barycentric rational curve in (3).
Example 1.Consider the quadratic rational curve P in Bézier form (1) with control points P 0 = (1, 0), P 1 = (1, 1), P 2 = (0, 1) and weights α 0 = 1, α 1 = 1/ 2, α 2 = 1, which describes a quarter circle (see Figure 3.a).Sampling this curve at the nodes , and the weights of the barycentric form (3) turn out to be Once a rational curve is represented in barycentric form, we can use a linear rational reparameterization to bring it into standard barycentric form with β 0 = β n = 1, very similarly to how the Bézier representation can be brought into standard form [13]. Lemma 2. For any λ ∈ (0, 1), consider the linear rational reparameterization ϕ : Let P be the barycentric rational curve (3) with nodes t i , interpolation points Q i , and weights β i and let P be the barycentric rational curve with nodes ti = ϕ(t i ), the same interpolation points Qi = Q i , and weights βi = β i λ ti /t i .Then, P = P • ϕ.
Note that β0 in Lemma 2 is well-defined, even if Moreover, we observe that sign( βi ) = sign(β i ) for i = 0, . . ., n .Therefore, if the β i are all positive, then so are the new weights βi .

Proposition 3. The barycentric rational curve (3) with nodes t i , interpolation points Q i , and weights β i can
be expressed in standard form by first reparameterizing it with ϕ in (7) for and then dividing all weights βi by β0 , as long as λ ∈ (0, 1).
Proof.According to Lemma 2, the first and the last weight of the reparameterized curve are where δ(t ) is again the denominator of ϕ(t ).It remains for us to show that the choice of λ in ( 8) guarantees β0 = βn , which is equivalent to β 0 δ(t n ) = β n δ(t 0 ) by ( 9), so that both weights are 1 after dividing them by β0 .
A natural question to ask at this point is: how does one get back from barycentric to Bézier form?To this end, it helps to recall that Pi = (α i P i , α i ) and to let Qi = (z i Q i , z i ), so that the assignments Q i = P (t i ) and z i = ẑ (t i ) for i = 0, . . ., n in the statement of Proposition 1 can be written compactly as Q = B P , where2 Proposition 4. The barycentric rational curve (3) with nodes t i , interpolation points Q i , and weights β i can be expressed in Bézier form (1) with control points P i = ( xi , ŷi )/ ẑi and weights α i = ẑi , where the vector Proof.First recall that the Bernstein-Vandermonde matrix B in ( 10) is non-singular, because the Bernstein basis is a Chebyshev system.The assertion then follows immediately by applying Proposition 1 to the rational Bézier curve with the stated control points P i and weights α i and verifying that it gives back the interpolation points Q i and weights β i .
Note that P = B −1 Q can be computed fast and accurately with O (n 2 ) time complexity [11].If the last coordinate α i = ẑi of the homogeneous control point Pi happens to vanish for some i , it means that the given barycentric rational curve cannot be written as a classical rational Bézier curve with control points in 2 .Instead, the control point P i needs to be replaced by the control vector α i P i = ( xi , ŷi ) ∈ 2 , representing an infinite control point in this case [14,8].Example 3. Using Proposition 4 to convert the barycentric rational curve P in standard form from Example 2 (see Figure 3.c) back to Bézier form, we find that the quadratic rational Bézier curve with control points P0 = (1, 0), P1 = (1, 1), P2 = (0, 1) and weights α0 = 2/3, α1 = 1/3, α2 = 1/3 also describes a quarter circle (see Figure 3.d).Bringing these weights into standard form, we return to the rational Bézier curve P that we started with in Example 1 (see Figure 3.a).

Shape editing using the barycentric form
Once a rational curve is given in barycentric form (3), several new options arise for manipulating the curve by modifying the different parameters of the barycentric form: the nodes t i , the interpolation points Q i , and the weights β i .
Changing one of the nodes, say t k , in isolation, while keeping the Q i and the β i fixed, has a rather unpredictable effect.However, it is possible to preserve the shape (and the parameterization) of the curve by simultaneously adapting the corresponding Q k and all β i , so that the effect amounts to "sliding" Q k along the curve.This can be achieved by first using Proposition 4 to express the curve in Bézier form and then applying Proposition 1 with the modified nodes to get back to the barycentric form.However, it turns out that we do not have to carry out these conversions explicitly, as the new interpolation points and weights can be expressed directly in terms of the given parameters of the barycentric form.
Proposition 5. Suppose we change the node t k for some k ∈ {0, . . ., n } to some new value tk / ∈ {t 0 , . . ., t n } and keep the other nodes fixed, that is, we let ti = t i for i = k .The barycentric rational curve (3) with nodes t i , interpolation points Q i , and weights β i can then be expressed alternatively in terms of the nodes ti , the interpolation points Qk = P ( tk ) and Qi = Q i for i = k , and the weights Proof.To prove this statement, we stick to the idea sketched out above.After converting the given curve to Bézier form, it follows directly from Proposition 1 that the new interpolation points are Qi = P ( ti ), which simplifies to Qi = P (t i ) = Q i for i = k .Moreover, we know that the given weights satisfy where w i is defined in (4) and the denominator polynomial ẑ can be written, independently of the Bézier form, in first barycentric form as ẑ (t ) = (t ) Likewise, the new weights satisfy βi = (−1) n+i wi ẑ ( ti ), where wi because ti = t i for i = k .For the remaining weight βk , note that ( tk In an interactive application, this "sliding" of Q k can be realized, for example, by letting the user click on the desired interpolation point, while holding the 'shift' key (to distinguish the action from a displacement of Q k ; see below), and translating the subsequent mouse movement (left/right or up/down) into an increase or decrease of t k until the mouse button is released.Note that the time complexity for updating for updating each of the other β i , and O (n ) for updating Q k (see Section 5), hence O (n ) overall, which is much more efficient than computing the conversion to Bézier form and back.
For the reasons pointed out in Section 2, it seems reasonable to prevent sliding the endpoints Q 0 and Q n , that is, to exclude the cases k = 0 and k = n in Proposition 5, and to restrict tk to the open interval (t k −1 , t k +1 ), so that Qk remains between its neighbours Q k −1 and Q k +1 along the curve.In this case, it follows immediately from (11) that sign( βi ) = sign(β i ) for i = k , hence the positivity of the weights β i carries over to the new weights βi .For βk , this is not obvious from (11), but implied by the fact that changing t k does not change the curve, so that the non-singularity of the curve still guarantees that all β i have the same sign [16].
The most direct control over the shape of the curve is given by displacing one of the interpolation points, say Q k , while keeping all other parameters fixed.By the interpolation property of the barycentric form, this will force the curve to pass through the new position of Q k at t k (see Figure 2.b).Compared to moving a Bézier control point P k , it should be noted that the basis function 4.a) is neither non-negative nor as nicely "bell-shaped" as the basis function that corresponds to P k .Hence, for large displacements, the shape may change less intuitively as it does in the case of editing the control polygon.However, while the general shape of the curve is more easily controlled with the Bézier control points P i , changing the interpolation points Q i , combined with the "sliding" procedure outlined above and inserting points with ease (see Section 4) provides a useful tool for "micro-editing" the curve shape.For example, it can be used to "snap" the curve to some point Q that must be interpolated exactly and the interpolation property guarantees that Q remains a point on the curve during subsequent editing operations, as long as Q is identical to one of the Q i .It remains for us to discuss what happens to the curve if we change one of the weights, say β k , and it turns out that we can use this parameter to modify the "flatness" of the curve at Q k .Indeed, Schneider and Werner [16] show that the derivative of As the numerator, which determines the direction of the tangent at Q k , does not depend on β k , which in turn appears only in the denominator, it follows that β k controls the length of the tangent, but not its direction.Therefore, decreasing β k "flattens" the curve locally at Q k , while increasing β k has the effect of letting the curve bend more tightly at Q k (see Figure 2.c and Figure 5).However, some limits on the possible values of β k need to be respected, if we want to guarantee that the curve remains non-singular.

Proposition 6. Consider a non-singular barycentric rational curve (3) with nodes
interpolation points Q i , and weights β i > 0 and suppose we change the weight β k for some k ∈ {0, . . ., n } to some new value βk .Then the modified curve P remains non-singular as long as βk ∈ (M , M ), where and Proof.First recall from ( 5) that the denominator D (t ) = n i =0 (−1) i β i t −t i of a non-singular barycentric rational curve with positive weights β i (see Figure 4.b) satisfies where Next observe that the denominator of the modified curve P vanishes at t , if and only if βk = S k ( t ).By the interpolation property of barycentric rational curves, it is clear that t / ∈ {t 0 , . . ., t n }.Therefore, P is non-singular for t ∈ [0, 1], as long as βk is not in the image of I = [0, 1] \ {t 0 , . . ., t n } under S k .To better understand the behaviour of S k , note that The effect of changing the central weight of a quadratic rational curve P in barycentric form (3): (a) The direction of the derivative P (t 1 ) at Q 1 is fixed, but its length is inverse proportional to β 1 .The dots visualize the curve points P (i /16) for i = 0, . . ., 16. and assume that t ∈ (t j , t j +1 ) for some j ∈ {0, . . ., n −1}.Since (−1) n − j (t ) is clearly positive, it follows from ( 13) that (−1) j D (t ) is positive too, with lim t →t j (−1) j D (t ) = lim t →t j +1 (−1) j D (t ) = +∞.Therefore, S k (t ) − β k is positive, if j ≥ k and j + k is odd, or if j < k and j + k is even, and negative otherwise, converging to +∞ or −∞ as t approaches t j or t j +1 , except at t k , because S k (t k ) = 0. Consequently, the image of (t j , t j +1 ) under S k is and for the M j in (12) (see Figure 4.c).Combining these images, we find that which, together with the considerations above, shows that the stated condition for βk guarantees P to be non-singular.
Note that M in Proposition 6 is always non-negative, because S k (t k ) = 0 and thus M ≥ M k ≥ 0, which is in line with our expectation that βk should be positive, just like β k , in order for P to be non-singular.
In general, it does not seem feasible to determine the bounds M and M analytically, but they can be computed numerically by first finding the roots of S k over the relevant intervals with Newton's method, using, for example, the midpoint of the interval as initial value, and then evaluating S k at these roots to get the M j in (12).

Point insertion and degree elevation
A common tool for increasing the flexibility of a rational Bézier curve is degree elevation, which can be used to represent a given curve of degree n as a curve of degree n + 1 without changing its shape.This increases the number of control points and weights by one and hence gives the user more control to model the desired shape.The equivalent of degree elevation in the barycentric form simply amounts to adding an interpolation point Q = P (t ) for some t ∈ [0, 1] \ {t 0 , . . ., t n }, adapting the weights β i , and computing the appropriate new weight for Q .
Proposition 7. Let k ∈ {0, . . ., n + 1} and t ∈ (t k −1 , t k ), where t −1 = 0 and t n +1 = 1.The barycentric rational curve P of degree n in (3) with nodes t i , interpolation points Q i , and weights β i can then be expressed alternatively as a barycentric rational curve P of degree n + 1 with parameters Proof.As in the proof of Proposition 5, we first use Proposition 4 to convert P to Bézier form and then conclude from Proposition 1 that the given weights satisfy β i = (−1) n +i w i ẑ (t i ), where w i is defined in (4) and ẑ (t ) = (t ) n i =0 (−1) n β i t −t i .Likewise, applying Proposition 1 to nodes t0 , . . ., tn+1 , it follows that Qi = P ( ti ), which simplifies to what is stated in (14), and that βi = (−1) n+1+i wi ẑ ( ti ), where wi = n +1 j =0, j =i because ti = t i for i < k and ti = t i −1 for i > k , and similarly to βi = (−1) For the remaining weight βk , note that ( tk ) = n j =0 ( tk − t j ) = 1/ wk , hence βk = (−1) n +1+k wk ( tk ) At this point, one may ask: what happens if we convert the barycentric rational curve P of degree n + 1 with the parameters in (14) to Bézier form?But as P is just a different representation of the same curve P , its Bézier form must simply be the degree-elevated Bézier form of P .Indeed, since degree elevation does not change the denominator polynomial ẑ , this fact can also be observed by applying Proposition 1 to the degree-elevated Bézier form of P and noticing that this gives the parameters in (14).

Performance of the barycentric form for curve evaluation
The classical way to evaluate a rational Bézier curve (1) at some parameter t ∈ [0, 1] is by applying the de Casteljau algorithm to the numerator and the denominator of P (t ) and dividing through, which has time complexity O (n 2 ).The rational de Casteljau algorithm [7] provides a more robust, but less efficient alternative with the same time complexity.A recent paper by Woźny and Chudy [18] presents a novel evaluation procedure for rational Bézier curves with a nice geometric interpretation.Like the de Casteljau algorithm, it is based on robust convex combinations, but it has a favourable linear time complexity.Yet another option is to use Proposition 1 to convert the curve into the barycentric form in (3) and to evaluate the latter.This can clearly be done in linear time, too, by first computing the sums in the numerator and the denominator and then dividing through (see Algorithm 1).
To compare the efficiency of these three algorithms (classical de Casteljau, linear-time geometric, barycentric), we implemented them in C++ on an Ubuntu 20.04.2 LTS laptop with 1.8 GHz Intel Core i7-10510U processor and 16 GB RAM.The time complexities of the algorithms are confirmed by the plots in Figure 6.a, which show the average running times for evaluating a rational Bézier curve of degree n with random control points P i ∈ [−1, 1] 2 and random weights α i ∈ [0.01, 10] at 10 6 random parameters t for n = 3, 5, 10, 20, . . ., 80. Regardless of n , the evaluation in barycentric form is the fastest, even though the running time includes the time for pre-computing the interpolation points Q i (with Woźny and Chudy's linear-time algorithm) and the weights β i (with the polynomial de Casteljau algorithm) for equidistant nodes t i = i /n and Lagrange weights w i = (−1) n −i n i n n /n ![4].Compared to the 10 6 evaluations, this pre-computation is negligible, but for fewer evaluations it is not.This effect can be seen in Figure 6.b, which reports the running times for evaluating a cubic rational Bézier curve at M = 100, 200, . . ., 1000 random parameters t ∈ [0, 1].While the linear-time Algorithm 1 Evaluation of P using the barycentric rational form Input: nodes t 0 . . ., t , interpolation points Q 0 , . . .,Q n , and weights β 0 , . . ., β n of P and parameter t Output: P (t ) N := 0 D := 0 σ := 1 for i from 0 to n do algorithm is the fastest for small M , the pre-computation needed for the barycentric evaluation pays off for large M , with the break-even at about M = 300 evaluations.While we use equidistant nodes in this comparison, we should point out that this may lead to numerical inaccuracies for n ≥ 50, due to the large variance of the w i , which carries over to the β i .Instead, stable results can be obtained by using Chebyshev points of the second kind as nodes, that is, t i = (1 − cos i π n )/2, because the corresponding Lagrange weights satisfy |w 0 | = |w n | = |w i |/2 for i = 1, . . ., n − 1 [4].

Conclusion
In this paper, we explored the use of barycentric rational curves in the context of shape design, and we studied their properties.Converting a given rational Bézier curve to barycentric form is simple and comes with several advantages.On the one hand, the barycentric form offers new tools for controlling the shape of the curve that are complementary to the classical way of manipulating rational Bézier curves.As the barycentric form provides neither a convex hull, nor a vanishing diminishing property, these new tools may be less intuitive, but we believe that they are still useful, at least for "micro-editing".After a modification in the barycentric form, the curve can easily be transformed back into Bézier form.On the other hand, the barycentric form is very efficient to evaluate in linear time.
Analogously to rational Bézier curves, the barycentric rational curve P in (3) can be seen as the projection of the polynomial curve P that interpolates the homogeneous interpolation points Qi = (z i Q i , z i ) at the nodes t i , where z i = (−1) n +i β i /w i , into the ẑ = 1 plane.In this homogeneous setting, the proposed editing operations can be understood as follows: (1) "sliding" Q k along P is equivalent to "sliding" Qk along P , and as the modification of t k entails a change of the w i , the β i need to be updated for i = k as in Proposition 5, so that the corresponding z i and Qi remain the same; (2) moving Q k is like moving Qk in the ẑ = z k plane; (3) modifying β k is tantamount to displacing Qk along the line through Qk and the origin.The larger β k , the further Qk is from the origin, and the more the projected curve P bends at Q k , very similarly to how increasing the weight α i pulls P towards the control point P k in the case of rational Bézier curves.
For the important class of non-singular rational curves, there is an interesting difference between the Bézier and the barycentric form.While the positivity of the α i is sufficient, the positivity of the β i is only necessary for the non-singularity of the curve.Consequently, the set of all Bézier curves with positive α i does not contain all non-singular curves, while the set of all barycentric rational curves with positive β i does, but also contains singular curves.In both cases, additional non-linear constraints are needed to fix this (cf.Proposition 6).
Another difference is that the barycentric form can describe curves that cannot be represented in Bézier form, at least not with the same degree.For example, a semi-circle can be modelled as a quadratic rational curve in barycentric form (see Figure 5.c), but not in Bézier form without using control vectors, and likewise for a full circle as a quartic rational curve.

Figure 6 :
Figure 6: Comparison of different algorithms for evaluating a rational Bézier curve: (a) running times (in seconds) for 10 6 evaluations of curves of different degree n ; (b) running times (in milliseconds) for M evaluations of a curve of degree 3.