geometric modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_spline_curves.… ·...

122
Geometric Modeling Summer Semester 2012 Polynomial Spline Curves Piecewise Polynomials· Splines Bases· Properties

Upload: others

Post on 04-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Geometric Modeling Summer Semester 2012

Polynomial Spline Curves Piecewise Polynomials· Splines Bases· Properties

Page 2: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Announcements

HISPOS Registration

• Important: Hispos registration is now open

• Do not forget to register for geometric modeling

Room Change

• On Tuesday, June 26th, the lecture will be held in Buiding E1 7 (Cluster MMCI Building), Room 0.02

Exam Topics

• Section “Spectral Graph Methods for 3D Shape Analysis” is not relevant for the exam.

Page 3: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Today...

Topics:

• Introduction: Geometric Modeling

• Mathematical Background

• Interpolation & Approximation

• Splines

Polynomial Spline Curves

Blossoming and Polar Forms

Rational Splines

Spline Surfaces

• Meshes

Page 4: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Today...

Topics:

• Introduction: Geometric Modeling

• Mathematical Background

• Interpolation & Approximation

• Splines

Polynomial Spline Curves

Blossoming and Polar Forms

Rational Splines

Spline Surfaces

• Meshes

Page 5: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Today

Polynomial Spline Curves

• Piecewise cubic interpolation

• Splines with local control

Hermite Splines

Bezier Splines

Non-Uniform B-Splines

Uniform B-Splines

Page 6: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Piecewise Cubic Interpolation

Page 7: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 8: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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?

Page 9: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Choosing the Degree...

Candidates:

• d = 0 (piecewise constant): not smooth

• d = 1 (piecewise linear): not smooth enough

• d = 2 (piecewise quadratic): constant 2nd derivative, still too inflexible

• d = 3 (piecewise cubic): degree of choice for computer graphics applications

Page 10: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Cubic Splines

Cubic piecewise polynomials:

• We can attain C2 continuity without fixing the second derivative throughout the curve

• C2 continuity is perceptually important We can see second order shading discontinuities

(esp.: reflective objects)

Motion: continuous position, velocity & acceleration Discontinuous 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”).

Page 11: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

yn 3)(

3

2)(

2

)(

1

)(

0)( tctctccxp iiii

i

p1

p2

pn

y2

Page 12: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Conditions

y0

y1

yn p1

p2

pn

y2

)1()0(:...2

)1()0(:...2

)1(:...1

)0(:...1

12

2

2

2

1

1

ii

ii

ii

ii

pdt

dp

dt

dni

pdt

dp

dt

dni

ypni

ypni (n conditions)

(n conditions)

(n-1 conditions)

(n-1 conditions)

(4n degrees of freedom)

2 dimensional null space (so far)

Page 13: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Conditions

y0

y1

yn p1

p2

pn

y2

)1()0(:...2

)1()0(:...2

)1(:...1

)0(:...1

12

2

2

2

1

1

ii

ii

ii

ii

pdt

dp

dt

dni

pdt

dp

dt

dni

ypni

ypni

0)1(

0)0(

2

2

12

2

npdt

d

pdt

d

additional: (n conditions)

(n conditions)

(n-1 conditions)

(n-1 conditions) alternative: cyclic boundary conditions

(closed curves)

Page 14: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Numerical Solution

Solving the system of equations:

• Band matrix, bandwidth O(1)

• Can be solved in O(n) time & space for n variables

***

****

*****

*****

*****

*****

****

***

Page 15: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 16: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Proof: Cubics Minimize Acceleration

Cubic spline: c(t)

Another C2 interpolating curve: a(t)

Residual: d(t) = a(t) – c(t).

nnn

n

n

dttddttdtcdttc

dttdtc

dttaaE

0

2

00

2

0

2

0

2

)('')('')(''2)(''

)('')(''

)('')(

Energy functional:

Page 17: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 order

first identical if 00)(

for 0cond. end order

first identical if 00)('

for 0

0

0

0

0

0

)(')(''')0(')0(')0('')(')(')(''

)(')(''')(')(')(''

)(')(''')(')('')('')(''

Integration by parts:

nnn

dttddttdtcdttcaE0

2

00

2 )('')('')(''2)('')(

Energy functional:

b

a

bt

at

b

a

dtxbxatbtadttbta )()(')()()(')(

Integration by parts:

Page 18: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

it

it

n

i

nn

tdic

dttdtcdttdtc

Middle term (cont.):

nnn

dttddttdtcdttcaE0

2

00

2 )('')('')(''2)('')(

Energy functional:

Integration by parts:

b

a

bt

at

b

a

dtxbxatbtadttbta )()(')()()(')(

Page 19: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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.

Page 20: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Spline Bases with Local Control

Page 21: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 control

Fitting 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.

Page 22: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Notation

Function design problem:

• Function f:

f (t) = c1b1(t) + c2b2(t) + c3b3(t) + ...

• Coefficients c1, c2, c3, ...

Curve design problem

• Function f: n

f (t) = b1(t)p1 + b2(t)p2 + b3(t)p3 + ...

• “Control points” p1, p2, p3, ... n

u

f(t) t

function graph

x

t

parametric curve

y

c1 c2 c3

p1

p2

p3

Page 23: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

New Idea

Problem: Again the basis...

• We want a basis such that:

Coefficients / control points have intuitive meaning

• Let the user edit the control points

Intuitive response

Manually controllable

Page 24: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Desirable Properties

Useful requirements for a spline basis:

• Well behaved curve

Smooth basis functions

• Local control

Basis functions with compact support

• Affine invariance: Applying an affine map x Ax + b on

– control points

– curve

should have the same effect

In particular: rotation, translation

Otherwise: interactive curve editing very difficult

Page 25: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Desirable Properties

Useful requirements for a spline basis:

• Convex hull property: The curve is in the convex hull of its control points

Avoids at least too weird oscillations

• Advantages Computational advantages (recursive intersection tests)

More predictable behavior

Page 26: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Summary

Useful properties

• Smoothness

• Local control / support

• Affine invariance

• Convex hull property

26

Page 27: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 28: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 very important for human modeling.

bbpbp

one to sum must

1111

)()()()()(

n

ii

n

ii

n

iii

n

iii tbtftbtbtb

Page 29: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 30: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 i

n

ii

Page 31: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 32: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 33: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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...

Page 34: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Hermite Splines

Page 35: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 36: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 iiii

i

h1 h2 h3

Page 37: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Hermite Basis

Linear system: (one dimension, one segment)

2321

33

2210

32)('

)(

tctccth

tctctccth

13211

010

132101

000

32)1('

)0('

)1(

)0(

mcccmh

mcmh

pccccph

pcph

13211

010

132101

000

32)1('

)0('

)1(

)0(

mcccmh

mcmh

pccccph

pcph

1

0

1

0

3

2

1

0

3210

0010

1111

0001

m

m

p

p

c

c

c

c

3

2

1

0

1

0

1

0

1122

1233

0100

0001

c

c

c

c

m

m

p

p

Page 38: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Hermite Basis

Solution:

1

0

1

0

32

1122

1233

0100

0001

,,,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:

Page 39: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Hermite Basis

Properties:

• hp0 and hp1

sum to one. (affine invariant w.r.t. position)

• Curve might leave convex hull of control points

Open question:

• How to specify derivatives?

Page 40: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 41: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Properties

Properties of this spline construction:

• Interpolates original points

• Local control

• C1 continuous

• Affine invariant

• No convex hull property

Tends to “overshoot”

This can be really nasty in practice

Page 42: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Bezier Curves

Page 43: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 44: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

All You See is Bezier Curves...

Page 45: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 ,...,, n

nnn BBBB

inini tt

i

ntB

1:)()( ) degree(

function basis n

thiB

n

i

ni

n

i

inintBtt

i

ntttt

0

)(

0

)(1)1()1(1

(n)

Page 46: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Examples

The first three Bernstein bases:

3)3(3

2)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.)

B0

B1

B2

Page 47: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

nn

nn BBBB inini tt

i

ntB

1:)()(

n = 3 (cubic)

n = 10

)(niB

)()(1:)( )1(1

)1()( tBttBttB ni

ni

ni

}...0{ for 0)(,1)(00 nitBtB n

i with

B0

B1 B2

B3

)1()( tBtB nin

ni

Page 48: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 49: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

p0

p1

p2

p3

p0

p1 p2

p3

Page 50: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Matrix Form

Matrix Notation: Bezier Monomials

2

1

0

2

121

022

001

1)(

p

p

p

f ttt

3

2

1

0

32

1331

0363

0033

0001

1)(

p

p

p

p

f tttt

(quadratic case)

(cubic case)

Page 51: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Format Conversion

Conversion: Compute Bezier coefficients from monomial coefficients

2

1

0

.)(2

.)(1

.)(0

1

121

022

001

c

c

c

c

c

c

Bez

Bez

Bez

3

2

1

0

.)(3

.)(2

.)(1

.)(0

1

1331

0363

0033

0001

c

c

c

c

c

c

c

c

Bez

Bez

Bez

Bez

(quadratic case)

(cubic case)

Page 52: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Format Conversion

Conversion: quadratic to cubic

000000

0

0

121

022

0011

1331

0363

0033

0001

)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.

Page 53: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

i

in

i

i

nnnn

n

tbxb

tbxb

c

c

c

bbbb

bbbb

1

11

1

111

)(,~

)(,~

~

~

~,

~~,

~

~,

~~,

~

Page 54: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Cubic Quadratic Case

Reducing the degree: Cubic Quadratic

6

115

160

1

10

110

120

1

20

110

110

1

60

115

16

1

~

~

~

35

3

140

9

35

1140

9

35

3

14

135

1

14

1

7

1

3210

2

1

0

cccc

c

c

c

Page 55: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Bezier Splines

Page 56: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 57: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Derivatives

Bernstein basis properties:

• Derivatives:

)()(

11

11

1

1)(!!

!1

!!

!

1)(1)(

)1()1(1

}1{}1{

}1{}1{

}1{}{}1{)(

tBtBn

tti

ntt

i

nn

ttiniin

ntit

iin

n

ttintiti

ntB

dt

d

ni

ni

iniini

iniini

iniinini

({k} = k if k > 0, zero otherwise)

Page 58: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

dt

dtB

dt

d

ni

ni

ni

iniini

iniini

iniinini

({k} = k if k > 0, zero otherwise)

Page 59: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

0

1)( pf

0)0( pf

npf )1(

n = 3 (cubic)

B0

B1 B2

B3

n = 10

Page 60: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

nnnn

nn

nn

nnn

n

ii

ni

ni

tBtBtB

tBtBtBn

tBtBntdt

d

pp

pp

pf

)()()(...

...)()()(

)()()(

)1(11

)1(1

)1(2

1)1(

1)1(

00)1(

0

0

)1()1(1

01)0f( pp ndt

d 1)1f( nnndt

dpp

nnnn

nn

nn

nnn

n

ii

ni

ni

tBtBtB

tBtBtBn

tBtBntdt

d

pp

pp

p

)()()(...

...)()()(

)()()f(

)1(11

)1(1

)1(2

1)1(

1)1(

00)1(

0

0

)1()1(1

n = 10

Page 61: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

nnnn

nn

nn

nnn

n

ii

ni

ni

tBtBtB

tBtBtBn

tBtBntdt

d

pp

pp

pf

)()()(...

...)()()(

)()()(

)1(11

)1(1

)1(2

1)1(

1)1(

00)1(

0

0

)1()1(1

01)0(' ppf n 1)1(' nnn ppf

nnnn

nn

nn

nnn

n

ii

ni

ni

tBtBtB

tBtBtBn

tBtBntdt

d

pp

pp

p

)()()(...

...)()()(

)()()f(

)1(11

)1(1

)1(2

1)1(

1)1(

00)1(

0

0

)1()1(1

n = 10

Page 62: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 63: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 64: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Bezier Spline Continuity

Rules for Bezier spline continuity:

• Additional requirement for C1 continuity:

Tangent vectors are proportional to differences p1 – p0, pn – pn-1

Therefore: 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)

Page 65: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 66: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 67: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Bezier Curve Editing

C-1 continuity C0 continuity

G1 continuity C1 continuity

Page 68: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 69: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Geometric Continuity

Geometric Continuity:

• G0 = C0: position varies continuously

• G1: tangent directions varies continuously

In 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 continuously

Equivalently: The curve can be reparametrized so that it becomes C2.

Also equivalent: A unit speed parametrization would be C2.

Page 70: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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.)

Page 71: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Uniform Cubic B-Splines

Page 72: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Literature

Literature:

• An Introduction to Splines for use in Computer Graphics and Geometric Modeling Richard H. Bartels, John C. Beatty, Brian A. Barsky Morgan Kaufmann 1987 (now hard to get, waited several month on Amazon)

Page 73: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 74: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Overview

Improvement over cubic Bezier splines:

• C2 continuity is easily attainable

• We will use only one type of basis functions

Shifted 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)

Page 75: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 76: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 = 3 i = -1

p1(t)

p2(t-1)

p4(t-3)

p3(t-2)

Page 77: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Basis Function

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)

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

4 if0

43 if)3()3(3)3(31

32 if)2(3)2(64

21 if)1(3)1(3)1(31

10 if

0 if0

4 if0

43 if)3(

32 if)2(

21 if)1(

10 if)(

0 if0

)(

32

6

1

32

6

1

32

6

1

3

6

1

4

3

2

1

t

tttt

ttt

tttt

tt

t

t

ttp

ttp

ttp

ttp

t

tb

Page 78: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Creating Curves

Creating uniform B-spline curves:

• Choose parameter interval [nstart-2, nend+2,], nstart < nend

• Use all shifted basis functions that overlap this interval:

B = { b(t – [nstart-1]), ..., b(t – [nend+1]) }

• Form linear combinations:

1

1

)()(end

start

n

niiitbt pf

1.0

0.8

0.6

0.4

0.2

0.0 1.0 2.0 3.0 4.0 5.0 6.0

i = 0 i = 1 i = 2 i = 3 i = -1

Page 79: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Uniform B-Spline Curves

one segment

two segments

three segments

Page 80: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 points

Single points: G2 curve

Double points: G1 curve

Triple points: G0 curve

Page 81: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Continuity Control

single points

double point

triple point (interpolates that point)

1

2

3

Page 82: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 83: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 84: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 85: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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...

Page 86: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Basis Change

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

324

323

322

31

3316

1)(

3646

1)(

33316

1)(

6

1)(

ttttp

tttp

ttttp

ttp

1331

3630

3030

1410

6

1MnUBM

1331

0363

0033

0001

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

b

b

b

b

b

b

b

b

3)3(3

2)3(2

2)3(1

3)3(0

:13:

13:1:

tBttB

ttBtB

Uniform B-Spline:

Bezier-Spline:

Page 87: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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?

Page 88: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

Page 89: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 90: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

12

1

2

1

2

1

2

1

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

ppp

pppppp

pppppp

pppppp

ppp

Page 91: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

The Elementary Approach

Normalization:

• Completely determines the pi.

• Turns out to hold everywhere in [0,1]

• Not yet clear why

• But: if it is possible, our conditions 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

12

1

2

1

2

1

2

1

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

ppp

pppppp

pppppp

pppppp

ppp

Page 92: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Properties

Minimal Support:

• We have 16 conditions (cubic case) 15 for smoothness, one for normalization Easy 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.

Page 93: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Repeated Convolution

Convolution:

• Weighted average of functions

• Definition:

Example:

dxtxgxftgtf )()()()(

t

g f

Page 94: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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( t

tb

dxtxbxbtbtbtb iii )()()()()( )0()()0()()(

Page 95: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Illustration

1

1 2 0 -1

b0

1

1 2 0 -1

b0

1

1 2 0 -1

b0

b0

1

1 2 0 -1

1

1 2 0 -1

1

1 2 0 -1

b0

b0

Page 96: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Illustration

1

1 2 0 -1

b0

1

1 2 0 -1

b0

Result:

• Piecewise linear B-spline basis function

• Each convolution with b0 increases the continuity by 1.

Page 97: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Illustration

b1

b1

1

1 2 0 -1

b1

1

1 2 0 -1

1

1 2 0 -1

b0

1

0 1 -1 -2

1

0 1 -1 -2

1

0 1 -1 -2

b0

b0

Page 98: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

kitfDtfdt

dtf

dt

dD

tFtFdttfbff

i

i

i

i

ii

t

t

)()1()(

)()1(

)()1()()(

1

2

2

2

2

1

1

tftfDtfD

tftfdt

d

tFtFdt

d

dt

dtf

dt

d

dt

dtf

dt

d

jj

j

j

j

j

j

j

j

j

Page 99: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Partition of Unity

Proof by Induction:

1

b2 b2 b2 b2

1 2 0 -1 1 0 -1

b0 b0

1

1

1 2 0 -1

b2

1 2 0 -1

b2 b0 b0 b0 b0

degree zero: OK degree d: given

degree d+1: follows degree d...

1

Page 100: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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.

Page 101: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 102: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Repeated Linear Interpolation

Another way to increase smoothness:

t t

t

t [0..2]

+

Page 103: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Repeated Linear Interpolation

Another way to increase smoothness:

t [0..3]

+

t t

t t

Page 104: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Plot of the Three Pieces

-0,5

0

0,5

1

1,5

2

0 0,5 1 1,5 2 2,5 3

Page 105: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Repeated Linear Interpolation

General Principle:

t [0..d+1]

+

t

t t

Page 106: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

De Boor Recursion

The uniform B-spline basis of degree d is given as:

otherwise

1 if

,0

,1)(0 iti

tNi

)()(11

1)( 1

11 tN

idi

tditN

idi

ittN d

idi

di

)()(1 11 tN

d

tditN

d

it di

di

Page 107: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 108: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Polynomial Spline Curves Non-Uniform B-Splines

Page 109: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)

Page 110: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

General De Boor Recursion

Generalized Formula:

otherwise

tif

,0

,1)(

10 iii

tttN

)()()( 11

1

11

1 tNtt

tttN

tt

tttN d

i

idi

didi

idi

idi

Remark: • If a knot value is repeated d times, the denominator may vanish

• In this case: The fraction is treated as a zero

Page 111: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Uniform Case:

For comparison – the uniform case:

otherwise

1 if

,0

,1)(0 iti

tNi

)()(11

1)( 1

11 tN

idi

tditN

idi

ittN d

idi

di

Page 112: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

i

idi tNt

0

)()( pf

Page 113: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

De Boor Algorithm

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

tt

tttttN

tt

tttt

tNtt

tttN

tt

tt

tNtt

tttN

tt

tt

tNtt

tttN

tt

tt

tNtf

p

ppp

pp

pp

pp

pp

p

Page 114: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

De Boor Algorithm

This means:

• For t [ti-1,...,ti), we obtain the function value f (t).

• We can write this as an algorithm...

dn

i

dii

ji

ijdi

jdiji

ijdi

iji

jn

i

ji

jdi

n

i

idi

tN

tt

tt

tt

tttN

tNtf

0

)(0

)1(1

11

1)1(

11

1)(

0

)(1

1

0

)1(1

)(

: with)(

)()(

p

pppp

p

Page 115: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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

tt

tttt

ttt

ttt

tt

ttt

j

di

ijdi

iji

ji

ji

ji

ji

ji

ijdi

jdiji

ijdi

iji

ii

p

pp

ppp

pp

Page 116: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Example

)(Output

),(1)(

)()()(

: increasingFor

1

11

1)(11

)(1)(

11

11

11

11

1

)0(

t

tt

tttt

ttt

ttt

tt

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=1 t3=2

t4=3

6

1

4

1

2

1

t = 1.5

Page 117: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Data Flow

Data Flow:

)1()2()1()0(

)2(1

)1(1

)0(1

)1(1

)0(1

)0(

di

diii

diii

didi

di

pppp

ppp

pp

p

Page 118: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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)()( 11

1 ttt ji

ji

ji

ppp

Page 119: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 for B-Spline interpolation; no convex hull property there)

Achieve more uniform speed for applications in animation

• No irregularities

Reduced smoothness, start/end conditions build into the computed bases

Advantages for rendering (no stopping at sharp corners)

Page 120: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Examples

The effect of parameter spacing:

uniform

first interval larger

Page 121: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

Examples

Multiplying Knots

Page 122: Geometric Modelingresources.mpi-inf.mpg.de/.../geomod/slides_public/08_Spline_Curves.… · Announcements HISPOS Registration •Important: Hispos registration is now open •Do not

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 understand what’s really going on: blossoming & polars

• We will look at that tool first, then go into the details again