# CS 184: COMPUTER GRAPHICS

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

# Lecture #13 -- Mon 3/9/2009.

### What computer graphics paradigm would you use to model the following items:

 corals golfball bunny sculpture construction cable

Voxels and Octree:
CSG and Boolean set operations:
B-rep and winged-edge data structure:
Procedural modeling:  e.g., sweeps:
Prototype instantiation:  e.g., procedural assembly of objects

### 3D B-Rep Modeling Primitives and  "Winged-Edge" Data Structure [13.1-13.2].

Faces - again, described efficiently by an ordered sequence of vertices; -- but "should" be planar.

We need to find their plane equation; needed for calculation of illumination: Martin Newell's plane equation formula:
Plane normal components are in same ratio as shadow of polygon on the three coord planes.
Each shadow area is computed as 2D projection as sum of trapezoids (x1-x2)(y1+y2)/2.
Form the sum of all such expressions around the contour; do it for all 3 projections.

## From the Hall of Fame of AS#5

Eric Biggs, "Stonehenge": http://inst.cs.berkeley.edu/~cs184-ax/as5/as5.html
William Li, "Kirby": http://inst.cs.berkeley.edu/~cs184-ah/as5.php
Timothy Liu: http://inst.cs.berkeley.edu/~cs184-cg/as5.html   (crazy colors)
Tyler Latzke: http://inst.cs.berkeley.edu/~cs184-br/as5.html   (nice errors; -- gave up after 56 hours working on it)

# Introduction to Splines

What are "splines" ? -- Wood strips used in ship building that yield nice smooth curves,
because nature is trying to minimize overall bending energy (= arc-length integral of curvature squared).
Depending on what fixtures are being used one can apply different constraints to those strips:
-- Position Constraints are implemented with pegs, and
-- Tangent Constriants can be realized with clamps.
Most "mathematical splines" used in CG are linearized approximations to the above difficult optimization problem.

When making smooth shapes by piecing together smooth curves, consider the
degrees of smoothness at the joints:
-- Parametric Continuity: differentiability of the parametric representation (C0, C1, C2, ...)
-- Geometric Continuity: smoothness of the resulting displayed shape (G0=C0, G1=tangent-cont., G2=curvature-cont. )

Distinguish between:
-- Interpolating splines (pass through all the data points; example Hermite splines), and
-- Approximating splines (only come close to data points; example B-Splines).

## Cubic Bezier Curves

These very handy curves are a mixture of the above two "pure" schemes.
Cubic Bezier Curve is defined by:
-- 2 interpolated endpoints, and
-- 2 approximated intermediary control points that define the tangent directions at the endpoints.
Cubic polynomials: ==> allow to make inflection points and true space curves in 3D.

Basic underlying math;
(Cubic) Polynomial: infinitely differentiable --> Continuity = C-infinity
Cubic Hermite Spline: 2 endpoints, 2 tangent directions.
Cubic Bezier Curve: 2 endpoints, 2 approximated intermediary control points.
-- (P1,P2) = 1/3 of starting velocity vector
-- (P3,P4) = 1/3 of ending velocity vector
Influence of parameters (qualitative view).

### Properties of Bezier Curves

• Cubic polynomial, ==> true space curves;
• Interpolates endpoints;
• Approximation of other two control points;
• End tangents defined by pairs of control points;
• Convex hull property;
• Invariant under affine transformations;
• Start-to-end symmetry;
• Infinitely differentiable;
• May have loops, cusps.

Skim:   Shirley, 2nd Ed:  Ch 15

Study: ( i.e., try to understand fully, so that you can answer questions on an exam):
Shirley, 2nd Ed:
Ch 15.6-15.7

### Programming Assignment 6: due (electronically submitted) beforeTuesday 3/17, 11pm <== THIS ASSIGNMENT CAN BE DONE IN PAIRS !

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