fast curve and surface generation for interactive shape design

7
105 Fast Curve and Surface Generation for Interactive Shape Design Wolfgang Strasser Fachbereich Informatik, Fachgebiet Graphisch-lnteraktive Sys- teme, Technische Hochsehule Darmstadt, Steubenplatz 12, D-6I O0 Darmstadt, F.R. Germany Interactive curve and surface design using interactive graph- ics systems is very attractive. However the designer's expecta- tions can be satisfied only if easily understood definition meth- ods are available and if the system responds without recogniz- able delay. These requirements can be met by careful selection of curve and surface definition methods. A subclass of B-spline is found to fulfill all requirements and can easily be imple- mented in fast special purpose hardware for surface generation and curve interpolation. Keywords: B-splines, curve and surface generators, interpola- tion and approximation, interactive curve design. Wolfgang Strasser received the Dipl.- Ing. degree in electrical engineering in 1969 from Technische Universit~it Berlin. He joined in the same year Nixdorf Computer GmbH where he was engaged in the development of new computer hardware. In 1971 he returned to the Technische Universifftt Berlin to work on graphics hardware. He received the Dr.-Ing. degree with a thesis on "Fast curve and surface gen- eration for computer display" in 1974. The year before he left the University and started work on interactive CATV-systems at Heinrich- Hertz-Institut Berlin. 1974 he was appointed head of the de- partment for information processing at this institute. Since 1978 he is Professor of computer science with the research group "Graphisch-interaktive Systeme" (computer graphics and interactive systems) at Technische Hochschule Darmstadt. North-Holland Publishing Company Computers in Industry 3 (1982) 105-11 ! 1. Introduction Graphics systems have become an important and promising tool for the computer aided design of three dimensional shapes. Potentially the com- puter can free the designer from the limitations of the drawing board and speed up the design pro- cess. However the successful use of this tool de- pends in a high degree on the existence of ade- quate mathematical principles for curve and surface representation, that can be handled in a simple manner without detailed mathematical knowledge. The development in this field has been initiated by Coons [1] in the early sixties and led to a new mathematical technique called computa- tional geometry [2]. This technique meets the re- quirements of computing, is adapted to the prob- lems of shape and easy to use in most cases. Beyond these mathematical properties, an acceptable computerized replacement of the draw- ing board has to respond to the designers actions in real-time. As the designer changes his input information, e.g. by moving the lightpen or the stylus on the graphics tablet, the resulting curve or surface should appear on the display without recognizable delay. This requirement can be met only by a careful selection of the methods for curve and surface description with respect to fast computation and suitability for hardware imple- mentation. A research project for the development of a universal user and application adaptable worksta- tion, incorporating these ideas, has been initiated by W. Giloi and J. Encarnacao at Technische Universit/it Berlin and Heinrich-Hertz-Institut Berlin in the early seventies. Some results of this work are described here. These efforts are con- tinued by the author and J. Encarnacao at Tech- nische Hochschule Darmstadt. In the subsequent sections, the available surface representation methods are briefly discussed and the choice of a particular technique explained. Algorithms for iterative curve fitting are given and the hardware realisation of a curve and surface generator is described. 0166-3615/82/0000-0000/$02.75 © 1982 North-Holland

Upload: wolfgang-strasser

Post on 21-Jun-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

105

Fast Curve and Surface Generation for Interactive Shape Design Wolfgang Strasser Fachbereich Informatik, Fachgebiet Graphisch-lnteraktive Sys- teme, Technische Hochsehule Darmstadt, Steubenplatz 12, D-6I O0 Darmstadt, F.R. Germany

Interactive curve and surface design using interactive graph- ics systems is very attractive. However the designer's expecta- tions can be satisfied only if easily understood definition meth- ods are available and if the system responds without recogniz- able delay. These requirements can be met by careful selection of curve and surface definition methods. A subclass of B-spline is found to fulfill all requirements and can easily be imple- mented in fast special purpose hardware for surface generation and curve interpolation.

Keywords: B-splines, curve and surface generators, interpola- tion and approximation, interactive curve design.

Wolfgang Strasser received the Dipl.- Ing. degree in electrical engineering in 1969 from Technische Universit~it Berlin. He joined in the same year Nixdorf Computer GmbH where he was engaged in the development of new computer hardware. In 1971 he returned to the Technische Universifftt Berlin to work on graphics hardware. He received the Dr.-Ing. degree with a thesis on "Fast curve and surface gen- eration for computer display" in 1974. The year before he left the University

and started work on interactive CATV-systems at Heinrich- Hertz-Institut Berlin. 1974 he was appointed head of the de- partment for information processing at this institute. Since 1978 he is Professor of computer science with the research group "Graphisch-interaktive Systeme" (computer graphics and interactive systems) at Technische Hochschule Darmstadt.

North-Holland Publishing Company Computers in Industry 3 (1982) 105-11 !

1. Introduction

Graphics systems have become an important and promising tool for the computer aided design of three dimensional shapes. Potentially the com- puter can free the designer from the limitations of the drawing board and speed up the design pro- cess. However the successful use of this tool de- pends in a high degree on the existence of ade- quate mathematical principles for curve and surface representation, that can be handled in a simple manner without detailed mathematical knowledge. The development in this field has been initiated by Coons [1] in the early sixties and led to a new mathematical technique called computa- tional geometry [2]. This technique meets the re- quirements of computing, is adapted to the prob- lems of shape and easy to use in most cases.

Beyond these mathematical properties, an acceptable computerized replacement of the draw- ing board has to respond to the designers actions in real-time. As the designer changes his input information, e.g. by moving the lightpen or the stylus on the graphics tablet, the resulting curve or surface should appear on the display without recognizable delay. This requirement can be met only by a careful selection of the methods for curve and surface description with respect to fast computation and suitability for hardware imple- mentation.

A research project for the development of a universal user and application adaptable worksta- tion, incorporating these ideas, has been initiated by W. Giloi and J. Encarnacao at Technische Universit/it Berlin and Heinrich-Hertz-Institut Berlin in the early seventies. Some results of this work are described here. These efforts are con- tinued by the author and J. Encarnacao at Tech- nische Hochschule Darmstadt.

In the subsequent sections, the available surface representation methods are briefly discussed and the choice of a particular technique explained. Algorithms for iterative curve fitting are given and the hardware realisation of a curve and surface generator is described.

0166-3615/82/0000-0000/$02.75 © 1982 North-Holland

106 W. Strasser / Fast Curve and Surface Generation ( omputers in lndust O,

2. Parametric or vector.valued representation

A surface may be described by one of the following methods: Implicit

F(x ,y , z ) = 0 (1)

Explicit

z = f (x , y ) (2)

Parametric or vector-valued method

x= x(u,v) ,

y = y ( u , v ) , (3)

z----z(u,v),

where (u, v) are independent variables or parame- ters.

In computer graphics the vector-valued method is usually preferred. Its advantages over the other methods are outlined below: • The shape of an object is independent of the

coordinate system and hence its mathematical representation should be axis-independent. The parametric method satisfies this by definition.

• Vector-valued methods present no difficulties in case that multiple-valued functions occur. The coordinates of a surface point are computed independently as functions of the parameters (u,v). Each pair (ui,vj) defines exactly one point. Fig. 1 shows for example the graph of a multiple-valued function which is the cross plot of two single-valued functions x(u) and y(u). If non-parametric methods are used, eq. (1) or eq. (2) has to be solved for x and y. This may result in considerable computational effort even for second degree surfaces, whilst the parametric method yields these quantities immediately.

• The user can define a section of a surface

Yt~)

u

Fig. 1. Two parametric functions x(u) and y(u) and the cross-

plot y vs. x [31.

simply by chosing a range for u and v (Umi n ~<a ~< u ~< b < u . . . . Umin < c ~ v ~ d < v .... ).

A profound discussion on these problems is given by Forrest [4].

Unless the exact shape of a surface can be specified analytically as for example with spheres, cylinders, etc. a constructive approach has to be taken. That means, the surface being a bivariate function of the parameters u and v has to be built up from simpler data, i.e. from points and tangent vectors (constants) or curves (functions of one variable). In principle there exist three basic ways in which surfaces can be defined from such data

[21. If vector P(u,v)=[X(u,v) , Y(u,v), Z(u,v)]

denotes known design data and vector Q(u,v) denotes the resulting surface computed from these data, then the cartesian product surface is defined by

r n n

O(u,v )= ~, ~, P ( u , , v i ) . U , . , , ( u ) . < . , ( v ) . (4) i - 0 j = 0

The discrete data P(u~,t~s ), which are points or tangent vectors, are interpolated by means of the weighting functions or interpolants U,,m(u), ~ , , (v) . The shape of the surface depends both on the given zero-variate data P(u i, v~) and on the choice of interpolants. Lofting utilizes one family of parametric curves for surface definition:

O(u,v) = ~ P(u, ,v) . G;,m(u) i=0

o r

1l

Q(u,v)= • P(u,v,) . v/,,,(v). (5) j=O

As this method uses more information to define the surface - univariate data instead of zero-variate data - it offers to the designer more freedom of control over surface shape. This advantage is bought at the expense of increased computational complexity compared to the cartesian product def- inition. Interpolation through two families of para- metric curves is called transfinite or extended Coons approximation and defined by eq. (6).

Q(u,v) = ~ P(u, ,v) . U~.,,(u) i = 0

+ P(u,v+). j = 0

Computers in Industry IV.. Strasser / Fast Curve and Surface Generation 107

3. B-Spline Approximation

i l d e f i n i t i o n

l

p / @ T ~ n s fir, ire definition

Cartesian product definition

Fig. 2. Hierarchy of surface definition [2].

i~0 ./=0

(6)

This generalized Coons patch gives even more control over surface shape compared to "lofting" or "cartesian product surface", but at the expense of substantially increased computational effort.

The available hierarchy of surface definition based on the amount of used input data is de- picted in fig. 2 [2].

The goal of this work was real-time response to user actions as well as simplicity of mathematical representation. Further considerations were there- fore restricted to the cartesian product definition for the following reasons. The basic data of this method are points which can be input and speci- fied by the user more easily than curves. In addi- tion the cartesian surface requires the least amount of computation. This is important considering re- sponse time and hardware realisation. Of course, "lofting" and "transfinite" surface representations offer more control over the resulting shape and more accurate approximation. But considering the resolution of the display screen and the lack of acceptable three-dimensional input devices, these arguments are irrelevant.

After the decision to use cartesion product defi- nition in parametric representation, appropriate interpolants U,.m(u), Vj.,(v) have to be chosen with attention to the designers needs and algorith- mic simplicity for hardware realisation. First of all, the designer wishes to control the objects shape by simply positioning vertices. Slopes, derivative continuity of higher orders, interpolation, cusps and other properties of shape should be com- pletely controllable by the position of vertices. Additionally the approximation should reflect the overall shape of the polygon defined by the vertices and exhibit no more interflection points than the defining polygon. A further important property is the local influence of vertices on the curve's shape. By moving one vertex, only a limited part of the curve should be affected and that in a predictable manner. From the hardware point of view, it is necessary that all these requirements can be met by a single family of interpolants implementable by a single and fast algorithm. Classical interpola- tion methods like those of Lagrange and Hermite are not satisfactory in this context. If for example the number of vertices is increased, Lagrangian curves tend to ripple due to the behaviour of higher order polynomials. Hermite interpolation allows to control the end conditions of a curve by specifying in addition to vertices tangent vectors and higher order derivatives. By this feature curve segments can be joined with the desired degree of continuity. Cubic splines are a special case of the Hermite interpolation where all curve segments are joined with second derivative continuity automati- cally. Thus the designer has to specify only the boundary conditions of the composed curve. Un- fortunately the effect of tangent vectors, i.e. first derivatives of the parameter, on shape is very difficult to predict. B6zier's method satisfies most of the above mentioned requirements of the desig- ner. It uses Bernstein polynomials, which are by the way identical to the binomial probability den- sity functions, as interpolants to weight the vertices. Defining polygon and resulting curve are related in a very understandable way, so that a desired shape can b e approximated interactively by mov- ing the vertices. Concerning the implementation, B6zier's method has the serious disadvantage that the degree of the polynomials increases propor- tionally to the number of polygon vertices used.

108 W. Strasser / Fast Curve and Surface Generation

The evaluation of the discussed methods suggests the search for an approximation that combines the advantages of cubic splines (piecewise polynomial definition, C 2 continuity at segment joints) with those of Btzier's method (simple shape definition, no need to directly specify tangent vectors) and beyond that incorporates local control. For de- tailed discussion refer to [5,6].

B-splines have been found to meet all the re- quirements [5]. Their properties are well docu- mented with respect to CAD and Graphic applica- tions in [3,5-8]. For reference purposes and fur- ther selection regarding simplicity for the designer and fast hardware implementation, some of their characteristics are reviewed and the necessary defi- nitions are introduced:

The B-spline N/,~(t) of order k is a piecewise continuous polynomial of degree (k - 1), continu- ously differentiable (k - 2) times at the knots ti E to <~ tl <~ .. .ti ~ t i+ 1 ... <~ t,. T = ( to , t l , . . . , t , ) is the knot vector. For simplicity the knots are assumed to be integers; the resulting B-splines are called uniform B-splines. N/,k(t ) can be defined in the interval t i ~ t ~ t i + k by means of the recursion scheme of Cox and de Boor [9]:

For k = 1:

N~,(t) = { ~ , otherwise f ° r t i < t ~ t i + k

and for k > 1:

l - t , • N , , , _ , ( t ) Ni ,k ( t ) ~ l i + k _ t - I i

+ t i+k- - t "N/+t,k_l(t ). (7) t i+k -- ti+ 1

Fig. 3 shows the basis splines N~,k(t ) for i = 0 and of the order k from 1 through 4. These functions vanish outside the interval [ti, ti+~]. Each basis function has only k spans with ( k - 1 ) interior knots, denoted by the dots in Fig. 3. This property is essential for obtaining local curve and surface approximation and modification methods.

Most applications that rely on interactive shape design can be satisfied using uniform B-splines without multiple knots of - at most - cubic degree (k = 4). It can be seen from Fig. 3 that with these constraints only seven different polynomials (the non-zero spans for k = 3 and k = 4) are used as weighting functions for all approximation or inter- polation tasks; the polynomials for i ~ 0 can be

Computers in lndustry

o i t 0 1 2 ~ ~s

k = 2 ~ k 4 - , =

~ o I ~ T fO ~ 2 a i

Fig. 3. B-Spl ine bas is f u n c t i o n s N,,k(t ) fo r i = 0 a n d k = 1 . . . . . 4.

computed by simple shift of indices and parameter values (see Fig. 4): N,,k(t ) = No, k(t -- i). Using eq. (4), a B-spline surface is then defined by

i = 0 j = 0

and the B-spline curve by

Q ( u ) = ~ Si-Ni,k(u), (9) i = 0

S~4 denote the vertices of the polygon. Because of the local support of the B-splines the surface is composed of (m - k + 2). (n - l + 2) patches each defined by k . l vertices and the curve is composed of (m - k + 2) segments, each defined by k vertices, respectively. Reparametrising each span of the ba- sis polynomials, so that t ~ [0, 1] for that particular span allows simple matrix notation for polynomi- als, curve segments and patches:

k = 3 :

U 3 = [ ½ ( 1 - - u ) Z , ( - - u 2 + u + ½ ) , ½ u 2] (10)

k = 4 :

g 4=1[(1 - u) 3, (3u 3 - 6u 2+ 4),

( - 3 u 3 + 3u 2 + 3 u + 1), u3],

2 O- 5

Fig . 4. F a m i l y o f u n i f o r m B-spl ines N,.4 ( t ) .

Computers in Industry W. Strasser / Fast Curve and Surface Generation 109

$3 K=2 $2

I K= 4

S~ S1

$5

K=2

$2

S1 $4

"~9 $7 $3

S~

Fig. 5. Examples of open and closed B-Spline curves.

From eq. (9):

Q,( u ) = Uk " S,

and from eq. (8):

Qi. j (u , v ) = U k • Sij" Vj v. (11)

Fig. 5 shows open and closed polygons and B-spline curves of order k = 2 through 4. The close re-

Fig. 6. Object defined by B-Spline patches of order 3.3.

lationship between polygon and curve is obvious. In general, the vertices are not points of the curve or surface. Slope discontinuity and vertex interpo- lation is obtained by specifying multiple vertices. Fig. 6 gives an example of an object defined by B-spline patches.

4. B-Spline interpolation

In many design situations, curve or surfaces are already existent, e.g. in form of a physical model or a drawing. To be able to work with this shape on the display system, it's B-spline representation with defining polygon is needed. This inversion problem can be solved when the relation between vertices, knots and nodes is known. The node Pi is that point on the curve Q(si), where vertex Si has the maximum influence on the curve. It can be seen from Fig. 3 and 5, that in case of k = 4 the nodes are knots, i.e. the joins of curve segments. Using this fact a very fast interactive interpolation procedure can be developed. As a first guess, the designer chooses some reasonable knots P, (nearly constant arc length between knots) on the curve. To obtain the vertices S~, the following system of simultaneous linear equations has to be solved for all curve segments. From eq. (9) with k = 4 and U ~ 0 :

P,= Q~(O) = { S , _ , + } S i + ~ S g + ,

( i = 1,2 . . . . . m - 1) (12)

The case i = 0 and i = m must be treated sep-

110 W. Strasser / Fast Curve and Surface Generation

arately to define boundary conditions (e.g. open or closed). Writing eq. (12) in matrix notation shows that inversion can be performed very efficiently because of the particular structure of the coeffi- cient matrix:

1 2 I

..-- 1 2 I 2 3 6

,] (13)

Very fast computation of the vertices S i can be performed, when the first guess of the node Pi is used as starting points for an iterative solution of eq. (13). Solving eq. (12) for S,, the following iteration can be performed

SiS : 3p~ _ ~ (S{+-jl + S/_ 11). (14)

For j = 1, i.e. the first iteration, Si+ 1 = P,+ 1 and Si-J = P~-1. This scheme shows good convergence and allows real-time computation of vertices by hardware. Provided that a fast curve generator is available, the designer can move knots e.g. with the lightpen and improve the curve fitting interac- tively.

5. Hardware curve and surface generation

Curves and surfaces are defined by eq. (11). As the number of used polynomials is very small their values for appropriate intervals of the parameters can be precomputed and stored. In a first ap- proach the (4 × 4) matrix multiplier built for coor- dinate transformations was used to solve eq. (11). Though this surface generation is very fast, it has the disadvantage to occupy the transformation hardware in the picture generation pipeline. There- fore an iterative scheme has been adopted, that allows the computation of many more surface points in real-time. Surfaces can be displayed flickerfree by a very dense grid of parametric curves. Intensity modulation by the Z-coordinate creates the impression of depth (Fig. 7).

The iterative hardware implements Newton's difference scheme which allows exact computation of polynomials without multiplication. Errors can occur only by bad starting conditions.

Let 8 = 1 /N be a constant interval, where N + 1 is the number of points to be computed for one curve segment. Then for k -- 4 (third degree poly-

Computers in lndustr;

Fig. 7. Surface patches generated by a dense grid of mesh lines. Intensity is modulated by Z-coordinate.

nomial) the following iterative scheme can be used ( Q ~ 1 :: Q ( u + 6)): Q , , ~ , = - Q , , + A Q , , ,

A Q , + i -- A Q , + A2Q, ,

AZQ, + J :- A2Q, + A3Q,,

A3Q, ~ ~ --- A3Q, = const. (15)

Given the starting conditions Qo, AQo, A2Q0, and A3Qo, the polynomials are completely defined. Note that all additions can be performed simulta- neously. Depending on the word length, a new point can be computed within 30 ns. The hardware consists of 2-complement adders and registers (Fig. 8).

Starting conditions depend on polynomials and vertices used. By rewriting the B-splines of eq, (10) to

W~-- [u 3 u2 u 1] . [A(4×4) ]

Computers in Industry W. Strasser / Fast Curve and Surface Generation 111

I I Regiafer

® 2'S complement a da~er/sot tJt~

Fig. 8. Hardware to compute third degree polynomials.

the starting conditions can be computed from

Qo 0001]

AQo = lll0/. A2Q0 6200 / A3Qo 6 0 0 0 J

8 3 0 0

0 6 2 0 0 0 8 0 0 0

0

0 .A .S, 0 1

C

(16) where S represents the vertices. Assuming constant 8 and k = 4, C can be precomputed and stored in a ROM. So by definition of vertices, new starting conditions can be supplied very fast.

Reconsidering the iterative computation of vertices from given curve data, it becomes evident, that the above curve generator can be used with slight modification to evaluate eq. (14). Refor- mulating this equation to eliminate the factor 3 gives

S/= P, + ½( P~-½( S,&-~' + S/_-~')) (17)

Thus, only two complement addition and shift is needed! As inexpensive hardware is available, a special scheme to evaluate the vertices from eq. (17) can be included in the tablet hardware. The

designer can then on demand be freed from the task of initial choice of the knots. The tablet hardware can compute these points from the dig- itized curve data. The designer can now move knots or vertices depending on the particular ap- plication. This interactive curve fitting is very fast and appealing with respect to user interface [10].

Acknowledgement

The author is grateful to his colleague J. En- carnacao for fruitful discussions and encourage- ment to write this paper.

References

[1] S.A. Coons, Surfaces for computer-aided design of space figures, M.I.T. ESL 9442-M-139, 1964

[2] A.R. Forrest, Mathematical principles for curve and surface representation, Proc. Curved Surfaces in engineer- ing, IPC Science and Technology Press Ltd., 1972

[3] W.J. Gordon, F.R. Riesenfeld, Bernstein-B~zier methods for the computer aided design of freeform curves and surfaces, GMR-1176, 1972

[4] A.R. Forrest, curves and surfaces for CAD, Dissertation University of Cambridge, 1968

[5] W. Strasser, Schnelle Kurven- and Fl~ichendarstellung auf grafischen Sichtgeriiten, Dissertation, TU Berlin, 1974

[6] W.J. Gordon, R.F. Riesenfeld, B-Spline Curves and Surfaces in: R.E. Barnhill and R.F. Riesenfeld, eds., Com- puter Aided Geometric Design (Academic Press, 1974)

[7] W. Giloi, Interactive Computer Graphics, Prentice Hall, Englewood Cliffs, 1978

[8] E. Cohen, T. Lyche and R. Riesenfeld, Discrete B-Splines and Subdivision Techniques in CAD and Computer Graphics, Computer Graphics and Image Processing 14, 87-111 (1980)

[9] C. de Boor, On calculating with B-Splines, Journal of Approximation Theory, Vol. 6, No. 1, July 1972

[10] W. Strasser, Fast Digital Hardware for Graphics Displays Proc. Simulation 75, Ziirich, 1975