Computer Aided Geometric North-Holland
53
Design 2 (1985) 53-59
Piecewise algebraic Thomas
W. SEDERBERG
surface patches
*
368 Clyde Bullding, Brigham Young
Uniwrsliy,
Presented at Gberwohach 15 November Revised 31 December 1984
Procv, UT 84602,
(/..?A
1984
Abstract. A technique is presented for modelling with piecewise algebraic surface patches. Each surface patch is defined within a tetrahedral lattice of control points. The shape of the surface is modified by adjusting the weights of the control points. This scheme makes it possible to piece together two algebraic surface patches with any degree of cross-boundary derivative continuity. The application of piecewise algebraic surface patches to solid modelling is discussed. Keywords. Algebraic
surfaces.
solid modelling
1. Introduction There are basically two ways to define surfaces for Computer Aided Geometric Design: with parametric equations or with implicit equations. A parametrically defined surface takes the form x = x(s, t), y = y(s. t), and z = z(s, r). A surface is defined implicitly by an equation of the form f( X, y, z) = 0. If f(x, y, z) is a polynomial, the surface is called an algebraic surface. Most of the research on free form surfaces has focused on the parametric form. Consequently, very elegant techniques have evolved for modelling with piecewise parametric surface patches. Conversely, research on free form algebraic surfaces has been virtually nonexistent, although algebraic surfaces of degree two (quadrics) and tori (which are degree four) form a standard class of modelling primitives. [Sabin ‘681 is an excellent work on the subject of geometric modelling with algebraic surfaces. Only a few other isolated papers have appeared on non-quadric implicit surfaces, such as [Ricci ‘731, [Blinn ‘821 and [Barr ‘811, and in each of these cases the implicit equation is not a polynomial. This paper presents tools for modelling with free form algebraic surfaces. In general, an algebraic surface may consist of one or more sheets of infinite extent. For our purposes we will only be concerned with the part of an algebraic surface within an arbitrary tetrahedron. We will refer to such a surface region as an ufgehruic surface patch. The tetrahedron contains a regular lattice of control points. Weights assigned to the control points provide a meaningful way to control the shape of the algebraic surface patch. Further, it is shown how two algebraic surface patches can be joined together with cross-boundary derivative continuity of any degree. Algebraic surfaces have two major advantages. First, they naturally define half spaces - a property which should be useful in solid modelling. Second, free form algebraic surface patches can be of much lower degree than free form parametric surface patches. It is known that any polynomial parametric surface can be expressed in an implicit equation [Sederberg ‘84a]. For example, a general bicubic patch can be expressed in an implicit equation of degree 18, yet an algebraic surface of degree five has more scalar coefficients than a bicubic patch (56 vs. 48). While it is not clear what correlation there is between modelling flexibility and number of coefficients, our feeling is that algebraic surfaces of degree as low as three may be adequate for * This research was performed 0167-8396/85/$3.30
under a grant
from General
4 1985. Elsevier Science Publishers
Electric
Company.
B.V. (North-Holland)
T. W. Sederberg
54
/ P~ecewse algehrarc surface putches
many free form modelling applications. Fig. 3 shows various cubic algebraic surfaces. Note that the egg is completely defined by a single cubic polynomial. If such an egg were modelled as a surface of revolution using pururnetric equations, that surface would have an implicit equation of degree no less than six. The convenience of parametric surfaces comes at the expense of surface degree. Section 2 discusses how an algebraic surface patch can be defined within a tetrahedron. Section 3 discusses cross-boundary derivative continuity. Section 4 mentions the application of algebraic surface patches to solid modelling, and Section 5 mentions some useful algebraic operations which can be applied to algebraic surface patches. This paper builds on some ideas for modelling with piecewise algebraic curves which are discussed in [Sederberg ‘84b].
2. Algebraic
surface
patches
We choose to work in trivariate barycentric coordinates because they provide a local coordinate system which works nicely for defining an algebraic surface within a specified tetrahedral region. ‘4 good discussion of bivariate barycentric coordinates can be found in [Boehm et al. ‘841 and trivariate barycentric coordinates are presented in [Barnhill et al. ‘841. We will give the barycentric coordinates the symbols s. 1, U, u. These four coordinates are connected by the relation s + t + u + u = 1 - redundancy being the cost of symmetry. Consider an arbitrary tetrahedron with vertices VnooO, VOnOO, Voono, and &,0,1 where the V’s are non-coplanar points in three space. The barycentric coordinates of a point P in three space are the values s. t, u, u such that P=S~,o”o+fVonO”+UVOOnO+L)VO”O,,,
s+t+u+u=l.
(2.1)
Cartesian coordinates are actually a special case of barycentric coordinates for which the defining tetrahedron has vertices, for example, VnooO= (0. 0, 0), V0,,0r,= (1, 0. 0), VOOn,,= (0, 1. = (0, 0, 1) in which case x = t, _v= U, and z = u. General barycentric coordinates 0). and YOUOn are linearly related to Cartesian coordinates. Therefore, any algebraic surface f(x, y, z) = 0 can be expressed in barycentric coordinates as f’(s. t. U, u) = 0 by a linear change of variables. Consider the scalar function defined by the polynomial equation w’=f(s, t, U, u). We adopt the notation s = (s, t, u, u), so f(s) =f( s, t, u, u). This function assigns a unique value w =f( s) to each point s. A contour surface of the function is comprised of all points s for which f(s) is a constant. Clearly, all contours are algebraic surfaces, and any algebraic surface can be viewed as the contour of a scalar function field. We define an algebraic surface purch as the contour f(s) = 0 clipped by the tetrahedron. The tetrahedral clipping is expressed by the inequality s, f, y u>o. What remains is to define the function field u’ =f(s) in such a way that it is reasonably easy to predict where the contour surface w = 0 lies. We suggest that Bernstein-Bezier-Farin polynomials [Boehm et al. ‘841 provide such a definition. A degree n algebraic surface patch can be defined using BernsteinBCzier-Farin polynomials as follows. First, impose a lattice of such that control points q,x, on the tetrahedron K,kl=
; K:,ooo+ f VOnOO + f VoOllO + f V000n,
i, j, k, l>O;
i+j+k+I=n. (2.2)
A degree n patch requires (n + l)( n + 2)(n + 3)/6 control points. The control points case n = 3 are shown in Fig. 1. It should be noted that V,,,, is hidden in this view.
for the
T.W. Sederherg / Plecewse dgehrcrrcwrJuc,epatches
Fig. 1. Control braic surface
We next assign a weight ti~,,~, to each control
f(S.
t7!
t, u. U)’
point, s~t’uV.
and the function i+j+/2+1=n;
55
point
lattice
for cub
patch.
M‘=/(s)
is defined
.s+t+u+c?=1
l,J.k./>o
(2.3) This completes our scheme for defining an algebraic surface patch. We now discuss the properties of this scheme which facilitate the design of a free form algebraic surface patch. Our attention focuses on the scalar function r~ =f(s), and we make the following observation on how the weights r~,,~, control f(s) in a manner in which it is reasonably easy to predict the location of the contour surface f(s) = 0. Point interpolation. The value of f(s) at any of the four tetrahedral vertices is the value of the weight of that vertex. This is easily verified from equation (2.3). This means that the algebraic surface f(s) can be forced to interpolate a corner vertex by setting the weight of that vertex to zero. Note that this is not true for any control point other than the corner vertices. Fig. 3(a-d) shows various surfaces which interpolate at least one corner vertex. Line interpolation. If all the weights of all n + 1 control points along an edge are zero. the entire edge interpolates the surface f(s) = 0. This is also easily verified from equation (2.3). Fig. 3b illustrates this with a hyperbolic paraboloid which interpolates four edges of the tetrahedron. Eight of the ten control point weights in Fig. 3b are zero. Fig. 3d illustrates this behavior in a cubic algebraic surface patch.
Localized influence of control point weights. A control point weight influences the function f( s ) most directly in the vicinity of the control point. In fact, the contribution of a particular control point’s weight to the function f(s) in equation (2.3) can be shown to be maximum at the control point. Qualitatively, this means that if f( y,A,) IS negative (positive), then decreasing (increasing) the value of w,,~, will tend to push the surface f(s) = 0 away from I$,,,, whereas increasing (decreasing) the value of w,,~, will tend to attract the surface towards y,,,. This type of control is illustrated in Fig. 3c which shows a series of four cubic algebraic surface patches whose control point weights are identical except for the weight of the topmost vertex. The value of that weight is zero in the bottom right surface, and is increasingly negative in the other three surfaces. As can be seen, the effect of modifying one weight tends to be quite local, especially for corner control points.
56
T W. Sederberg / Piecewise algebraic surface parches
Fig. 2 Avoiding
self-intersections,
Gradient control. If the weight of a corner control point is zero, along with the weight of two of its three nearest neighbors, the surface will be tangent to the plane defined by the three control points whose weights are zero. This is illustrated in Fig. 3(b-d). Edge intersection. The value of the function f(s) along any of the six tetrahedral edges can be expressed as a univariate Bernstein polynomial whose coefficients are the n + 1 control point weights along the edge. This means that if all the weights are positive (or negative) then the algebraic surface patch will not intersect that edge. It also means that the surface will intersect the edge exactly once if there is exactly one sign variation in the sequence of control point weights along the edge. self-intersections. A danger of algebraic surfaces is that it is possible for the surface to intersect itself. This can be avoided within the region of the tetrahedron by imposing a monotonicity condition on the control points. Consider all lines defined by any two control points in the tetrahedron. Of that set of lines, consider all lines parallel to a given tetrahedral edge. See Fig. 2. If the weights of all control points on each of these lines increase (or decrease) monotonically in the same direction, then any line parallel to the edge will intersect the edge at most once. This can be seen by examining the directional derivative of f(s) in the direction of the edge. If the monotonicity condition is satisfied, then the directional derivative will be everywhere positive (or negative) within the tetrahedron. It should be noted that this monotonicity condition is not always desirable. One strength of algebraic surfaces is their ability to define closed volumes, sucn as the egg in Fig. 3e which is defined by a single cubic polynomial. Avoiding
This section has discussed how an algebraic surface patch can be defined within a tetrahedron, and several suggestions were made as to how the shape of such a surface patch can be controlled.
3. Cross-boundary
derivative continuity
A crucial property of this algebraic surface patch formulation is that it inherits most of the tools of Bernstein-Bezier-Farin curves and surfaces: we can subdivide the surface by subdiving the tetrahedron; we can perform degree elevation and reduction; and we can impose crossboundary derivative continuity. Derivative continuity is achieved by simply imposing derivative
T. W. Seder-her,: / Piecewrse dgehrarc surfuce porches
Fig. 3. (a) Algebraic surface patches of degrees l-4. (b) Hyperbolic paraboloid the weight of the topmost control point. (d) Sample cubic algebraic surface algebraic surface. (f) C’ cubic algebraic surface patches.
as algebraic surface patch. (c) Altering patch. (e) Egg modelled with a cubic
58
T. W. Sederberg
/ Piemwe
ulgehrurt
surf&e
purches
continuity on the S(s) function of two adjacent tetrahedrons. This procedure is discussed in [Alfeld ‘841. Fig. 3f illustrates two C’ cubic algebraic surface patches. It must be emphasized that much work remains to be done on the problem of creating an extended mesh of C’ algebraic surface patches. The paper by Alfeld is one of the first to address the problem. Thus, while it is easy to join two algebraic surface patches arbitrarily smoothly, it is not clear at present how easily this can be done for an extended mesh of patches. An approach which should be explored is to define the patch within a parallelpiped instead of within a tetrahedron. This has the disadvantage that the degree of the algebraic surface would be 3n, but the advantage that parallelpipeds are much easier to work with than tetrahedrons and that we could define our functions with trivariate tensor product B-splines. which would solve the continuity problem.
4. Solid modelling A promising application for algebraic surface patches surface equation defines the half-spaces ,f( s) < 0 and define f(s) G 0 to be ‘inside’ the volume, and f(s) > 0 form solid primitive is obtained by clipping this volume bounded solid f(s,t.
u,u)
s, t, u,1120;
is in modelling solids, since the implicit ,f(s) 2 0. For discussion. we arbitrarily to be ‘outside’ the volume. A useful free against the tetrahedron. This yields the
s+t+u+u=l.
The color images in Fig. 3 are rendered as solids. These primitives constructive solid geometry modelling scheme.
(4.1) should
fit naturally
into a
5. Algebraic operations It is possible to perform certain useful algebraic operations on algebraic surface patches, as long as the degree of the patch is not too high. One such operation is to take the resultant of two surface patches in order to facilitate computing the curve of intersection. The resultant of two algebraic surfaces with respect to Z, for example, is an equation f(x, y) = 0 which is a projection of the curve of intersection of the two surfaces. Another useful algebraic operation is to compute the discriminant. The discriminant of the surface is the equation of the silhouette curve, which is very useful in rendering the surface. The images in Fig. 3 were rendered using an algorithm which computes the silhouette curve. These images were all computed in 1-3 minutes on a VAX 11/750, which compares very favorably with algorithms for rendering parametric surfaces. Algebraic surface patches could be ray traced very efficiently, since the ray intersection equation is a univariate polynomial whose degree is the degree of the surface.
6. Conclusion A scheme was described for defining algebraic surface patches. The two primary values of algebraic surface patches is that their degree is much lower than the degree of typical free form parametric surface patches, and they define a half space which should be quite useful for modelling solids.
Acknowledgements Scott Parry provided
valuable
assistance
in writing
the rendering
algorithm.
T. W. Sederberg / Plecewse ulgehrcrrc &me
parches
59
References Alfeld. P. (1984) A trivariate Clough-Tocher scheme for tetrahedral data. MRC Technical Summary Report #2702. Mathematics Research Center. University of Wisconsin-Madison. Barnhill. R.E. and Little, F.F. (1984). Three- and four-dimensional surfaces, Rocky Mountain J. Math. 14, 777102. Barr. A. (1981) Superquadrics and angle-preserving transformations, IEEE Computer Graphics Appl. I. 11-23. Blinn, J. (1982). A generalization of algebraic surface drawing, ACM Trans. Graphics 1, 2355256. Bohm, W.. Farin. G. and Kahmann, J. (1984). A survey of curve and surface methods in CAGD, Computer Aided Geometric Design. 1, l-60. Ricci. A. (1973) A constructive geometry for computer graphics, Computer J. 16, 157-160. Sabin, M.A. (1968), The use of potential surfaces for numerical geometry, B.A.C. Weybridge, VTO/MS/153. Sederberg. T.W., Anderson. D.C.. and Goldman. R.N. (1984a), Implicit representation of parametric curves and surfaces. Computer Vision, Graphics. and Image Processing 28, 72-84. Sederberg, T.W. (1984b), Planar piecewise algebraic curves, to appear in Computer Aided Geometric Design.