Visually C2 cubic splines

Visually C2 cubic splines

Visually C2 cubic splines Gerald Farin (n)J~ Generalized C 2 conditions are used to define a class o f cubic spllnes. A B spline-Iike design sche...

252KB Sizes 77 Downloads 239 Views

Visually

C2

cubic splines

Gerald Farin

(n)J~

Generalized C 2 conditions are used to define a class o f cubic spllnes. A B spline-Iike design scheme Is provided for these curves. computer-aided design, cubic splines, C = curves

The definition of splines is closely related to an underlying set of breakpoints, the so-called 'knot vector'. In an ab initio design, where one is typically given a B-spline polygon, this means that one has to employ some more or less ad hoc procedure to equip oneself with this knot vector. In this paper we present a method that produces cubic splines with continuous curvature which can be defined without a knot vector. CUBIC C 1 SPLINES

A cubic C 1 spline curve is uniquely defined by its B6zier polygon bo, b l , . . . , b3n and its knot vector (to, tl . . . . , tn), where n is the number of cubic segments 1 . We call b3i+1, b3i+2 ; i = 0, 1 , . . . , n-1 (generally not lying on the spline curve) inner B~zier points, and the b3i (on the curve) junction points. In the ab initio design of C 1 piecewise cubics, one would be given the inner B6zier points as well as (for open curves) bo and b3n, and the knot vector. The remaining B6zier points b3i will then be computed in order to establish differentiability between adjacent segments:

(ti-ti_l)b3i+l b3i =

t/+ ~

+ (ti+I -tl) b3i_ 1 - -

t i_ z

which has the geometric meaning that b3i lies on the straight line segment joining b3/_z and b3i+ 1, subdividing it with ratio Ati_ 1 : At/. Now suppose we are asked to solve the above problem without being given a knot vector. A solution is to place the b3i anywhere between b3i-x and b3/+ 1 ; the ratios thus defined can be used to define a knot vector with respect to which the curve will be once differentiable. Hence a purely geometric configuration (three points being collinear) implies the existence of a parametrization (the knot vector) with respect to which the curve is C ~ . This leads to the following definition: A curve is called visually C r if there exists a parametrization with respect to which it is cr~ A cubic spline curve has many parametrizations: the knot vector describes the only parametrization with respect to which the curve will take the form of a cubic spline. We shall discuss the problem of if - and under what conditions - we can determine the b31 such that the resulting piecewise cubic curve is visually C2 .

l

Figure I. Two parametr/zations o f a visually C 2 curve

VISUAL C2 CONTINUITY

Let r(u) denote a curve that is twice differentiable at r(uo). Setting r_ = r(u o - 0), r÷ = r(uo + 0), Taylor's expansion yields 2

2

(u - Uo)i/i! D/r_ = ~ (u - uo)i/i! D/r+ i=0

where D = d/du. Let x(r) and y(t) be parametrizations of the curve as shown in Figure 1. We can now express equation (1) in terms of r and t where r0 =.r(Uo), Xo .= X(ro), etc and compare coefficients

of (u - Uo)': Xo = yo

volume 14 number 3 may 1982

(2a)

Dro ~,0 = Dto y~

(2b)

(Dro)2~o + D21"o~o = (Dto)2y~ ' + D 2 toy~

(2c)

In equations (2) dots denote differentiation with respect to r while primes denote differentiation with respect to t. Elementary vector algebra proves that an equivalent form of equation (2c) is provided by (Dro) 3 [x0 x Xo] = (gto) 3 [Yo x y~)'] Using the identities Dr0 = Xo" Dro and Dro = y~" Dto we can rewrite equations (2) to obtain ~ o l a l = ~ola2

(~) (3/,)

It,0 x Xo ]/a~ = [y~ x y~'] la~

(3c)

Xo = yo

where we have seta 1 = I Xo I and a 2 = l y~ I. As all steps needed to obtain equations (3) from equation (1) can also be carried out in the reverse direction, equations (3) give a necessary and sufficient condition for visual C 2 continuity of two curve segments x(~') and y(t). APPLICATION

TO CUBIC BEZIER CURVES

let us now consider two B6zier polynomials:

x(r)= Ligusterweg 8,445 Lingen/Ems, FRG

(I)

i=0

3,

3

j=0

J

z b3(i-1),/ (

)~J(1-r)3-J;

0~
0010-4485/82/030137-03 $03.00 © Butterworth & Co (Publishers) Ltd

137

and

b31_ I

y(t)=

3 3 >2 bai+/( )tJ(1-t)3-/; /=o J

dI

b3~

o'2

b3~ , i

1 i I

0 ~
h h2

(See Figure 2.) We know 1

(1) = 3 (ba;

)

b31- 2

(1) = 6(bai - 2bai-1 + bai-2) y' (0) = 3 (bai+ a - b3i)

i

?c

y " (0) = 6(b3i+2 - 2bai+t + bai) Using simple vector algebra equations (3) yield the visually C 2 conditions for BCzier curves Ab3i_l/dl = A b a i / d 2 ; d l = Iz~bai_tl,d2 = IAbail

(4a)

[Abai-I X Abai_~]/dl a = [Ab3i x A b a i + l ] / d 3

(4b)

! Figure 2. Visually C 2 conditions for Bdzier curves

(with common centre of curvature)

As a simple consequence, we note

area (bai_2, . . . , bai)/dl a = area (bai_7. . . . . .

(]2

bai)/d ~ (5)

Note that equation (4b) implies that the b3i_2, . . . , bai+2 must form a convex plane polygon.

V I S U A L L Y C2 A L G O R I T H M O

Let us now return to the earlier question: how to place the b3i such that the resulting piecewise cubic curve is visually C2 ' From equation (5) and Figure 2 it is clear that (6)

hi Ih= = d, 2 Id: 2

b2 ~u

and the desired visually C 2 algorithm becomes: given all inner B~zier points such that any b3i_2, • . . , bai+2 are plane and convex, as well as (for open curves) bo and ban , compute h, :

I (bai-1 - bai-2) x (b3i+1 - b3i-1)1 I bai+l - b3/_ 1 i

(7)

/

3 "~ (11

o Given •

Computed

Figure 3. Example of closed visually C: B spHne

I(bai+2 - b a / + l ) x (b3/+1 - ba:-l)l h2 =

Ib3/+1 - ba/-t I

The bai are given by

bai = ( d h , bai+, +~/h2 bai-,)l(*,/h, +~/h2)

(8)

V I S U A L L Y C 2 B SPLINES The visually C 2 algorithm is only a tool for the construction of visually C z spline curves; because of the planarity/ convexity conditions it is not a free-form design scheme in its own right. It is, however, possible to make it the main ingredient of such a scheme, for which we give the following visually C 2 B spline algorithm: •

given an arbitrary 3D polygon {ai} ]=o p~us (for open curves) two arbitrary points bo and ban • given also two arbitrary inner BCzier points on each polygon leg, in the order ah b3i+ 1, b3i+2, ai+l • compute the junction points b3i using the visually C 2 algorithm

Since the planarity/convexity conditions from the visually C 2 algorithm are now trivially met, the above is a general free-form scheme. Figure 3 shows a visually C: B spline that is not a 'true' B spline. It is important to note the geometric significance of the second step: it offers an explicit handle to prescribe the tangents at the junction points. This is not possible for 'true' B splines. 138

REVIEW FROM DIFFERENTIAL

GEOMETRY

From elementary differential geometry 4 it is known that equation (4/9) states that x(r) and y(t) have the same curvature at x0 = Yo. The curvature of a B6zier curve at ba/is given by:

~i = (2/3) jAb3i-j x Ab3i-2 iN1 3

(9)

= (2/3) hx/d, 2 The last formulation coincides with the 'natural spline condition' given by Boehm 2. The plane spanned by b3i-~, • • •, bai+2 or by ai_l, ai, a/+ 1 respectively, is the osculating plane at bai.

CONCLUSIONS •





Visually C 2 B splines are an intrinsically vector-valued scheme; there is no 1 D basis representation as is the case for 'true' B splines. In the second step of the visually C ~ B spline algorithm, it is also possible to place the inner Bdzier points outside the straight line segments (a/, ai+1) in a pairwise manner; this allows the generation of 'highly curved' segments. It should be noted that all results have been obtained without making use of terms from differential

computer-aided design

@

geometry. We feel that this should help in applying these ideas to surfaces, where the notion of arc length and related concepts are inappropriate. One might hope that the addition of the obvious 'follow-up' equation volume (b3i-3, • • •, b3i)

volume (b3i, . . . , b3i+3)

d,' (10) to equations (4) might serve as a characterization for visual C3 continuity. It turns out, however, that (10) is only a necessary, not a sufficient condition. It is interesting to note, however, that (10) does ensure continuity of torsion.

volume 14 number 3 may 1982

ACKNOWLEDGEM

ENTS

This research was partly supported by the Science and Engineering Research Council with Grant GR/A/92238 at Brunel University, Uxbridge, UK. The author wishes to thank W Boehm and a referee for helpful suggestions. REFERENCES

I Boehm;W'Cubic B-spline curves and surfaces in CAGD' Comput. Vo119 (1977) pp 29-34 2 Boehm, W 'On cubics: a survey' (to be published) 3 Manning, J R 'Continuity conditions for spline curves' Comput. J. Vo117 (1974) pp 181-186 4 O'Neill, B Elementary differential geometry Academic Press (1969)

139

optimisers.., building marmgement systems.., lighting control...

Electronics and energy conservation are t w o of the major g r o w t h sectors of the eighties. Combine the t w o and you have the hottest prospect since W a t t and his steam engine - E l e c t r o n i c Energy Management. The rapidly falling cost of electronics and the equally rapid rise of energy prices have stimulated an almost explosive development of n e w technologies for controlling energy consumption, They range from very simple devices costing less than £ 100 up to giant computerised building management systems costing upward of £ I million, E n e r g y lUlenager, the magazine which over the last three years has recorded and commented on the birth of this w h o l e n e w technology, is sponsoring the second E l e c t r o n i c Energy

Management Conference a n d Exhibition.

A E IENT Conference and Exhibition West Centre Hotel Lillie Rd, London SW6 23-24 June 1982

A t the first event, held last year, over 40 manufacturers exhibited their products - giving convincing evidence that the UK Is at the forefront of the technology - w h i l e delegates heard 20 authoritative papers, We Intend to make Electronic Energy Management '82 even bigger and better, The exhibition area has been almost doubled and the scope of the conference extended, The first day of the conference w i l l be devoted to practical aspects of electronic energy management w h i l e the second day, which Is co-sponsored by the leading scientific journals, C o l u l ~ t e r A i ~ D e s i g n and MkrolllHroeos|mrs a n d ~ @ l y | t o m | , w i l l feature n e w developments and techniques In the field, Entrance to the e x h i b i t i o n is free; there w i l l be a conference fee for delegates, For more details fill in the coupon at the bottom of this page, We t h i n k this w i l l be an event you cannot afford to miss, I f

you are concerned about your company's energy bills then you need to k n o w the facts about Electronic Energy Management.

[] I am interested in attending the conference [please tick)

~ I am Interested in exhibiting

Name .......................................................................................................................................................................................... Company .................................................................................................................................................................................... Address ....................................................................................................................................................................................... ~ e i , . , ,

.......

.,°

.......

. .........

..o

.................................................................

Return to EJeerwMama~er,Centoty House, TannerSt, London SEJ 3PJ contact JacquiMa~kellon 01-231 1481

maximum demand control.., tariff selection.., bttilding simulation... 140

computer-aided design