The Utah Teapot

a screen shot of the Utah teapot in
Toy Story

The glutSolidTeapot(1), with lighting: tw/demos/curves-and-surfaces/Teapot.cc screen shot of Teapot.cc demo

Curves

Three ways of representing curves

  1. explicit equations
  2. implicit equations
  3. parametric equations
What are the pros and cons? Why do we prefer parametric equations for curve drawing?

What kind of parametric equations do we want?

Why do we prefer low degree?

Ways to specify a curve:

  1. Interpolating
  2. Hermite
  3. Bezier

What are the pros and cons of these?

Activity

Launch xfig (Linux application) or Fireworks and try drawing curves

Solving for the Coefficients

Let's look at the abstract problem of solving for the coefficients in the Hermite case:

Px(t) = C0+C1t+C2t^2+C3t^3
P'x(t) = C1+2*C2t+3*C3t^2

The Hermite geometry matrix is the inverse of the matrix of "t" values.

The same idea works for Bezier. In fact, we define:

P'(0) = 3(P1-P0)

Blending Functions

In general, we have a weighted sum, or blend of the control points

P(t) = B_0(t)*P_0 + B_1(t)*P_1 + B_2(t)*P_2 + B_3(t)*P_3

The interpolating blending functions look like:

The Hermite blending functions look like:

The Bezier blending functions look like:

Important observation:

The Bezier curve always lies within its convex hull

Using OpenGL

We'll need the following functions:

#glMap1f(target, u_min, u_max, stride, order, point_array);
glMap1f(target, u_min, u_max, point_array);
glEnable(target);
glEvalCoord1f(u);
glMapGrid1f(steps,u_min,u_max);
glEvalMesh1(GL_LINE,start,stop);

What are all these arguments?

OR use the following, which is more limited, but fairly convenient:

twDrawBezierCurve(point_array,steps)

Let's look at these demos (all in curves-and-surfaces)

FunkyCurve.py

Activity: try to make a ribbon, like one of those worthy cause lapel pins.

Let's look at

CokeSilhouette.py

Can you make a circle? If so, how? If not, why not?

Written by Scott D. Anderson
scott.anderson@acm.org
Creative Commons License
This work is licensed under a Creative Commons License.

Valid HTML 4.01!