The glutSolidTeapot(1), with lighting: tw/demos/curves-and-surfaces/Teapot.cc
Three ways of representing curves
What kind of parametric equations do we want?
Why do we prefer low degree?
Ways to specify a curve:
What are the pros and cons of these?
Launch xfig (Linux application) or Fireworks and try drawing curves
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)
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
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

This work is licensed under a Creative Commons
License.