Curve and Surface
Outline
• Parametric Curves & Splines
• Cubic Splines
–
–
–
–
Hermite
Bézier
B-Splines
NURBS
• Subdivision Curves & Surfaces
• Appendix: Subdivision Masks
2
How to describe this curve?
3
Control Points
• We can specify control points to draw the curve
4
Control Points
• Control points are not a unique specification
5
Polynomials
• A polynomial is a function of the form:
f(t) = antn + an-1tn-1 + … + a1t + a0
• n is the degree of the polynomial
• The order of the polynomial is the number of
coefficients it has
• Always: order = degree + 1
• Examples:
f(t) = a1t + a0 Linear
f(t) = a2t2 + a1t + a0 Quadratic
f(t) = a3t3 + a2t2 + a1t + a0 Cubic
6
Polynomial Curves
• Could make a curve that passes through n
control points out of a degree (n-1) polynomial
– Regression, Lagrange interpolation, etc.
7
Polynomial Curves
• Polynomial curves wiggle too much when forced
to fit more and more points.
• In technical terms this is called overfitting
8
Why Parametric Curves?
• Parametric curves are very flexible
• They are not required to be functions
• Curves can be multi-valued with respect to any
coordinate system
9
Particle Motion
• A parametric curve P(t) describes the motion of
an imaginary particle through space at time t.
• We can compute the velocity of the particle:
dP(t ) �dx(t ) dy(t ) �
v(t )
�
�
�
dt
dt �
� dt
• The tangent line at P(t0) to the curve is:
tangent(u) = P(t0) + v(t0)u
• The normal at P(t0) perpendicular
(t )the
� dy (t ) dxto
� tangent
�
�
line is n(t0 ) v (t0 ) �
� dt
dt �
t t0
10
Parametric Polynomial Curves
• A parametric polynomial curve is a parametric
curve
n
�
i
x
(
t
)
a
t
• where each function x(t), y(t) �
i
�
i 0
is described by a polynomial: �
�
n
�y (t ) b t i
�
i
�
i 0
�
• Polynomial curves have certain advantages:
– Easy to compute
– Indefinitely differentiable
11
Curve Drawing
• We want:
–
–
–
–
–
Predictable control: Curves don’t wiggle
Multiple values: Curves of arbitrary length
Local control: Local edits have local effects
Versatility: Be able to draw any curve
Continuity: Smoothness guarantees
• Spline curvesgive us all of these
12
Spline Curves
• The word splinecomes from ship building with wood
• A wooden plank is forced between fixed posts,
called “ducks”
• Real-world splines are still being used for designing
ship hulls, automobiles, and aircraft fuselage and
wings
13
Splines
www.abm.org
14
Spline Curves
• Spline curve - any composite curve formed with
piecewise parametric polynomials subject to
certain continuity conditions at the boundary of
the pieces.
– Huh?
• We have seen parametric polynomials. Let’s
look at the other terms:
– Piecewise
– Continuity conditions
15
Piecewise Curves
• To avoid overfitting we will want to represent a
curve as a series of curves pieced together
• A piecewise parametric polynomial curve uses
different polynomial functions for different parts
of the curve
– Advantages: Provides flexibility
– Problem: How do we fit the pieces together?
16
Parametric Continuity
• C0: Curves are joined
– “watertight” curve / mesh
• C1: First derivative is continuous
– d/dt Q(t) = velocity is the same.
– “looks smooth, no facets”
• C2: Second derivative is continuous
– d2/dt2Q(t) = acceleration is
the same (important for animation
and shading)
17
Geometric Continuity
• G0: Curves are joined
• G1: First derivatives are proportional at the joint point
– The tangent vectors have the same directions, but not
necessarily the same magnitude
– Velocity of a moving point is not continuous
• G2: First and second derivatives are proportional at
joint point
– Acceleration of the point is not continuous
• Parametric continuity of order n implies geometric
continuity of order n, but not vice-versa.
18
Specifying Splines
• Control Points - a set of
points that influence the
curve's shape
• Hull - the lines that
connect the control points
• Interpolating – curve
passes through the
control points
• Approximating – control
points merely influence
shape
19
Parametric Cubic Curves
• In order to assure C2 continuity our functions
must be of at least degree three
• Here's what a 2D parametric cubic function looks
like:
• In matrix form:
20
Parametric Cubic Curves
• This is a cubic function in 3D:
• To avoid the dependency on the dimension we
will use the following notation:
21
Parametric Cubic Curves
• What does the derivative of a cubic curve look
like?
22
Solving for Coefficients
• Problem: Polynomial coefficients (the c’s) are
amazingly bad control knobs
• Usually, we want to control the curve in terms of what
it does — passing through control points, etc.
• The whole story of polynomial splines is deriving
their coefficients given a set of control points and
continuity conditions
• Approach:
– State what we want the curve to do
– Solve for coefficients that satisfy the constraints set by the
control points and continuity conditions
23
Outline
• Parametric Curves & Splines
• Cubic Splines
–
–
–
–
Hermite
Bézier
B-Splines
NURBS
• Subdivision Curves & Surfaces
• Appendix: Subdivision Masks
24
Cubic Hermite Specification
• Given:
– Two control points (P1, P2).
– Tangents (derivatives) at the knot points (P’1, P’2):
• “Control knob” vector: [P1, P2, P’1, P’2]
25