Smooth 2
Smooth 2
Required:
Optional
1 2
3 4
Parametric polynomial curves de Casteljau’s algorithm
n
x(u) = ∑ ak uk
k =0
n
y(u) = ∑ bk uk
k =0
Advantages:
5 6
7 8
Finding Q(u) (cont’d) Bernstein polynomials
How could we draw one of these things? Suppose the control points are arranged as follows:
Bézier curves offer a fairly simple way to model One problem with Béziers is that every control point
parametric curves. affects every point on the curve (except the
endpoints).
But, let’s consider some general properties we would
like curves to have… Moving a single control point affects the whole
curve!
Bézier curves are approximating. The curve does We want our curve to have continuity: there
not (necessarily) pass through all the control points. shouldn’t be any abrupt changes as we move along
Each point pulls the curve toward it, but other points the curve.
are pulling as well.
“0th order” continuity would mean that curve doesn’t
jump from one place to another.
We’d like to have a curve that is interpolating, that We can also look at derivatives of the curve to get
is, that always passes through every control point. higher order continuity.
17 18
First order continuity implies continuous first In general, we define Cn continuity as follows:
derivative:
dQ(u ) Q(u ) is C n continuous
Q '(u ) =
du iff
i
Let’s think of u as “time” and Q(u) as the path of a d Q( u )
Q ( i ) (u ) = is continuous for 0 ≤ i ≤ n
particle through space. What is the meaning of the du i
first derivative, and which way does it point?
Note: these are nested degrees of continuity:
C-1: C0:
19 20
Reparameterization Arc length parameterization
We have so far been considering parametric We can reparameterize a curve so that equal steps in
continuity, derivatives w.r.t. the parameter u. parameter space (we’ll call this new parameter “s”)
map to equal distances along the curve:
This form of continuity makes sense particularly if we
really are describing a particle moving over time and
want its motion (e.g., velocity and acceleration) to be Q( s ) ⇒ Δs = s2 − s1 = arclength [ Q( s1 ), Q( s2 )]
smooth.
But, what if we’re thinking only in terms of the shape We call this an arc length parameterization. We can
of the curve? Is the parameterization actually re-write the equal step requirement as:
intrinsic to the shape, i.e., is it the case that a shape
has only one parameterization? arclength[ Q( s1 ), Q( s2 )]
=1
s2 − s1
arclength[ Q( s1 ), Q( s2 )] dQ( s )
lim = =1
s2 → s1 s2 − s1 ds
21 22
1
Q′′( s ) = κ ( s ) = Q′′( s ) ∼ c( s ) − Q( s )
r( s)
where r(s) and c(s) are the radius and center of O(s),
respectively, and κ(s) is the “curvature” of the curve at s.
Bézier curves have C-infinity continuity on their Suppose we have a cubic Bézier defined by
interiors, but we saw that they do not exhibit local (V0,V1,V2,V3), and we want to attach another curve
control or interpolate their control points. (W0,W1,W2,W3) to it, so that there is C0 continuity at
the joint.
It is possible to define points that we want to
interpolate, and then solve for the Bézier control C 0 : QV (1) = QW (0)
points that will do the job.
What constraint(s) does this place on (W0,W1,W2,W3)?
But, you will need as many control points as
interpolated points -> high order polynomials ->
wiggly curves. (And you still won’t have local
control.)
25 26
How then could we construct a curve passing For degree 3 (cubic) curves, we have already shown
through a set of points P1…Pn? that we get:
Q′(0) =
27 28
Ensuring C1 continuity The C1 Bezier spline
Suppose we have a cubic Bézier defined by How then could we construct a curve passing
(V0,V1,V2,V3), and we want to attach another curve through a set of points P0…Pn?
(W0,W1,W2,W3) to it, so that there is C1 continuity at
the joint.
⎧Q (1) = QW (0)
C 1 : ⎨ V'
⎩QV (1) = QW (0)
'
29 30
If we set each derivative to be one half of the vector We can write the Catmull-Rom to Bezier
between the previous and next controls, we get a transformation as:
Catmull-Rom spline.
⎡V0T ⎤ ⎡ 0 1 0 0 ⎤ ⎡ P0T ⎤
⎢ T⎥ ⎢ ⎢ ⎥
0 ⎥ ⎢ P1T ⎥
This leads to:
⎢V1 ⎥ = ⎢ −1/ 6 1 1/ 6 ⎥
⎢V2T ⎥ ⎢ 0 1/ 6 1 −1/ 6 ⎥ ⎢ P2T ⎥
V0 = P1 ⎢ T⎥ ⎢ ⎥⎢ ⎥
⎢⎣V3 ⎥⎦ ⎣ 0 0 1 0 ⎦ ⎢⎣ P3T ⎥⎦
V1 = P1 + 61 ( P2 - P0 )
V2 = P2 - 61 ( P3 - P1 ) V = MCatmull-RomP
V3 = P2
31 32
Endpoints of Catmull-Rom splines Tension control
We can see that Catmull-Rom splines don’t We can give more control by exposing the derivative
interpolate the first and last control points. scale factor as a parameter:
33 34
Finally, we’ll want to develop C2 splines. To do this, Suppose we have a cubic Bézier defined by
we’ll need second derivatives of Bezier curves. (V0,V1,V2,V3), and we want to attach another curve
(W0,W1,W2,W3) to it, so that there is C2 continuity at
Taking the second derivative of Q(u) yields: the joint.
⎧QV (1) = QW (0)
Q′′(0) = 6(V0 - 2V1 + V2 ) ⎪
C : ⎨QV' (1) = QW' (0)
2
35 36
Building a complex spline B-splines
Instead of specifying the Bézier control points Here is the completed B-spline.
themselves, let’s specify the corners of the A-frames
in order to build a C2 continuous spline.
V0 = ____[____ B0 + ____ B1 ]
+ ____[____ B1 + ____ B2 ]
= ____ B0 + ____ B1 + ____ B2
V1 = ____ B1 + ____ B2
V2 = ____ B1 + ____ B2
These are called B-splines. The starting set of points V3 = ____ B1 + ____ B2 + ____ B3
are called de Boor points.
37 38
V = MB-splineB
39 40
Closing the loop Curves in the animator project
What if we want a closed curve, i.e., a loop? In the animator project, you will draw a curve on the
screen:
With Catmull-Rom and B-spline curves, this is easy:
Q(u ) = ( x (u ), y (u ) )
θ (u ) = y (u )
t (u ) = x ( u )
θ (t )
41 42
Summary
43