# CS 284: CAGD  Lecture #3 -- Wed 9/02, 2009.

PREVIOUS < - - - - > CS 284 HOME < - - - - > CURRENT < - - - - > NEXT

## Preparation:

Rockwood: pp 31-58.

## Warm-up Exercise: Draw Bézier Curves ...

Announcement:
Tomorrow, Thu, Sep. 3, 12:30pm-1:30pm in 380 Soda Hall:
PhD dissertation talk by Raph Levien:
From Spiral to Spline: Optimal Techniques in Interactive Curve Design.

# Lecture Topics:  Bézier Curves

• A very simple and very useful spline ...
• The defining control points
• Cubic Case
• The General Behavior
• Visualize these properties with the applet in Ch3, (about 25% down).
• n-th degree Case
•  How much can we do with a curve of a particular degree ? -- See homework discussion below!

### Understanding the Properties of Bezier Curves

• Endpoint Interpolation
• Look at basis functions; check cases for t=0 and t=1.
• Tangent Condition
• Look at the basis functions; differentiate.
• Convex Hull
• Partition of unity; only interpolation -- not extrapolation.
• Linear Precision
• Special case of convex hull property: Curve can collapse onto a line.
• Affine Invariance
• Splines are based on linear operators. A linear transformation (rotation, skewing, scaling) of the control points leads to a corresponding transformation of whole curve.
• Back-to-front Symmetry
• If control polygon is used in reverse order, the same shape results. (NOT true for some quaternion splines on sphere).
• Variation Diminishing
• Any line cannot intersect with the spline more often than with its control polygon.
• What can we say about the number of inflection points ?

## Homework Discussion: What can you do with Bézier Curves?

• n-th degree Case
•  How much can we do with a curve of a particular degree ?
• What can we do with an eighth-order Bezier curve (p52)?
• What order is needed for a figure-8 shape with C2 point-symmetry ?  --> order 6.

### Bernstein Basis Functions

• Formulas: in book, page 35, eqn 38.  -- Symmetry in "t" and "(1-t)"
• Diagrams: check applet, page 36; need to click on: "learn about Bernstein functions".

## Drawing Bézier Curves:  de Casteljau Algorithm  ( "cass - tell - sho" )

• How NOT to evaluate a Bezier curve:
• by explicitely calculating a polynomial in the powers of t.
• Finding curve points by interpolation
• Recursive linear interpolation (p46).
• An efficient pipelining scheme, fast and robust!
• Finding Tangent Directions at various locations
• Use derivatives.
• Subdivision: Split curve at value t into two segments; find the control polygons for both segments.
• New control points come directly from de Casteljau algorithm.
• Use of subdivision for clipping to a boundary.
• Use of subdivision for curve refinement.

## Working with Bézier Curves

• Derivatives
• Hodograph is just another Bezier curve;
• its control points have the coordiantes of the original connecting segments.
• Degree Elevation
• Choosing higher-order basis to obtain more control points:
• either to edit fine features into the curve,
• or to match the degrees of adjacent Bezier patches.
• The general formula for finding the new control points;
• think about redistributing the needed control points uniformaly along a straight line.
• Review of Continuity:
• Individual segment is always C-infinity continuous.
• It also has G-infinity continuity, unless v=0 at some point;
• then it possibly has a cusp and may only be G0 continuous!

## Stitching Bezier Curves Together

Rockwood: pp 59-73 (Lagrange Interpolation)

## New Homework Assignment: G1-Stitching of Bezier Curves

In this first programming assignment you will be introduced (gently) to SLIDE and to the Tcl language. Your actual programming will be less than ten lines of code (most of the expressions you will need have already been provided), but it encourages experimentation and thinking.  The hard part is to actually get Slide to load an function properly on your computer. SLIDE is very particular about having all the paths set up properly, the variables in the right place, and using exactly the right version of Tcl. But it will be worth the effort, because we can then do many instructive experiements quite quickly. Good luck!

The first such experiment using SLIDE is to learn how to stitch cubic Bezier segments together to make a smooth, pleasing-looking, interpolating curve that behaves well even for rather ragged control polygons with irregularly spaced control points (like the example we did in class by hand).

Your assignment is to find a robust expression for the placement for the inner control points of each Bezier segment, involving only information from the nearest neighbor points, and which guarantees a G1-continuous overall curve.

Information on how to install SLIDE on your computer can be found at:

The first file that you should try to run is:
http://www.cs.berkeley.edu/~sequin/CS284/CODE/icosa.slf
Make sure that you have in the same directory the files: MATH.tcl, MOVIE.tcl, SLFCONSTS.tcl, SLIDEUI.tcl
Then you may try other files in that same directory: Instancing.slf, IcosaGen.slf, SweepDemol.slf, GearMovie.slf

DUE: Wed Sept. 9, 2009:   Have SLIDE installed and the provided version of "pa1.slf" running.

For your first programming assignment, the code that you should modify and execute, can be found at:
http://www.cs.berkeley.edu/~sequin/CS284/CODE/pa1.slf

DUE: Mon Sept. 14, 2009:   Have your modification of "pa1.slf" running. Hand in:

• Window snapshot showing your best solution;
• The formula you used to place the inner control points;
• A one paragraph discussion of your approach, and what you learned from it;
• Any other comments/observations you would like to make.

PREVIOUS < - - - - > CS 284 HOME < - - - - > CURRENT < - - - - > NEXT
Page Editor: Carlo H. Séquin