keyframing and splines jehee lee seoul national university

33
Keyframing and Splines Jehee Lee Seoul National University

Upload: buck-wells

Post on 18-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Keyframing and Splines Jehee Lee Seoul National University

Keyframing and Splines

Jehee Lee

Seoul National University

Page 2: Keyframing and Splines Jehee Lee Seoul National University

What is Motion ?

• Motion is a time-varying transformation from body local system to world coordinate system (in a very narrow sense)

World coordinates

Page 3: Keyframing and Splines Jehee Lee Seoul National University

What is Motion ?

• Motion is a time-varying transformation from body local system to world coordinate system

World coordinates

Body local coordinates

)(tT

Page 4: Keyframing and Splines Jehee Lee Seoul National University

What is Keyframing ?

World coordinates

Body local coordinates

)(tT

)( 11 tTT )( 22 tTT

)( 33 tTT

Page 5: Keyframing and Splines Jehee Lee Seoul National University

Transfomation

• Rigid transformation– Rotate + Translate– 3x3 orthogonal matrix + 3-vector

• Affine transformation– Scale + Shear + Rigid Transf.– 3x3 matrix + 3-vector

• Homogeneous transformation– Projective + Affine Transf.– 4x4 homogeneous matrix

• General transformation– Free-form deformation

bRxx :T

bAxx :T

Hxx:T

Page 6: Keyframing and Splines Jehee Lee Seoul National University

Particle Motion

• A curve in 3-dimensional space

World coordinates

)(),(),()( tztytxt p

Page 7: Keyframing and Splines Jehee Lee Seoul National University

Keyframing Particle Motion

• Find a smooth function that passes through given keyframes

World coordinates

),( 00 pt

),( 11 pt

),( 22 pt

),( 33 pt

.0),,( nit ii p)(tp

Page 8: Keyframing and Splines Jehee Lee Seoul National University

Polynomial Curve

• Mathematical function vs. discrete samples– Compact– Resolution independence

• Why polynomials ?– Simple– Efficient– Easy to manipulate– Historical reasons

dcbap

tttt

dtctbtatz

dtctbtaty

dtctbtatx

zzzz

yyyy

xxxx

23

23

23

23

)(

or

)(

)(

)(

Page 9: Keyframing and Splines Jehee Lee Seoul National University

Degree and Order

• Polynomial– Order n+1 (= number of coefficients)– Degree n

011

1)( atatatatx nn

nn

Page 10: Keyframing and Splines Jehee Lee Seoul National University

Polynomial Interpolation

• Linear interpolation with a polynomial of degree one– Input: two nodes– Output: Linear polynomial

),( 00 xt

),( 11 xt

01)( atatx

1

0

1

0

1

0

1011

0001

1

1

x

x

a

a

t

t

xata

xata

Page 11: Keyframing and Splines Jehee Lee Seoul National University

Polynomial Interpolation

• Quadratic interpolation with a polynomial of degree two

),( 00 xt

),( 11 xt

012

2)( atatatx

2

1

0

2

1

0

222

211

200

2021222

1011212

0001202

1

1

1

x

x

x

a

a

a

tt

tt

tt

xatata

xatata

xatata

),( 22 xt

Page 12: Keyframing and Splines Jehee Lee Seoul National University

Polynomial Interpolation

• Polynomial interpolation of degree n

),( 00 xt

),( 11 xt

01)( atatatx nn

nnnn

nn

nn

nn

x

x

x

a

a

a

tt

tt

tt

1

0

1

0

1

11

1

01

0

1

1

1),( nn xt

Do we really need to solve the linear system ?

Page 13: Keyframing and Splines Jehee Lee Seoul National University

Lagrange Polynomial

• Weighted sum of data points and cardinal functions

• Cardinal polynomial functions

)())(()(

)())(()()(

110

110

nkkkkkk

nkkk tttttttt

tttttttttL

nn xtLxtLxtLtx )()()()( 1100

ik

iktL ik if0

if1)(

Page 14: Keyframing and Splines Jehee Lee Seoul National University

Limitation of Polynomial Interpolation

• Oscillations at the ends– Nobody uses higher-order polynomial interpolation now

• Demo– Lagrange.htm

Page 15: Keyframing and Splines Jehee Lee Seoul National University

Spline Interpolation

• Piecewise smooth curves– Low-degree (cubic for example) polynomials– Uniform vs. non-uniform knot sequences

0x

1x

nx2x

3x

Time0t 1t 2t 3t nt

Page 16: Keyframing and Splines Jehee Lee Seoul National University

Why cubic polynomials ?

• Cubic (degree of 3) polynomial is a lowest-degree polynomial representing a space curve

• Quadratic (degree of 2) is a planar curve– Eg). Font design

• Higher-degree polynomials can introduce unwanted wiggles

Page 17: Keyframing and Splines Jehee Lee Seoul National University

Basis Functions

• A linear space of cubic polynomials – Monomial basis

– The coefficients do not give tangible geometric meaning

012

23

3)( atatatatx

),,,( 0123 tttt

ia

Page 18: Keyframing and Splines Jehee Lee Seoul National University

Bezier Curve

• Bernstein basis functions

• Cubic polynomial in Bernstein bases

iinni tt

i

ntB

)1()(

33

22

12

03

333

322

311

300

)1(3)1(3)1(

)()()()()(

bbbb

bbbbp

tttttt

tBtBtBtBt

333

1232

231

330

)(

)1(3)(

)1(3)(

)1()(

ttB

tttB

tttB

ttB

Page 19: Keyframing and Splines Jehee Lee Seoul National University

Bezier Control Points

• Control points (control polygon)

• Demo– Bezier.htm

3210 ,,, bbbb

Page 20: Keyframing and Splines Jehee Lee Seoul National University

Properties of Bezier Curves

• The curve is contained in the convex hull of the control polygon

• The curve is invariant under affine transformation– Partition of unity of Bernstein basis functions

• Variation diminishing

• End point interpolation

10if1)(0 ttBni

3

0

)1(

)0(

bp

bp

Page 21: Keyframing and Splines Jehee Lee Seoul National University

Properties of Cubic Bezier Curves

• The tangent vectors to the curve at the end points are coincident with the first and last edges of the control point polygon

)(3)1('

)(3)0('

23

01

bbp

bbp

0b

1b

2b

3b

Page 22: Keyframing and Splines Jehee Lee Seoul National University

Bezier Splines with Tangent Conditions

• Find a piecewise Bezier curve that passes through given keyframes and tangent vectors

• Adobe Illustrator provides a typical example of user interfaces for cubic Bezier splines

),( 00 pt

),( 11 pt

),( 22 pt

),( 33 pt

Page 23: Keyframing and Splines Jehee Lee Seoul National University

Catmull-Rom Splines

• Polynomial interpolation without tangent conditions– -continuity– Local controllability

• Demo– CatmullRom.html

),( 00 pt

),( 11 pt

),( 22 pt

),( 33 pt

2)(' 11 ii

itpp

p

1C

Page 24: Keyframing and Splines Jehee Lee Seoul National University

Natural Cubic Splines

• Is it possible to achieve higher continuity ?– -continuity can be achieved from splines of

degree n

1nC

),( 00 xt

),( 11 xt

),( nn xt),( 22 xt

),( 33 xt),( 11 nn xt

Page 25: Keyframing and Splines Jehee Lee Seoul National University

Natural Cubic Splines

• We have 4n unknowns – n Bezier curve segments (4 control points per each segment)

• We have (4n-2) equations– 2n equations for end point interpolation– (n-1) equations for tangential continuity– (n-1) equations for second derivative continuity

• Two more equations are required !

),( 00 xt

),( 11 xt

),( nn xt),( 22 xt

),( 33 xt),( 11 nn xt

Page 26: Keyframing and Splines Jehee Lee Seoul National University

Natural Cubic Splines

• Natural spline boundary condition

• Closed boundary condition

• High-continuity, but no local controllability

• Demo– natcubic.html

– natcubicclosed.html

0)()( 0 ntxtx

)()(and)()( 00 nn txtxtxtx

Page 27: Keyframing and Splines Jehee Lee Seoul National University

B-splines

• Is it possible to achieve both -continuity and local controllability ?– B-splines can do !

• Uniform cubic B-spline basis functions

333

2332

2331

330

6

1)(

)1333(6

1)(

)463(6

1)(

)1(6

1)(

ttB

ttttB

tttB

ttB

2C

)()()()()( 333

322

311

300 tBtBtBtBt bbbbp

Page 28: Keyframing and Splines Jehee Lee Seoul National University

Uniform B-spline basis functions

• Bell-shaped basis function for each control points

• Overlapping basis functions– Control points correspond to knot points

Page 29: Keyframing and Splines Jehee Lee Seoul National University

B-spline Properties

• Convex hull• Affine invariance• Variation diminishing• -continuity• Local controllability

• Demo– Bspline.html

2C

Page 30: Keyframing and Splines Jehee Lee Seoul National University

NURBS

• Non-uniform Rational B-splines– Non-uniform knot spacing– Rational polynomial

• A polynomial divided by a polynomial• Can represent conics (circles, ellipses, and hyperbolics)• Invariant under projective transformation

• Note– Uniform B-spline is a special case of non-uniform B-spline– Non-rational B-spline is a special case of rational B-spline

Page 31: Keyframing and Splines Jehee Lee Seoul National University

Cubic Spline Interpolation in a B-Spline Form

Page 32: Keyframing and Splines Jehee Lee Seoul National University

Cubic Spline Interpolation in a B-Spline Form

Page 33: Keyframing and Splines Jehee Lee Seoul National University

Summary

• Polynomial interpolation– Lagrange polynomial

• Spline interpolation– Piecewise polynomial– Knot sequence– Continuity across knots

• Natural spline ( -continuity)• Catmull-Rom spline ( -continuity)

– Basis function• Bezier• B-spline

2C1C