Cubic spline curves with shape control

Cubic spline curves with shape control

Comput. & Graphics, Vol. 18, No. 5, pp. 707-713, 1994 Copyright ~) 1994 ElsevierScience Ltd Printed in Great Britain 0097-8493/94 $6.00 + .00 Pergamo...

356KB Sizes 0 Downloads 102 Views

Comput. & Graphics, Vol. 18, No. 5, pp. 707-713, 1994 Copyright ~) 1994 ElsevierScience Ltd Printed in Great Britain 0097-8493/94 $6.00 + .00

Pergamon

0097-8493( 94 ) 00081-6

Technical Section CUBIC SPLINE CURVES WITH SHAPE CONTROL MUHAMMAD SARFRAZ Department of Information and Computer Science, University of Petroleum and Minerals, Dharan 31261, Saudi Arabia Abstract--A constructive approach is adopted to build B-spline like basis for cubic spline curves with a more general continuity than/3-continuity. This method provides not only a large variety of very. interesting shape controls like biased, point, and interval tensions but, as a specialcase, also recovers a number of spline methods like u-spline of Nielson [ 9 ], ¢3-splines[ 1], "y-splines of Boehm[ 3 ] and weighted ,-splines [ 6 ]. The method for evaluating these generalized/3-splines is suggested by a transformation to B6zier form. I. INTRODUCFION B-splines are a useful and powerful tool for Computer Graphics and they can be found frequently in the existing C A D / C A M (Computer Aided D e s i g n / C o m puter Aided Manufacturing) systems. They form a basis for the space of n th degree splines of continuity class C" t Each B-spline is a nonnegative n th degree spline that is nonzero only on n + 1 intervals. The B-splines form a partition of unity, that is, they sum up to one. Curves generated by summing control points multiplied by the B-splines have some very desireable shape properties, including the local convex hull property and variation diminishing property. It is desirable to generalize the idea of B-spline like ,local basis functions for the classes of splines with shape parameters considered in the description of continuity. The first local basis for GC 2 splines was developed by Lewis [ 8 ]. In 1981, Barsky [ 1] generalized B-sptines to ¢ksplines. These splines preserve the geometric smoothness of the design curve whilst allowing the continuity conditions on the spline functions at the knots to be varied by certain parameters, thus giving greater flexibility. Later in 1984, Barrels and Beatty [ 2 ] developed local bases for ¢3-spline curves that are equivalent to Boehm's [ 3 ] 3,-splines. Foley [ 5 ], in 1986, constructed a B-spline-like basis for weighted splines; different weights were built into the basis functions so that the control point curve was a C j piecewise cubic with local control of interval tension. This paper constructs, in Section 2, a B-spline-like local basis for the cubic splines with a very general class of G C ~ continuity: we will call it generalized f3continuity. The design curve, in Section 3, maintains the generalized/3-continuity. This description of cubic splines with generalized f3-continuity not only provides a large variety of shape control, discussed in Section 4, like interval tension, point tension, local tension, global tension, or biased tensions but it also recovers a large number of well-known useful methods, mentioned in Section 5, including weighted splines, vsplines, weighted u-splines, g a m m a splines, beta splines[1-7, 9, 10]. The approach adopted in the construction of local basis for the generalized ~-splines is quite different from those adopted for different spline methods in [ 1-5, 8 ],

but is similar to that in [12]. The way for evaluating the generalized cubic/3-spline representation of a curve is suggested by a transformation to piecewise defined B~zier form. This form will also expedite a proof of the variation diminishing property for the generalized /3-spline representation. 2. LOCAL SUPPORT BASIS For the purpose of the analysis, let additional knots be introduced outside the knot partition to < t~ < . . . . . < t,, of the interval [to, t,], defined by t-3 < t 2 < t < to and t, < t,+, < In+2 < In+3.

Dejinition 1. We will call a function p(t) generalized /3-continuous at t = ti if it satisfies the following constraints

:/~,(,,+)J

~.,

~3.j[p,~,(,,

where the parameters/3j,i will be chosen as

~1.,,¢33.,>0,

{32.i>-0, i = - 2

.....

n+2.

(2)

For the construction of the local support basis functions, let ~:, j = - 1 . . . . . n + 2, be the generalized cubic ¢¢-spline functions such that

{

0

~.(t) =

for

t < tj 2.

for

t >_ tj+L.

(3)

with the piecewise representation

4)j(t) = R o ( O ) P . +

R,(0)fS., + R2(O)ff).i + R3(O)Pj,i,

(4)

in each interval [t,, tg+~], where

Rk(O)= 707

(3) k k 0 (1-

0) 3k

,

k=0 .....

3.

(5)

708

M. SARFRAZ

The requirement that ~bj is a generalized fl-spline, uniquely determines the following t~i,i 2 = 0 ,

(local support) Bj(t) = O, for t @ (tj 2, tj+2),

l~i,i = 1 - - h i , 1

I~i,i_l = #i_.,

PROPOSITION 2. The generalized fl-spline basis functions Bj(t), j = - l . . . . . n + l, are such that

(I0)

n+l

I?,a_2 = 0,

12,,,_;= #~-____!, l?;,; = 1,

(6)

(Partition of unity) Z Bj(t) = 1

~Yi-I

j= 1

Wt,,-i _ 1 --h; 'Yi ,

W,,[-2 : O,

W,,;=l,

for (Positivity) Bj(t) > O,

t~[to,

t.].

for all t.

(11) (12)

where Proof The local support and the partition of unity properties follow immediately from the definition and the construction of the basis functions. For the positivity property Eq. (12), it can be noted immediately that for the parameters defined in Eq. (2),

].t i = y i ' O i , i / l ] i ,

hi = (1

"~i)ll2,i-illli

-

I,

hi-I "Yi ~l,i

hi-i + hiBl.i =

02,i(03,i+1

--

%, O;,j > 0,

04,i+1 ),

for all j and i = 2, 4.

(13)

Moreover,

//2d = 04.i+1 (01.i - - O z . ' ) , 7li = O l d O 3 d + l

O,.i = 6{h~_,(2

01,j

- - 02.i04.i+ ,

-

hi-ih2

%)

+ ---7

2

fl2,i'~i

~-

hi

} fl3.i~Yi

(14)

- - 02. j = 03. j - - 04. j

where ,

02.i = 6h2i-,,

01. j - -

02,j = 6{h}-l( 1 -- Tj) hj_,h} 2 } + ~ fl2,jYj + hj ~3,j'~j

03.i = 6{h~-l( 1 - % )

+ h, jh~ 2

( 15)

)

fl2d"Yi +

04., = 6h 2 fl3,i.

h2 ~3,i( 1 + y/)} J

is also positive. Therefore, the quantities ~l.j, hence

~2,jand

\

The local support generalized fl-spline basis is now defined by the difference functions Bj(t) as: Bj(t) : Oj(t) - Oj+,(t),

j = -1 .....

n + 1.

(7)

~ j = O I . j -~- •2.j

"~

2(OLj -- 02.j)(O3.j+l

--

04.j+l)

(16)

are positive. The above imply that all non-zero terms in Eq. (9) are positive and thus (12) follows.E]

3. DESIGN CURVE To apply the generalized cubic fl-spline as a practical method for curve design, a convenient method for computing the curve representation

Thus if in any interval [t;, t,+~ ], Bj(t) = Ro(O)F:,i + RI(O)Vj,~ + R2(O)Wj,; + R3(O)Fj, i,

(8)

.+l

p ( t ) = ~, PjBj(t),

t @ [to, t,],

(17)

j--I

then we have: Fj,i 2 = O,

Vj.i-z=O,

i - 2 > j >_ i + 2,

Fi,i-1

Fi.i = 1 -- hi -- #i,

F,.i+, : hi+l,

i-2>j>_i+

i-2>_j>_i+

Wi i- , = 1

hi 1 - - "Yi

= ~i--1,

i+2

p(t)=

]d i

Vi. i = 1 - - - , Yi

1, ,

Z

PjBj(t),

tE[ti,

ti+,],

J=i--I

1,

|: . = ]di-- 1 " i.t 1 "~i-I '

Wj, i - 2 = O ,

is required, where Pj E ~ N define the control points of the representation. Now, by the local support property,

W.i.i

--

Xi+i

1

i=0 .....

n-1.

(18)

(9) Substitution of Eq. (8) then gives the piecewise defined BOzier representation p ( t ) = Ro(O)F; + R.(O)V;

-- Yi+z

+ R2(O)Wi + R3(O)F;+,,

(19)

709

Cubic spline curves with shape control

0

@

0

0

0

0



0

a

a

0

It



0





0

@

0

0

0

@

0

Fig. 1. Generalized fl-splines with f12: varying for point tension control. where

ai > 0 ,

k~ = X, Pi I + ( 1 - Xi - # i ) P i + #,Pi+],

(20)

V i = (1 - ~ i ) P i + a, Pi+,,

a, + f l i < 1.

Thus Vj and W, lie on the line segment joining Pi and Pi+t, where Vi is before W~. Also, we can write Fi = (1 - "yi)Wi_l

I ~ = fliPi + (1 - fli)Pi+l,

with

~,= ~l,i/~i 1 . fli

fli>-O,

(21)

~2,i/~iJ

The transformation to Brzier form is very convenient for computational purposes and also leads to: PROPOSITION 3. (Variation diminishing property). The generalized fl-spline curve p ( t ) , t ~ [to, t,], defined by Eq. (17), crosses any (hyper) plane of dimension N - 1 no more times than it crosses the controlpolygon P joining the control points { P : } 7 ~ .

"~ "~irl,

(22)

where we already know that 0 < % < 1. Thus the control polygon of the piecewise defined Brzier representation is obtained by corner cutting of the generalized fl-spline control polygon. Since the piecewise defined Brzier representation is variation diminishing, it follows that the generalized fl-spline representation is also variation diminishing.J3 REMARK 4. Using the B-spline like representation of the generalized fl-spline, the interpolation problem can be tackled through n+ I

PjBj(t,) = Fi,

Vi,

(23)

j=-I

P r o o f Following the arguments, Eqs. (13-16), for positivity, in the previous proposition, it is straightforward that the coefficients ai, r, in Eq. (20) satisfy •

@

o

where the matrix of the Bj(Ii ) forms a tridiagonal matrix. Since 0 < ui, X, < ½, the tridiagonal system in











o



0

O



0





0

o



0

0

e

o





e

o

Fig. 2. Generalized fl-splines with/32.4 and fl2.5varying for interval tension control.

710

M. SARFRAZ

(~ •l

e

°

o

0

0

0

o

(J

0

0

0

0

e

0

@

Fig. 3. Generalized h'-splines with global tension using the shape parameter ~32.;. Eq. (23) is diagonally dominant. Thus a unique interpolatory generalized/3-spline exists and can be easily calculated by using the tridiagonal L U decomposition algorithm. For further details, regarding shape control and the constraints on the shape parameters, the reader is being referred to [ 13 ]. 4. SHAPE CONTROL

The parameters defined in Eq. (2) can be used to control the local or global shape of the curve: (i) It is a simple matter to see that, for any i when f32.i is increased (and other shape parameters are kept fixed), ~,, ~i --* 0, which implies P ( 6 ) --~ P~. Thus the curve is pulled towards the control point Pi. If we also let/~2,i+l --* ~ , then we shall have p(t,+j) --~ P~+] and it follows that for any t [ t~, t~+j], p (t) must converge to the straight line from Pi to P,÷~. Thus the behaviour of ~2.i can be used to achieve the point and interval tensions both locally and globally. (ii) The shape parameter/~.~ also produces a similar shape behaviour as that of ~2.~ in a different way. The increase in ~ . , , for any i, (while the other

shape parameters are kept fixed) makes the curve approaching the point e = ~,e,_, + (1 -

where

°

o

8

o

o



o

Q

o

0<~=

lim ~,~.

This shows that the curve is not only pulled towards a point on the line from Pi ~to Pi but also shifts backward. Similarly, if~j+~ is also increased sufficiently large, this will make the curve tighten between two points P and Q, which lie on the lines from P~ ~ to P~ and P~ to P~+l respectively, (iii) Another interesting shape characteristic can be achieved by the variation of the shape parameters /3~.i and f33,i. If they are assumed large enough (and/32.g supposed to be fixed; for simplicity, let /32.~ = 0) then ~,~ and /~i decrease and increase monotonically towards 0 and 1 respectively. This shows that the curve at t, is pulled and shifted completely to the control point P H . In the case when/3jj+~ and/33,,+~ are also increased, the curve is shifted and pulled to the line segment P H P ~ .

o o

x)P~,

o

o

-





a

o

o

e

o

o

o

e

o

Fig. 4. Generalized/~-splines with 3~.4varying for appearing a corner in the middle of the interval.

711

Cubic spline curves with shape control

O

0

0

iiii

O

Cl

0

0

0

0







0

o

0

0

0



Fig. 5. Generalized ¢~-splines with ~1.4 and B~.5 varying to tighten the curve across the line segments P3P4 and PnP> 5. SOME SPECIAL CASES A number of spline methods can be obtained as a result of distinct replacements of the parameters involved in the above construction. For example A.

~l,i

:

[~3.i :

1,

where vi > 0, coi> 0, Vi, gives weighted u-spline method of Foley[6]. This also covers the cases B and C. E. The special case:

~2,i - O,

[~l,i = ~l.i,

corresponds to the cubic spline representation. B. The weighted spline[s] can be obtained by the following replacement:

fll,i

:

1,

fl2,i : O,

fl3,i --

COi I

COt

COl > O.

C. The v-spline [ 9 ] can be obtained with the following choice: /~l,i = ~3,i =:

1,

~2,i = [~2,i,

~3.' = ~1,i,2

where/3],i > 1, ¢32.i >~ 0, corresponds to B-splines method. E The y-splines of Boehm[ 3] can also be recovered. The relationship of our/32~, and the tension factors (Boehm's %) used by Boehm for his curvature continuous cubic splines is derived here from our B6zier representation as:

/~2,* = vi >~ 0,

( Boehm

"~" % ) -

6h,.~h, -

-

01,i

--

02,i'

D. The replacement

~.,, = 1,

Pi

~2,i = - - ,

53.,-

COt

COt

e

where/3].i = ~3., = 1. It can be easily noticed that the behaviour of l/(Boehm's' %) is same as that of ~2.,.

¢di-. 1

o O

0

0



0

O

0

0

0



0

0

c

0

0

o



0

0

0





Q

0

0

19

ct

0

O

Fig. 6. Generalized/3-splines with global tension using the shape parameter/Sty,.

M. SARFRAZ

712

0



G

0



o

0

o

0

o

o

o



@

o

o

Q











o

e

Fig. 7. Generalized/~-splines with/~l,+ and/~,+ varying for biased point tension.

6. EXAMPLES The shape control of the generalized/3-spline is illustrated by the following examples for the data set in R 2. Unless otherwise stated we will assume/31j = 1, ~2+i = 0, ~3.~ = 1 in all the examples. Figure 1 illustrates the effect of progressively increasing the value of the point tension parameter ~2.4 at the knot t4 whilst Fig. 2 shows the interval tension effect due to progressive increases in ~2,4and ~2.5. Figure 3 displays the global tension effect due to progressive increase in ~2.i. The values of the varying parameters, in each curve of the Figs. 1, 2, and 3, are taken as 0, 5 and 50 respectively. Figures 4, 5, and 6 display the results of Section 4(i). First, second and third curve: (a) of Fig. 4 respectively correspond to the values l, 5 and 50 of/~1,5, (b) of Fig. 5 respectively correspond to the values/~t.4 =/~1.5 = 1, 5, and 50, (c) of the Fig. 6 respectively correspond to the values 1, 5, and 50 of/3].i, Vi.



Q



0

Q

7. CONCLUDING REMARKS The cubics with a more general form of continuity than ~/-continuity have been dealt with. The freeform spline curve scheme has been developed and analysed whereas the interpolation problem is also considered. These schemes can be implemented to achieve a large variety of shape controls via the parameters involved in the description of the generalized ~-continuity constraints. Moreover, a large n u m b e r of existing spline methods can also be recovered through this most general description of continuity, Thus a user has a freedom, through these generalized/~-splines, to use a suitable method for a desired shape control. The freeform curve method is computed by the generation of B6zier points whereas the implementation



0

II

Q

@

6

Demonstration of the results of Section 4 (ii) is done in Figs. 7, 8, and 9. The curves in Fig. 7 correspond to the values 1, 10, and 1000 offlj.i =/33.~, for i = 4. The curves in Fig. 8 are when i = 4, 5 and the curves in Fig. 9 are Vi.



Q



Q

O



Q





6

0

Q

0

Q







B

o

Q

0

o

Fig. 8. Generalized/~-splines with/3~,~ and/33,i i = 4, 5 varying for biased interval tension.

Cubic spline curves with shape control



o

o

o

e

713

o

o

o



e

o

o

*

Fig. 9. Generalized ~-splines with ~-splines with ~., and ~3+,, Vi, varying for biased global tension.

of the tridiagonal system solver L U decomposition algorithm is proposed for the computation of the interpolatory scheme. The approach adopted for the construction of the curve scheme is not restricted to only cubic spline case, it can be applied to the higher order spline curves: this is not straightforward as higher order continuity constraints will then be involved, which can make the manipulations too complicated. As far as shape control is concerned, in higher order case, there will be too many parameters to be considered which may not be that useful for practical purposes. However, these parameters can be reduced by certain simplifications and similar kind of shape, as in this paper, can be achieved. REFERENCES

1. B.A. Barsky, The Beta-spline: A local representation based on shape parameters and.hmdamental geometric measure, Ph.D. thesis, University of Utah ( 1981 ). 2. R. Bartels and J. Beatty, Beta-splines with a difference. Technical report cs-83-40, Computer Science Department, University of Waterloo, Waterloo, Ontario, Canada N2L 3GI (1984). 3. W. Boehm, Curvature continuous curves and surfaces. Comp. Aided Geom. Design 2(2), 313-323 (1985).

4. P. Dierckx and B. Tytgat, Generating the B6zier points of ~-spline curve. Comp. Aided Geom. Design 6, 279-291 (1989). 5. T.A. Foley, Local control of interval tension using weighted splines. Comp. Aided Geom. Design 3, 281-294 (1986). 6. T. A. Foley, Interpolation with interval and point tension controls using cubic weighted v-splines. ACM Trans. Math. Software 13, 68-96 (1987). 7. T. N. T. Goodman and K. Unsworth, Generation of beta spline curves using a recursive relation. In Fandamental Algorithms for Computer Graphics. R. E. Earnshaw (Ed.), Springer, Berlin, 326-357 (1985). 8. J. Lewis, "B-spline" bases.[br splines under tension, nusplines, and fractional order splines. Presented at the SIAM-SIGNUM-meeting, San Francisco, CA ( 1975 ). 9. G. M. Nielson, Some piecewise polynomial alternatives to splines under tension. In Computer Aided Geometric Design. R. E Barnhill (Ed.), Academic Press, New York (1974). 10. G. M. Nielson, Rectangular v-splines. 1EEE Comp. Graph. Appl. 6, 35-40 (1986). 11. 1. J. Schoenburg, Contributions to the problem of approximation of equidistant data by analytic functions. Q. Appl. Math 4, 45-99 (1946). 12. M. Sarfraz, A C 2 rational cubic spline alternative to the NURBS. Comp. & Graph. 16( 1), 69-78 (1992). 13. M. Sarfraz, Generalized geometric interpolation for rational cubic splines. Comp. & Graph. 18( 1), 61-72.