1 / 29

Computer Graphics

Computer Graphics. Lecture 10 Curves and Surfaces I. Types of Curves. Explicit: y = mx + b r = A r x + B r y + C r Implicit: Ax + By + C = 0 (x – x 0 ) 2 + (y – y 0 ) 2 – r 2 = 0 Parametric:

geraldglass
Télécharger la présentation

Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics Lecture 10 Curves and Surfaces I

  2. Types of Curves • Explicit: y = mx + b r = Arx + Bry + Cr • Implicit: Ax + By + C = 0 (x – x0)2 + (y – y0)2 – r2 = 0 • Parametric: x = x0 + (x1 – x0)t x = x0 + rcosq y = y0 + (y1 – y0)t y = y0 + rsinq Lecture 10

  3. Why parametric? • Parametric curves are very flexible. • They are not required to be functions • Curves can be multi-valued with respect to any coordinate system. • Parameter count generally gives the object’s dimension. (x(u,v), y(u,v), z(u,v)) • Coord functions independent. Lecture 10

  4. Specifying curves • Control Points: • A set of points that influence the curve’s shape. • Knots: • Control points that lie on the curve. • Interpolating spline: • Curve passes through the control points. • Approximating spline: • Control points merely influence shape. Lecture 10

  5. Piecewise curve segments We can represent an arbitrary length curve as a series of curves pieced together. But we will want to control how these curves fit together … Lecture 10

  6. Parametric Cubic Curves • In order to assure C2 continuity our functions must be of at least degree 3. This is also the lowest order to describe a non-planar curve. • Cubic has 4 degrees of freedom and can control 4 things. • Use polynomials: x(t) of degree n is a function of t. - y(t) and z(t) are similar and each is handled independently (why parametric is easier to handle than implicit form). • That is: Lecture 10

  7. An Illustrative Example • The whole story of parametric splines is in deriving their coefficients. • How we do that, by satisfying constraints set by the knots and continuity conditions, is what classifies the spline system and distinguishes the different systems. • Example: Cubic Hermite Splines Lecture 10

  8. Hermite splines • 4 degrees of freedom, 2 at each end to control C0 and C1 continuity at each end. • Polynomial can be specified by the position of, and gradient at, each endpoint of curve. • Determine: x = X(t) in terms of x0, x0/, x1, x1/ Now: X(t) = a3t3 + a2t2 + a1t + a0 and X/(t) = 3a3t2 + 2a2t + a1 Lecture 10

  9. Finding Hermite coefficients Substituting for t at each endpoint: x0 = X(0) = a0 x0/ = X/(0) = a1 x1 = X(1) = a3 + a2 + a1 + a0 x1/ = X/(1) = 3a3 + 2a2+ a1 And the solution is: a0 = x0 a1 = x0/ a2 = -3x0 – 2x0/ + 3x1 – x1/ a3 = 2x0 + x0/ - 2x1 + x1/ Lecture 10

  10. The Hermite matrix: MH The resultant polynomial can be expressed in matrix form: X(t) = tTMHq ( q is the control vector) We can now define a parametric polynomial for each coordinate required independently, ie. X(t), Y(t) and Z(t) Lecture 10

  11. Hermite Basis (Blending) Functions The graph shows the shape of the four basis functions – often called blending functions. They are labelled with the elements of the control vector that they weight. Note that at each end only position is non-zero, so the curve must touch the endpoints x0 x1 x0/ x1/ Lecture 10

  12. Family of Hermite curves. y(t) Note : Start points on left. x(t) Lecture 10

  13. Displaying Hermite curves. • Simple : • Loop through t – select step size to suit. • Plug x values into the geometry matrix. • Evaluate P(t)  x value for current position. • Repeat for y & z independently. • Draw line segment between current and previous point. • Joining curves: • Coincident endpoints for C0 continuity • Align tangent vectors for C1 continuity . Lecture 10

  14. Bézier Curves • Hermite cubic curves are difficult to model – need to specify point and gradient. • More intuitive to only specify points. • Pierre Bézier specified 2 endpoints and 2 additional control points to specify the gradient at the endpoints. • Can be derived from Hermite matrix: • Two end control points specify tangent Lecture 10

  15. Bézier Curves P2 Note the Convex Hull has been shown as a dashed line – use as a bounding extent for intersection purposes. P4 P1 P3 P3 P4 P1 P2 Lecture 10

  16. Bézier Matrix We must first define the blending functions. For a polynomial of order n (degree n-1), we have n control points with terms up to tn-1, as follows: fris a blending function the coefficient of trin the binomial expansion of (t+(1-t))n-1 Lecture 10

  17. Bézier Matrix • The cubic form is the most popular X(t) = tTMBq (MB isthe Bézier matrix) • With n=4 and r=0,1,2,3 we get: • Similarly for Y(t) and Z(t) Lecture 10

  18. Bézier blending functions This is how they look – Again the Convex Hull property holds, ie. The functions sum to 1 at any point along the curve. Endpoints have full weight The weights of each function is clear and the labels show the control points being weighted. q0 q3 q1 q2 Lecture 10

  19. Example Interpolation Spline. Catmull-Rom spline interpolates control points. The gradient at each control point is the vector between adjacent control points. Lecture 10

  20. Uniform Nonrational B-Splines • Cubic Bézier curves are joined together in the same way as Hermite curves for arbitrary length by joining short 4-point pieces with C0 and C1 order continuity. • However cubic B-Splines can have any number of control points and any length of curve with C0, C1 and C2 order continuity. • Segments of the B-Spline, joined at knots, depend on a few adjacent control points which are shared between segments for continuity. Lecture 10

  21. What are B-Splines? • Consider a bi-infinite set of knots {ti} • B-Splines are a set of local functions which together form a basis for certain classes of piecewise polynomial functions with these knots. • Any piecewise polynomial of order k, degree k-1, with continuous (k-2)th derivative is a weighted sum of functions Bik from the set: Lecture 10

  22. Parametric B-Spline curves B-Spline functions are used as blending functions: fi(t) = Bi,k(t) Given control points: x1 … xn And B-Splines: Bi,k where i = 1 … n Then: Support of function X is tn < t < tn+k ie. the range over which X is non-zero. Lecture 10

  23. Parametric B-Splines Also works for closed curve, ie. wrapped-round set of n knots. Lecture 10

  24. 1 t0 t1 t2 t3 t4 What does a B-Spline look like? They look rather like the shape above and there is one starting at each t. The one above is a cubic B-Spline with a support of 4 knot intervals. Thus within one interval there are portions of 4 splines which have influence. Lecture 10

  25. f(t) 4/6 1/6 t 1 B-Spline blending functions for one interval. Here again the functions hold the Convex Hull property. They are non-negative. There are four of them and therefore another 4x4 matrix as we’ve seen. Lecture 10

  26. Knot. Control point. m = 9 (P0 ..P9) m-1 knots m+1 control points m-2 curve segments Uniform Non-rational B-Splines. • For each i 4 , there is a knot between Qi-1 and Qi at t = ti. • Initial points at t3 and tm+1 are also knots, so we have a total of m-1 knots. Lecture 10

  27. Knot. Control point. P1 P3 Q3 P0 P2 Uniform Non-rational B-Splines. • First segment Q3 is defined by point P0 through P3 over the range t3 = 0 to t4 = 1. Lecture 10

  28. Knot. Control point. P1 P3 P4 Q4 P2 Uniform Non-rational B-Splines. • Second segment Q4 is defined by point P1 through P4 over the range t4 = 1 to t5= 2. Lecture 10

  29. Reading for this lecture • Foley et al. Chapter 11, section 11.2 up to and including 11.2.3 • Introductory text Chapter 9, section 9.2 up to and including section 9.2.4 Lecture 10

More Related