Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.

Similar presentations


Presentation on theme: "Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College."— Presentation transcript:

1 Computer Graphics: Programming, Problem Solving, and Visual Communication
Steve Cunningham California State University Stanislaus and Grinnell College PowerPoint Instructor’s Resource

2 Interpolation and Spline Modeling
Creating curves and surfaces with just a few control points

3 Interpolations If we have just a few points, we can define curves or surfaces from polygons of relatively low degree that go through the points OR: We could modify this requirement to have the curves or surfaces influenced by the points

4 Interpolations (2) For example, with any three points
P0, P1, P2 we can define a quadratic function of one variable f0(t)P0+f1(t)P1+f2(t)P2 with the quadratic functions f0(t)=(1-t)2, f1(t)=2t(1-t), and f2(t)=t2 with domain [0,1] that goes through P0 and P2 and goes towards P1

5 Interpolations (3) These three functions are called the quadratic Bernstein basis for the quadratic Bézier curves, and an example curve is:

6 Interpolations (4) There are Bernstein basis functions of all degrees; the general form for the n+1 functions of degree n on [0,1] is Notice that these are the terms in expanding (1-t)n

7 Interpolations (5) The cubic Bézier curve is the most commonly used of these. It takes four control points, goes through the two endpoints, and interpolates the others. An example curve is:

8 Other Interpolations Catmull-Rom spline: a cubic spline that uses four control points and goes through the second and third of them in directions determined by the first and fourth

9 Another Way to Compute Splines
Another way to compute spline functions uses matrices and may be more efficient For the Bézier cubic spline, this is:

10 Extending Spline Curves
Using P0-P1-P2-P3 then P3-P4-P5-P6 is not smooth Adding midpoints Q0 and Q1 between points P2-P3 and P4-P5:

11 Spline Curves in 3D Everything said about spline curves is valid in 3D as well as 2D, and we have:

12 Spline Surfaces Simplest surface is a patch, defined by a square array of control points The interpolating functions are used for both variables (u,v) in the square domain [0,1]x[0,1] If the functions are cubic in each variable, the result is a bicubic whose coefficients depend on the control points:

13 Spline Surface (2) An example of a single bicubic patch of a Bézier surface, with control points:

14 Spline Surface (3) OpenGL gives you some tools that let you avoid the details of programming all the basis functions These are the evaluator functions, and they let you get normals and texture coordinates automatically. The downside is that you can only use the kind of splines that OpenGL gives you.

15 Spline Surface (4) Examples of an extended surface with automatic normals (left) and a patch with automatic texture coordinates (right)


Download ppt "Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College."

Similar presentations


Ads by Google