Post on 31-Jan-2021
Geometric ModelingSummer Semester 2010
Polynomial Spline CurvesPiecewise Polynomials · Splines Bases · Properties
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 2 / 116
Today...
Topics:• Mathematical Background
• Interpolation & Approximation
• Polynomial Spline CurvesPiecewise Cubic Interpolation
Splines with local control
– Hermite Splines
– Bezier Splines
– Uniform B‐Splines
– Non‐Uniform B‐Splines
Polynomial Spline CurvesPiecewise Cubic Interpolation
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 4 / 116
What we have so far...
What we have so far:• Given a basis, we can interpolate and approximate points
Curves, surfaces, higher dimensional objects
Functions (heightfields) and parametric objects
Differential properties can be prescribed as well
Problem:• We need a suitable basis
• Polynomial bases don’t work for large degree (say ≥ 10)Monomials – numerical nightmare
Orthogonal polynomials: Runge’s phenomenon still limits applicability
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 5 / 116
Piecewise Polynomials
Key Idea:• Polynomials of high degree don’t work
• Therefore: Use piecewise polynomials of low degree
• What is a good degree to use?
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 6 / 116
Choosing the Degree...
Candidates:
• d = 0 (piecewise constant): not smooth
• d = 1 (piecewise linear): not smooth enough
• d = 2 (piecewise quadratic): constant 2ndderivative, still too inflexible
• d = 3 (piecewise cubic): degree of choicefor computer graphics applications
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 7 / 116
Cubic Splines
Cubic piecewise polynomials:• We can attain C2 continuity without fixing the second derivative throughout the curve
• C2 continuity is perceptually importantThe eye can see second order shading discontinuities (esp.: reflective objects)Motion: continuous position, velocity & accelerationDiscontinuous acceleration noticeable (object/camera motion)
• One more argument for cubics:Among all C2 curves that interpolate a set of points (and obey to the same end conditions), a piecewise cubic curve has the least integral acceleration (“smoothest curve you can get” in this sense).
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 8 / 116
Piecewise Cubic Interpolation
Setup:• (n+1) control points y0...yn (to be interpolated)
• For simplicity: assume uniform spacing t0...tn = (0,1,2,...,n)
• n cubic polynomial pieces p1...pn parametrized over [0...1]
• Multidimensional case: solve problem for each axis (x,y,z)
y0
y1
yn3)(
32)(
2)(
1)(
0)( tctctccxpiiii
i +++=
p1p2
pn
y2
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 9 / 116
Conditions
y0
y1
ynp1
p2
pn
y2
)1()0(:...2
)1()0(:...2
)1(:...1)0(:...1
12
2
2
2
1
1
−
−
−
==∀
==∀
==∀==∀
ii
ii
ii
ii
pdtd
pdtd
ni
pdtd
pdtd
ni
ypni
ypni (n conditions)
(n conditions)
(n‐1 conditions)
(n‐1 conditions)
(4n degrees of freedom)
2 dimensional null space(so far)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 10 / 116
Conditions
y0
y1
ynp1
p2
pn
y2
)1()0(:...2
)1()0(:...2
)1(:...1)0(:...1
12
2
2
2
1
1
−
−
−
==∀
==∀
==∀==∀
ii
ii
ii
ii
pdtd
pdtd
ni
pdtd
pdtd
ni
ypni
ypni
0)1(
0)0(
2
2
12
2
=
=
npdtd
pdtd
additional:(n conditions)
(n conditions)
(n‐1 conditions)
(n‐1 conditions) alternative:cyclic boundary conditions
(closed curves)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 11 / 116
Numerical Solution
Solving the system of equations:• Band matrix, bandwidth O(1)
• Can be solved in O(n) time & space for n variables ⎟
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
************
**********
*********
***
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 12 / 116
Cubics Minimize Acceleration
Theorem:• Given n data points (yi, ti) to interpolate and fixed end conditions (either prescribed 1st derivative, or zero second derivative), a piecewise cubic interpolant minimizes
the energy:
• This means: A cubic spline curve has the least square acceleration.
• Related to elastic energy: Hooke’s elastic energy of a
straight line is given by:
• I.e.: cubic spline interpolation approximates elastic beams.
∫=n
dttffE0
2)('')(
∫=n
dttE0
2)]([2)( fκf λ
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 13 / 116
Proof: Cubics Minimize Acceleration
[ ]
∫∫∫
∫
∫
++=
+=
=
nnn
n
n
dttddttdtcdttc
dttdtc
dttaaE
0
2
00
2
0
2
0
2
)('')('')(''2)(''
)('')(''
)('')(
Cubic spline: c(t)Another C2 interpolating curve: a(t)Residual: d(t) = a(t) – c(t).
Energy functional:
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 14 / 116
Proof: Cubics Minimize Acceleration
Cubic spline: c(t)Another C2 interpolating curve: a(t)Residual: d(t) = a(t) – c(t).
[ ]
( )[ ]
( ) ( ) ∫
∫
∫∫
−−−−=
−−=
−=
==
==
n
n''cn'c
nnt
t
nn
n
dttdtccacncnanc
dttdtctctatc
dttdtctdtcdttdtc
0cond. end orderfirst identical if 0
0)( for 0
cond. end orderfirst identical if 0
0)(' for 0
00
00
0
)(')(''')0(')0(')0('')(')(')(''
)(')(''')(')(')(''
)(')(''')(')('')('')(''
Integration by parts:
∫∫∫ ++=nnn
dttddttdtcdttcaE0
2
00
2 )('')('')(''2)('')(
Energy functional:
[ ] ∫∫ −= ==b
a
btat
b
a
dtxbxatbtadttbta )()(')()()(')(
Integration by parts:
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 15 / 116
Proof: Cubics Minimize Acceleration
Cubic spline: c(t)Another C2 interpolating curve: a(t)Residual: d(t) = a(t) – c(t).
[ ]
0
)()5.0('''
)(')(''')('')(''
tion)(interpola 0
11
0
0 const. piecewise0
=
+=
=
=
+==
−
=∑
∫∫
itit
n
i
nn
tdic
dttdtcdttdtc
Middle term (cont.):
∫∫∫ ++=nnn
dttddttdtcdttcaE0
2
00
2 )('')('')(''2)('')(
Energy functional:
Integration by parts:
[ ] ∫∫ −= ==b
a
btat
b
a
dtxbxatbtadttbta )()(')()()(')(
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 16 / 116
Proof: Cubics Minimize Acceleration
Cubic spline: c(t)Another C2 interpolating curve: a(t)Residual: d(t) = a(t) – c(t).
positive:energy additional
0
2
spline cubic
0
2 )('')('')( ∫∫ +=nn
dttddttcaE
Energy functional:
Positive additional energy:Any function that differs in second derivative from c will have higher energy.
⇒ c is a minimal function in terms of E.
Polynomial Spline CurvesSpline Bases with Local Control
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 18 / 116
So what’s missing?
So we have solved our problem – what’s left to do?• Target area: interactive geometric modeling
• Shape of the entire curve depends on all control points
• Changing one control point can affect the whole curve
• Not a big issue for algorithmic curve controlFitting curves to data, optimizing curves according to some objective function, etc...
• But not acceptable for modeling by humans
• “User interface problem”: We want local control.
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 19 / 116
Notation
Function design problem:• Function f: R → Rf(t) = c1b1(t) + c2b2(t) + c3b3(t) + ...
• Coefficients c1, c2, c3, ... ∈ R
Curve design problem• Function f: R → Rn
f(t) = b1(t)p1 + b2(t)p2 + b3(t)p3 + ...
• “Control points” p1, p2, p3, ... ∈ Rn
u
f(t)t
function graph
x
t
parametric curve
y
c1 c2 c3
p1
p2
p3
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 20 / 116
New Idea
Problem: Again the basis...• We want a basis such that the coefficients / control points have intuitive meaning
• Then we can just let the user edit the control points
• The effect of control point editing has to be intuitive enough to be manually controllable
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 21 / 116
Desirable Properties
Useful requirements for a spline basis:• The curve should be well behaved: smooth basis functions
• Local control: basis functions with compact support
• Affine invariance:Applying an affine map x → Ax + b to the control points should have the same effect as transforming the curveIn particular: rotation, translationOtherwise, interactive curve editing is almost impossible
• Convex hull property:Good to have: The curve is in the convex hull of its control pointsAvoids at least too weird oscillationsComputational advantages (recursive intersection tests)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 22 / 116
Affine Invariance
Affine Invariance:• Affine map: x → Ax + b• Part I: Linear invariance – we get this automatically
Linear approach:
Therefore:
∑∑== ⎟⎟
⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
==n
i zi
yi
xi
i
n
iii
p
p
p
tbtbt1 )(
)(
)(
1)()()( pf
( ) ( )∑∑==
=⎟⎟⎠
⎞⎜⎜⎝
⎛=
n
iii
n
iii tbtbt
11)()()( AppAfA
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 23 / 116
Affine Invariance
Affine Invariance:• Affine map: x → Ax + b• Part II: Translational invariance – need some brains
For translational invariance, the sum of the basis functions must be one everywhere (for all parameter values t that are used).
This is called “partition of unity property”.
The bi form an “affine combination” of the control points pi.
This is absolutely necessary for human modeling.
( ) bbpbp
one to sum must
1111)()()()()( ⎟⎟⎠
⎞⎜⎜⎝
⎛+=+=+ ∑∑∑∑
====
n
ii
n
ii
n
iii
n
iii tbtftbtbtb
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 24 / 116
Convex Hull Property
Convex combinations:• A convex combination of a set of points {p1,...,pn} is any point of the form:
(Remark: λi ≤ 1 is redundant)
• The set of all admissible convex combinations forms the convex hull of the point set
Easy to see (simple exercise): This convex hull is the smallest set that contains all points {p1,...,pn} and every complete straight line between two elements of the set.
1,0:..1 and 1 :with 11
≤≥=∀=∑∑==
ii
n
ii
n
iii ni λλλλ p
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 25 / 116
Convex Hull Property
Accordingly:• If we have this property:
the constructed curves / surfaces will be:Affine invariant (translations, linear maps)
Be restricted to the convex hull of the control points
• Corollary: Curves with this property will have linear precision, i.e.: if all control points lie on a straight line, the curve is a straight line segment, too.
• Surfaces with planar control points will be flat, too.
0)(:..1: and 1)(:1
≥=∀Ω∈∀=Ω∈∀ ∑=
tbnittbt in
ii
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 26 / 116
Convex Hull Property
Convex Hull Property:• Very useful property
Avoids at least the worst oscillations (no escape from convex hull, unlike polynomial interpolation through control points)
Linear precision property is intuitive (people expect this)
Can be used fast range checks
– Test for intersection with convex hull first, then the object.
– Recursive intersection algorithms in conjunction with subdivision rules (more on this later)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 27 / 116
Spline Techniques
Spline bases we will look at in this lecture:• Hermite interpolation
• Bezier curves & surfaces
• Uniform B‐splines
• Non‐uniform B‐splines
• [NURBS: Non‐uniform rational B‐splines](not linear, more on this later)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 28 / 116
Spline Techniques
Two views:• Linear algebra: polynomial function spaces
Basis changes
Derivatives and continuity conditions
• Geometry: Successive linear interpolation (“blossoming”)Construct polynomial spline curves by repeated linear interpolation of control points
More intuitive explanations of properties
Mathematical formalism: Blossoming and polar forms
This part of the lecture will deal with the linear algebra view. Blossoming gets a separate chapter...
Polynomial Spline CurvesHermite Splines
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 30 / 116
Hermite Splines
Overview:• Simple spline technique, easy to implement
• Has some shortcomings
• We will look at C1 cubic Hermite splines as an example
Key Idea:• Specify position and derivatives at the endpoints of each segment
• Come up with a rule to match them easily
• Precompute basis for this purpose
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 31 / 116
Illustration
For each segment hi(t) we know:• Positions: hi(0), hi(1)
• Derivatives: ∂t hi(0), ∂t hi(1)
3)(3
2)(2
)(1
)(0)( tctctccth
iiiii +++=
h1 h2 h3
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 32 / 116
Hermite Basis
Linear system: (one dimension, one segment)
2321
33
2210
32)(')(
tctccth
tctctccth
++=
+++=
1
0
1
0
)1(')0(')1()0(
mh
mh
ph
ph
=
=
=
=
1321
01
13210
00
32 mcccmc
pcccc
pc
=++⇒
=⇒
=+++⇒
=⇒
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
=
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
1
0
1
0
3
2
1
0
3210001011110001
m
m
p
p
c
c
c
c
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
=
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−−
3
2
1
0
1
0
1
0
1122123301000001
c
c
c
c
m
m
p
p
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 33 / 116
Hermite Basis
Solution:
[ ]⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−−
=
1
0
1
0
32
1122123301000001
,,,1)(
m
m
p
p
ttttf
32
32
321
32
)(
2)(
23)(
231)(
1
0
0
ttth
tttth
ttth
ttth
m
m
p
p
+−=
+−=
−=
+−=
Basis Functions:
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 34 / 116
Hermite Basis
Properties:• hp0 and hp1 sum to one.(affine invariant w.r.t. position)
• Curve might leave convex hull ofcontrol points
Open question:• How to specify derivatives?
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 35 / 116
Illustration
Simple rule for derivatives:• Derivatives:
• “Catmull‐Rom Spline”
fi
fi+1
1
011
11
2
:)1(:)0(
})1..1{(,2
:)1(
})..2{(,2
:)0(
−
−+
−
−=∂
−=∂
−∈−
=∂
∈−
=∂
nnnt
t
iiit
iiit
ni
ni
xxf
xxf
xxf
xxf
xi‐1
xi
xi+1
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 36 / 116
Properties
Properties of this spline construction:• Interpolates original points
• Local control
• C1 continuous
• Affine invariant
• No convex hull propertyTends to “overshoot”
This can be really nasty in practice
Polynomial Spline CurvesBezier Curves
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 38 / 116
Bezier Splines
History:• Bezier splines developed
by Paul de Casteljau at Citroën (1959)
Pierre Bézier at Renault (1962)
for designing smooth free‐form parts in automotive design applications.
• Today: The standard tool for 2D curve editing,Cubic 2D Bezier curves are used almost everywhere:
Postscript, PDF, Truetype (quadratic curves), Windows GDI...
Corel Draw, Powerpoint, Illustrator, ...
• Widely used in 3D curve & surface modeling as well
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 39 / 116
All You See is Bezier Curves...
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 40 / 116
Bernstein Basis
Bezier splines use the Bernstein basis:• Bernstein basis of degree n:
• Each basis function is a polynomial of degree n.
• The basis functions form a partition of unity
(binomial theorem)
• For t ∈ [0..1], the basis functions are positive (Bi (t) ≥ 0).
{ })()(1)(0 ,...,, nnnn BBBB =( ) inini tti
ntB −−⎟⎟
⎠
⎞⎜⎜⎝
⎛= 1:)()( ) degree( function basis
nthiB −=
( ) ( ) ∑∑==
− =−⎟⎟⎠
⎞⎜⎜⎝
⎛=−+=+−=
n
i
ni
n
i
inin tBtti
ntttt
0
)(
0)(1)1()1(1
(n)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 41 / 116
Examples
The first three Bernstein bases:
( )
( ) ( )
( ) ( )( ) 3)3(32)3(2
2)3(1
3)3(0
2)2(2
)2(1
2)2(0
)1(1
)1(0
)0(0
:13:
13:1:
:12:1:
:1:
1:
tBttB
ttBtB
tBttBtB
tBtB
B
=−=
−=−=
=−=−=
=−=
=
n=3 (cubic)B0
B1 B2
B3
n=1 (linear)
B0 B1
n=2 (quad.)
B0B1
B2
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 42 / 116
Bernstein Basis
Bernstein basis properties:•
• Basis for polynomials of degree n.
• Each basis function has its maximum at i/n.
• Recursive computation:
• Symmetry:
{ },,...,, )()(1)(0 nnnn BBBB = ( ) inini ttin
tB −−⎟⎟⎠
⎞⎜⎜⎝
⎛= 1:)()(
n=3 (cubic)
n =10
)(niB
( ) )()(1:)( )1( 1)1()( tBttBttB ninini −−− +−=}...0{ for 0)(,1)(00 nitBtB
ni ∉==with
B0
B1 B2
B3
)1()( tBtB n inni −= −
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 43 / 116
Bezier Curves
Bezier curves Properties:
• Curves:
• Considering the interval t ∈ [0..1]
• Bezier curves are affine invariant.
• Bezier curves are contained in the convex hull of the control points.
• The influence of the control points is moving along the curve with index i. Largest influence at t = i/n.
• However: A single curve segment has no fully local control.
n=3 (cubic)
n =10
)()(0
)( tBtn
i
nii∑
=
= pfB0
B1 B2
B3
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 44 / 116
Bezier Curves: Examples
Bezier Curves:
• ∑=
=n
i
niiBt
0
)()( pf
p0
p1
p2
p3
p0
p1
p2
p3
n=3 (cubic)B0
B1 B2
B3
p0p1
p2p3
p0
p1p2
p3
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 45 / 116
Matrix Form
Matrix Notation: Bezier → Monomials
[ ]⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−=
2
1
02
121022001
1)(p
p
p
f ttt
[ ]⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−
−=
3
2
1
0
32
1331036300330001
1)(
p
p
p
p
f tttt
(quadratic case)
(cubic case)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 46 / 116
Format Conversion
Conversion: Compute Bezier coefficients from monomial coefficients
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛−
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
−−=
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
2
1
0
.)(2
.)(1
.)(0
1
121022001
c
c
c
c
c
c
Bez
Bez
Bez
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛−
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−
−=
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
3
2
1
0
.)(3
.)(2
.)(1
.)(0
1
1331036300330001
c
c
c
c
c
c
c
c
Bez
Bez
Bez
Bez
(quadratic case)
(cubic case)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 47 / 116
Format Conversion
Conversion: quadratic to cubic
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
−−
−
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−
−=
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
00000000
121022001
1
1331036300330001
)2(2
)2(1
)2(0
)3(3
)3(2
)3(1
)3(0
c
c
c
c
c
c
c
Convert to monomials and back to Bezier coefficients.(Other degrees similar)
Example Application: Output of TrueType fonts in Postscript.
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 48 / 116
The Other Way Round...
Reducing the degree:• Exact solution is not always possible• Approximate solution: least‐squares(function approximation)
• System of normal equations:
( )
( )∑
=
=
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
=⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛m
iii
nnnnn
n
tbctf
fxb
fxb
c
c
bbbb
bbbb
1
11
1
111
)(:)(,,~
,~
~
~
~,~~,~
~,~~,~
( )
( )∑
= ⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
=⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
⇔m
iin
i
i
nnnn
n
tbxb
tbxb
c
c
c
bbbb
bbbb
1
11
1
111
)(,~
)(,~
~
~
~,~~,~
~,~~,~
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 49 / 116
Cubic → Quadratic Case
Reducing the degree: Cubic → Quadratic
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
+
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
+
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
+
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
=⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜⎜
⎝
⎛
61151601
101101201
201101101
60115161
~~~
353
1409
351
1409
353
141
351
141
71
3210
2
1
0
cccc
c
c
c
Polynomial Spline CurvesBezier Splines
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 51 / 116
Bezier Splines
Local control: Bezier splines• Concatenate several curve segments
• Question: Which constraints to place upon the control points in order to get C‐1, C0, C1, C2 continuity?
p0
p1
p2
p3
p0
p1
p2
p3
(i)
(i)
(i)
(i)
(i+1)
(i+1)
(i+1)
(i+1)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 52 / 116
Derivatives
Bernstein basis properties:• Derivatives:
( ) ( )( )
( ) ( ) ( ) ( )
( ) ( )
[ ])()(
11
111
1)(!!
!1!!
!
1)(1)(
)1()1(1
}1{}1{
}1{}1{
}1{}{}1{)(
tBtBn
tti
ntt
i
nn
ttiniin
ntit
iinn
ttintiti
ntB
dtd
ni
ni
iniini
iniini
iniinini
−−−
−−−−
−−−−
−−−−
−=
⎥⎦
⎤⎢⎣
⎡−⎟⎟
⎠
⎞⎜⎜⎝
⎛ −−−⎟⎟
⎠
⎞⎜⎜⎝
⎛−−
=
−−−
−−−
=
−−−−⎟⎟⎠
⎞⎜⎜⎝
⎛=
({k} = k if k > 0, zero otherwise)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 53 / 116
Derivatives
Bernstein basis properties:• Derivatives:
( ) ( )( )
( ) ( )(( ) ( ) )
[ ])()(2)()1(1)}(1{1)(
1)(1}1{
1)(1)(
)2()2(1
)2(2
}2{}{}1{}1{
}1{}1{}2{
}1{}1{)(2
2
tBtBtBnn
ttininttini
ttinititii
n
ttintiti
n
dtd
tBdtd
ni
ni
ni
iniini
iniini
iniinini
−−−
−−
−−−−−
−−−−−
−−−−
+−−=
−−−−+−−−
−−−−−⎟⎟⎠
⎞⎜⎜⎝
⎛=
−−−−⎟⎟⎠
⎞⎜⎜⎝
⎛=
({k} = k if k > 0, zero otherwise)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 54 / 116
Bezier Curve Properties
Important for continuous concatenation:• Function value at {0,1}:
• First derivative vector at {0,1}
• Second derivative vector at {0,1}
( )∑=
−−⎟⎟⎠
⎞⎜⎜⎝
⎛=
n
ii
ini tti
nt
01)( pf
0)0( pf =
npf =)1(
n=3 (cubic)B0
B1 B2
B3
n =10
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 55 / 116
Bezier Curve Properties
Important for continuous concatenation:• Function value at {0,1}:
• First derivative vector at {0,1}:
• Second derivative vector at {0,1}
,)0( 0pf = npf =)1(
n=3 (cubic)B0
B1 B2
B3
[ ]ni
ini
ni tBtBntdt
dpf )()()(
0
)1()1(1
=
−−− −= ∑
( )01)0f( pp −= ndtd ( )1)1f( −−= nnndt
dpp
[ ] [ ]([ ] [ ] )nnnnnnnn
nnn
tBtBtB
tBtBtBn
pp
pp
)()()(...
...)()()(
)1(11
)1(1
)1(2
1)1(
1)1(
00)1(
0
−−−
−−
−−
−−−
+−+
+−+−= n =10
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 56 / 116
Bezier Curve Properties
Important for continuous concatenation:• Function value at {0,1}:
• First derivative vector at {0,1}:
• Second derivative vector at {0,1}
,)0( 0pf = npf =)1(
n=3 (cubic)B0
B1 B2
B3
[ ]ni
ini
ni tBtBntdt
dpf )()()(
0
)1()1(1
=
−−− −= ∑
( )01)0(' ppf −= n ( )1)1(' −−= nnn ppf
[ ] [ ]([ ] [ ] )nnnnnnnn
nnn
tBtBtB
tBtBtBn
pp
pp
)()()(...
...)()()(
)1(11
)1(1
)1(2
1)1(
1)1(
00)1(
0
−−−
−−
−−
−−−
+−+
+−+−= n =10
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 57 / 116
Bezier Curve Properties
Important for continuous concatenation:• Function value at {0,1}:
• First derivative vector at {0,1}:
• Second derivative vector at {0,1}:
0)0( pf =npf =)1(
n=3 (cubic)B0
B1 B2
B3
n =10
[ ]210 2)1()0('' pppf +−−= nn[ ]212)1()1('' −− +−−= nnnnn pppf
[ ]01)0(' ppf −= n[ ]1)1(' −−= nnn ppf
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 58 / 116
Bezier Spline Continuity
Rules for Bezier spline continuity:• C0 continuity:
Each spline segment interpolates the first and last control point
Therefore: Points of neighboring segments have to coincide for C0 continuity.
p1(i)
(i)p0
(i)p2
p3(i)
p0(i+1)
p1(i+1)
p2(i+1)
p3(i+1)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 59 / 116
Bezier Spline Continuity
Rules for Bezier spline continuity:• Additional requirement for C1 continuity:
Tangent vectors are proportional to differences p1 – p0, pn – pn‐1Therefore: These vectors must be identical for C1 continuity
p1(i)
(i)p0
(i)p2
p3(i)
p0(i+1)
p1(i+1)
p2(i+1)
p3(i+1)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 60 / 116
Bezier Spline Continuity
Rules for Bezier spline continuity:• Additional requirement for C2 continuity:
d2/dt2 vectors are prop. to (p2 – 2p1 + p0), (pn – 2pn‐1 + pn‐2)
Tangents must be the same (C2 implies C1)
Therefore: Triangle of first / last three points must be the same
p1(i)
(i)p0
(i)p2
p3(i)
p0(i+1)
p1(i+1)
p3(i+1)
p2(i+1)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 61 / 116
In Practice
In practice:• Everyone is using cubic Bezier curves• Higher degrees rare (CAD/CAM applications)• Typically: “points & handles” interface• Four modes:
Discontinuous (two curves)
C0 Continuous (points meet)
Tangent direction continuous (handles point into the same direction, but different length)(“G1 continuous”, more on this shortly)
C1 Continuous (handle points have symmetric vectors)
• C2 is rarely supported (too restrictive, no local control)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 62 / 116
Bezier Curve Editing
C‐1 continuity C0 continuity
G1 continuity C1 continuity
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 63 / 116
Geometric Continuity
Parametric Continuity:• C0, C1, C2... continuity.
• Does a particle moving on this curve have a smooth trajectory (position, velocity, acceleration,...)?
• Useful for animation (object movement, camera paths)
Geometric Continuity:• Is the curve itself smooth?
• C.f.: differential geometry – parametrization independent measures
• More relevant for modeling (curve design)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 64 / 116
Geometric Continuity
Geometric Continuity:• G0 = C0: position varies continuously
• G1: tangent directions varies continuouslyIn other words: the normalized tangent varies continuously
Equivalently: The curve can be reparametrized so that it becomes C1.
Also equivalent: A unit speed parametrization would be C1.
• G2: curvature varies continuouslyEquivalently: The curve can be reparametrized so that it becomes C2.
Also equivalent: A unit speed parametrization would be C2.
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 65 / 116
Geometric Continuity for Bezier Splines
This means:
G1 continuity
This Bezier curve is G1: It can be reparametrized to become C1. (Just increase the speed for the second segment by ratio of tangent vector lengths.)
Polynomial Spline CurvesUniform Cubic B‐Splines
Geometric Modeling SoSem 2010 – Polynomial Spline Curves
Literature
Literature:• An Introduction to Splines for use in Computer Graphics and Geometric ModelingRichard H. Bartels, John C. Beatty, Brian A. BarskyMorgan Kaufmann 1987
(now hard to get, waited several month on Amazon)
67 / 116
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 68 / 116
Overview
Uniform cubic B‐splines• This is a special case of general B‐splines
(which additionally provide arbitrary degree and general and non‐uniform parametrization)
• We look at this first to get an intuition for the basic ideas and concepts for B‐splines
• Some derivations are left out – will be shown later for the general case
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 69 / 116
Overview
Improvement over cubic Bezier splines:• C2 continuity is easily attainable
• We will use only one type of basis functionsShifted in the domain to create curves with multiple segments
This principle is conceptually easier to apply in general modeling problems (e.g. as a basis for finite elements, for PDEs or variational problems)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 70 / 116
Key Ideas
Key Ideas:• We design one basis function b(t)
• Properties:b(t) is C2 continuous.
b(t) is piecewise polynomial, degree 3 (cubic).
b(t) has local support.
Overlaying shifted b(t + i) forms a partition of unity.
b(t) ≥ 0 for all t
• In short: We build‐in all the desirable properties into the basis. Linear combinations will inherit these.
1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 71 / 116
Shifted Basis Functions
Basis function:• Consists of four polynomial parts p1...p4.
• Shifted basis b(t – i): spacing of 1.
• Each interval to be used must be overlapped by 4 different bi.
1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0
1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0 5.0 6.0
basis function b(t) shifted basis functions b(t ‐ i) for [0..6]
i=0 i=1 i=2 i=3i=‐1
p1(t)
p2(t‐1)
p4(t‐3)
p3(t‐2)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 72 / 116
Basis Function1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0
basis function b(t)
p1(t)
p2(t‐1)
p4(t‐3)
p3(t‐2)
31 6
1)( ttp =
( )322 333161)( ttttp −++=
( )323 36461)( tttp +−=
( )324 33161)( ttttp −+−=
( )( )( )
⎪⎪⎪⎪
⎩
⎪⎪⎪⎪
⎨
⎧
>≤
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 73 / 116
Creating Curves
Creating uniform B‐spline curves:• Choose parameter interval [nstart‐2, nend+2,], nstart
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 74 / 116
Uniform B‐Spline Curvesone segment
two segments
three segments
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 75 / 116
Discontinuities
Continuity Control• Easier than with Bezier curves
• The parametric function is always C2, by construction
• However: We can create curves with lower geometric smoothness
This will lead to a degenerate (non‐regular) parametrization
This problem is fixed with general, non‐uniform B‐Splines
• Basic idea: Double control pointsSingle points: G2 curve
Double points: G1 curve
Triple points: G0 curve
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 76 / 116
Continuity Control
single points
double point
triple point(interpolates that point)
× 1
× 2
× 3
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 77 / 116
Illustration
1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0 5.0 6.0
1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0 5.0 6.0
× 2 × 3
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 78 / 116
End Conditions
Problem:• We need at least 4 points for one spline segment,5 for two and so on.
• Means: We need s + 3 control points for s segments (rather than s + 1), two more than in spline interpolation.
• This is inconvenient...
• Simple solution:Use double or triple end points
Triple end points will be interpolated
We will get along with s + 1 control points
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 79 / 116
Knot Sequences
Specifying a uniform, cubic B‐Spline curve:• A set of control points p1, ..., pn.
• Knot multiplicities (i1, ..., ik), ij ∈ {1,2,3}, Σij = n.For example (3,1,1,1,3,1,1,1,3)
– Creates one sharp corner in the middle of the spline
– Interpolates the end points
× 3× 3 × 3
× 1 × 1× 1 × 1
× 1 × 1
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 80 / 116
Conversion to Bezier Basis
Uniform B‐Splines can be converted to the Bezier Format:
• Cubic polynomial pieces
• Each can be represented as Bezier segment
• Just a basis change...
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 81 / 116
Basis Change
31 6
1)( ttp =
( )322 333161)( ttttp −++=
( )323 36461)( tttp +−=
( )324 33161)( ttttp −+−=
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−
−=→
133136303030
1410
61
MnUBM
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−−−
−=→
1331036300330001
MnBezM
( ) MnUBMnBezBezUB MMM →−→→ = 1
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
=
⎟⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜⎜
⎝
⎛
−
−
−→
)4(3
)3(2
)2(1
)1(
)4(
)3(
)2(
)1(
~~~~
i
i
i
i
BezUB
i
i
i
i
M
bbbb
bbbb
( ) ( )
( ) 3)3(32)3(2
2)3(1
3)3(0
:13:
13:1:
tBttB
ttBtB
=−=
−=−=
Uniform B‐Spline:
Bezier‐Spline:
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 82 / 116
Where does the basis come from?
How do we construct a B‐Spline basis?• Derivation of uniform cubic B‐Splines?
• Generalizations:General degree?
Non‐uniform parametrization?
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 83 / 116
Three Approaches:
Three ways to get the basis:1. The elementary approach:
Derive a linear system of equations, solve
2. Repeated convolution:d‐fold convolution of box functions
3. de‐Boor Recursion:Repeated linear interpolation
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 84 / 116
The Elementary Approach
Cubic Uniform B‐Spline Basis:• One basis function, just shifted
• Consists of four pieces p1, p2, p3, p4.
• We just need the coefficients of the pieces
• Setting up a linear system...
1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0
basis function b(t)
p1(t)
p2(t‐1)
p4(t‐3)
p3(t‐2)
pieces pi(t)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 85 / 116
The Elementary Approach
Linear system:1.0
0.8
0.6
0.4
0.2
0.0 1.0 2.0 3.0 4.0
basis function b(t)
p1(t)
p2(t‐1)
p4(t‐3)
p3(t‐2)
pieces pi(t)
121
21
21
21
0)1(0)1(0)1()0()1()0()1()0()1()0()1()0()1()0()1()0()1()0()1()0()1(
0)0(0)0(0)0(
3210
444
434343
323232
212121
111
=⎟⎠⎞
⎜⎝⎛+⎟
⎠⎞
⎜⎝⎛+⎟
⎠⎞
⎜⎝⎛+⎟
⎠⎞
⎜⎝⎛
=′′=′=
′′=′′′=′=
′′=′′′=′=
′′=′′′=′==′′=′=
pppp
ppppppppppppppppppppp
ppp
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 86 / 116
Normalization:• Completely determines the pi.
• Turns out to hold everywhere in [0,1]
• Not yet clear why
• But: if it is possible, ourconditions are sufficient
• So we have to show that it is possible
Positivity:• Not enforced; we get this accidentally (simplicity)
• Same argument: if it’s possible, the conditions are sufficient
The Elementary Approach
121
21
21
21
0)1(0)1(0)1()0()1()0()1()0()1()0()1()0()1()0()1()0()1()0()1()0()1(
0)0(0)0(0)0(
3210
444
434343
323232
212121
111
=⎟⎠⎞
⎜⎝⎛+⎟
⎠⎞
⎜⎝⎛+⎟
⎠⎞
⎜⎝⎛+⎟
⎠⎞
⎜⎝⎛
=′′=′=
′′=′′′=′=
′′=′′′=′=
′′=′′′=′==′′=′=
pppp
ppppppppppppppppppppp
ppp
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 87 / 116
Properties
Minimal Support:• We have 16 conditions (cubic case)
15 for smoothness, one for normalizationEasy to see: linear independent
• Need 4 polynomial segments to get sufficiently many degrees of freedom
• Consequence: Any C2 function with 3 or less polynomial segments, and the zero function everywhere else, must be the zero function.
15 linear independent constraints, homogeneous.Zero vector is the only solution.
• Therefore: We have minimal support.
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 88 / 116
Repeated Convolution
Convolution:• Weighted average of functions
• Definition:
Example:
∫∞
∞−
−=⊗ dxtxgxftgtf )()()()(t
gf
⊗ =
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 89 / 116
Repeated Convolution
A Different Derivation:• We start with 0th degree basis functions
• Increase smoothness by convolution
Degree‐zero B‐Spline:
General‐degree B‐Spline:
⎩⎨⎧ ∈
=otherwise ,0
)1...0[ if ,1)()0(
ttb
∫∞
∞−
−=⊗= dxtxbxbtbtbtb iii )()()()()( )0()()0()()(
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 90 / 116
Illustration
1
1 20‐1
b0
1
1 20‐1
b0
1
1 20‐1
b0
b0
1
1 20‐1
1
1 20‐1
1
1 20‐1
b0
b0
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 91 / 116
Illustration
1
1 20‐1
b0
1
1 20‐1
b0
Result:• Piecewise linear B‐spline basis function
• Each convolution with b0 increases the continuity by 1.
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 92 / 116
b1
b1
Illustration
1
1 20‐1
b1
1
1 20‐1
1
1 20‐1
b0
1
0 1‐1‐2
1
0 1‐1‐2
1
0 1‐1‐2
b0
b0
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 93 / 116
Smoothness
Convolution with a box filter increases smoothness:Function f that is Ck‐1 at t = t0, and Ck everywhere else:
1..1for 0)(),()(:
)()1()(:1
0
−==Δ−=Δ
−+==⊗=
+−
+
⊗ ∫
kitfDtfdtdtf
dtdD
tFtFdttfbff
ii
i
i
ii
t
t
( )
( )
( ))()1()(
)()1(
)()1()()(
1
2
2
2
2
1
1
tftfDtfD
tftfdtd
tFtFdtd
dtdtf
dtd
dtdtf
dtd
jj
j
j
j
j
j
j
j
j
−+Δ=Δ
−+=
⎟⎠
⎞⎜⎝
⎛ −+=⎟⎠
⎞⎜⎝
⎛=
−⊗
−
−
−
−
⊗−
−
⊗
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 94 / 116
1
b2 b2 b2b2
1 20‐1
Partition of Unity
Proof by Induction:
10‐1
b0b0
1
1
1 20‐1
b2
1 20‐1
b2b0 b0b0b0
degree zero: OK degree d: given
degree d+1: followsdegree d...
1
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 95 / 116
Other Properties
Positivity:• By definition
Continuity:• Smoothness increasing property: k‐fold convolution is Ck.
Piecewise polynomial:• Easy to see: Polynomial in each interval
• Degree k for k‐fold convolution.
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 96 / 116
Consequences
Consequences:• The constructed functions are identical to the explicitly constructed ones (limited degrees of freedom)
• This means, the explicitly constructed basis has the same properties (partition of unity, positivity)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 97 / 116
Repeated Linear Interpolation
Another way to increase smoothness:
t t
t
t ∈ [0..2]
× ×
+
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 98 / 116
Repeated Linear Interpolation
Another way to increase smoothness:
t ∈ [0..3]
× ×
+
t t
t t
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 99 / 116
Plot of the Three Pieces
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 100 / 116
Repeated Linear Interpolation
General Principle:
t ∈ [0..d+1]
× ×
+
t
t t
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 101 / 116
De Boor Recursion
The uniform B‐spline basis of degree d is given as:
⎩⎨⎧
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 102 / 116
Connection
Three constructions:• It can be shown that this construction is equivalent to the previous two.
• Rough idea:Convolution with a box filter increases degree by one (multiplication with linear weight in de Boor formula)
Antiderivative of box filter: evaluate at t, t+1(corresponds to overlaying Ni, Ni+1)
Need to show that the coefficients match (induction)
Polynomial Spline CurvesNon‐Uniform B‐Splines
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 104 / 116
Generalization
De Boor formula can be generalized:• Arbitrary parameter sequences (“knot sequence”)(t0, t1, ..., tn) with t0 ≤ t1 ≤ ... ≤ tn
Not necessary to have uniform spacing
Will give us more flexibility in curve design.
• Specifying one parameter value multiple times is permitted, e.g. (0, 0, 0, 1, 2, 3, 4, 4, 4, 5, 6, 7, 8, 8, 8)
This has a similar effect as multiple nodes in simple uniform B‐Splines
Will avoid irregular parametrization (means: will create a basis that itself is less smooth, not just the traced out curve)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 105 / 116
General De Boor Recursion
Generalized Formula:
⎩⎨⎧
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 106 / 116
Uniform Case:
For comparison – the uniform case:
⎩⎨⎧
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 107 / 116
B‐Splines
Constructing a Spline Curve:• Choose a degree d.
• Choose a knot sequence (t0, t1, ..., tn) with t0 ≤ t1 ≤ ... ≤ tn(n ≥ d – 1)
• Choose control points p0, p1, ..., pm (m = n – d + 1)
• Form the spline curve:
De Boor Algorithm:• This evaluation can be expanded explicitly...
∑=
=n
ii
di tNt
0)()( pf
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 108 / 116
( ) ( ) ( ) ( )
11
0
1
11
11111
0
1
11
111
1
01
1
11
11
11
1
1
11
1
11
1
0
1
11
1
0
11
0
1
11
1
0
)(
:)(
)()(
)()(
)()(
)()(
i
n
i
di
idi
idiiii
n
i
di
idi
idiii
n
ii
di
idi
dii
di
idi
i
n
ii
di
idi
din
ii
di
idi
i
n
ii
di
idi
din
ii
di
idi
i
n
ii
di
tN
tttttt
tNtt
tttt
tNtttt
tNtt
tt
tNtttt
tNtt
tt
tNtttt
tNtt
tt
tNtf
p
ppp
pp
pp
pp
pp
p
∑
∑
∑
∑∑
∑∑
∑
+
=
−
−−+
−+−−+
=
−
−−+
−+−−
+
=−
−
−−+
+−−
−−+
−
+
=−
−
−−+
+−
=
−
−−+
−
=
−+
+
+
=
−
−−+
−
=
=
−−+−
=−
−+−=
⎟⎟⎠
⎞⎜⎜⎝
⎛⎥⎦
⎤⎢⎣
⎡−−
+⎥⎦
⎤⎢⎣
⎡−
−=
⎟⎟⎠
⎞⎜⎜⎝
⎛−−
+⎟⎟⎠
⎞⎜⎜⎝
⎛−
−=
⎟⎟⎠
⎞⎜⎜⎝
⎛−−
+⎟⎟⎠
⎞⎜⎜⎝
⎛−
−=
=
De Boor Algorithm
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 109 / 116
( ) ( )
∑
∑
∑
+
=
−−
−−−+
−+−−
−−−+
−+
=
−−
+
=
−
=
−
−+
−−
==
=
dn
i
dii
ji
ijdi
jdiji
ijdi
iji
jn
i
ji
jdi
n
ii
di
tN
tttt
tttttN
tNtf
0
)(0
)1(1
11
1)1(
11
1)(
0
)(1
1
0
)1(1
)(
: with)(
)()(
p
pppp
p
De Boor Algorithm
This means:• For t ∈ [ti‐1,...,ti), we obtain the function value f (t).• We can write this as an algorithm...
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 110 / 116
De Boor Algorithm
De Boor Algorithm:• We want to evaluate f (t) for a t ∈ [ti‐1,...,ti)• We compute:
( ) ( )
( ) ( )
)(Output
),(1)(
)()()(
: increasingFor
1
11
1)(11
)(1)(
11
11
11
11
1
)0(
t
tttttt
ttttt
ttt
ttt
j
di
ijdi
iji
ji
ji
ji
ji
ji
ijdi
jdiji
ijdi
iji
ii
−
−−−+
−−−
−
−−
−−−+
−+−−
−−−+
−
−−
=−+=
−
−+
−−
=
=
p
pp
ppp
pp
ααα
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 111 / 116
Example
( ) ( )
( ) ( )
)(Output
),(1)(
)()()(
: increasingFor
1
11
1)(11
)(1)(
11
11
11
11
1
)0(
t
tttttt
ttttt
ttt
ttt
j
di
ijdi
iji
ji
ji
ji
ji
ji
ijdi
jdiji
ijdi
iji
ii
−
−−−+
−−−
−
−−
−−−+
−+−−
−−−+
−
−−
=−+=
−
−+
−−
=
=
p
pp
ppp
pp
ααα
p1(0) p4
(0)
p3(0)
p2(0)
t1=0
t2=1t3=2
t4=3
61
41
21
t = 1.5
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 112 / 116
Data Flow
Data Flow:
)1()2()1()0(
)2(1
)1(1
)0(1
)1(1
)0(1
)0(
−−
−−−−
+−+−
−
di
diii
diii
didi
di
ppppppp
ppp
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 113 / 116
De Boor Algorithm
Some nice properties:•
• The algorithm forms only convex combinations of the original data points.
Affine invariance follows directly
Numerically stable – no cancelation or error amplification problems
Much better than transforming to monomial basis
But slower: O(d2) instead O(d) multiplications with Horner scheme in monomial basis
( ) ) somefor ()(1)()( 111 ααα ttt jijiji −−− −+= ppp
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 114 / 116
Benefits of Non‐Uniform B‐Splines
Improvements over the uniform case:• We can choose the parameter intervals freely
Typically: Use distance between control points as knot distance
Allows better adaptation to distance between control points
Curves tend to “overshoot” less (in particular: problem forB‐Spline interpolation; no convex hull property there)
Achieve more uniform speed for applications in animation
• No irregularitiesReduced smoothness, start/end conditions build into the computed bases
Advantages for rendering (no stopping at sharp corners)
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 115 / 116
Examples
The effect of parameter spacing:
uniform
first interval larger
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 116 / 116
Examples
Multiplying Knots
Geometric Modeling SoSem 2010 – Polynomial Spline Curves 117 / 117
A Closer Look at B‐Splines
Need some more tools & properties:• Proof various properties
• Operations: Knot insertion, degree elevation, etc.
• Convert to alternative bases (e.g. Bezier, monomials)
Problem:• Indexing nightmare
• We need a better formalism to understandwhat’s really going on: blossoming & polars
• We will look at that tool first, then go into the details again
Geometric Modeling�Summer Semester 2010Today...Polynomial Spline Curves�Piecewise Cubic InterpolationWhat we have so far...Piecewise PolynomialsChoosing the Degree...Cubic SplinesPiecewise Cubic InterpolationConditionsConditionsNumerical SolutionCubics Minimize AccelerationProof: Cubics Minimize AccelerationProof: Cubics Minimize AccelerationProof: Cubics Minimize AccelerationProof: Cubics Minimize AccelerationPolynomial Spline Curves�Spline Bases with Local ControlSo what’s missing?NotationNew IdeaDesirable PropertiesAffine InvarianceAffine InvarianceConvex Hull PropertyConvex Hull PropertyConvex Hull PropertySpline TechniquesSpline TechniquesPolynomial Spline Curves�Hermite SplinesHermite SplinesIllustrationHermite BasisHermite BasisHermite BasisIllustrationPropertiesPolynomial Spline Curves�Bezier CurvesBezier SplinesAll You See is Bezier Curves...Bernstein BasisExamplesBernstein BasisBezier CurvesBezier Curves: ExamplesMatrix FormFormat ConversionFormat ConversionThe Other Way Round...Cubic Quadratic CasePolynomial Spline Curves�Bezier SplinesBezier SplinesDerivativesDerivativesBezier Curve PropertiesBezier Curve PropertiesBezier Curve PropertiesBezier Curve PropertiesBezier Spline ContinuityBezier Spline ContinuityBezier Spline ContinuityIn PracticeBezier Curve EditingGeometric ContinuityGeometric ContinuityGeometric Continuity for Bezier SplinesPolynomial Spline Curves�Uniform Cubic B-SplinesLiteratureOverviewOverviewKey IdeasShifted Basis FunctionsBasis FunctionCreating CurvesUniform B-Spline CurvesDiscontinuitiesContinuity ControlIllustrationEnd ConditionsKnot SequencesConversion to Bezier BasisBasis ChangeWhere does the basis come from?Three Approaches:The Elementary ApproachThe Elementary ApproachThe Elementary ApproachPropertiesRepeated ConvolutionRepeated ConvolutionIllustrationIllustrationIllustrationSmoothnessPartition of UnityOther PropertiesConsequencesRepeated Linear InterpolationRepeated Linear InterpolationPlot of the Three PiecesRepeated Linear InterpolationDe Boor RecursionConnectionPolynomial Spline Curves�Non-Uniform B-SplinesGeneralizationGeneral De Boor RecursionUniform Case:B-SplinesDe Boor AlgorithmDe Boor AlgorithmDe Boor AlgorithmExampleData FlowDe Boor AlgorithmBenefits of Non-Uniform B-SplinesExamplesExamplesA Closer Look at B-Splines