Title: Advanced Computer Graphics Spring 2005
1Advanced Computer Graphics
(Spring 2005)
- COMS 4162, Lecture 12 Spline Curves (review)
Ravi Ramamoorthi
http//www.cs.columbia.edu/cs4162
Most material taken from COMS 4160 lectures 6 and
7
2To Do / Motivation
- One of written questions in assignment deals with
material in this (actually next) lecture - Otherwise, mainly intended for completeness,
since splines are very common modeling tool - This lecture reviews spline curves (from 4160).
Next lecture discusses extensions to NURBs and
surfaces
3Curved Surfaces
- Motivation
- Exact boundary representation for some objects
- More concise representation than polygonal mesh
- Easier to model with and specify for many
man-made objects and machine parts (started with
car bodies)
HB Figure 10.46
4Curve Representations
- Function y f(x)
- Implicit f(x,y) 0
- Subdivision (x,y) as limit of recursive process
- Parametric x f(t), y g(t)
5Curved Surface Representations
- Function z f(x,y)
- Implicit f(x,y,z) 0
- Subdivision (x,y,z) as limit of recursive
process - Parametric x f(s,t), y g(s,t), z h(s,t)
6Parametric Surfaces
- Boundary defined by parametric function
- x f(u,v)
- y f(u,v)
- z f(u,v)
- Example (sphere)
- x sin(?) cos(?)
- y sin(?) sin(?)
- z cos(?)
7Parametric Representations
- One function vs. many (defined piecewise)
- Continuity
- How specified?
8Parametric Polynomial Curves
- A parametric polynomial curve of order n
- Advantages of polynomial curves
- Easy to compute
- Infinitely differentiable everywhere
9(Cubic) Spline Constructions
- Bézier 4 control points
- B-splines approximating, C2, local control
- Hermite 2 points, 2 normals
- Natural splines interpolating, C2, no local
control - Catmull-Rom interpolating, C1, local control
Book chapter 11 covers some spline
constructions But material is hard to read,
doesnt follow format here. I recommend
following lecture.
10Bezier Curve (with 4160-HW2 demo)
- Motivation Draw a smooth intuitive curve (or
surface) given a few key user-specified control
points - hw2.exe
Control points (all that user specifies, edits)
Control polygon
Smooth Bezier curve (drawn automatically)
11Bezier Curve (Desirable) properties
- Interpolates, is tangent to end points
- Curve within convex hull of control polygon
Control points (all that user specifies, edits)
hw2.exe
Control polygon
Smooth Bezier curve (drawn automatically)
12deCasteljau Linear Bezier Curve
- Just a simple linear combination or interpolation
(easy to code up, very numerically stable)
P1
F(1)
Linear (Degree 1, Order 2) F(0) P0, F(1)
P1 F(u) ?
F(u)
P0
F(0)
13deCasteljau Quadratic Bezier Curve
Quadratic Degree 2, Order 3 F(0) P0, F(1)
P2 F(u) ?
F(u) (1-u)2 P0 2u(1-u) P1 u2 P2
14Geometric interpretation Quadratic
u
1-u
1-u
u
u
15Geometric Interpretation Cubic
16Summary deCasteljau Algorithm
P1
P0
Linear Degree 1, Order 2 F(0) P0, F(1) P1
17Idea of Blossoms/Polar Forms
- (Optional) Labeling trick for control points and
intermediate deCasteljau points that makes thing
intuitive - E.g. quadratic Bezier curve F(u)
- Define auxiliary function f(u1,u2) number of
args degree - Points on curve simply have u1u2 so that F(u)
f(u,u) - And we can label control points and deCasteljau
points not on curve with appropriate values of
(u1,u2 )
18Idea of Blossoms/Polar Forms
- Points on curve simply have u1u2 so that F(u)
f(u,u) - f is symmetric f(0,1) f(1,0)
- Only interpolate linearly between points with one
arg different - f(0,u) (1-u) f(0,0) u f(0,1) Here,
interpolate f(0,0) and f(0,1)f(1,0)
00
01
11
1-u
u
1-u
u
0u
1u
1-u
u
uu
F(u) f(uu) (1-u)2 P0 2u(1-u) P1 u2 P2
19Geometric interpretation Quadratic
0110
u
1u
1-u
1-u
u
uu
0u
u
00
11
20Polar Forms Cubic Bezier Curve
001
011
111
000
21Geometric Interpretation Cubic
22Why Polar Forms?
- Simple mnemonic which points to interpolate and
how in deCasteljau algorithm - Easy to see how to subdivide Bezier curve (next)
which is useful for drawing recursively - Generalizes to arbitrary spline curves (just
label control points correctly instead of 00 01
11 for Bezier) - Easy for many analyses (beyond scope of course)
23Subdividing Bezier Curves
- Drawing Subdivide into halves (u ½) Demo
hw2.exe - Recursively draw each piece
- At some tolerance, draw control polygon
- Trivial for Bezier curves (from deCasteljau
algorithm) hence widely used for drawing - Why specific labels/ control points on
left/right? - How do they follow from deCasteljau?
24Geometrically
0½1
001
011
½½½
0½½
½½1
00½
½11
000
111
25Geometrically
0½1
001
011
½½½
0½½
½½1
00½
½11
000
111
26Subdivision in deCasteljau diagram
001
011
111
000
These (interior) points dont appear in
subdivided curves at all
Right part of Bezier curve (uuu, 1uu, 11u,
111) Always right edge of deCasteljau pyramid
Left part of Bezier curve (000, 00u, 0uu,
uuu) Always left edge of deCasteljau pyramid
27Properties (brief discussion)
- Demo
- Interpolation End-points, but approximates
others - Single piece, moving one point affects whole
curve (no local control as in B-splines later) - Invariant to translations, rotations, scales etc.
That is, translating all control points
translates entire curve - Easily subdivided into parts for drawing. Hence,
Bezier curves easiest for drawing (4160-HW2)
hw2.exe
28Bezier Disadvantages
- Single piece, no local control (move a control
point, whole curve changes) hw2.exe - Complex shapes can be very high degree,
difficult - In practice, combine many Bezier curve segments
- But only position continuous at join since Bezier
curves interpolate end-points (which match at
segment boundaries) - Unpleasant derivative (slope) discontinuities at
end-points - Can you see why this is an issue?
29Piecewise Polynomial Curves
- Idea
- Use different polynomial functionsfor different
parts of the curve - Advantage
- Flexibility
- Local control
- Issue
- Smoothness at joints (continuity)
30Continuity
- Continuity Ck indicates adjacent curves have the
same kth derivative at their joints
31C0 Continuity
- Adjacent curves share
- Same endpoints Qi(1) Qi1(0)
- Aside discontinuous curves sometimes called C-1
32C1 Continuity
- Adjacent curves share
- Same endpoints Qi(1) Qi1(0)
- Same derivatives Qi (1) Qi1 (0)
33C2 Continuity
- Adjacent curves share
- Same endpoints Qi(1) Qi1(0)
- Same derivatives Qi (1) Qi1 (0)
- Same second derivatives Qi (1) Qi1 (0)
34(Cubic) Spline Constructions
- Bézier 4 control points
- B-splines approximating, C2, local control
- Hermite 2 points, 2 normals
- Natural splines interpolating, C2, no local
control - Catmull-Rom interpolating, C1, local control
Book chapter 11 covers some spline
constructions But material is hard to read,
doesnt follow format here. I recommend
following lecture.
35B-Splines
- Cubic B-splines have C2 continuity, local control
- 4 segments / control point, 4 control
points/segment - Knots where two segments join Knotvector
- Knotvector uniform/non-uniform (we only consider
uniform cubic B-splines, not general NURBS)
Demo hw2.exe
36Polar Forms Cubic Bspline Curve
- Labeling little different from in Bezier curve
- No interpolation of end-points like in Bezier
- Advantage of polar forms easy to generalize
Uniform knot vector -2, -1, 0, 1, 2 ,3 Labels
correspond to this
37deCasteljau Cubic B-Splines
- Easy to generalize using
polar-form labels - Impossible remember
without
1 0 1
0 1 2
1 2 3
-2 1 0
-2 -1 0
1 2 3
-1 0 1
0 1 2
?
?
?
?
?
?
-1 0 u
0 1 u
1 2 u
38deCasteljau Cubic B-Splines
- Easy to generalize using
polar-form labels - Impossible remember
without
1 0 1
0 1 2
1 2 3
-2 1 0
-2 -1 0
1 2 3
-1 0 1
0 1 2
(2u)/3
(1-u)/3
(1u)/3
(2-u)/3
u/3
1-u/3
-1 0 u
0 1 u
1 2 u
?
?
?
?
1 u u
0 u u
39deCasteljau Cubic B-Splines
- Easy to generalize using
polar-form labels - Impossible remember
without
1 0 1
0 1 2
1 2 3
-2 1 0
-2 -1 0
1 2 3
-1 0 1
0 1 2
(2u)/3
(1-u)/3
(1u)/3
(2-u)/3
u/3
1-u/3
-1 0 u
0 1 u
1 2 u
(1u)/2
(1-u)/2
1-u/2
u/2
1 u u
0 u u
1-u
u
u u u
40Explicit Formula (derive as exercise)
P0
P2
P1
P3
-2 -1 0
1 2 3
-1 0 1
0 1 2
(2u)/3
(1-u)/3
(1u)/3
(2-u)/3
u/3
1-u/3
-1 0 u
0 1 u
1 2 u
(1u)/2
(1-u)/2
1-u/2
u/2
1 u u
0 u u
1-u
u
u u u