Properties of generalized Ball curves and surfaces T N T Goodman and H B Said*
It is shown that the generalized Ball representation for a polynomial curve is much better suited to degree raising and lowering than the B~zier representation. The generalized Ball basis is then extended to polynomial surfaces over a triangle, and recursive algorithms for evaluation and degree raising are given. generalized Ball basis, deg,ree raising, degree lowering, triangular polynomial patch
In a paper by Ball 1, a basis was introduced for cubic polynomials over a finite interval, and, in a paper by Said 2, this was extended to polynomials of arbitrary odd degree. Said derived a recursive algorithm for evaluating, at any point, a polynomial expressed by this 'generalized Ball basis', and, in a paper by Goodman and Said 3, it was pointed out that this evaluation is considerably more efficient than the de Casteljau algorithm for evaluating a polynomial expressed in the more usual Bezier form. This paper also showed that the generalized Ball form possesses the same 'shapepreserving' properties as the B~zier form. (For details of the B~zier form, see the paper by Boehm et al.4.) Another advantage of the generalized Ball basis is that it renders trivial the reduction of degree from 2m + 1 to 2m, and this paper investigates further degree raising and lowering for generalized Ball curves. Degree raising and lowering are procedures of considerable practical importance. It may be that a designer finds that a curve of given degree does not possess sufficient flexibility for his/her needs, and one way to gain flexibility is to increase the degree of the curve. However, it is in the design of surfaces that degree raising and lowering are most important. Some algorithms produce surfaces from curve input, and it is necessary that the degrees of these curves be modified until they all have the same degree (see the paper by Farin s, p 46). Similarly, in the calculation of the intersection of two surfaces, it may be necessary to ensure that the surfaces have the same degree. In shape-preserving interpolation by surfaces, degrees in certain patches may need to be raised to provide the required shape, and degree modification is then needed
to match adjacent patches (see the paper by Asaturyan~). Further important applications are implemented by different CAD systems using different representations of curves and surfaces, with degrees of polynomials varying from 3 to about 20. Degree raising and lowering are then required for the transmission of data between systems (see the paper by HoschekT). An algorithm for raising the degree of a generalized Ball curve is developed in the second section of this paper. This is similar to that for raising the degree of a B6zier curve, but it essentially enables the degree to be raised by 2 for the cost of raising it by 1 in the B#zier case. This section also constructs an algorithm for lowering the degree of a generalized Ball curve, when this can be done exactly. The algorithm has a stability not possessed by the corresponding algorithm for the B6zier form, and the degree can be reduced by 2 for the cost of reducing it by 1 in the B~zier case. The third section of the paper investigates in some detail how any generalized Ball curve can be approximated by one of lower degree, giving precise error bounds. The fourth section of the paper considers a basis for polynomial surfaces over a triangle that reduces to the generalized Ball basis along the edges of the triangle. This bivariate generalized Ball surface is analogous to the Bezier surface over a triangle, and it is shown that there is a recursive algorithm for its ev,~luation at any point that is similar to the de Casteljau algorithm for the B6zier surface. Finally, algorithms are given for raising the degree of a generalized Ball surface over a triangle. For brevity, many of the details of the proofs of the results have been omitted. Full details can be found in the paper by Goodman and Said 8.
DEGREE RAISING AND LOWERING The univariate generalized-Ball-basis functions of degree m + i + 1 are defined as follows: j~(t) = (ram+/)E(1-t)
"÷1
and Department of Mathematics and Computer Science, University of Dundee, Dundee DD1 4HN, UK * School of Mathematical and Computer Sciences, Universiti Sains Malaysia, 11800 Penang,Malaysia Paper received: 24 November 1989. Revised: 29 May 1990
554
fl~%+1
,(t) = fln~(1
-- t)
(1)
for 0 ~< i ~< m and 0 ~ t ~< 1. These basis functions are derived from the explicit representation of Hermite 2-point Taylor interpolation (see Said2). By the use of
0010-4485/91/080554-07 ~ 1991 Butterworth-Heinemann Ltd
computer-aided design
these functions, a generalized Ball curve of odd degree can be defined as 2rn+l
B2m+ l(t) =
E
fl ~(t)vi
0 ~< t ~<1
(2)
i=0
where, for 0 ~< i ~< 2m + 1, Vi is a point in two or three dimensions that is called a control point. The polygonal arc joining the control points is called the control polygon. In the same way as the Bernstein basis, the generalized Ball basis possesses the variation-diminishing property, and thus the curve mimics properties of the shape of the control polygon, such as convexity and monotonicity (see the papers by Goodman and Said 3 and Goodmang). It is now shown how to express a generalized Ball curve of degree 2m + 1 in terms of the generalized Ball basis of degree 2m + 3.
Theorem "1: Given 2m+1
B2m+l(t) =
~,
vi~r~(t)
0 <~ t <~ 1
i=0
then 2m+3
B2m+ l(t) =
E v/~m +l(t) i=0
(3)
constructed by a simple procedure of 'cutting corners'. This is illustrated for m = 3 in Figure 1. This is now compared with the algorithm for degree raising in B6zier form. Given a B~zier curve of degree n, with B6zier points bo,..., bn, the curve is equal to a Bezier curve of degree n + 1 with B6zier points bO . . . . , bn + 1, where f)i
i
92rn + 3 _ i __
i
m+i+l
m
i
O,...,n + 1
2m -- 1
+ 1
m+i+l
Vi
(4)
where, from the degree-raising algorithm, for i = O , . . . , m - 1,
~i -- m Jr- i vi _ i_Vi_l
92rn + 4 _ /
m+l
+
bi-1 + n + 1 -- i n+l bi
B2m+ l(t) ~-" E V/~~-l(t) i=o
Vi-1 +
m+i+l
i
n+l
(see Farin s, p 46). Therefore, raising the degree of a B6zier curve from n to n + 1 requires the evaluation of n convex combinations. Thus, raising the degree of a B6zier curve from either 2m + 1 to 2m + 2 or 2m + 2 to 2m + 3 requires the evaluation of either 2m + 1 or 2m + 2 convex combinations, whereas the degree of a generalized Ball curve can be raised directly from 2m + 1 to 2m + 3 by the evaluation of only 2m + 1 convex combinations. Next, lowering the degree of a generalized Ball curve is considered. It is easily seen that the curve of Equation 2 has a degree 2m if and only if Vm = Vm+l, and a degree 2 m - 1 if and only if Vm = Vm+ 1 = (Vm_ 1 + Vm+2)/2. In this latter case,
where, for i = 0.... , m, Vi-
--
m+l+i
m
V2m+l - i
m+i
(5) ~2m--1--i
9m+1 = Yr,+2 -- (~?r, + Vm+3) 2
m
(6/
Proof: It can be proved by induction, using Equations 4 and 5, that, for k = 0,..., m, k--1
-- - -
m
i V2m+l--i
-- --V2rn+2--i
m
The procedure is illustrated for m = 3 in Figure 2. Degree lowering is essentially the reverse of the above algorithm for degree raising, and so the procedure for m = 4 can be easily seen from Figure 1, with V/replaced by V/, i = 0 .... ,9, and Vi replaced by ~i, i = 0. . . . . 7.
B2m+l(t)= E vi~+l(t} i=0
½
4- V k l m -f- +l -tl kltk(1-3
2m--k
1
+
^
V2m--k+3
m
I
1 ^
V4 = V5
½
i=k+l
+
V4
v'5
+ 1 ½
k--1 Jr" E V 2 m + 3 - - i /RJ 2mm+ +l 3 - i(t) i=0
4
•
Thus, given the control points Vo,..., V2m+l of a generalized Ball curve of degree 2m + 1, the control points Vo, ..., V2m + 3 of the same curve expressed as a generalized Ball curve of degree 2m + 3 can be
volume 23 number 8 october 1991
1 /
(7)
Simplifying Equation 7 for k = m by applying Equation 6 then gives Equation 3.
V7
Vl
^
^
Vl
v8
V8
\ ^
Vo = Vo
^
V9 = V7
Figure 1. Degree raising from degree 7 to degree 9 555
"V2
~'3
2
complicated. In contrast, the degree of a generalized Ball curve can be reduced by the alteration of only the central control points. For example, B2,,+ ~ carl be approximated by the polynomial of degree 2m:
2 1
,
2
1
m-
V3 = V4
1
Pit) = i=0
1
3
3
1~,4
-[-(Vm-}-Vm+l)(2mm)tm(1--t)m2 2m+1
+
v,#?(tl i=m+2
'Vo : Vo
V7 = "V5
Figure 2. Degree lowering from degree 7 to degree 5
This is clearly the best approximation if V0. . . . . Vm_l, V,,+2 .... , V2m+l are not changed. The error in this approximation can be shown to be
IIB2n,+l
- PH "= sup [B2m+l(t) -- P(t) I t~[(), 1 ]
A B~zier curve of degree n with B6zier points b o . . . . . b~ in fact has a degree n - 1 if and only if x (2m+1) -°~
i=O
In this case, the B~zier points b0, ..., gn--1 for the B~zier representation of degree n - 1 can be determined by bi -
n .bi
i
n--i
n --
gi-1
i = 0,..., n - 1
(8)
P2m(t) =
~
ViB?(t) + W
tin(1 -- t) m
i=0 2m+1
n --
n--i
+
i .bn-
n--!
.bn-i
n--1
(9)
(see Farin s, p 49). For n = 2m, a symmetric method is gained by the application of Equations 8 and 9 for i = 0,..., m - 1. For n = 2m + 1, Equations 8 and 9 can be applied for i = 0,..., m - 1, and b m can then be derived by.either Equation 8 or Equation 9. In any case, it can be seen that the reduction of the degree of a B~zier curve from 2m + 1 to 2m or from 2m to 2m -- 1 requires at least as much computation as that required to reduce the degree of a generalized Ball curve directly from 2m + 1 to 2m - 1. It should also be noted that the formulae for reducing the degree of a B~zier curve tend to be numerically unstable, as the calculation of each new B6zier point requ#es the subtraction of a previously calculated point. In contrast, the formulae for reducing the degree of a generalized Ball curve calculate each new control point directly in terms of the original control points, and the process is therefore stable.
APPROXIMATE
~
V,~(t)
(11)
i--m+2
i = 0,...
DEGREE LOWERING
As detailed in the introduction to this paper, many applications require a polynomial curve to be replaced by one of lower degree. As this cannot, in general, be done without the alteration of the original curve, it is now considered how to approximate a polynomial curve by one of lower degree. It has already been seen that the conditions on the B~zier points for the degree of a B~zier curve to be reduced are somewhat
556
(10)
Suppose that there is now a polynomial of degree 2m of the form
or by bn-l-i
1 +
This can be approximated by the polynomial of degree 2m - 1 m -- 1
v, flr'lt)
Q(t) = i=0
(V .... 1 +
+
2 2m+
Vm+2)['2m'tm(l__t)m tin)
!
+
v, i --
?lt)
m + 2
Indeed, this is the only possibility if V0. . . . . Vm V,, + 2. . . . . V2m + 1 are not changed. Then /
Vm
P2,,(t) -- Q(t) = t W
]
2
Vm+2~(2m~tm(1
2
and so IIP2m-qll=lVm
1-2W+Vm+2l
__ ,)m
./\m/
(2m)
2 ~2m+1~ (12 m This rather crude approximation can be improved dramatically if the coefficients Vm_ 1 and Vm+ 2 are also modified. Equation 11 needs to be approximated by a polynomial of the form m--2
Q(t) =
~
Vi~'(t)+
V;~ 1 / ~ _ 1 ( t )
i=0
+
2 2rn +
+
7".
1
(13)
i=m+3
computer-aided design
It can be shown that a good approximation occurs when
Vm --1 = V m - 1 ~V'm+ 2 = Vm+ 2 -l-
(2W-
Vm_ 1 -- Vm+ 2) 4
(2W-
(14)
V m _ 1 - - Vm+ 2)
4
and, in this case, the error is IIP2m- QN = ( 2 % - - 1 ) 1 2 W - - V m - - 1 -
Vm+2'
14
(15)
BIVARIATE GENERALIZED BALL BASIS The construction of the bivariate Bernstein-B6zier basis functions on a triangle is well discussed in the paper by Farin 1°. The basis functions are reduced to the univariate basis functions on each side of the triangle. A similar approach will be adopted in the definition of the bivariate generalized-Ball-basis functions on a triangle. Let P be any point on a triangle T whose vertices are A,B and C. u, v, w are defined as the barycentric coordinates of the triangle, which satisfy u + v + w -- 1, u, v, w >/0, and any point P on the triangle can be expressed as
P = uA + vB + wC which has reduced the error in Equation 10 by a factor of (1 - 1/m)m-1/m. Suppose that it is now wished to approximate B2m + 1 by a polynomial of degree 2m - 1. Clearly, it can first be reduced to degree 2m and then to 2m - 1 by the above method, the error being bounded by the sum of the errors in each step. However, as the coefficients Vm--~, Vm+2 are modified in the second step, a better approximation can be obtained at no extra cost if they are also modified in the first step. It can be shown that a good approximation is given by
For m ~> 1, the bivariate generalized Ball surface is defined as 4
B2m+ I(P) = 2 Bi2m+l(P) where
2 Ai, J,k (m + j + k)! vJwk i+j+k=2m+ l m!j!k! i~m+l
B12m+1 (P) = um+ l
B2m+ 2(P) = v m+ l
m--2
~.~ Ai,j,k i + j + k = 2m+ l j>.m+l
P(t) = ~, Vfl~m(t) i=0 -k (3Vm-1 -k 2V m -- Vm+2) ~ _ l ( t
B3m+ I(P) = W m+ l
)
i+j+k=2m+ l k~>rn+l
4 4(Vm-1-1-Vm-l-Vm+1-1-Vm+2)(22)tm(1--4
t)m
(18)
i=1
B4m+I(P) =
(m + k + i)[wkui
Ai,j,k
m!k[i[
(m + i + j)[
UI VI
m!i[j[
(2m + 1)! Ai,j,k - uivjwk i+j+k=2m+ l i[j[k[
~
i,j,k <~m
+ (3Vm+2 + 2Vm+l - Vm+g)#Tm+2(t) 4
+
2m+1
T,
v,#m(t)
(16)
,=m+3
The error in this case is bounded by (2m#
1
/ 3 )lVn _ _ V m + I I L ~ )
-k(2%--1)lVrn
"~l.s / 3 "~--m+l 4 m L l + 2 m _ 2/
1--Vm--Vm+~+Vm+21(1--~)m-14-m/m
(17) It is remarked that, by Stirling's formula, 1(mx)-1/2 as m--* oo, and so, as m--* oo, t h e error b o u n d in Equation 17 b e h a v e s like lYre -- Vm + 1 [ m -233/22 -5/2e-3/2/~-1/2
+ IVm-1 - %, - Vm+l + Vm+21m-3/22-1e-1x-1/2 The polynomial in Equation 17 can, of course, be expressed in terms of t.he generalized Ball basis for degree 2m - 1 using the degree-lowering algorithm in the second section of the paper.
volume 23 number 8 october 1991
where the coefficients Ai,j, k are points in three dimensions. B2m+I(P)is reduced to the univariate case when u = 0 o r v = 0 o r w = 0 . Note that, for I~1 ~< m, D~B2m+I(A)= D~Blm+I(A). Moreover, Blrn+l is determined by D~B2m+I(A), I~1 ~< m. Similarly, B22m+1 and B3m+l are determined by D~B2m+I(B), I~l~i m + l o r j / > m + 1 o r k / > m + 1.ThenB~m+l = 0, and, as this is expressed in terms of Bernstein-B6zier basis functions, Ai,i,k = 0 for h j, k ~< m. Thus, all the basis functions are linearly independent, and so any polynomial of degree 2m + 1 can be expressed in the form B2rn + 1 • As with the B6zier representation on a triangle, it is convenient pictorially to associate the term involving the coefficients Ai,j, k with the point with barycentric coordinates (i/(2m + 1 ), j/(2m + 1), k/(2m + 1)). Figure 3 then shows the subtriangles corresponding to B~m+l, i = 1 , 2 , 3 , 4 . The terms of B~ and B4 are given in Figure 4, with their coefficients omitted. By symmetry, the terms of B2 and B3 could be portrayed in a similar manner. In the paper by Said 2, a recursive algorithm is given for the evaluation of a generalized Ball curve that is similar to the de Casteljau algorithm for a B6zier curve. A recursive algorithm for the evaluation of a generalized
557
A
where A~,l/,k = Ai.j, k, and for r ~> 1 and i + / + k = 2m + 1 - r ,
= Ai+l,i,k
i >~ m + 1
' k = A ' Li+l,k 1 A,,i,
j ~> m + 1
(20)
,-1 'A~~,l,k ~-" Ai,j,k+l Ar,.I,k = U A i+l,i,k r-l r--1 + wA ,.i,k+~ r I + vA~,i+l.k
k ~ m + 1
otherwise (21)
Proof: This follows by induction on r. Corollary 1: Putting r = m in Theorem 2, B
C
Figure 3. Subtriangles corresponding to B ~, B 2, B 3 and B~for the generalized Ball representation
(22)
The expression on the right-hand side of Equation 22 is a B~zier polynomial of degree m + 1 on the triangle with coefficients Aijmk. Thus, as in the univariate case (see Said2), the recursive algorithm for the bivariate generalized Ball polynomial consists of two steps:
u4 U 4 V ~
m (m + 1)[ uiviwk E Ai,i,k i+i+k .... +1 i[j!k[
B2m+l (P) =
W
Reduce B2m+l to a Bezier polynomial of degree m + 1 by using Equations 19, 20 and 21. • Use the de Casteljau algorithm on the Bezier polynomial (see Farinl°).
• U4V~II4,,2~f V ' 4,/tAIX 4W2
Figure 4. Polynomials for B~ and B'~ with coefficients omitted
Ball surface that is similar to the de Casteljau algorithm for a B~zier surface over a triangle (see Farin 1°) is now given.
Theorem 2: For m /> 1 and 0 ~< r ~< m, 4 B2m+l(p) = y ' B2m i + 1,~(P)
(19)
i=1
where Blm+l,r(P)
=
u m+l
(m -t- j + k)!
~
A[/,k
i + j + k = 2 m + l --r i~m+l
m~j[k[
vi w k
Figure 5 illustrates reduction to the Bezier form for m = 3. A dot in a subtriangle indicates that a new point uP + vQ + wR is calculated, where P, Q and R are the vertices of the subtriangle. Figures 5a, 5b and 5c show the successive steps from the original generalized Ball form for degree 7 to the B~zier form for degree 4, while Figure 5d shows the first step in the de Casteljau algorithm for evaluating the quartic B~zier surface. Finally, an algorithm is given for raising the degree of a generalized Ball surface on a triangle. Essentially, for the c o m p o n e n t B4 of the surface, the algorithm for the B~zier triangle is used (see Farin ~, p 249), while, for the rest of the surface, the algorithm similar to that for generalized Ball curves giv(~n in Theorem 1 is applied. Along the edges of the triangle the procedure is reduced to that of Theorem 1. The procedures for raising the degree from 2m to 2m + 1 and from 2m + 1 t o 2 m + 2 are now expressed separately. Detailed proofs are given in the paper by Goodman and Said 8. It is first noted that any polynomial of degree 2m on the triangle ABC, as before, can be expressed in the form 4
B2,~(P) = ~ B~m+ I,I(P) i=1
B2m+ l,~(P) = vm+ l
r (m + k + i)!wku~ E i + i + k = 2 m + l--r A~'i'k m!k[i[
/>~m+l
B]~+~,~/P/=
w m+l
Y,
4,tj,~
i+i+k=2m+l--r
(m + i + j)[ uivJ
rnU~j~
where the B~zm+ 1,1 are defined as in Theorem 2 for the coefficients A~,j,k, i + j + k = 2m. This can then be evaluated recursively by the application of Theorem 2 for r = 1 . . . . . m, to reduce it to a B~zier polynomial of degree m + 1.
k~>m+l
r
B4m+l,r (P) =
558
A i,j,k E i + j + k = 2 m + l --r i,j,k <~m
(2m + 1 -- r)! . u~vl w k i!j!k!
Theorem 3: The polynomial B2rn can be written in the form B2n~+ 1 where the new coefficients A,j,k (i + j + k = 2m + 1) can be expressed in terms of the old
computer-aided design
8
C
b
d
Figure 5. Recursive evaluation of a generalized Ball surface; (a) reducing generalized Ball surface of degree 7 to degree 6, (b) reducing degree 6 to degree 5, (c) reducing degree 5 to B6zier form of degree 4, (d) reducing B6zier form of degree 4 to B6zier form of degree 3
coefficients A~i,k (i + j + k = 2m) as follows:
Ai,i,k = A~-l,i,k
i >1 m + 1
Ai,j,k =
A~i 1,k
j ~> m + 1
Ai,j, k =
A~j,k_ 1
k >1 m + 1
volume 23 number 8 october 1991
and, for i, j, k ~< m,
Ai'j'k
i
-
-
A1
j
A1
k
A1
2m + 1 i-- ~,i,k+ 2m + 1 i,j- l,k + 2rn + 1 ~,i,k--1
Theorem 4: B2m+l can be written in the form B2m+2 , where the new coefficients A~i,k (i + j + k = 2m + 2)
559
can be expressed in terms of the old coefficients Ai.i,~ ( i + j + k = 2 m + 1) as follows. For = 2m + 2 ..... m + 1, a n d i + j + k = 2m + 2 ,
Ail,i,k
=
m + 1 m + 1 +j+ 4-
/
m+ 1+
k Ai 1,i,k
+k
m+l+
+k
A)+ 1,i,k 1
except for the c a s e s i = j = m 4- l a n d = k - - - m + 1. Similarly, the A~i,k are defined for j >1 m + 1 and for k~> m + 1 (except for i = j = m + 1, j = k = m + 1 and k = i = m + 1). Then, A~m +1,m+1,0 = (Am+2,m,0 1 4- A 1..... +2,0)/2
is defined, and similarly for Ag, m+l,m+l, A1+1,o,m+l. Finally, f o r i + j + k = 2 m + 2 , i,j,k~< m,
A~j'k _ 2m i+ 2 Ai- 1,i,k 4- 2m J+ ~ Ai'i 1,k k + 2m + ~ AiJ'k- 1 is defined.
CONCLUSIONS It is known that, in the recursive evaluation of a polynomial curve at a point, the generalized Ball form requires about half the computation of the de Casteljau algorithm for the Bezier form. Moreover, the generalized Ball representation has shape-preserving properties that are similar to those of the Bezier representation. In this paper, it is shown that a generalized Ball curve is much better suited to degree raising and lowering than a B~zier curve, and that the recursive-evaluation and degree-raising algorithms can be extended to generalized Ball su'rfaces over triangles. This suggests that, in situations where evaluation and raising and lowering the degree is important, while other processes such as subdivision and the evaluation of derivatives are less important, the designer of curves and surfaces should consider using the generalized Ball form instead of the B~zier form.
560
The authors would like to thank the referees for their helpful comments. This research was performed while the first author was visiting the Universiti Sains Malaysia. The visit was made possible by the Universiti Sains Malaysia and the British Council under its Project 710 CICHE Programme.
REFERENCES
k
+
A~+ 1,/ 1,k
ACKNOWLEDGEMENTS
1 Ball, A A 'CONSURF. Part 1: Introduction to conic lofting tile' Comput.-Aided Des. Vol 6 (1974) pp 243-249 2 Said, H B 'Generalized Ball curve and its recursive algorithm' ACM Trans. Graph. Vol 8 (1989) pp 360-371
3 Goodman, T N T and Said, H B 'Shape-preserving properties of the generalised Ball basis' TR M6/88 Universiti Sains Malaysia (1988) (to appear in Comput. Aided Geom. Des.) 4 Boehm, W, Far/n, G and Kahman, J 'A survey of curve and surface methods in CAGD' Comput. Aided Geom. Des. Vol 1 (1984) pp 1-60 5 Far/n, G Curves and Surfaces for Computer-Aided Geometric Design Academic Press, USA (1988) 6 Asaturyan, S 'Shape preserving surface interpolation schemes' PhD Thesis University of Dundee, UK (1989) 7 Hoschek, J 'Exact and approximate conversion of spline curves and spline surfaces' in Dahmen, W, Gasca, M and Micchelli, C (Eds.) Computation of Curves and Surfaces Kluwer, Netherlands (1990) pp 73-116
8 Goodman, T N T and Said, H B 'Further properties of the generalised Ball basis' AA/897 University of Dundee, UK (1989) 9 Goodman, T N T 'Shape preserving representations' in Lyche, T and Schumaker, L L (Eds.) Mathematical Methods in CAGD Academic Press, USA (1989) pp 333-351 10 Far/n, G 'Triangular Bernstein-Bezier patches' Comput. Aided Geom. Des. Vol 3 (1986) pp 83-127
computer-aided design