Curvature and the fairness of curves and surfaces

8 downloads 67460 Views 760KB Size Report
If we present a plot of a curve to a car body designer and ask for comments .... the automotive field. Another ... Of course, one projection of the curve may have an.
Fairing Curves Curvature and the Fairness of Curves and Surfaces Gerald Farin Arizona State University Nickolas Sapidis University of Rochester

interactive techniques are often praised as the optimal tool to achieve aesthetic shapes. Yet the interactive “tweaking of control polygons” cannot produce shapes of production quality. We discuss the use of curvature plots for the design of curves that have to meet aesthetic requirements. We also discuss a local method to fair cubic B-spline curves and surfaces.

T

1 he curves and surfaces encountered in technical design can usually be classified as having to be more aesthetic (for example, car bodies) or more functional (airplane fuselages). In this article, we concentrate on the first kind, although both requirements for curves often go hand in hand. Our aim is to emphasize the usefulness of curvature as a measure for curve fairness. While the inspection of curvature is merely a passive interrogation 52

tool, we propose to use a method that automatically locates points on the curve where it has shape imperfections and removes those imperfections. The goal of automatic shape control will never be accomplished completely, but in view of steadily increasing automation in the design process, coming at least close to the goal seems mandatory. If we present a plot of a curve to a car body designer and ask for comments about its shape, we are likely to encounter terms like “too round here, too flat there, corner here, and wiggle there.” For a CAD system to deal with them, such shape terms must be translated into mathematical terms. The appropriate tool is the concept of curvature, which is intrinsically related to the fairness (or sweetness or beauty) of a curve. For a given curve, we can plot curvature versus arc length and thus obtain the curvature plot of the curve. The curvature plot can be used for the definition of fair curves:

0272~1716/89/0300-005'2$01.00 1989IEEE

IEEE Computer

Graphics

& Applications

A curve is fair if its curvature plot consists of relatively few monotone pieces. The above definition of fairness (also suggested by Dill’ and Birkhoff’ in a similar form] is certainly subjective; however, it has proved to be a practical concept. Once a designer has experienced that “flat spots” on the curve correspond to “almost zero” curvature values and that points of inflection correspond to crossings of the zero curvature line, he or she will use curvature plots as an everyday tool. (This was the observation of the first author of this article when he worked in CAD/CAM development at Mercedes-Benz.) We should also point out, however, that a curve whose shape is optimized according to any mathematical translation of “fairness” will not necessarily please everyone. In the words of I? Bezier, “From an industrial viewpoint, a curve or a surface is nice if and only if it looks nice to the chairman of the board, the sales manager, the head stylist, and the prospective customer.”

In that sense, automated fairing methods can be viewed only as helping to obtain a fast approximation to an optimum. No computer system should attempt to proaesthetic” objects. The finishing duce “optimally touches, if deemed necessary, must always be left to the human designer.

Curvature plots The curvature plot of a parametric curve is a display of the function x(s), where x is the curvature at the arc length value s (see sidebar). The roughness of this plot can be described in terms of the derivative of K(S): The plot is rough where x(s) is slope-discontinuous, Spline curves are typically obtained in two ways: as a curve that interpolates to given data points or as the result of interactive manipulation of a B-spline polygon. In both cases, it is hard to tell from the display on the screen if the shape of the curve is acceptable or not. Two curves may look identical on the screen, yet they may

Curvature “(t) = Let x = x(t) be a point on a space curve. Consider points xI and x,that are right and left neighbors of x, as shown in the figure. The three points x1, x, x,determine a circle provided they are not collinear. If we let x1 and x, approach x, we generate a sequence of circles that approaches a limit circle (provided the curve is sufficiently smooth). This circle is called the osculating circ/e at x. It can be viewed as the circle that best approximates the curve at the point x. The osculating circle lies in a plane; it is called the “osculating plane.” If the osculating circle has a small radius, the curve bends sharply at x; if it has a large radius, the curve is flat at x. Since the osculating circle is a good local approximation to the curve, it seems reasonable to express the “roundness” of the curve in terms of the radius of the osculating circle. This number, the curvature x of the curve at x(t), is defined as the reciprocal of the radius of curvature. It can easily be computed from

K(t) = Ilk(t) x 3Ul Il~(t)l13 ’

1989

(2)

A fundamental result from differential geometry reveals the connection between curvature and the shape of a curve: If we know the curvature of a planar curve at every point, then the curve is completely determined (except for rotations or translations). More details on curvature and related topics in differential geometry can be found in M. do Carmo, Differential Geometry of Curves and Surfaces, PrenticeHall, Englewood Cliffs, N.J., 1976; and G. Farin, Curve and Surface Design, Academic Press, New York, 1988.

(1)

Here we use the abbreviations i=dxldt and K = d’x/dP. For a planar curve (x(i),y(t)), we can also assign a sign to its curvature: We simply define the sign of curvature to equal the sign of thez component of j, xR. This convention is very useful-with it, we can distinguish between convex (positive curvature) and concave (negative curvature) regions of a curve. The signed curvature is given by

March

qt)$(t) - j;(t);(t) K;(t)Y + Mt))213’2~

The osculating circle at a point on a curve is the limit circle through three points that are approaching one position. The irwerse of its radius is called the curvature of the curve at that position.

53

reveal significant shape differences when plotted to full scale on a large flatbed plotter. Such plots are both expensive and time consuming-a tool to analyze curve shape at the CAD terminal is needed. Again, that tool is the curvature plot of a curve. (Figures 2 and 3 below show two curves and their respective curvature plots.) We emphasize here that this tool is also necessary in the ab initio design of B-spline curves. It is commonly believed that “tweaking the control polygon” interactively at the terminal will produce acceptable curves after a few iterations. However, a mouse or even a light pen is a tool far too crude for moving control points to generate curves of production quality. We might hope that a quality control tool could be inspection of the control polygon: The polygon does exaggerate the behavior of the curve itself. However, extracting information about fairness from a discrete polygon is not easy. This observation, again, comes from the first author’s experience in the automotive field. Another example is the famous “Utah teapot”: That teapot underwent a curvature analysis before final release!3 This section concludes with some remarks on the use of curvature plots. We do not recommend plotting the curvature as defined by Equation 1 in the sidebar, but rather as defined by the current planar projection, that is, the curvature of the curve as it appears on the screen. Thus Equation 2 should be used instead. The reason is that it is very easy to point to changes in the sign of curvature, which indicate inflection points. Those sign changes can be marked by special symbols on the plot. Of course, one projection of the curve may have an acceptable curvature plot while another does not. Then the curve should be changed in the “bad” projection only. The curvature plot should include the range of displayed curvatures; this helps in deciding if wiggles in the plot are perhaps due just to scaling problems. Displaying the maximal and minimal radii of curvature instead of the corresponding curvatures may be helpful-after all, a radius of curvature is geometrically more intuitive than its inverse. Some researchers prefer to plot curvature directly on the curve: The curvature plot is then an offset curve to the original curve, with the offset distance proportional to the curvature value.4 The response of designers (as noted by the first author of this article) indicates that the “standard” plots as used here give more precise information about the behavior of the curve.

Smoothing Digitizing errors cause a typical problem in the design process: Data points have been obtained from some digitizing device (a tablet being the simplest), and a fair curve is desired through the points. In many cases, however, the digitized data are inaccurate, and this presence 54

of digitizing error often manifests itself in a “rough” curvature plot of the interpolating spline. For a given curvature plot, we can now search for the largest slope discontinuity of K(s) (s being arc length) and try to “fair” the curve there. Let this largest slope discontinuity occur at t = t,. The data point x(t,) is potentially in error, so why not move x(t,) to a more favorable position? Intuitively, such a more favorable position should be such that the curvature of the spline curve through the new data point no longer exhibits a slope discontinuity. We now make the following observation: If a spline curve is three (instead of just two) times differentiable at a point x(tJ, then certainly its curvature is differentiable at ti; i.e., it does not have a slope discontinuity there (assuming that the tangent vector does not vanish at ti). Also, the two cubic segments corresponding to the intervals (t,mI,t,) and (t$,+J are now part of one cubic segment: The knot t, is only a pseudoknot, which could be removed from the knot sequence without changing the curve. Back to our curve-fairing problem: We will try to remove the offending knot t, from the knot sequence, thereby, we hope, fairing the curve, and then reinsert the knot to keep a spline curve of the same structure as the initial one. The process of knot insertion is well understood.5-7 The inverse process, knot removal, has no unique solution. Several possibilities have been discussed.‘-” We present here a simple yet effective solution to the knot-removal problem. Let us denote the B-spline vertices of a C2 cubic spline curve by di; let the offending knot ti be associated with vertex di. We now formulate our knot-removal problem as follows: To what position do we have to move di so that the resulting new curve becomes three times differentiable at ti? After some calculation (equating the left and the right third derivatives of the new spline curve), we verify that the new vertex di is given by d, = (tj+Z

-

tj)lj

+

(tj

-

tj--2

-

tj-*)l‘j

I

, t J+Z

where the auxiliary

points li,r, are given by

1, = (t,+l - tj-s)d,

-I - (tj+l t,

- tj)dj-2

-tj-3

and r, = ctI+3 - tj-lldj+l

- (tj - tj-1 )dj+2

fj+3 - tj

The geometry behind these equations is illustrated in Figure 1. A more general knot-removal theory can be found in the literature.* The faired curve now differs from the old curve between x(ti_*) and x($+J-thus this fairing procedure is local. Figures 2 through 5 illustrate applications of this algorithm. Some comments about this curve-fairing procedure follow. IEEE Computer

Graphics

& Applications

tj

tj+l

t,t3

Figure 1. The knot-removal algorithm: The old vertex dj is replaced by di SO that the spline curve is now three times differentiable at tj.

Figure 3. The curve from Figure 2 was faired by applying the curve-fairing algorithm twice. It is shown in (a): its curvature plot is shown in (b). Note that the curvature plot improved dramatically, yet the two curves still look identical. The changes resulted in a relative deviation of the curves of less than 0.02 percent.

a

a

b Figure 2. A B-spline curve with its polygon (a) and its curvature plot (b). The curve and its polygon are not distinguishable at the resolution of the figure. This is also a typical situation at a terminal.

b ‘igure 4. A second example of a cubic B-spline curve: a curve and polygon, (b) initial curvature plot. Note the “flat spot” at the marked point.

(“1

Of all possible knot-removal procedures, this is the most local: Only one control point, namely dj, is changed. Other methods-for example, Kjellander’s method4-change the whole curve to fair at t,. A slightly more complicated, yet local and convexity-enforcing method has been developed.” In practice, the “improved” vertex dj may be farther away from the original vertex dj than a prescribed tolerante allows. In that case, we restrict a “realistic” ai to be March 1989

in the direction toward the “optimal” ai, but within tolerance to the old dj. Note that we left it to our algorithm to decide where to fair the curve. This approach has two advantages: The fairing process can be automated by the implementation 55

L a

b Figure 5. Curve (a) and curvature plot(b) after fairing at the (automatically detected) imperfection. In this case, the deviation of the new curve from the old one is clearly visible.

of a stopping criterion described below, and the automatic knot selection usually results in smoother curves than are obtained by selecting knots manually. While the above algorithm produces a curve that is obviously fairer than the original curve at the “offending” knot tj, it is not so clear that the “global fairness” will be improved. The global fairness can be measured by the sum t of all (absolute) slope discontinuities of the curvature. It is our experience that E always decreases, although there are cases where we have to apply the algorithm repeatedly to achieve this. Therefore, a totally automated version of this algorithm should be run two or three times before invoking the stopping criterion. Typically, Z will decrease monotonically for a number of iterations of the algorithm and then decrease in a nonmonotonic way. In our experience, detection of this phenomenon served as a useful stopping criterion.

Extension to surfaces The above algorithm can be generalized by the familiar tensor product method (a technical remark: this is possible because that algorithm can be interpreted as a linear curve operator). The tensor product method has been discussed in detail.7.” 56

Figure 6. (a) A bicubic spline surface with a family of reflection lines (bold). Note the wiggles in the reflection lines, corresponding to imperfections in the surface shape. (b) The surface after application of the surface smoothing algorithm. The reflection lines look (almost) fair themselves now, indicating a satisfactory surface shape. The changes resulted in a relative deviation of the surfaces of less than 0.02 percent.

Applying it to our case, we get the following algorithm to fair a tensor product B-spline surface: Let {d,,,} be the control net of that surface with knot sequences { uI} and {vi}. Fair the surface by first interpreting all rows of the control net as B-spline control polygons and then applying the curve-fairing algorithm to each of them. In the second step, interpret all columns of the resulting control net as B-spline polygons and apply the curve-fairing algorithm to each of them. The final control net will correspond to a surface that is fairer than the original one, as explained below. We are not attempting here to define the concept of fairness for surfaces-this is still an open question.‘.‘2-‘4 We use an approach first introduced by Klass” that is a simulation of a method used by stylists to see if the shape of a car is acceptable. A car is placed in a room with parallel fluorescent strip lights on the ceiling. These lights are reflected in the polished car surface, producing SOIEEE Computer

Graphics

& Applications

called “reflection lines.” If each of them is fair (see above), then the surface itself is said to be fair. Figure 6 gives an example of the application of our surface-fairing method.

Conclusion and future research We have presented a local method to optimize the curvature plot of a given cubic spline curve. It automatically determines where the curve is to be faired and can be applied repeatedly. A straightforward generalization to surfaces is easy to formulate. A predecessor of this method was successfully implemented by the first author into the CAD/CAM system at Mercedes-Benz. An open research question remains. Our fairing method will remove “wiggles” from the curvature plot of a spline curve. Still, a designer might not be satisfied with the overall shape of the curve. The following tool is then desirable: The designer prescribes the “target curvature plot,” and the system produces a spline curve with that curvature plot. We have experimented with methods to accomplish this, but not with sufficient success to report them. Other curve-fairing methods (e.g., a convexityenforcing method”‘) do not have the property of being linear curve operators; the theory of tensor products is therefore not applicable to them. However, we can still apply such a nonlinear curve-fairing method to surfaces in a “brute force” way: fair row by row, then column by column. We conjecture that such brute-force algorithms would also have a fairing effect. n

Gerald Farin is an associate professor of conputer science at Arizona State University. He has been an assistant professor of mathematics at the University of lltah and has worked in the CAD/CAM development group at Mercedw Benz, West Germany, where he Implemented Hspline curves and surfaces. He recently pllblished a text on curve and surface design. Farin’s research interests include geomettx: modeling and curve and surface design. fje 1979 from the Technical University of Hraunsl:h‘P

Acknowledgment This research was supported in part by NSF grant DCR-8502858 and by Department of Energy grant DEFG02-87ER25041, both awarded to Arizona State University.

References 1. J.C. Dill, “An Application of Color Graphics to the Display of Surface Curvature,” Computer Graphics (Proc. SIGGRAPH), Vol. 15, No. 3, Aug. 1981, pp. 153-161. 2. G.D. Birkhoff, Aesthetic Measure, Harvard Univ. Press, Cambridge, Mass., 1933. 3. E Crow, “The Origins of the Teapot,” CC&A, Vol. 7, No. 1, Jan. 1987, pp. 8-19. 4. J.A. Kjellander, Computer-Aided

1989

Ari-

Nickolas S. Sapidis is a research ft!llou and tl~rc,toral student in the Mechanic:al Engineering Department of the Iiniversity of Kochester. FIis research interests include c:ornl)lltc:r-aided gc:ometric design, solid mudeling. finite-elemr,rlt analysis, and the efficient Integration of tht,stl techniques in a CAI) environment, Sapidis receiwd his M A in applli~tl mathematics from the Uni\rersity of Utah. whfrre he was a member of the Math CAGD Group frrlm 1985 to 1987. He also holds a diplomu in naval architecture and marlne engineering from the National Technical University of Athens, Greece.

“Smoothing of Cubic Parametric Splines,” Design, Vol. 15, No. 3, May 1983, pp. 175-179.

5. W. Boehm, “Inserting New Knots into B-spline Curves,’ Computer-Aided Design, Vol. 12, No. 4, Aug. 1980, pp. 199-201. March

Farin can be contacted at the Computer S~lt:nc.c: I)r:partm?nt. zona State University, Tcmpe. A % 852(17.

Sapidis can be reached at the Department of Mechanical ing, University of Rochester, Rochester, NY 14ti27.

Enginwr-